Skip to content

Commit baacb47

Browse files
authored
Build: remove code to post-process generated Quarkus jars (#2667)
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.
1 parent 359388e commit baacb47

File tree

2 files changed

+0
-61
lines changed

2 files changed

+0
-61
lines changed

build-logic/src/main/kotlin/Utilities.kt

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
import java.io.File
18-
import java.io.FileOutputStream
19-
import java.nio.file.attribute.FileTime
20-
import java.util.zip.ZipFile
21-
import java.util.zip.ZipOutputStream
2217
import org.gradle.api.Project
2318
import org.gradle.process.JavaForkOptions
2419

@@ -66,41 +61,3 @@ fun JavaForkOptions.addSparkJvmOptions() {
6661
"-Djdk.reflect.useDirectMethodHandle=false",
6762
)
6863
}
69-
70-
/**
71-
* Rewrites the given ZIP file.
72-
*
73-
* The timestamps of all entries are set to `1980-02-01 00:00`, zip entries appear in a
74-
* deterministic order.
75-
*/
76-
fun makeZipReproducible(source: File) {
77-
val t = FileTime.fromMillis(318211200_000) // 1980-02-01 00:00 GMT
78-
79-
val outFile = File(source.absolutePath + ".tmp.out")
80-
81-
val names = mutableListOf<String>()
82-
ZipFile(source).use { zip -> zip.stream().forEach { e -> names.add(e.name) } }
83-
names.sort()
84-
85-
ZipOutputStream(FileOutputStream(outFile)).use { dst ->
86-
ZipFile(source).use { zip ->
87-
names.forEach { n ->
88-
val e = zip.getEntry(n)
89-
zip.getInputStream(e).use { src ->
90-
e.setCreationTime(t)
91-
e.setLastAccessTime(t)
92-
e.setLastModifiedTime(t)
93-
dst.putNextEntry(e)
94-
src.copyTo(dst)
95-
dst.closeEntry()
96-
src.close()
97-
}
98-
}
99-
}
100-
}
101-
102-
val origFile = File(source.absolutePath + ".tmp.orig")
103-
source.renameTo(origFile)
104-
outFile.renameTo(source)
105-
origFile.delete()
106-
}

build-logic/src/main/kotlin/polaris-java.gradle.kts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -256,24 +256,6 @@ configurations.all {
256256
}
257257
}
258258

259-
if (plugins.hasPlugin("io.quarkus")) {
260-
tasks.named("quarkusBuild") {
261-
actions.addLast {
262-
listOf(
263-
"quarkus-app/quarkus-run.jar",
264-
"quarkus-app/quarkus/generated-bytecode.jar",
265-
"quarkus-app/quarkus/transformed-bytecode.jar",
266-
)
267-
.forEach { name ->
268-
val file = project.layout.buildDirectory.get().file(name).asFile
269-
if (file.exists()) {
270-
makeZipReproducible(file)
271-
}
272-
}
273-
}
274-
}
275-
}
276-
277259
gradle.sharedServices.registerIfAbsent(
278260
"intTestParallelismConstraint",
279261
TestingParallelismHelper::class.java,

0 commit comments

Comments
 (0)