-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only verify git user information when creating and pushing tags. fixes …
- Loading branch information
Showing
5 changed files
with
105 additions
and
26 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
37 changes: 37 additions & 0 deletions
37
src/main/groovy/nebula/plugin/release/util/ReleaseTasksUtil.groovy
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package nebula.plugin.release.util | ||
|
||
import org.gradle.api.Project | ||
|
||
class ReleaseTasksUtil { | ||
|
||
static final String SNAPSHOT_TASK_NAME = 'snapshot' | ||
static final String SNAPSHOT_TASK_NAME_OPTIONAL_COLON = ":$SNAPSHOT_TASK_NAME" | ||
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 DEV_SNAPSHOT_TASK_NAME_OPTIONAL_COLON = ":$DEV_SNAPSHOT_TASK_NAME" | ||
static final String DEV_SNAPSHOT_SETUP_TASK_NAME_OPTIONAL_COLON = ":$DEV_SNAPSHOT_SETUP_TASK_NAME" | ||
static final String IMMUTABLE_SNAPSHOT_TASK_NAME = 'immutableSnapshot' | ||
static final String IMMUTABLE_SNAPSHOT_SETUP_TASK_NAME = 'immutableSnapshotSetup' | ||
static final String IMMUTABLE_SNAPSHOT_TASK_NAME_OPTIONAL_COLON = ":$IMMUTABLE_SNAPSHOT_TASK_NAME" | ||
static final String CANDIDATE_TASK_NAME = 'candidate' | ||
static final String CANDIDATE_TASK_NAME_OPTIONAL_COLON = ":$CANDIDATE_TASK_NAME" | ||
static final String CANDIDATE_SETUP_TASK_NAME = 'candidateSetup' | ||
static final String FINAL_TASK_NAME = 'final' | ||
static final String FINAL_TASK_NAME_WITH_OPTIONAL_COLON = ":$FINAL_TASK_NAME" | ||
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 USE_LAST_TAG_PROPERTY = 'release.useLastTag' | ||
|
||
static boolean isUsingLatestTag(Project project) { | ||
return project.hasProperty(USE_LAST_TAG_PROPERTY) && project.property(USE_LAST_TAG_PROPERTY).toString().toBoolean() | ||
} | ||
|
||
static boolean isReleaseTaskThatRequiresTagging(List<String> cliTasks) { | ||
def hasCandidate = cliTasks.contains(CANDIDATE_TASK_NAME) || cliTasks.contains(CANDIDATE_TASK_NAME_OPTIONAL_COLON) | ||
def hasFinal = cliTasks.contains(FINAL_TASK_NAME) || cliTasks.contains(FINAL_TASK_NAME_WITH_OPTIONAL_COLON) | ||
return hasCandidate || hasFinal | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
src/test/groovy/nebula/plugin/release/util/ReleaseTasksUtilSpec.groovy
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package nebula.plugin.release.util | ||
|
||
import nebula.test.ProjectSpec | ||
import spock.lang.Unroll | ||
|
||
class ReleaseTasksUtilSpec extends ProjectSpec { | ||
|
||
def 'verify isUsingLatestTag reads the project property accordingly'() { | ||
given: | ||
project | ||
|
||
expect: | ||
!ReleaseTasksUtil.isUsingLatestTag(project) | ||
|
||
when: | ||
project.ext.'release.useLastTag' = false | ||
|
||
then: | ||
!ReleaseTasksUtil.isUsingLatestTag(project) | ||
|
||
when: | ||
project.ext.'release.useLastTag' = true | ||
|
||
then: | ||
ReleaseTasksUtil.isUsingLatestTag(project) | ||
} | ||
|
||
@Unroll | ||
def 'checking release task for #tasks results in #expected'() { | ||
expect: | ||
ReleaseTasksUtil.isReleaseTaskThatRequiresTagging(tasks) == expected | ||
|
||
where: | ||
tasks || expected | ||
['build'] || false | ||
['build', 'devSnapshot'] || false | ||
['build', 'candidate'] || true | ||
['build', 'immutableSnapshot'] || false | ||
['build', 'final'] || true | ||
[':devSnapshot'] || false | ||
['devSnapshot'] || false | ||
[':snapshot'] || false | ||
['snapshot'] || false | ||
['candidate'] || true | ||
[':candidate'] || true | ||
['immutableSnapshot'] || false | ||
[':immutableSnapshot'] || false | ||
['final'] || true | ||
[':final'] || true | ||
} | ||
|
||
} |