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.
Motivation
Cargo build caches build artifacts so that successive invocations won't rebuild the parts of the code that haven't changed. Currently our project is experiencing spurious rebuilds even when nothing has changed. This leads to slower development cycles.
On top of the spurious rebuilds, the build is also experience build non-determinism. Crate feature selection doesn't appear to be consistent across multiple successive builds under certain circumstances (e.g. when building more than a single package at a time). This is a problem because it means that we might be encountering bugs related to incorrect feature configuration. This also has the potential to mask bugs for the same reason.
In this PR
This PR addresses several of the issues causing spurious rebuilds and build non-determinism:
mc-util-build-enclave
emitsrerun-if-changed
directives based on files in the filesystem. However, currently the files aren't sorted, leading Cargo to think that the build inputs have changed, thus invoking a rebuild. This PR adds sorting to the file iteration so that they're always printed in the same order.--target
when invoking cargo.cargo test
with the default settings, where feature unification appears to be non-deterministic. A workaround for this is applied to CI, which is to add--tests
when callingcargo test
. Typically, when callingcargo test
with the default settings, cargo will build the project in a number of different ways (see https://doc.rust-lang.org/cargo/commands/cargo-test.html), and then test the tests. By specifying--tests
, Cargo is instructed to build only the tests, and then run them. This prevents feature configuration from other types of builds from being impacted by this bug and affecting the feature selection of the test build.Future Work
--target
and--tests
from the CircleCI configuration. MC-1731 has been created to track the status of this bug.