You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
2.8 KiB
67 lines
2.8 KiB
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 |
|
|
|
// Call out to compile against internal repository |
|
task uploadArtifactory(type: GradleBuild) { |
|
startParameter = project.gradle.startParameter.newInstance() |
|
startParameter.addInitScript( file('gradle/netflix-oss.gradle') ) |
|
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') ) |
|
startParameter.getExcludedTaskNames().add('check') |
|
tasks = [ 'build' ] |
|
} |
|
|
|
// 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') |
|
} |
|
} |
|
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') |
|
} |
|
} |
|
} |
|
|
|
// 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 |
|
}
|
|
|