build(libduckdb-sys): sort C++ source files for deterministic builds #583
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Summary
This PR modifies the build.rs script in the libduckdb-sys crate to ensure deterministic builds by sorting the C++ file paths before including them in the build process.
Closes #582.
Motivation
Currently, cpp_files is derived from a HashSet, which yields non-deterministic ordering. This causes builds to vary across runs, leading to non-reproducible binaries. The change directly addresses the “Unreproducible binaries due to cpp_files HashSet in build.rs” issue by introducing a structured ordering of file inclusions.
Implementation Details
Convert the cpp_files iterator into a Vec.
Apply .sort() to that vector to enforce a consistent ordering.
Iterate over the sorted vector to invoke cfg.file(...) on each entry.
Test Results (Unchanged from Before)
These two tests continue to fail—they were failing prior to this PR and remain unrelated to its intent:
These errors are caused by a Binder Error—specifically stating that the column "varint" in the list was not found in the FROM clause—and are unrelated to the sorted C++ files.