Sfoglia il codice sorgente

Revert "禁用buildSrc上传"

This reverts commit 6d6d7ce40bf006f4166294e1dac75db06cf2f008.
nieqiurong@163.com 7 anni fa
parent
commit
f731574848
4 ha cambiato i file con 24 aggiunte e 26 eliminazioni
  1. 1 0
      .gitignore
  2. 18 25
      build.gradle
  3. 3 0
      buildSrc/build.gradle
  4. 2 1
      gradle.properties

+ 1 - 0
.gitignore

@@ -19,3 +19,4 @@ html
 
 # MacOS
 .DS_Store
+/repo/

+ 18 - 25
build.gradle

@@ -115,36 +115,29 @@ subprojects {
         archives javadocJar
     }
 
-    tasks.whenTaskAdded { task ->
-        if (task.name.contains('uploadArchives') || task.name.contains("signArchives")) {
-            task.enabled = new File(project.property('signing.secretKeyRingFile') as String).isFile()
-        }
-    }
-
-    signing {
-        sign configurations.archives
-    }
-
     // gradle clean build uploadArchives -Dun=用户名 -Dps=密码 -x test
     uploadArchives {
         repositories {
             mavenDeployer {
-                beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
-                def userName = System.getProperty("un")
-                def passWord = System.getProperty("ps")
-                repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
-                    //noinspection GroovyAssignabilityCheck
-                    authentication(userName: userName, password: passWord)
-                }
-
-                snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
-                    //noinspection GroovyAssignabilityCheck
-                    authentication(userName: userName, password: passWord)
+                def isLocal = Boolean.valueOf(project.properties.get("local"))
+                if(isLocal){
+                    repository(url: uri('../repo'))
+                }else {
+                    signing {
+                        sign configurations.archives
+                    }
+                    beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
+                    def userName = System.getProperty("un")
+                    def passWord = System.getProperty("ps")
+                    pom.version = "$project.version"
+                    pom.artifactId = "$project.name"
+                    pom.groupId = "$project.group"
+                    repository(url: pom.version.endsWith('SNAPSHOT') ? 'https://oss.sonatype.org/content/repositories/snapshots/'
+                        :'https://oss.sonatype.org/service/local/staging/deploy/maven2/') {
+                        //noinspection GroovyAssignabilityCheck
+                        authentication(userName: userName, password: passWord)
+                    }
                 }
-
-                pom.version = "$project.version"
-                pom.artifactId = "$project.name"
-                pom.groupId = "$project.group"
                 pom.project {
                     //noinspection GroovyAssignabilityCheck
                     name 'mybatis-plus'

+ 3 - 0
buildSrc/build.gradle

@@ -4,6 +4,9 @@ apply plugin: "groovy"
     https://github.com/gradle/gradle/issues/867
     https://github.com/spring-gradle-plugins/propdeps-plugin/commit/bd14013e6f0adba7908778349bb0a08b50212658
  */
+
+uploadArchives.enabled = false
+
 dependencies {
     compile gradleApi()
     compile localGroovy()

+ 2 - 1
gradle.properties

@@ -1,3 +1,4 @@
 signing.keyId=1FD337F9
 signing.password=243194995
-signing.secretKeyRingFile=/Users/hubin/dev/signing.gpg
+signing.secretKeyRingFile=/Users/hubin/dev/signing.gpg
+local=true