From 6dfa99017fd89f81933122334b6f197e883c5b25 Mon Sep 17 00:00:00 2001 From: Robert Stupp Date: Wed, 24 Sep 2025 19:16:04 +0200 Subject: [PATCH] Build: remove code to post-process generated Quarkus jars Before Quarkus 3.28, the Quarkus generated jars used the "current" timestamp for all ZIP entries, which made the jars not-reproducible. Since Quarkus 3.28, the generated jars use a fixed timestamp for all ZIP entries, so the custom code is no longer necessary. This PR depends on Quarkus 3.28. --- build-logic/src/main/kotlin/Utilities.kt | 43 ------------------- .../src/main/kotlin/polaris-java.gradle.kts | 18 -------- 2 files changed, 61 deletions(-) diff --git a/build-logic/src/main/kotlin/Utilities.kt b/build-logic/src/main/kotlin/Utilities.kt index 05734d4cbe..f75ff5b3f8 100644 --- a/build-logic/src/main/kotlin/Utilities.kt +++ b/build-logic/src/main/kotlin/Utilities.kt @@ -14,11 +14,6 @@ * limitations under the License. */ -import java.io.File -import java.io.FileOutputStream -import java.nio.file.attribute.FileTime -import java.util.zip.ZipFile -import java.util.zip.ZipOutputStream import org.gradle.api.Project import org.gradle.process.JavaForkOptions @@ -66,41 +61,3 @@ fun JavaForkOptions.addSparkJvmOptions() { "-Djdk.reflect.useDirectMethodHandle=false", ) } - -/** - * Rewrites the given ZIP file. - * - * The timestamps of all entries are set to `1980-02-01 00:00`, zip entries appear in a - * deterministic order. - */ -fun makeZipReproducible(source: File) { - val t = FileTime.fromMillis(318211200_000) // 1980-02-01 00:00 GMT - - val outFile = File(source.absolutePath + ".tmp.out") - - val names = mutableListOf() - ZipFile(source).use { zip -> zip.stream().forEach { e -> names.add(e.name) } } - names.sort() - - ZipOutputStream(FileOutputStream(outFile)).use { dst -> - ZipFile(source).use { zip -> - names.forEach { n -> - val e = zip.getEntry(n) - zip.getInputStream(e).use { src -> - e.setCreationTime(t) - e.setLastAccessTime(t) - e.setLastModifiedTime(t) - dst.putNextEntry(e) - src.copyTo(dst) - dst.closeEntry() - src.close() - } - } - } - } - - val origFile = File(source.absolutePath + ".tmp.orig") - source.renameTo(origFile) - outFile.renameTo(source) - origFile.delete() -} diff --git a/build-logic/src/main/kotlin/polaris-java.gradle.kts b/build-logic/src/main/kotlin/polaris-java.gradle.kts index 40ad4ce1d1..f124b97d35 100644 --- a/build-logic/src/main/kotlin/polaris-java.gradle.kts +++ b/build-logic/src/main/kotlin/polaris-java.gradle.kts @@ -256,24 +256,6 @@ configurations.all { } } -if (plugins.hasPlugin("io.quarkus")) { - tasks.named("quarkusBuild") { - actions.addLast { - listOf( - "quarkus-app/quarkus-run.jar", - "quarkus-app/quarkus/generated-bytecode.jar", - "quarkus-app/quarkus/transformed-bytecode.jar", - ) - .forEach { name -> - val file = project.layout.buildDirectory.get().file(name).asFile - if (file.exists()) { - makeZipReproducible(file) - } - } - } - } -} - gradle.sharedServices.registerIfAbsent( "intTestParallelismConstraint", TestingParallelismHelper::class.java,