File tree Expand file tree Collapse file tree
localrepo/src/main/kotlin/com/yy/publish Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ object PublishExtensionUtil {
2525 username = publishExtension.repoUserName
2626 password = publishExtension.repoPassword
2727 }
28- if (publishExtension.sdkVersion .contains(" SNAPSHOT" )) {
28+ if (project.version.toString() .contains(" SNAPSHOT" )) {
2929 setUrl(" ${publishExtension.snapshotRepo} " )
3030 } else {
3131 setUrl(" ${publishExtension.releaseRepo} " )
Original file line number Diff line number Diff line change 1+ package com.yy.publish.analyzer
2+
3+ /* *
4+ * Created by wangfeihang on 2019-08-26.
5+ */
6+ object DependenciesVersionUtil {
7+ fun getVersion (originVersion : String ): String {
8+ return if (! originVersion.endsWith(" -SNAPSHOT" )) {
9+ " $originVersion -unionlocal-SNAPSHOT"
10+ } else {
11+ originVersion.subSequence(0 , originVersion.indexOf(" -SNAPSHOT" )).toString() + " -unionlocal-SNAPSHOT"
12+ }
13+ }
14+ }
Original file line number Diff line number Diff line change @@ -77,8 +77,8 @@ class DependencyAnalyzer(
7777
7878 val exclusions = dependency.getExclusions()
7979 val sdkVersion =
80- if (isLocal.call(dependency) && dependency.version?.endsWith( " -SNAPSHOT " ) == false ) {
81- dependency.version + " -SNAPSHOT "
80+ if (isLocal.call(dependency)) {
81+ DependenciesVersionUtil .getVersion( dependency.version ? : " " )
8282 } else {
8383 dependency.version
8484 }
Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ class PomAnalyzer(
7070 }
7171
7272 })
73- val sdkVersion = if (local && ! this .version.endsWith( " -SNAPSHOT " )) this .version + " -SNAPSHOT " else this .version
73+ val sdkVersion = if (local) DependenciesVersionUtil .getVersion( this .version) else this .version
7474 return UnionSdkInfo (
7575 groupId = this .groupId,
7676 artifactId = this .artifactId,
Original file line number Diff line number Diff line change @@ -50,11 +50,13 @@ object SdkPathUtil {
5050 }
5151
5252 fun getSdkPomPath (project : Project , parentPath : String ): String? {
53+ val fileCreateTime: Long = 0
54+ var file: File ? = null
5355 project.fileTree(parentPath).forEach {
54- if (it.name.endsWith(" .pom" )) {
55- return it.absolutePath
56+ if (it.name.endsWith(" .pom" ) && it.lastModified() > fileCreateTime ) {
57+ file = it
5658 }
5759 }
58- return null
60+ return file?.absolutePath
5961 }
6062}
You can’t perform that action at this time.
0 commit comments