This repository was archived by the owner on Oct 5, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
src/main/groovy/org/ajoberstar/gradle/git/release/semver Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,10 @@ import org.ajoberstar.grgit.Grgit
22
22
23
23
import org.gradle.api.Project
24
24
25
+ /**
26
+ * Strategy that infers the version based on the tag on the current
27
+ * HEAD.
28
+ */
25
29
class RebuildVersionStrategy implements VersionStrategy {
26
30
public static final RebuildVersionStrategy INSTANCE = new RebuildVersionStrategy ()
27
31
@@ -34,13 +38,25 @@ class RebuildVersionStrategy implements VersionStrategy {
34
38
return ' rebuild'
35
39
}
36
40
41
+ /**
42
+ * Determines whether this strategy should be used to infer the version.
43
+ * <ul >
44
+ * <li >Return {@code false }, if any project properties starting with "release." are set.</li>
45
+ * <li >Return {@code false }, if there aren't any tags on the current HEAD that can be parsed as a version.</li>
46
+ * <li >Return {@code true }, otherwise.</li>
47
+ * </ul>
48
+ */
37
49
@Override
38
50
boolean selector (Project project , Grgit grgit ) {
39
51
return grgit. status(). clean &&
40
52
project. properties. keySet(). find { it. startsWith(' release.' ) } == null &&
41
53
getHeadVersion(grgit)
42
54
}
43
55
56
+ /**
57
+ * Infers the version based on the version tag on the current HEAD with the
58
+ * highest precendence.
59
+ */
44
60
@Override
45
61
ReleaseVersion infer (Project project , Grgit grgit ) {
46
62
String version = getHeadVersion(grgit)
Original file line number Diff line number Diff line change @@ -20,6 +20,9 @@ import com.github.zafarkhaja.semver.Version
20
20
21
21
import org.ajoberstar.grgit.Tag
22
22
23
+ import groovy.transform.PackageScope
24
+
25
+ @PackageScope
23
26
final class TagUtil {
24
27
private TagUtil () {
25
28
throw new AssertionError (' Cannot instantiate this class.' )
You can’t perform that action at this time.
0 commit comments