Skip to content

Commit

Permalink
Merging build/single-project
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Ryan committed Sep 24, 2012
2 parents efad4fe + 53adc06 commit 9013658
Show file tree
Hide file tree
Showing 11 changed files with 205 additions and 238 deletions.
69 changes: 28 additions & 41 deletions build.gradle
@@ -1,5 +1,5 @@
// Establish version and status
ext.githubProjectName = rootProject.name // Change if github project name is not the same as the root project's name
ext.githubProjectName = rootProject.name

buildscript {
repositories { mavenCentral() }
Expand All @@ -16,51 +16,38 @@ apply from: file('gradle/check.gradle')
apply from: file('gradle/license.gradle')
apply from: file('gradle/release.gradle')

subprojects {
// Closure to configure all the POM with extra info, common to all projects
pom {
project {
url "https://github.com/Netflix/${rootProject.githubProjectName}"
scm {
connection "scm:git:git@github.com:Netflix/${rootProject.githubProjectName}.git"
url "scm:git:git@github.com:Netflix/${rootProject.githubProjectName}.git"
developerConnection "scm:git:git@github.com:Netflix/${rootProject.githubProjectName}.git"
}
issueManagement {
system 'github'
url "https://github.com/Netflix/${rootProject.githubProjectName}/issues"
}
// Closure to configure all the POM with extra info, common to all projects
pom {
project {
url "https://github.com/Netflix/${githubProjectName}"
scm {
connection "scm:git:git@github.com:Netflix/${githubProjectName}.git"
url "scm:git:git@github.com:Netflix/${githubProjectName}.git"
developerConnection "scm:git:git@github.com:Netflix/${githubProjectName}.git"
}
issueManagement {
system 'github'
url "https://github.com/Netflix/${githubProjectName}/issues"
}
}

group = "com.netflix.${githubProjectName}" // TEMPLATE: Set to organization of project

dependencies {
compile 'javax.ws.rs:jsr311-api:1.1.1'
compile 'com.sun.jersey:jersey-core:1.11'
testCompile 'org.testng:testng:6.1.1'
testCompile 'org.mockito:mockito-core:1.8.5'
}
}

project(':') {
apply plugin: 'java'

dependencies {
compile 'joda-time:joda-time:1.6.2'
compile 'org.apache.servicemix.bundles:org.apache.servicemix.bundles.commons-csv:1.0-r706900_3'
compile 'com.github.stephenc.high-scale-lib:high-scale-lib:1.1.2'
compile 'com.google.guava:guava:11.0.1'
compile 'org.apache.cassandra:cassandra-all:1.1.1'
compile 'org.apache.cassandra:cassandra-thrift:1.1.1'
compile 'com.eaio.uuid:uuid:3.2'
compile 'org.slf4j:slf4j-api:1.6.4'
compile 'org.codehaus.jettison:jettison:1.2'
compile 'commons-codec:commons-codec:1.5'
compile 'com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:1.3'
compile 'commons-lang:commons-lang:2.4'
compile 'org.apache.thrift:libthrift:0.7.0'
testCompile 'junit:junit:4.8.1'
}
dependencies {
compile 'joda-time:joda-time:1.6.2'
compile 'org.apache.servicemix.bundles:org.apache.servicemix.bundles.commons-csv:1.0-r706900_3'
compile 'com.github.stephenc.high-scale-lib:high-scale-lib:1.1.2'
compile 'com.google.guava:guava:11.0.1'
compile 'org.apache.cassandra:cassandra-all:1.1.1'
compile 'org.apache.cassandra:cassandra-thrift:1.1.1'
compile 'com.eaio.uuid:uuid:3.2'
compile 'org.slf4j:slf4j-api:1.6.4'
compile 'org.codehaus.jettison:jettison:1.2'
compile 'commons-codec:commons-codec:1.5'
compile 'com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:1.3'
compile 'commons-lang:commons-lang:2.4'
compile 'org.apache.thrift:libthrift:0.7.0'
testCompile 'junit:junit:4.8.1'
}

20 changes: 10 additions & 10 deletions codequality/HEADER
@@ -1,13 +1,13 @@
Copyright 2012 Netflix, Inc.
Copyright ${year} Netflix, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
2 changes: 1 addition & 1 deletion gradle.properties
@@ -1 +1 @@
version=1.7
version=1.0.7-SNAPSHOT
40 changes: 19 additions & 21 deletions gradle/check.gradle
@@ -1,25 +1,23 @@
subprojects {
// Checkstyle
apply plugin: 'checkstyle'
tasks.withType(Checkstyle) { ignoreFailures = true }
checkstyle {
ignoreFailures = true // Waiting on GRADLE-2163
configFile = rootProject.file('codequality/checkstyle.xml')
}
// Checkstyle
apply plugin: 'checkstyle'
tasks.withType(Checkstyle) { ignoreFailures = true }
checkstyle {
ignoreFailures = true // Waiting on GRADLE-2163
configFile = rootProject.file('codequality/checkstyle.xml')
}

// FindBugs
apply plugin: 'findbugs'
//tasks.withType(Findbugs) { reports.html.enabled true }
// FindBugs
apply plugin: 'findbugs'
//tasks.withType(Findbugs) { reports.html.enabled true }

// PMD
apply plugin: 'pmd'
//tasks.withType(Pmd) { reports.html.enabled true }
// PMD
apply plugin: 'pmd'
//tasks.withType(Pmd) { reports.html.enabled true }

apply plugin: 'cobertura'
cobertura {
sourceDirs = sourceSets.main.java.srcDirs
format = 'html'
includes = ['**/*.java', '**/*.groovy']
excludes = []
}
apply plugin: 'cobertura'
cobertura {
sourceDirs = sourceSets.main.java.srcDirs
format = 'html'
includes = ['**/*.java', '**/*.groovy']
excludes = []
}
47 changes: 16 additions & 31 deletions gradle/convention.gradle
@@ -1,40 +1,25 @@
apply plugin: 'java' // Plugin as major conventions

// For Artifactory
rootProject.status = version.contains('-SNAPSHOT')?'snapshot':'release'
sourceCompatibility = 1.6

subprojects { project ->
apply plugin: 'java' // Plugin as major conventions
// GRADLE-2087 workaround, perform after java plugin
status = version.contains('-SNAPSHOT')?'snapshot':'release'

version = rootProject.version

sourceCompatibility = 1.6

// GRADLE-2087 workaround, perform after java plugin
status = rootProject.status

task sourcesJar(type: Jar, dependsOn:classes) {
classifier = 'sources'
from sourceSets.main.allSource
}

task javadocJar(type: Jar, dependsOn:javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}

artifacts {
archives sourcesJar
archives javadocJar
}
task sourcesJar(type: Jar, dependsOn:classes) {
classifier = 'sources'
from sourceSets.main.allSource
}

javadoc.doFirst { println "" }
task javadocJar(type: Jar, dependsOn:javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}

task aggregateJavadoc(type: Javadoc) {
description = 'Aggregate all subproject docs into a single docs directory'
source subprojects.collect {project -> project.sourceSets.main.allJava }
classpath = files(subprojects.collect {project -> project.sourceSets.main.compileClasspath})
destinationDir = new File(projectDir, 'doc')
javadoc.doFirst { println "" }

artifacts {
archives sourcesJar
archives javadocJar
}

// Generate wrapper, which is distributed as part of source to alleviate the need of installing gradle
Expand Down
2 changes: 0 additions & 2 deletions gradle/license.gradle
@@ -1,9 +1,7 @@
// Dependency for plugin was set in buildscript.gradle

subprojects {
apply plugin: 'license' //nl.javadude.gradle.plugins.license.LicensePlugin
license {
header rootProject.file('codequality/HEADER')
ext.year = Calendar.getInstance().get(Calendar.YEAR)
}
}
61 changes: 31 additions & 30 deletions gradle/maven.gradle
@@ -1,43 +1,44 @@
// Maven side of things
subprojects {
apply plugin: 'maven' // Java plugin has to have been already applied for the conf2scope mappings to work
apply plugin: 'signing'
apply plugin: 'maven' // Java plugin has to have been already applied for the conf2scope mappings to work
apply plugin: 'signing'

signing {
required { gradle.taskGraph.hasTask(uploadMavenCentral) }
sign configurations.archives
}
signing {
required { gradle.taskGraph.hasTask(uploadMavenCentral) }
sign configurations.archives
}

/**
* Publishing to Maven Central example provided from http://jedicoder.blogspot.com/2011/11/automated-gradle-project-deployment-to.html
*/
task uploadMavenCentral(type:Upload, dependsOn: signArchives) {
configuration = configurations.archives
doFirst {
repositories.mavenDeployer {
beforeDeployment { org.gradle.api.artifacts.maven.MavenDeployment deployment -> signing.signPom(deployment) }
/**
* Publishing to Maven Central example provided from http://jedicoder.blogspot.com/2011/11/automated-gradle-project-deployment-to.html
* artifactory will execute uploadArchives to force generation of ivy.xml, and we don't want that to trigger an upload to maven
* central, so using custom upload task.
*/
task uploadMavenCentral(type:Upload, dependsOn: signArchives) {
configuration = configurations.archives
doFirst {
repositories.mavenDeployer {
beforeDeployment { org.gradle.api.artifacts.maven.MavenDeployment deployment -> signing.signPom(deployment) }

// To test deployment locally, use the following instead of oss.sonatype.org
//repository(url: "file://localhost/${rootProject.rootDir}/repo")
// To test deployment locally, use the following instead of oss.sonatype.org
//repository(url: "file://localhost/${rootProject.rootDir}/repo")

repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2') {
authentication(userName: rootProject.sonatypeUsername, password: rootProject.sonatypePassword)
}
repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2') {
authentication(userName: rootProject.sonatypeUsername, password: rootProject.sonatypePassword)
}

// Prevent datastamp from being appending to artifacts during deployment
uniqueVersion = false
// Prevent datastamp from being appending to artifacts during deployment
uniqueVersion = false

// Closure to configure all the POM with extra info, common to all projects
pom.project {
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
// Closure to configure all the POM with extra info, common to all projects
pom.project {
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
}
}
}
}

21 changes: 9 additions & 12 deletions gradle/release.gradle
Expand Up @@ -7,8 +7,7 @@ task release(overwrite: true, dependsOn: commitNewVersion) << {
commitNewVersion.dependsOn updateVersion
updateVersion.dependsOn createReleaseTag
createReleaseTag.dependsOn preTagCommit
def buildTasks = tasks.matching { it.name =~ /:build/ }
preTagCommit.dependsOn buildTasks
preTagCommit.dependsOn build
preTagCommit.dependsOn checkSnapshotDependencies
//checkSnapshotDependencies.dependsOn confirmReleaseVersion // Introduced in 1.0, forces readLine
//confirmReleaseVersion.dependsOn unSnapshotVersion
Expand All @@ -24,9 +23,9 @@ task uploadArtifactory(type: GradleBuild) {
startParameter.getExcludedTaskNames().add('check')
tasks = [ 'build', 'artifactoryPublish' ]
}

task releaseArtifactory(dependsOn: [checkSnapshotDependencies, uploadArtifactory])


task buildWithArtifactory(type: GradleBuild) {
startParameter = project.gradle.startParameter.newInstance()
startParameter.addInitScript( file('gradle/netflix-oss.gradle') )
Expand All @@ -35,21 +34,19 @@ task buildWithArtifactory(type: GradleBuild) {
}

// Ensure upload happens before taggging but after all pre-checks
//releaseArtifactory.dependsOn checkSnapshotDependencies
releaseArtifactory.dependsOn checkSnapshotDependencies
createReleaseTag.dependsOn releaseArtifactory
gradle.taskGraph.whenReady { taskGraph ->
if ( taskGraph.hasTask(uploadArtifactory) && rootProject.status == 'release' && !taskGraph.hasTask(':release') ) {
throw new GradleException('Project has to be release status releasing to Artifactory')
throw new GradleException('"release" task has to be run before uploading a release to Artifactory')
}
}
subprojects.each { project ->
project.uploadMavenCentral.dependsOn rootProject.checkSnapshotDependencies
rootProject.createReleaseTag.dependsOn project.uploadMavenCentral

gradle.taskGraph.whenReady { taskGraph ->
if ( taskGraph.hasTask(project.uploadMavenCentral) && !taskGraph.hasTask(':release') ) {
throw new GradleException('"release" task has to be run before uploading to Maven Central')
}
project.uploadMavenCentral.dependsOn rootProject.checkSnapshotDependencies
rootProject.createReleaseTag.dependsOn project.uploadMavenCentral
gradle.taskGraph.whenReady { taskGraph ->
if ( taskGraph.hasTask(project.uploadMavenCentral) && !taskGraph.hasTask(':release') ) {
throw new GradleException('"release" task has to be run before uploading to Maven Central')
}
}

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.

0 comments on commit 9013658

Please sign in to comment.