Skip to content

Commit

Permalink
the version offset checks against the branch and the tag
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Amesbury committed Feb 13, 2019
1 parent 97d8095 commit 2a3a3a6
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ class GitVersionPlugin : Plugin<Project> {
var gitCommitCount = getGitCommitCount(project.projectDir)
val gitTagCount = getGitTagCount(project.projectDir)
val gitBranchName = getGitBranchName(project.projectDir)
val gitVersion = getGitVersion(project.projectDir)

val byType = project.extensions.getByType(MoonlitDoorExtension::class.java)
byType.offsets.find { Regex(it.name).matches(gitBranchName) }?.let {
project.extensions.getByType(MoonlitDoorExtension::class.java).offsets.find { Regex(it.name).matches(gitBranchName) || Regex(it.name).matches(gitVersion) }?.let {
gitCommitCount += it.offset
}
project.extensions.add(GIT_COMMIT_COUNT, gitCommitCount)
project.extensions.add(GIT_TAG_COUNT, gitTagCount)
project.extensions.add(GIT_COMMIT_AND_TAG_COUNT, gitCommitCount + gitTagCount)
project.extensions.add(GIT_VERSION, getGitVersion(project.projectDir))
project.extensions.add(GIT_VERSION, gitVersion)
project.extensions.add(GIT_BRANCH_NAME, gitBranchName)
}

Expand Down

0 comments on commit 2a3a3a6

Please sign in to comment.