geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aba...@apache.org
Subject [03/15] incubator-geode git commit: GEODE-775: Add build support to easily sign release files
Date Sat, 06 Feb 2016 18:07:32 GMT
GEODE-775: Add build support to easily sign release files

Use the gradle signing plugin to sign jar artifacts and distributions.
This is only done for release versions (-SNAPSHOT).  Exclude KEYS and
signatures from the distributions.  Requires a user gradle file with
the following properties:

    signing.keyId=
    signing.password=
    signing.secretKeyRingFile=


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/5e8eed51
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/5e8eed51
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/5e8eed51

Branch: refs/heads/develop
Commit: 5e8eed518e97201e48754314a2bddb962dbda229
Parents: 010f5f6
Author: Anthony Baker <abaker@apache.org>
Authored: Tue Jan 12 08:42:06 2016 -0800
Committer: Anthony Baker <abaker@apache.org>
Committed: Tue Jan 12 13:15:37 2016 -0800

----------------------------------------------------------------------
 build.gradle                  | 12 ++++++++++++
 gemfire-assembly/build.gradle | 20 ++++++++++++++++++--
 2 files changed, 30 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/5e8eed51/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index 1f1077c..b9bd12f 100755
--- a/build.gradle
+++ b/build.gradle
@@ -37,6 +37,7 @@ dependencyVersions.keys().each{ k -> project.ext[k] = dependencyVersions[k]}
 
 allprojects {
   version = versionNumber + '.' + releaseType
+  ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
 
   // We want to see all test results.  This is equivalatent to setting --continue
   // on the command line.
@@ -110,6 +111,17 @@ gradle.taskGraph.whenReady({ graph ->
 
 subprojects {
   apply plugin: 'java'
+  apply plugin: 'signing'
+
+  // set these properties in ~/.gradle/gradle.properties file: 
+  // signing.keyId
+  // signing.password
+  // signing.secretKeyRingFile
+  if (isReleaseVersion) {
+    signing {
+      sign configurations.archives
+    }
+  }
 
   // apply compiler options
   gradle.taskGraph.whenReady( { graph ->

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/5e8eed51/gemfire-assembly/build.gradle
----------------------------------------------------------------------
diff --git a/gemfire-assembly/build.gradle b/gemfire-assembly/build.gradle
index 4c74513..54c33c6 100755
--- a/gemfire-assembly/build.gradle
+++ b/gemfire-assembly/build.gradle
@@ -14,6 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+import org.gradle.api.internal.artifacts.publish.ArchivePublishArtifact;
 
 buildscript {
     repositories {
@@ -30,11 +31,17 @@ apply plugin: 'maven-publish-auth'
 
 jar.enabled = false
 
-
 configurations {
   archives
 }
 
+// gradle doesn't automatically remove the jar artifact even though we disabled it
+// this causes the signing plugin to fail
+configurations.all {
+  artifacts.removeAll artifacts.findAll { it instanceof ArchivePublishArtifact &&
!it.archiveTask.enabled }
+}
+
+
 dependencies {
   provided project(':gemfire-core')
   
@@ -184,6 +191,13 @@ gradle.taskGraph.whenReady( { graph ->
     archive.doLast {
       ant.checksum file:"${archive.archivePath}", algorithm:"md5"
       ant.checksum file:"${archive.archivePath}", algorithm:"sha-256"
+
+      if (isReleaseVersion) {      
+        signing {
+          required { isReleaseVersion }
+          sign archive.archivePath
+        }
+      }
     }
   }
 })
@@ -193,6 +207,7 @@ distributions {
     baseName = 'apache-geode-src'
     contents {
       from (rootDir) {
+        exclude 'KEYS'
         exclude 'gradlew'
         exclude 'gradlew.bat'
         exclude 'gradle/wrapper/gradle-wrapper.jar'
@@ -216,6 +231,7 @@ distributions {
     baseName = 'apache-geode' //TODO rootProject.name
     contents {
       duplicatesStrategy 'exclude'
+      exclude '*.asc'
       
       into ('config') {
         from defaultCacheConfig
@@ -323,7 +339,7 @@ afterEvaluate {
   // the ones defined in root ASF pom
   publishing {
     repositories {
-      if (project.version.endsWith('-SNAPSHOT')) {
+      if (!isReleaseVersion) {
         // Apache Development Snapshot Repository
         maven {
           name "apache.snapshots.https"


Mime
View raw message