diff --git a/CHANGELOG.md b/CHANGELOG.md index deb9af8..23fc55d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +5.0.0 / 2017-04-19 +================== + +* Add some tasks and rework task ordering + * BREAKING: `snapshot`, `devSnapshot`, `candidate`, `final` are no longer finalized by release, they now depend on `release` + * Added `snapshotSetup`, `devSnapshotSetup`, `candidateSetup`, `finalSetup` added if you need to run specific things early in the process + * Added `postRelease` task for tasks you want to happen after release (which tags the repo), we have moved publishing to be called by this step + 4.2.0 / 2017-03-31 ================== diff --git a/README.md b/README.md index e4ea1ef..0d7fcef 100644 --- a/README.md +++ b/README.md @@ -128,6 +128,39 @@ The plugin assumes Git root is in the same location as Gradle root. If this isn' ./gradlew -Pgit.root= final +# Lifecycle Hooks + +### For `devSnapshot` + +* `devSnapshotSetup` - any kind of setup is good to live around here, e.g. setting status, various checks +* `release` - probably have `release` dependOn any `assemble` and `check` tasks, dependsOn `devSnapshotSetup` +* `postRelease` - any steps you want to happen after the repo tag, in our case this is where publishing happens since if the publish partially fails we don't want to fix the tags, dependsOn `release` +* `devSnapshot` - command line task to kick off devSnapshot workflow, dependsOn `postRelease` + +### For `snapshot` + +* `snapshotSetup` - any kind of setup is good to live around here, e.g. setting status, various checks +* `release` - probably have `release` dependOn any `assemble` and `check` tasks, dependsOn `snapshotSetup` +* `postRelease` - any steps you want to happen after the repo tag, in our case this is where publishing happens since if the publish partially fails we don't want to fix the tags, dependsOn `release` +* `snapshot` - command line task to kick off snapshot workflow, dependsOn `postRelease` + +### For `candidate` + +* `candidateSetup` - any kind of setup is good to live around here, e.g. setting status, various checks +* `release` - this is where the tag is pushed to the repo, so probably have `release` dependOn any `assemble` and `check` tasks, dependsOn `candidateSetup` +* `postRelease` - any steps you want to happen after the repo tag, in our case this is where publishing happens since if the publish partially fails we don't want to fix the tags, dependsOn `release` +* `candidate` - command line task to kick off devSnapshot workflow, dependsOn `postRelease` + +### For `final` + +* `finalSetup` - any kind of setup is good to live around here, e.g. setting status, various checks +* `release` - this is where the tag is pushed to the repo, so probably have `release` dependOn any `assemble` and `check` tasks, dependsOn `finalSetup` +* `postRelease` - any steps you want to happen after the repo tag, in our case this is where publishing happens since if the publish partially fails we don't want to fix the tags, dependsOn `release` +* `final` - command line task to kick off devSnapshot workflow, dependsOn `postRelease` + +Gradle and Java Compatibility +============================= + Built with Oracle JDK7 Tested with Oracle JDK8 @@ -136,6 +169,7 @@ Tested with Oracle JDK8 | 2.13 | yes | | 3.3 | yes | | 3.4.1 | yes | +| 3.5 | yes | LICENSE ======= diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index fec688c..de5db83 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index dd87d4d..7fec3bd 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Thu Mar 30 11:37:52 PDT 2017 +#Wed Apr 19 13:06:32 PDT 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-rc-2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-bin.zip diff --git a/src/main/groovy/nebula/plugin/release/ReleasePlugin.groovy b/src/main/groovy/nebula/plugin/release/ReleasePlugin.groovy index 818de43..dfbcc1d 100644 --- a/src/main/groovy/nebula/plugin/release/ReleasePlugin.groovy +++ b/src/main/groovy/nebula/plugin/release/ReleasePlugin.groovy @@ -42,11 +42,16 @@ class ReleasePlugin implements Plugin { static Logger logger = Logging.getLogger(ReleasePlugin) static final String SNAPSHOT_TASK_NAME = 'snapshot' + static final String SNAPSHOT_SETUP_TASK_NAME = 'snapshotSetup' static final String DEV_SNAPSHOT_TASK_NAME = 'devSnapshot' + static final String DEV_SNAPSHOT_SETUP_TASK_NAME = 'devSnapshotSetup' static final String CANDIDATE_TASK_NAME = 'candidate' + static final String CANDIDATE_SETUP_TASK_NAME = 'candidateSetup' static final String FINAL_TASK_NAME = 'final' + static final String FINAL_SETUP_TASK_NAME = 'finalSetup' static final String RELEASE_CHECK_TASK_NAME = 'releaseCheck' static final String NEBULA_RELEASE_EXTENSION_NAME = 'nebulaRelease' + static final String POST_RELEASE_TASK_NAME = 'postRelease' static final String GROUP = 'Nebula Release' @Override @@ -113,23 +118,40 @@ class ReleasePlugin implements Plugin { releaseCheck.grgit = releaseExtension.grgit releaseCheck.patterns = nebulaReleaseExtension - def snapshotTask = project.task(SNAPSHOT_TASK_NAME) - def devSnapshotTask = project.task(DEV_SNAPSHOT_TASK_NAME) - def candidateTask = project.task(CANDIDATE_TASK_NAME) - candidateTask.doLast { + def postReleaseTask = project.task(POST_RELEASE_TASK_NAME) + postReleaseTask.group = GROUP + postReleaseTask.dependsOn project.tasks.release + + def snapshotSetupTask = project.task(SNAPSHOT_SETUP_TASK_NAME) + def devSnapshotSetupTask = project.task(DEV_SNAPSHOT_SETUP_TASK_NAME) + def candidateSetupTask = project.task(CANDIDATE_SETUP_TASK_NAME) + candidateSetupTask.doLast { project.allprojects.each { it.status = 'candidate' } } - def finalTask = project.task(FINAL_TASK_NAME) - finalTask.doLast { + def finalSetupTask = project.task(FINAL_SETUP_TASK_NAME) + finalSetupTask.doLast { project.allprojects.each { it.status = 'release' } } - [snapshotTask, devSnapshotTask, candidateTask, finalTask].each { + [snapshotSetupTask, devSnapshotSetupTask, candidateSetupTask, finalSetupTask].each { it.group = GROUP - it.finalizedBy project.tasks.release it.dependsOn releaseCheck } + def snapshotTask = project.task(SNAPSHOT_TASK_NAME) + snapshotTask.dependsOn snapshotSetupTask + def devSnapshotTask = project.task(DEV_SNAPSHOT_TASK_NAME) + devSnapshotTask.dependsOn devSnapshotSetupTask + def candidateTask = project.task(CANDIDATE_TASK_NAME) + candidateTask.dependsOn candidateSetupTask + def finalTask = project.task(FINAL_TASK_NAME) + finalTask.dependsOn finalSetupTask + + [snapshotTask, devSnapshotTask, candidateTask, finalTask].each { + it.group = GROUP + it.dependsOn postReleaseTask + } + def cliTasks = project.gradle.startParameter.taskNames determineStage(cliTasks, releaseCheck) checkStateForStage() @@ -148,6 +170,7 @@ class ReleasePlugin implements Plugin { } } + configurePublishingIfPresent() configureBintrayTasksIfPresent() } @@ -208,13 +231,13 @@ class ReleasePlugin implements Plugin { void configurePublishingIfPresent() { project.plugins.withType(MavenPublishPlugin) { project.tasks.withType(GenerateMavenPom) { task -> - project.rootProject.tasks.release.dependsOn(task) + project.rootProject.tasks.postRelease.dependsOn(task) } } project.plugins.withType(IvyPublishPlugin) { project.tasks.withType(GenerateIvyDescriptor) { task -> - project.rootProject.tasks.release.dependsOn(task) + project.rootProject.tasks.postRelease.dependsOn(task) } } } @@ -225,7 +248,7 @@ class ReleasePlugin implements Plugin { project.plugins.withType(JavaPlugin) { task.dependsOn(project.tasks.build) } - project.rootProject.tasks.release.dependsOn(task) + project.rootProject.tasks.postRelease.dependsOn(task) } } else { logger.info('Skipping configuration of bintray task since it is not present') @@ -236,7 +259,7 @@ class ReleasePlugin implements Plugin { project.plugins.withType(JavaPlugin) { task.dependsOn(project.tasks.build) } - project.rootProject.tasks.release.dependsOn(task) + project.rootProject.tasks.postRelease.dependsOn(task) } } else { logger.info('Skipping configuration of artifactoryPublish task since it is not present')