groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject [13/22] groovy git commit: push signing of artifacts into the main build instead of the groovy-release repo (more tweaks - exclude extra artifacts from root project publication)
Date Fri, 13 Jan 2017 15:58:26 GMT
push signing of artifacts into the main build instead of the groovy-release repo (more tweaks
- exclude extra artifacts from root project publication)


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/cf07fc0a
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/cf07fc0a
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/cf07fc0a

Branch: refs/heads/parrot
Commit: cf07fc0a4840a1df56cf1a74047b278bd3fa7328
Parents: adab220
Author: paulk <paulk@asert.com.au>
Authored: Sat Jan 7 13:22:36 2017 +1000
Committer: paulk <paulk@asert.com.au>
Committed: Sat Jan 7 14:07:42 2017 +1000

----------------------------------------------------------------------
 gradle/bintray.gradle | 88 ++++++++++++----------------------------------
 gradle/upload.gradle  | 20 ++++++++---
 2 files changed, 38 insertions(+), 70 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/cf07fc0a/gradle/bintray.gradle
----------------------------------------------------------------------
diff --git a/gradle/bintray.gradle b/gradle/bintray.gradle
index 01142ce..ee3a50b 100644
--- a/gradle/bintray.gradle
+++ b/gradle/bintray.gradle
@@ -46,6 +46,7 @@ allprojects {
         }
         publish {
             repository {
+                excludePatterns = 'org/codehaus/groovy/groovy/*/groovy-all*,org/codehaus/groovy/groovy/*/groovy-backports*,org/codehaus/groovy/groovy/*/groovy-binary*'
                 repoKey = project.hasProperty('bintrayRepoKey') ? project.bintrayRepoKey
: 'oss-snapshot-local' //The Artifactory repository key to publish to
                 //when using oss.jfrog.org the credentials are from Bintray. For local build
we expect them to be found in
                 //~/.gradle/gradle.properties, otherwise to be set in the build server
@@ -57,78 +58,35 @@ allprojects {
 }
 
 artifactoryPublish {
+    def curDate = new Date()
+    def pomSource = { a -> "$projectDir/target/poms/pom-${a.name - 'groovy-'}.xml" }
+    def destBase = { a -> "org/codehaus/groovy/${a.name}/${version}/${a.name}-${version}${a.classifier
? '-' + a.classifier : ''}" }
+    def newDetails = { orig, newFile, newExt, newType -> gradleDeployDetails(new DefaultPublishArtifact(
+            orig.name, newExt, newType, orig.classifier, curDate, newFile), 'artifacts',
destBase(orig) + '.' + newExt) }
+    def makeTransformedDetails = { orig -> newDetails(orig, orig.file, orig.extension,
orig.extension) }
+    def makeTransformedPomDetails = { orig -> newDetails(orig, file(pomSource(orig)),
'pom', 'pom') }
+    def makeTransformedPomSigDetails = { orig -> newDetails(orig, file(pomSource(orig)
+ '.asc'), 'pom.asc', 'asc') }
     mavenDescriptor = new File("$projectDir/target/poms/pom-groovy.xml")
     doFirst{
-        def curDate = new Date()
-        def additionalFiles = [
-                gradleDeployDetails(new DefaultPublishArtifact("groovy-all", "jar", "jar",
null,
-                        curDate, file("$projectDir/target/libs/groovy-all-${version}.jar")),
'artifacts',
-                        "org/codehaus/groovy/groovy-all/${version}/groovy-all-${version}.jar"),
-                gradleDeployDetails(new DefaultPublishArtifact("groovy-all", "jar", "jar",
'sources',
-                        curDate, file("$projectDir/target/libs/groovy-all-${version}-sources.jar")),
'artifacts',
-                        "org/codehaus/groovy/groovy-all/${version}/groovy-all-${version}-sources.jar"),
-                gradleDeployDetails(new DefaultPublishArtifact("groovy-all", "jar", "jar",
'javadoc',
-                        curDate, file("$projectDir/target/libs/groovy-all-${version}-javadoc.jar")),
'artifacts',
-                        "org/codehaus/groovy/groovy-all/${version}/groovy-all-${version}-javadoc.jar"),
-                gradleDeployDetails(new DefaultPublishArtifact("groovy-all", "jar", "jar",
'groovydoc',
-                        curDate, file("$projectDir/target/libs/groovy-all-${version}-groovydoc.jar")),
'artifacts',
-                        "org/codehaus/groovy/groovy-all/${version}/groovy-all-${version}-groovydoc.jar"),
-                gradleDeployDetails(new DefaultPublishArtifact("groovy-all", "jar", "jar",
'indy',
-                        curDate, file("$projectDir/target/libs/groovy-all-${version}-indy.jar")),
'artifacts',
-                        "org/codehaus/groovy/groovy-all/${version}/groovy-all-${version}-indy.jar"),
-                gradleDeployDetails(new DefaultPublishArtifact("groovy-all", "pom", "pom",
null,
-                        curDate, file("$projectDir/target/poms/pom-all.xml")), 'artifacts',
-                        "org/codehaus/groovy/groovy-all/${version}/groovy-all-${version}.pom"),
-                gradleDeployDetails(new DefaultPublishArtifact("groovy-all", "pom.asc", "pom.asc",
null,
-                        curDate, file("$projectDir/target/poms/pom-all.xml.asc")), 'artifacts',
-                        "org/codehaus/groovy/groovy-all/${version}/groovy-all-${version}.pom.asc"),
-                gradleDeployDetails(new DefaultPublishArtifact("groovy-binary", "zip", "zip",
null,
-                        curDate, distBin.archivePath), 'artifacts',
-                        "org/codehaus/groovy/groovy-binary/${version}/groovy-binary-${version}.zip"),
-                gradleDeployDetails(new DefaultPublishArtifact("groovy-binary", "zip.asc",
"zip.asc", null,
-                        curDate, new File(distBin.destinationDir, distBin.archiveName + '.asc')),
'artifacts',
-                        "org/codehaus/groovy/groovy-binary/${version}/groovy-binary-${version}.zip.asc"),
-                gradleDeployDetails(new DefaultPublishArtifact("groovy-binary", "pom", "pom",
null,
-                        curDate, file("$projectDir/target/poms/pom-binary.xml")), 'artifacts',
-                        "org/codehaus/groovy/groovy-binary/${version}/groovy-binary-${version}.pom"),
-                gradleDeployDetails(new DefaultPublishArtifact("groovy-binary", "pom.asc",
"pom.asc", null,
-                        curDate, file("$projectDir/target/poms/pom-binary.xml.asc")), 'artifacts',
-                        "org/codehaus/groovy/groovy-binary/${version}/groovy-binary-${version}.pom.asc"),
-
-        ]
-        tasks.withType(Jar).matching { it.name.startsWith('backport') }.all {
-            String baseDir = "org/codehaus/groovy/${baseName}/${version}"
-            additionalFiles << gradleDeployDetails(
-                    new DefaultPublishArtifact(baseName, "jar", "jar", classifier, curDate,
archivePath),
-                    'artifacts',
-                    "$baseDir/${archiveName}")
-            additionalFiles << gradleDeployDetails(
-                    new DefaultPublishArtifact(baseName, "jar.asc", "jar.asc", classifier,
curDate, new File(destinationDir, archiveName + '.asc')),
-                    'artifacts',
-                    "$baseDir/${archiveName}.asc")
-            if (!classifier) {
-                def pomLocation = "$projectDir/target/poms/pom-${baseName - 'groovy-'}.xml"
-                additionalFiles << gradleDeployDetails(
-                        new DefaultPublishArtifact(baseName, "pom", "pom", null, curDate,
file(pomLocation)),
-                        'artifacts',
-                        "$baseDir/${baseName}-${version}.pom")
-                additionalFiles << gradleDeployDetails(
-                        new DefaultPublishArtifact(baseName, "pom.asc", "pom.asc", null,
curDate, file(pomLocation + '.asc')),
-                        'artifacts',
-                        "$baseDir/${baseName}-${version}.pom.asc")
+        configurations.archives.artifacts.findAll{ it.name != project.name }.each {
+            // the plugin we are using uses the project name rather than the artifact name
+            // as the artifactId, so we add the transformed one ourselves
+            // this also covers signatures which we already added during install
+            deployDetails.add(makeTransformedDetails(it))
+            if (it.type == 'jar' && it.extension == 'jar' && !it.classifier)
{
+                // and the pom and its signature
+                deployDetails.add(makeTransformedPomDetails(it))
+                deployDetails.add(makeTransformedPomSigDetails(it))
             }
         }
+
         allprojects {
-            configurations.archives.artifacts.findAll{ it.name == project.name &&
it.type == 'jar' && it.extension == 'jar' }.each {
-                def pomLocation = "$project.projectDir/target/poms/pom-${project == rootProject
? 'groovy' : 'default'}.xml"
-                String baseDir = "org/codehaus/groovy/${it.name}/${version}"
-                additionalFiles << gradleDeployDetails(
-                        new DefaultPublishArtifact(it.name, "pom.asc", "pom.asc", null, curDate,
file(pomLocation + '.asc')),
-                        'artifacts',
-                        "$baseDir/${it.name}-${version}.pom.asc")
+            configurations.archives.artifacts.findAll{ it.name == project.name &&
it.type == 'jar' && it.extension == 'jar' && !it.classifier }.each {
+                // add pom signatures
+                def pomSigLocation = "$project.projectDir/target/poms/pom-${project == rootProject
? 'groovy' : 'default'}.xml.asc"
+                deployDetails.add(newDetails(it, file(pomSigLocation), 'pom.asc', 'pom'))
             }
         }
-        additionalFiles.each { deployDetails.add(it) }
     }
 }
 

http://git-wip-us.apache.org/repos/asf/groovy/blob/cf07fc0a/gradle/upload.gradle
----------------------------------------------------------------------
diff --git a/gradle/upload.gradle b/gradle/upload.gradle
index 8515d07..d99ad18 100644
--- a/gradle/upload.gradle
+++ b/gradle/upload.gradle
@@ -47,7 +47,7 @@ allprojects {
         signing.sign(c, f)
         project.artifacts.add('archives', new File(f.parent, f.name + '.asc')) {
             classifier = c
-            type = 'jar.asc'
+            type = 'asc'
             extension = 'jar.asc'
         }
     }
@@ -57,7 +57,7 @@ allprojects {
         project.artifacts.add('archives', new File(archiveTask.destinationDir, archiveTask.archiveName
+ '.asc')) {
             name = archiveTask.baseName
             classifier = archiveTask.classifier
-            type = archiveTask.extension + '.asc'
+            type = 'asc'
             extension = archiveTask.extension + '.asc'
         }
     }
@@ -109,6 +109,8 @@ allprojects {
 
     install {
         doFirst {
+            // gradle doesn't expect us to mutate configurations like we do here
+            // so signing the configuration won't work and we do it manually here
             signArchiveTask(jar)
             signArchiveTask(sourceJar)
             signArchiveTask(javadocJar)
@@ -125,7 +127,9 @@ allprojects {
     }
 }
 
-// the root project generates an alternate 'groovy-all' artifact
+// the root project generates several alternate artifacts, e.g. 'groovy-all'
+// we don't want them in the root project so add them as artifacts with a modified name
+// we'll exclude the original artifacts during publication with an exclude pattern
 [uploadArchives, install]*.with {
     dependsOn([sourceAllJar, javadocAllJar, groovydocAllJar, distBin, distDoc, dist, distBin])
     doFirst {
@@ -150,7 +154,12 @@ allprojects {
         signArchiveTask(groovydocAllJar)
 
         // TODO rework these?
-        signing.sign(distBin)
+        signing.sign(distBin.archivePath)
+        project.artifacts.add('archives', new File(distBin.destinationDir, distBin.archiveName
+ '.asc')) {
+            name = 'groovy-binary'
+            type = 'asc'
+            extension = 'zip.asc'
+        }
         signing.sign(distSrc.archivePath)
         signing.sign(distDoc.archivePath)
         signing.sign(dist.archivePath)
@@ -165,7 +174,8 @@ allprojects {
             project.artifacts.add('archives', new File(t.destinationDir, t.archiveName +
'.asc')) {
                 name = t.baseName
                 classifier = t.classifier
-                type = t.extension + '.asc'
+                type = 'asc'
+                extension = t.extension + '.asc'
             }
         }
 


Mime
View raw message