@@ -17,11 +17,15 @@ apply plugin: 'maven'
1717apply plugin : ' signing'
1818apply plugin : ' maven-publish'
1919
20- version = VERSION_NAME
20+ def getVersionName () {
21+ return isSnapshotBuild() ? VERSION_NAME + " .0-SNAPSHOT" : VERSION_NAME
22+ }
23+
24+ version = getVersionName()
2125group = GROUP
2226
23- def isReleaseBuild () {
24- return VERSION_NAME . contains( " SNAPSHOT " ) == false
27+ def isSnapshotBuild () {
28+ return hasProperty( ' isSnapshot ' ) && project . isSnapshot == " true "
2529}
2630
2731def getReleaseRepositoryUrl () {
@@ -53,7 +57,7 @@ afterEvaluate { project ->
5357
5458 pom. groupId = GROUP
5559 pom. artifactId = POM_ARTIFACT_ID
56- pom. version = VERSION_NAME
60+ pom. version = getVersionName()
5761
5862 repository(url : getReleaseRepositoryUrl()) {
5963 authentication(userName : getRepositoryUsername(), password : getRepositoryPassword())
@@ -97,14 +101,14 @@ afterEvaluate { project ->
97101 mavenInstaller {
98102 pom. groupId = GROUP
99103 pom. artifactId = POM_ARTIFACT_ID
100- pom. version = VERSION_NAME
104+ pom. version = getVersionName()
101105 }
102106 }
103107 }
104108 }
105109
106110 signing {
107- required { isReleaseBuild () && gradle. taskGraph. hasTask(" uploadArchives" ) }
111+ required { ! isSnapshotBuild () && gradle. taskGraph. hasTask(" uploadArchives" ) }
108112 if (project. hasProperty(' signing.inMemoryKey' )) {
109113 def signingKey = findProperty(" signing.inMemoryKey" ). replace(" \\ n" ," \n " )
110114 def signingPassword = findProperty(" signing.password" )
@@ -122,7 +126,7 @@ afterEvaluate { project ->
122126
123127 pom. groupId = GROUP
124128 pom. artifactId = POM_ARTIFACT_ID
125- pom. version = VERSION_NAME
129+ pom. version = getVersionName()
126130
127131 pom. project {
128132 name POM_NAME
@@ -181,7 +185,7 @@ afterEvaluate { project ->
181185 repositories. mavenInstaller {
182186 pom. groupId = GROUP
183187 pom. artifactId = POM_ARTIFACT_ID
184- pom. version = VERSION_NAME
188+ pom. version = getVersionName()
185189
186190 pom. project {
187191 name POM_NAME
@@ -235,7 +239,7 @@ afterEvaluate { project ->
235239 library(MavenPublication ) {
236240 groupId GROUP
237241 artifactId POM_ARTIFACT_ID
238- version VERSION_NAME
242+ version getVersionName()
239243 artifact(" ${ buildDir} /outputs/aar/${ artifactId} -release.aar" )
240244 pom. withXml {
241245 def dependenciesNode = asNode(). appendNode(' dependencies' )
0 commit comments