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

Commit f130729

Browse files
committed
Adding comments.
1 parent 8b7705e commit f130729

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/main/groovy/org/ajoberstar/gradle/git/release/semver/RebuildVersionStrategy.groovy

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ import org.ajoberstar.grgit.Grgit
2222

2323
import org.gradle.api.Project
2424

25+
/**
26+
* Strategy that infers the version based on the tag on the current
27+
* HEAD.
28+
*/
2529
class RebuildVersionStrategy implements VersionStrategy {
2630
public static final RebuildVersionStrategy INSTANCE = new RebuildVersionStrategy()
2731

@@ -34,13 +38,25 @@ class RebuildVersionStrategy implements VersionStrategy {
3438
return 'rebuild'
3539
}
3640

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+
*/
3749
@Override
3850
boolean selector(Project project, Grgit grgit) {
3951
return grgit.status().clean &&
4052
project.properties.keySet().find { it.startsWith('release.') } == null &&
4153
getHeadVersion(grgit)
4254
}
4355

56+
/**
57+
* Infers the version based on the version tag on the current HEAD with the
58+
* highest precendence.
59+
*/
4460
@Override
4561
ReleaseVersion infer(Project project, Grgit grgit) {
4662
String version = getHeadVersion(grgit)

src/main/groovy/org/ajoberstar/gradle/git/release/semver/TagUtil.groovy

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ import com.github.zafarkhaja.semver.Version
2020

2121
import org.ajoberstar.grgit.Tag
2222

23+
import groovy.transform.PackageScope
24+
25+
@PackageScope
2326
final class TagUtil {
2427
private TagUtil() {
2528
throw new AssertionError('Cannot instantiate this class.')

0 commit comments

Comments
 (0)