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

bernardobotella pushed a commit to branch CASSANALYTICS-105-fix-dist-artifacts
in repository https://gitbox.apache.org/repos/asf/cassandra-analytics.git

commit fe734d99b620b94262753cfd28e38871def67bcf
Author: Bernardo Botella Corbi <[email protected]>
AuthorDate: Fri Nov 14 08:55:31 2025 -0800

    Fix gradle generated artifacts
---
 CHANGES.txt  |  1 +
 build.gradle | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 82 insertions(+), 3 deletions(-)

diff --git a/CHANGES.txt b/CHANGES.txt
index 1ea15c25..0f2bab39 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,5 +1,6 @@
 0.2.0
 -----
+ * Generated distribution artifacts fix (CASSANALYTICS-105)
  * Fix SSTable descriptor mismatch preventing newly produced SSTables from 
being uploaded (CASSANALYTICS-98)
  * Expose SidecarCdc builders and interfaces (CASSANALYTICS-94)
  * Fix bulk reader node availability comparator ordering (CASSANALYTICS-99)
diff --git a/build.gradle b/build.gradle
index c5839ac2..a11100fc 100644
--- a/build.gradle
+++ b/build.gradle
@@ -28,6 +28,7 @@ plugins {
   id 'com.github.johnrengelman.shadow' version '8.1.1'
 
   id 'distribution'
+  id 'signing'
 
   // Release Audit Tool (RAT) plugin for checking project licenses
   id("org.nosphere.apache.rat") version "0.8.1"
@@ -257,10 +258,21 @@ distributions {
   main {
     distributionBaseName = 'apache-cassandra-analytics'
     contents {
-      from 'LICENSE.txt'
-      setDuplicatesStrategy(DuplicatesStrategy.INCLUDE)
+      from('.') {
+        include 'LICENSE.txt'
+        include 'NOTICE.txt'
+        include 'CHANGES.txt'
+      }
+
+      // Include all project JARs in lib/ directory
+      into('lib') {
+        from subprojects.collect { it.tasks.withType(Jar) }
+      }
+
+      setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE)
     }
   }
+
   // Packages the sources as a tarball for distribution
   sources {
     distributionBaseName = 'apache-cassandra-analytics'
@@ -268,7 +280,11 @@ distributions {
     contents {
       from '.'
       include '**/*.*'
-      exclude '**.gradle/**'
+      include 'scripts/mvnw'
+      include 'gradlew'
+      include 'build.gradle'
+      exclude '**/.gradle/**'
+      exclude 'gradle/wrapper/gradle-wrapper.jar'
       exclude '**.idea/**'
       exclude 'bin/**'
       exclude 'dependencies/**'
@@ -338,3 +354,65 @@ ext {
                           && project.gradle.startParameter.taskNames.any { 
it.contains("upload") })
 
 }
+
+signing {
+    required { shouldSign }
+    if (shouldSign) {
+        useGpgCmd()
+    }
+    sign distZip
+    sign distTar
+    sign sourcesDistTar
+    sign sourcesDistZip
+}
+
+// Generate SHA-256 and SHA-512 checksums for distribution artifacts
+// Required for Apache releases
+tasks.register('generateDistributionChecksums') {
+    description = 'Generates SHA-256 and SHA-512 checksums for distribution 
artifacts'
+    group = 'distribution'
+
+    dependsOn distTar, distZip, sourcesDistTar, sourcesDistZip
+
+    doLast {
+        println "Generating checksums for distribution archives..."
+        [distTar, distZip, sourcesDistTar, sourcesDistZip].each { task ->
+            def archive = task.archiveFile.get().asFile
+
+            if (archive.exists()) {
+                // Generate SHA-256 checksum
+                def sha256File = new File("${archive}.sha256")
+                def sha256 = java.security.MessageDigest.getInstance("SHA-256")
+                archive.withInputStream { is ->
+                    def buffer = new byte[8192]
+                    int read
+                    while ((read = is.read(buffer)) != -1) {
+                        sha256.update(buffer, 0, read)
+                    }
+                }
+                sha256File.text = sha256.digest().encodeHex().toString() + "  
" + archive.name
+
+                // Generate SHA-512 checksum
+                def sha512File = new File("${archive}.sha512")
+                def sha512 = java.security.MessageDigest.getInstance("SHA-512")
+                archive.withInputStream { is ->
+                    def buffer = new byte[8192]
+                    int read
+                    while ((read = is.read(buffer)) != -1) {
+                        sha512.update(buffer, 0, read)
+                    }
+                }
+                sha512File.text = sha512.digest().encodeHex().toString() + "  
" + archive.name
+            } else {
+                println "  ✗ Archive not found: ${archive.absolutePath}"
+            }
+        }
+    }
+}
+
+distTar.finalizedBy generateDistributionChecksums
+distZip.finalizedBy generateDistributionChecksums
+sourcesDistTar.finalizedBy generateDistributionChecksums
+sourcesDistZip.finalizedBy generateDistributionChecksums
+assembleDist.finalizedBy generateDistributionChecksums
+assembleSourcesDist.finalizedBy generateDistributionChecksums


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to