forked from Netflix/Hystrix
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'gradle-template/multi-project'
Conflicts: build.gradle gradle/wrapper/gradle-wrapper.properties
- Loading branch information
Showing
11 changed files
with
129 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,11 @@ | ||
// Executed in context of buildscript | ||
repositories { | ||
// Repo in addition to maven central | ||
maven { | ||
name 'build-repo' | ||
url 'https://raw.github.com/Netflix-Skunkworks/build-repo/master/releases/' // gradle-release/gradle-release/1.0-SNAPSHOT/gradle-release-1.0-SNAPSHOT.jar | ||
} | ||
repositories { maven { url 'http://dl.bintray.com/content/netflixoss/external-gradle-plugins/' } } // For gradle-release | ||
} | ||
dependencies { | ||
classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.6.0' | ||
classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.6.1' | ||
classpath 'com.mapvine:gradle-cobertura-plugin:0.1' | ||
classpath 'gradle-release:gradle-release:1.0-SNAPSHOT' | ||
classpath 'gradle-release:gradle-release:1.1.5' | ||
classpath 'org.ajoberstar:gradle-git:0.5.0' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,26 @@ | ||
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' | ||
checkstyle { | ||
ignoreFailures = true | ||
configFile = rootProject.file('codequality/checkstyle.xml') | ||
} | ||
|
||
// FindBugs | ||
apply plugin: 'findbugs' | ||
//tasks.withType(Findbugs) { reports.html.enabled true } | ||
// FindBugs | ||
apply plugin: 'findbugs' | ||
findbugs { | ||
ignoreFailures = 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 = [] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,12 @@ | ||
|
||
// For Artifactory | ||
rootProject.status = version.contains('-SNAPSHOT')?'snapshot':'release' | ||
// GRADLE-2087 workaround, perform after java plugin | ||
status = project.hasProperty('preferredStatus')?project.preferredStatus:(version.contains('SNAPSHOT')?'snapshot':'release') | ||
|
||
subprojects { project -> | ||
apply plugin: 'java' // Plugin as major conventions | ||
|
||
version = rootProject.version | ||
|
||
sourceCompatibility = 1.6 | ||
|
||
// GRADLE-2087 workaround, perform after java plugin | ||
// Restore status after Java plugin | ||
status = rootProject.status | ||
|
||
task sourcesJar(type: Jar, dependsOn:classes) { | ||
|
@@ -51,9 +48,6 @@ subprojects { project -> | |
} | ||
} | ||
|
||
// Ensure output is on a new line | ||
javadoc.doFirst { println "" } | ||
|
||
configurations { | ||
provided { | ||
description = 'much like compile, but indicates you expect the JDK or a container to provide it. It is only available on the compilation classpath, and is not transitive.' | ||
|
@@ -70,14 +64,38 @@ subprojects { project -> | |
} | ||
} | ||
|
||
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') | ||
apply plugin: 'github-pages' // Used to create publishGhPages task | ||
|
||
def docTasks = [:] | ||
[Javadoc,ScalaDoc,Groovydoc].each{ Class docClass -> | ||
def allSources = allprojects.tasks*.withType(docClass).flatten()*.source | ||
if (allSources) { | ||
def shortName = docClass.simpleName.toLowerCase() | ||
def docTask = task "aggregate${shortName.capitalize()}"(type: docClass, description: "Aggregate subproject ${shortName}s") { | ||
source = allSources | ||
destinationDir = file("${project.buildDir}/docs/${shortName}") | ||
doFirst { | ||
def classpaths = allprojects.findAll { it.plugins.hasPlugin(JavaPlugin) }.collect { it.sourceSets.main.compileClasspath } | ||
classpath = files(classpaths) | ||
} | ||
} | ||
docTasks[shortName] = docTask | ||
processGhPages.dependsOn(docTask) | ||
} | ||
} | ||
|
||
githubPages { | ||
repoUri = "[email protected]:Netflix/${rootProject.githubProjectName}.git" | ||
pages { | ||
docTasks.each { shortName, docTask -> | ||
from(docTask.outputs.files) { | ||
into "docs/${shortName}" | ||
} | ||
} | ||
} | ||
} | ||
|
||
// Generate wrapper, which is distributed as part of source to alleviate the need of installing gradle | ||
task createWrapper(type: Wrapper) { | ||
gradleVersion = '1.1' | ||
gradleVersion = '1.5' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,61 @@ | ||
apply plugin: 'release' | ||
|
||
// Ignore release plugin's task because it calls out via GradleBuild. This is a good place to put an email to send out | ||
task release(overwrite: true, dependsOn: commitNewVersion) << { | ||
// This is a good place to put an email to send out | ||
} | ||
commitNewVersion.dependsOn updateVersion | ||
updateVersion.dependsOn createReleaseTag | ||
createReleaseTag.dependsOn preTagCommit | ||
def buildTasks = tasks.matching { it.name =~ /:build/ } | ||
preTagCommit.dependsOn buildTasks | ||
preTagCommit.dependsOn checkSnapshotDependencies | ||
//checkSnapshotDependencies.dependsOn confirmReleaseVersion // Introduced in 1.0, forces readLine | ||
//confirmReleaseVersion.dependsOn unSnapshotVersion | ||
checkSnapshotDependencies.dependsOn unSnapshotVersion // Remove once above is fixed | ||
unSnapshotVersion.dependsOn checkUpdateNeeded | ||
checkUpdateNeeded.dependsOn checkCommitNeeded | ||
checkCommitNeeded.dependsOn initScmPlugin | ||
|
||
[ | ||
uploadIvyLocal: 'uploadLocal', | ||
uploadArtifactory: 'artifactoryPublish', // Call out to compile against internal repository | ||
buildWithArtifactory: 'build' // Build against internal repository | ||
].each { key, value -> | ||
[ uploadIvyLocal: 'uploadLocal', uploadArtifactory: 'artifactoryPublish', buildWithArtifactory: 'build' ].each { key, value -> | ||
// Call out to compile against internal repository | ||
task "${key}"(type: GradleBuild) { | ||
startParameter = project.gradle.startParameter.newInstance() | ||
doFirst { | ||
startParameter.projectProperties = [status: project.status, preferredStatus: project.status] | ||
} | ||
startParameter.addInitScript( file('gradle/netflix-oss.gradle') ) | ||
startParameter.getExcludedTaskNames().add('check') | ||
tasks = [ 'build', value ] | ||
} | ||
} | ||
task releaseArtifactory(dependsOn: [checkSnapshotDependencies, uploadArtifactory]) | ||
|
||
// Ensure upload happens before taggging but after all pre-checks | ||
releaseArtifactory.dependsOn checkSnapshotDependencies | ||
createReleaseTag.dependsOn releaseArtifactory | ||
gradle.taskGraph.whenReady { taskGraph -> | ||
if ( taskGraph.hasTask(uploadArtifactory) && rootProject.status == 'release' && !taskGraph.hasTask(':release') ) { | ||
throw new GradleException('"release" task has to be run before uploading a release to Artifactory') | ||
// Marker task for following code to key in on | ||
task releaseCandidate(dependsOn: release) | ||
task forceCandidate { | ||
onlyIf { gradle.taskGraph.hasTask(releaseCandidate) } | ||
doFirst { project.status = 'candidate' } | ||
} | ||
task forceRelease { | ||
onlyIf { !gradle.taskGraph.hasTask(releaseCandidate) } | ||
doFirst { project.status = 'release' } | ||
} | ||
release.dependsOn([forceCandidate, forceRelease]) | ||
|
||
task uploadMavenCentral(dependsOn: subprojects.tasks.uploadMavenCentral) | ||
task releaseSnapshot(dependsOn: [uploadArtifactory, uploadMavenCentral]) | ||
|
||
// Ensure our versions look like the project status before publishing | ||
task verifyStatus << { | ||
def hasSnapshot = version.contains('-SNAPSHOT') | ||
if (project.status == 'snapshot' && !hasSnapshot) { | ||
throw new GradleException("Version (${version}) needs -SNAPSHOT if publishing snapshot") | ||
} | ||
} | ||
subprojects.each { project -> | ||
project.uploadMavenCentral.dependsOn rootProject.checkSnapshotDependencies | ||
rootProject.createReleaseTag.dependsOn project.uploadMavenCentral | ||
uploadArtifactory.dependsOn(verifyStatus) | ||
uploadMavenCentral.dependsOn(verifyStatus) | ||
|
||
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') | ||
} | ||
// Ensure upload happens before taggging, hence upload failures will leave repo in a revertable state | ||
preTagCommit.dependsOn([uploadArtifactory, uploadMavenCentral]) | ||
|
||
|
||
gradle.taskGraph.whenReady { taskGraph -> | ||
def hasRelease = taskGraph.hasTask('commitNewVersion') | ||
def indexOf = { return taskGraph.allTasks.indexOf(it) } | ||
|
||
if (hasRelease) { | ||
assert indexOf(build) < indexOf(unSnapshotVersion), 'build target has to be after unSnapshotVersion' | ||
assert indexOf(uploadMavenCentral) < indexOf(preTagCommit), 'preTagCommit has to be after uploadMavenCentral' | ||
assert indexOf(uploadArtifactory) < indexOf(preTagCommit), 'preTagCommit has to be after uploadArtifactory' | ||
} | ||
} | ||
|
||
// Prevent plugin from asking for a version number interactively | ||
ext.'gradle.release.useAutomaticVersion' = "true" | ||
|
||
release { | ||
// http://tellurianring.com/wiki/gradle/release | ||
failOnCommitNeeded=true | ||
failOnPublishNeeded=true | ||
failOnUnversionedFiles=true | ||
failOnUpdateNeeded=true | ||
includeProjectNameInTag=true | ||
requireBranch = null | ||
git.requireBranch = null | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
#Tue Aug 14 16:28:54 PDT 2012 | ||
#Tue Apr 02 11:45:56 PDT 2013 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=http\://services.gradle.org/distributions/gradle-1.3-bin.zip | ||
distributionUrl=http\://services.gradle.org/distributions/gradle-1.5-bin.zip | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters