Skip to content

Commit e5583fd

Browse files
committed
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.
1 parent 091fe6f commit e5583fd

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
@@ -253,21 +253,3 @@ configurations.all {
253253
}
254254
}
255255
}
256-
257-
if (plugins.hasPlugin("io.quarkus")) {
258-
tasks.named("quarkusBuild") {
259-
actions.addLast {
260-
listOf(
261-
"quarkus-app/quarkus-run.jar",
262-
"quarkus-app/quarkus/generated-bytecode.jar",
263-
"quarkus-app/quarkus/transformed-bytecode.jar",
264-
)
265-
.forEach { name ->
266-
val file = project.layout.buildDirectory.get().file(name).asFile
267-
if (file.exists()) {
268-
makeZipReproducible(file)
269-
}
270-
}
271-
}
272-
}
273-
}

0 commit comments

Comments
 (0)