Skip to content

Commit

Permalink
Add auto versioning build feature
Browse files Browse the repository at this point in the history
  • Loading branch information
dai0304 committed Nov 26, 2016
1 parent 0edfb47 commit e382869
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ buildscript {
classpath "com.gradle.publish:plugin-publish-plugin:0.9.1"
classpath "com.diffplug.gradle.spotless:spotless:1.3.3"
classpath "de.thetaphi:forbiddenapis:2.2"
classpath 'org.ajoberstar:grgit:1.1.0'
classpath 'org.ajoberstar:grgit:1.7.0'
classpath "de.aaschmid:gradle-cpd-plugin:1.0"
}
}
Expand All @@ -28,7 +28,21 @@ defaultTasks "clean", "build"

// ======== deployment options (dispatched on group name) ========
group = "jp.classmethod.aws"
version = "0.32-SNAPSHOT"

ext {
git = org.ajoberstar.grgit.Grgit.open(file('.'))
describedCommit = git.describe().toString().trim()
}

version = describedCommit +
(describedCommit.matches(".*-[0-9]+-g[0-9a-f]{7}") ? "-SNAPSHOT" : "") +
(git.status().isClean() ? "" : "+dirty")

task showVersion {
doLast {
println version
}
}

sourceCompatibility = targetCompatibility = 1.8

Expand Down

0 comments on commit e382869

Please sign in to comment.