You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ja...@apache.org on 2021/10/05 20:32:23 UTC

[lucene] branch main updated: LUCENE-9488 Assemble source tar, with checksum and signing (#353)

This is an automated email from the ASF dual-hosted git repository.

janhoy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene.git


The following commit(s) were added to refs/heads/main by this push:
     new 5cd0d68  LUCENE-9488 Assemble source tar, with checksum and signing (#353)
5cd0d68 is described below

commit 5cd0d68a06c32ea9787540a2d36db9f816ee3a2b
Author: Jan Høydahl <ja...@users.noreply.github.com>
AuthorDate: Tue Oct 5 22:30:45 2021 +0200

    LUCENE-9488 Assemble source tar, with checksum and signing (#353)
    
    Also see LUCENE-10152 for a future cleanup of this code
---
 lucene/packaging/build.gradle | 37 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 36 insertions(+), 1 deletion(-)

diff --git a/lucene/packaging/build.gradle b/lucene/packaging/build.gradle
index e2698ad..343bfae 100644
--- a/lucene/packaging/build.gradle
+++ b/lucene/packaging/build.gradle
@@ -179,7 +179,38 @@ artifacts {
   luceneZip(distZip)
 }
 
+// Source distribution using git export
+def sourceTarFile = file("build/distributions/lucene-${version}-src.tgz")
+import org.apache.commons.codec.digest.DigestUtils
 
+task assembleSourceDist() {
+    def target = sourceTarFile
+
+    outputs.files target
+
+    // TODO: This is copied from distribution.gradle - reuse?
+    def checksum = { file ->
+        String sha512 = new DigestUtils(DigestUtils.sha512Digest).digestAsHex(file).trim()
+        new File(file.parent, file.name + ".sha512").write(sha512 + "  " + file.name, "UTF-8")
+    }
+
+    doFirst {
+        quietExec {
+            executable = project.externalTool("git")
+            workingDir = project.rootDir
+
+            args += [
+                    "archive",
+                    "--format", "tgz",
+                    "--prefix", "lucene-${version}/",
+                    "--output", target,
+                    "HEAD"
+            ]
+        }
+        checksum(sourceTarFile)
+    }
+}
+assembleDist.dependsOn assembleSourceDist
 
 // NOTE: we don't use the convinence DSL of the 'signing' extension to define our 'Sign' tasks because
 // that (by default) adds our signature files to the 'archives' configuration -- which is what
@@ -213,8 +244,12 @@ task signDistZip(type: Sign) {
   dependsOn failUnlessGpgKeyProperty
   sign configurations.luceneZip
 }
+task signSourceDistTar(type: Sign) {
+    dependsOn failUnlessGpgKeyProperty, assembleSourceDist
+    sign sourceTarFile
+}
 task signDist {
   group = 'Distribution'
   description = 'GPG Signs the main distributions'
-  dependsOn signDistTar, signDistZip
+  dependsOn signDistTar, signDistZip, signSourceDistTar
 }