Skip to content

Apache Lucene open-source search software

LUCENE-9488 Assemble source tar, with checksum and signing (#353)

Jan Høydahl5cd0d68a06c3
diff --git a/lucene/packaging/build.gradle b/lucene/packaging/build.gradle
index e2698ad4744..343bfae5c55 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
}