forked from Netflix/ribbon
-
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.
- Loading branch information
Justin Ryan
committed
Apr 2, 2013
1 parent
63e44e8
commit 8caf8ec
Showing
6 changed files
with
72 additions
and
80 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,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
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,60 +1,55 @@ | ||
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 | ||
preTagCommit.dependsOn build | ||
preTagCommit.dependsOn buildWithArtifactory | ||
preTagCommit.dependsOn checkSnapshotDependencies | ||
checkSnapshotDependencies.dependsOn confirmReleaseVersion | ||
confirmReleaseVersion.dependsOn unSnapshotVersion | ||
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] | ||
} | ||
startParameter.addInitScript( file('gradle/netflix-oss.gradle') ) | ||
startParameter.getExcludedTaskNames().add('check') | ||
tasks = [ 'build', value ] | ||
} | ||
} | ||
task releaseArtifactory(dependsOn: [preTagCommit, uploadArtifactory]) | ||
|
||
// Marker task for following code to key in on | ||
task releaseCandidate(dependsOn: release) | ||
task forceCandidate { | ||
onlyIf { gradle.taskGraph.hasTask(releaseCandidate) } | ||
doFirst { project.status = 'candidate' } | ||
} | ||
release.dependsOn(forceCandidate) | ||
|
||
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") | ||
} | ||
} | ||
uploadArtifactory.dependsOn(verifyStatus) | ||
uploadMavenCentral.dependsOn(verifyStatus) | ||
|
||
// Ensure upload happens before taggging but after all pre-checks | ||
createReleaseTag.dependsOn releaseArtifactory | ||
createReleaseTag.dependsOn([uploadArtifactory, uploadMavenCentral]) | ||
|
||
subprojects.each { project -> | ||
project.uploadMavenCentral.dependsOn rootProject.preTagCommit | ||
rootProject.createReleaseTag.dependsOn project.uploadMavenCentral | ||
gradle.taskGraph.whenReady { taskGraph -> | ||
def hasRelease = taskGraph.hasTask('commitNewVersion') | ||
def indexOf = { return taskGraph.allTasks.indexOf(it) } | ||
|
||
gradle.taskGraph.whenReady { taskGraph -> | ||
if ( rootProject.status == 'release' && !taskGraph.hasTask(':release') ) { | ||
throw new GradleException('"release" task has to be run before uploading a release') | ||
} | ||
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 { | ||
failOnCommitNeeded=true | ||
failOnPublishNeeded=true | ||
failOnSnapshotDependencies=true | ||
failOnUnversionedFiles=true | ||
failOnUpdateNeeded=true | ||
includeProjectNameInTag=true | ||
revertOnFail=true | ||
requireBranch = null | ||
git.requireBranch = null | ||
} |