[testng] 156/160: Break the publish build in multiple files.

Eugene Zhukov eugene-guest at moszumanska.debian.org
Tue Aug 18 10:22:33 UTC 2015


This is an automated email from the git hooks/post-receive script.

eugene-guest pushed a commit to annotated tag testng-6.9.5
in repository testng.

commit 01794396ac49704e552ba07e6817752e02e90b9d
Author: Cedric Beust <cedric at beust.com>
Date:   Sat Jul 11 16:20:39 2015 -0700

    Break the publish build in multiple files.
---
 build.gradle                     |   3 +-
 gradle/publishing-jcenter.gradle |  70 +++++++++++++++++++
 gradle/publishing-maven.gradle   |  50 +++++++++++++
 gradle/publishing.gradle         | 147 +++------------------------------------
 4 files changed, 132 insertions(+), 138 deletions(-)

diff --git a/build.gradle b/build.gradle
index 8c32f0f..3788392 100644
--- a/build.gradle
+++ b/build.gradle
@@ -32,7 +32,6 @@ plugins {
 version = '6.9.5-SNAPSHOT'
 
 apply plugin: 'java'
-apply from: 'gradle/publishing.gradle'
 
 repositories {
     mavenCentral()
@@ -137,3 +136,5 @@ if (JavaVersion.current().isJava8Compatible()) {
         }
     }
 }
+
+apply from: 'gradle/publishing.gradle'
diff --git a/gradle/publishing-jcenter.gradle b/gradle/publishing-jcenter.gradle
new file mode 100644
index 0000000..a0b7ea1
--- /dev/null
+++ b/gradle/publishing-jcenter.gradle
@@ -0,0 +1,70 @@
+//
+// Artifactory
+// ./gradlew artifactoryPublish (upload snapshot to jfrog)
+// ./gradlew bintrayUpload (upload release to JCenter)
+//
+
+apply plugin: 'com.jfrog.bintray'
+apply plugin: 'com.jfrog.artifactory'
+
+Properties properties = new Properties()
+try {
+    properties.load(project.rootProject.file('local.properties').newDataInputStream())
+} catch (FileNotFoundException ignore) {}
+
+group = 'org.testng'
+
+bintray {
+    user = properties.getProperty("bintray.user")
+    key = properties.getProperty("bintray.apikey")
+    publications = ['mavenCustom']
+    // Without this, javadocs don't get uploaded
+    configurations = ['archives']
+    pkg {
+        repo = 'maven'
+        name = 'testng'
+        desc = 'Testing framework for Java'
+        licenses = ['Apache-2.0']
+        labels = ['testng']
+
+        version {
+            name = project.version //Bintray logical version name
+            gpg {
+                // Without this, .asc files don't get generated
+                sign = true
+            }
+
+        }
+    }
+}
+
+artifactory {
+    def a_user = hasProperty('artifactory_user') ? artifactory_user : System.getenv('artifactory_user')
+    def a_password = hasProperty('artifactory_password') ? artifactory_password : System.getenv('artifactory_password')
+    def a_contextUrl = hasProperty('artifactory_contextUrl') ? artifactory_password : System.getenv('artifactory_contextUrl')
+
+    contextUrl = "${a_contextUrl}"
+    //The base Artifactory URL if not overridden by the publisher/resolver
+    publish {
+        repository {
+            repoKey = 'oss-snapshot-local'
+            username = "${a_user}"
+            password = "${a_password}"
+            maven = true
+
+        }
+        defaults {
+            publications('mavenJava')
+        }
+
+    }
+    resolve {
+        repository {
+            repoKey = 'libs-snapshot'
+            username = "${a_user}"
+            password = "${a_password}"
+            maven = true
+
+        }
+    }
+}
diff --git a/gradle/publishing-maven.gradle b/gradle/publishing-maven.gradle
new file mode 100644
index 0000000..c87f8c4
--- /dev/null
+++ b/gradle/publishing-maven.gradle
@@ -0,0 +1,50 @@
+//
+// Publish to Maven Central
+//
+
+// ./gradlew publish (to publish to Maven Central)
+
+apply plugin: 'maven-publish'
+apply plugin: 'maven'
+
+javadoc {
+    failOnError false
+}
+
+signing {
+    required { gradle.taskGraph.hasTask("uploadArchives") }
+    sign configurations.archives
+}
+
+publishing {
+    publications {
+        mavenCustom(MavenPublication) {
+            from components.java
+            artifact sourcesJar
+
+            groupId 'org.testng'
+            artifactId 'testng'
+            version project.version
+        }
+    }
+}
+
+// ./gradlew uploadArchives (upload snapshot to Maven Central's snapshot repo)
+uploadArchives {
+    repositories {
+        mavenDeployer {
+            beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
+
+            repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2") {
+                authentication(userName: System.getenv('SONATYPE_USER'), password: System.getenv('SONATYPE_PASSWORD'))
+            }
+            snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots") {
+                authentication(userName: System.getenv('SONATYPE_USER'), password: System.getenv('SONATYPE_PASSWORD'))
+            }
+            pom.version = project.version
+            pom.artifactId = 'testng'
+            pom.groupId = 'org.testng'
+        }
+    }
+}
+
diff --git a/gradle/publishing.gradle b/gradle/publishing.gradle
index e6e0851..fd74e50 100644
--- a/gradle/publishing.gradle
+++ b/gradle/publishing.gradle
@@ -1,79 +1,26 @@
 import java.text.SimpleDateFormat
 
+apply plugin: 'signing'
+
 Date buildTimeAndDate = new Date()
 ext {
     buildTime = new SimpleDateFormat('yyyy-MM-dd').format(buildTimeAndDate)
     buildDate = new SimpleDateFormat('HH:mm:ss.SSSZ').format(buildTimeAndDate)
 }
 
-apply plugin: 'maven-publish'
-apply plugin: 'com.jfrog.bintray'
-
 jar {
     manifest {
         attributes(
-            'Built-By': System.properties['user.name'],
-            'Created-By': System.properties['java.version'] + " (" + System.properties['java.vendor'] + " " + System.getProperty("java.vm.version") + ")",
-            'Build-Date': project.buildTime,
-            'Build-Time': project.buildDate,
-            'Specification-Title': project.name,
-            'Specification-Version': project.version,
+                'Built-By': System.properties['user.name'],
+                'Created-By': System.properties['java.version'] + " (" + System.properties['java.vendor'] + " " + System.getProperty("java.vm.version") + ")",
+                'Build-Date': project.buildTime,
+                'Build-Time': project.buildDate,
+                'Specification-Title': project.name,
+                'Specification-Version': project.version,
         )
     }
 }
 
-publishing {
-    publications {
-        mavenCustom(MavenPublication) {
-            from components.java
-            artifact sourceJar
-
-            groupId 'org.testng'
-            artifactId 'testng'
-            version project.version
-        }
-    }
-}
-
-//task install(dependsOn: publishToMavenLocal)
-
-Properties properties = new Properties()
-try {
-    properties.load(project.rootProject.file('local.properties').newDataInputStream())
-} catch (FileNotFoundException ignore) {}
-
-bintray {
-    user = properties.getProperty("bintray.user")
-    key = properties.getProperty("bintray.apikey")
-    publications = ['mavenCustom']
-    // Without this, javadocs don't get uploaded
-    configurations = ['archives']
-    pkg {
-        repo = 'maven'
-        name = 'testng'
-        desc = 'Testing framework for Java'
-        licenses = ['Apache-2.0']
-        labels = ['testng']
-
-        version {
-            name = project.version //Bintray logical version name
-            gpg {
-                // Without this, .asc files don't get generated
-                sign = true
-            }
-            
-        }
-    }
-}
-
-//
-// Upload to Sonatype snapshot
-// ./gradlew uploadArchives
-//
-
-apply plugin: 'maven'
-apply plugin: 'signing'
-
 javadoc {
     failOnError false
 }
@@ -94,32 +41,6 @@ artifacts {
     archives sourcesJar
 }
 
-signing {
-    required { gradle.taskGraph.hasTask("uploadArchives") }
-    sign configurations.archives
-}
-
-uploadArchives {
-    repositories {
-        mavenDeployer {
-            beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
-
-            repository(url: "https://oss.sonatype.org/content/repositories/snapshots") {
-                authentication(userName: System.getenv('SONATYPE_USER'), password: System.getenv('SONATYPE_PASSWORD'))
-            }
-            pom.version = project.version
-            pom.artifactId = 'testng'
-            pom.groupId = 'org.testng'
-        }
-    }
-}
-
-//
-// Artifactory
-// ./gradlew artifactoryPublish (upload snapshot)
-// ./gradlew bintrayUpload (upload release)
-//
-
 buildscript {
     repositories {
         jcenter()
@@ -131,54 +52,6 @@ buildscript {
     }
 }
 
-allprojects {
-    apply plugin: "com.jfrog.artifactory"
-}
-
-artifactory {
-    def a_user = hasProperty('artifactory_user') ? artifactory_user : System.getenv('artifactory_user')
-    def a_password = hasProperty('artifactory_password') ? artifactory_password : System.getenv('artifactory_password')
-    def a_contextUrl = hasProperty('artifactory_contextUrl') ? artifactory_password : System.getenv('artifactory_contextUrl')
-
-    contextUrl = "${a_contextUrl}"
-    //The base Artifactory URL if not overridden by the publisher/resolver
-    publish {
-        repository {
-            repoKey = 'oss-snapshot-local'
-            username = "${a_user}"
-            password = "${a_password}"
-            maven = true
-
-        }
-        defaults {
-            publications('mavenJava')
-        }
-
-    }
-    resolve {
-        repository {
-            repoKey = 'libs-snapshot'
-            username = "${a_user}"
-            password = "${a_password}"
-            maven = true
-
-        }
-    }
-}
-
-//
-// Publish to maven by default
-//
-
-apply plugin: 'maven-publish'
-
-group = 'org.testng'
-
-publishing {
-    publications {
-        mavenJava(MavenPublication) {
-            from components.java
-        }
-    }
-}
+apply from: 'gradle/publishing-maven.gradle'
+apply from: 'gradle/publishing-jcenter.gradle'
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/testng.git



More information about the pkg-java-commits mailing list