@@ -2,7 +2,7 @@ apply plugin: 'idea'
22apply plugin : ' eclipse'
33
44group = ' co.permify'
5- version = ' 0.0.1'
5+ version = ' 0.0.1' // Default version
66
77buildscript {
88 repositories {
@@ -18,7 +18,7 @@ repositories {
1818 mavenCentral()
1919}
2020
21- if (hasProperty(' target' ) && target == ' android' ) {
21+ if (hasProperty(' target' ) && target == ' android' ) {
2222
2323 apply plugin : ' com.android.library'
2424 apply plugin : ' com.github.dcendents.android-maven'
@@ -36,7 +36,6 @@ if(hasProperty('target') && target == 'android') {
3636 targetCompatibility JavaVersion . VERSION_1_8
3737 }
3838
39- // Rename the aar correctly
4039 libraryVariants. all { variant ->
4140 variant. outputs. each { output ->
4241 def outputFile = output. outputFile
@@ -54,7 +53,7 @@ if(hasProperty('target') && target == 'android') {
5453
5554 afterEvaluate {
5655 android. libraryVariants. all { variant ->
57- def task = project. tasks. create " jar${ variant.name.capitalize()} " , Jar
56+ def task = project. tasks. create( " jar${ variant.name.capitalize()} " , Jar )
5857 task. description = " Create jar artifact for ${ variant.name} "
5958 task. dependsOn variant. javaCompile
6059 task. from variant. javaCompile. destinationDirectory
@@ -94,13 +93,15 @@ if(hasProperty('target') && target == 'android') {
9493 }
9594 publications {
9695 maven(MavenPublication ) {
97- artifactId = ' permify'
98- from components. java
96+ artifactId = ' permify'
97+ from components. java
98+ def commitHash = ' git rev-parse --short HEAD' . execute(). text. trim()
99+ version = " ${ version} -${ commitHash} "
99100 }
100101 }
101102 }
102103
103- task execute(type :JavaExec ) {
104+ task execute(type : JavaExec ) {
104105 mainClass = System . getProperty(' mainClass' )
105106 classpath = sourceSets. main. runtimeClasspath
106107 }
0 commit comments