-
Notifications
You must be signed in to change notification settings - Fork 2.9k
First steps towards build reproducibility #48869
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
c734864
4e1833f
f719476
33c9d5d
b815e6a
a519616
ab142a8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
package io.quarkus.deployment.pkg; | ||
|
||
import java.nio.file.Path; | ||
import java.time.Instant; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Optional; | ||
|
@@ -49,6 +50,13 @@ public interface PackageConfig { | |
*/ | ||
Optional<String> outputName(); | ||
|
||
/** | ||
* The timestamp used as a reference for generating the packages (e.g. for the creation timestamp of ZIP entries). | ||
* <p> | ||
* The approach is similar to what is done by the maven-jar-plugin with `project.build.outputTimestamp`. | ||
*/ | ||
Optional<Instant> outputTimestamp(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this similar to what I suggested before in this enhancement request (#41070)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we decide to go this way, it could be used to do what you were asking for. For now, the main reason for it is to make sure the Quarkus jars are generated reproducibly. |
||
|
||
/** | ||
* Setting this switch to {@code true} will cause Quarkus to write the transformed application bytecode | ||
* to the build tool's output directory. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,10 @@ static void walk(Path root, Path rootDir, Path walkDir, PathFilter pathFilter, M | |
PathVisitor visitor) { | ||
final PathTreeVisit visit = new PathTreeVisit(root, rootDir, pathFilter, multiReleaseMapping); | ||
try (Stream<Path> files = Files.walk(walkDir)) { | ||
final Iterator<Path> i = files.iterator(); | ||
final Iterator<Path> i = files | ||
// we sort the elements to be deterministic, we compare the toString() to make sure the order is the same on Linux and Windows | ||
.sorted((p1, p2) -> p1.toString().compareTo(p2.toString())) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this appear to be generally necessary or only in specific cases? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So it's probably only necessary in specific cases... but figuring out which cases is hard and when you had new use cases, people will have to think about it (and will forget). I think in general bringing a more deterministic behavior is nice. As for the specific comparator, it's the only way to get the same ordering on Linux and Windows. Now, maybe we shouldn't merge this PR for now and wait for the whole thing and then try to evaluate the cost of it? |
||
.iterator(); | ||
while (i.hasNext()) { | ||
if (!visit.setCurrent(i.next())) { | ||
continue; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if the user does not set the value? Is
project.build.outputTimestamp
propagated? I wonder if the JavaDoc should contain this kind of info.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yes, I can add a comment. You actually don't need to set it in the Maven case, I propagate
project.build.outputTimestamp
.As for Gradle, I'll see when I get a Maven build fully reproducible.