@@ -19,40 +19,8 @@ plugins {
1919 id(" com.gradle.plugin-publish" ) version " 0.9.10"
2020}
2121
22- fun getHeadCommitSHA1Short (logger : Logger ): String? {
23- val gitDir = project.file(" .git" )
24- if (! gitDir.exists() || ! gitDir.isDirectory || ! gitDir.canRead()) {
25- logger.error(" .git directory does not exist" )
26- return null
27- }
28- val headFile = File (gitDir, " HEAD" )
29- if (! headFile.exists() || ! headFile.isFile || ! headFile.canRead()) {
30- logger.error(" HEAD does not exist" )
31- return null
32- }
33- val headContent = headFile.readText(Charsets .UTF_8 )
34- if (headContent.contains(' :' )) {
35- logger.warn(" HEAD is branch" )
36- val refFile = File (gitDir, headContent.split(' :' )[1 ].trim())
37- if (! refFile.exists() || ! refFile.isFile || ! refFile.canRead()) {
38- logger.warn(" Failed to find HEAD's branch" )
39- return null
40- }
41- return refFile.readText(Charsets .UTF_8 ).trim().take(7 )
42- } else {
43- logger.warn(" HEAD is single commit" )
44- return headContent.trim().take(7 )
45- }
46- }
47-
48- val currentCommit = getHeadCommitSHA1Short(logger)
49- logger.warn(" $currentCommit " )
5022group = " com.cherryperry.gfe"
51- version = if (currentCommit != null ) {
52- " 1.0.$currentCommit "
53- } else {
54- throw IllegalStateException (" Failed to resolve commit based version" )
55- }
23+ version = " 1.1.0"
5624
5725configure<JavaPluginConvention > {
5826 sourceCompatibility = JavaVersion .VERSION_1_8
0 commit comments