Skip to content

Commit

Permalink
Merge pull request #200 from nebula-plugins/immutable-snapshot-preced…
Browse files Browse the repository at this point in the history
…ence-enhancement

nebula.release should not enforce precedence for immutable snapshots
  • Loading branch information
rpalcolea authored Sep 23, 2020
2 parents 188c36d + f80090c commit 8e6c4c9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1252,6 +1252,31 @@ class ReleasePluginIntegrationSpec extends GitVersioningIntegrationSpec {
result.standardOutput.contains('Pushing changes in [v0.1.0] to origin')
}

def 'Can create devSnapshot with scope patch if candidate for next minor is present'() {
git.tag.add(name: 'v3.1.2')
git.tag.add(name: 'v3.2.0-rc.1')
git.tag.add(name: 'v3.2.0-rc.2')

when:
def version = inferredVersionForTask('devSnapshot', '-Prelease.scope=patch')

then:
version == dev('3.1.3-dev.0+')
}

def 'Can create devSnapshot with scope patch if candidate for next minor is present - immutable snapshot'() {
replaceDevWithImmutableSnapshot()
git.tag.add(name: 'v3.1.2')
git.tag.add(name: 'v3.2.0-rc.1')
git.tag.add(name: 'v3.2.0-rc.2')

when:
def version = inferredVersionForTask('devSnapshot', '-Prelease.scope=patch')

then:
version.toString().startsWith("3.1.3-snapshot." + getUtcDateForComparison())
}

private void replaceDevWithImmutableSnapshot() {
new File(buildFile.parentFile, "gradle.properties").text = """
nebula.release.features.replaceDevWithImmutableSnapshot=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,8 @@ final class Strategies {
allowDirtyRepo: true,
preReleaseStrategy: all(PreRelease.STAGE_FLOAT, PreRelease.TIMESTAMP, PreRelease.SHOW_UNCOMMITTED),
buildMetadataStrategy: BuildMetadata.COMMIT_ABBREVIATED_ID,
createTag: false
createTag: false,
enforcePrecedence: false
)

/**
Expand Down

0 comments on commit 8e6c4c9

Please sign in to comment.