Skip to content
This repository has been archived by the owner on Oct 5, 2018. It is now read-only.

Commit

Permalink
Explicit release prop check in rebuild strategy
Browse files Browse the repository at this point in the history
Rebuild strategy used to look for any property on the project that
started with release. This could cause some issues with model rules and
projects with evaluationDependsOnChildren. Explicitly looking for the
properties avoids this issue.

Fixes #252
  • Loading branch information
ajoberstar committed Apr 9, 2017
1 parent 4980ccf commit 0488e16
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ class RebuildVersionStrategy implements VersionStrategy {
@Override
boolean selector(Project project, Grgit grgit) {
def clean = grgit.status().clean
def props = project.properties.keySet().find { it.startsWith('release.') }
def propsSpecified = project.hasProperty(SemVerStrategy.SCOPE_PROP) || project.hasProperty(SemVerStrategy.STAGE_PROP)
def headVersion = getHeadVersion(project, grgit)

if (clean && props == null && headVersion) {
if (clean && !propsSpecified && headVersion) {
logger.info('Using {} strategy because repo is clean, no "release." properties found and head version is {}', name, headVersion)
return true
} else {
logger.info('Skipping {} strategy because clean is {}, "release." properties are {} and head version is {}', name, clean, props, headVersion)
logger.info('Skipping {} strategy because clean is {}, "release." properties are {} and head version is {}', name, clean, propsSpecified, headVersion)
return false
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class RebuildVersionStrategySpec extends Specification {
def 'selector returns false if any release properties are set'() {
given:
mockClean(true)
Project project = getProject('release.anything': 'value')
Project project = getProject('release.scope': 'value')
mockTagsAtHead('v1.0.0')
expect:
!strategy.selector(project, grgit)
Expand Down

0 comments on commit 0488e16

Please sign in to comment.