@@ -105,25 +105,25 @@ export TMPDIR="$TEST_TMPDIR"
105105export RUST_BACKTRACE=1
106106# We're building once, so there's no need to incur the overhead of an incremental build.
107107export CARGO_INCREMENTAL=0
108- # This allows us to build with unstable options, which gives us access to some
109- # timing information.
110- #
111- # If we remove "--timings=json" below, this would no longer be needed.
108+ # This allows us to use -Zbuild-analysis to collect per-crate build timing
109+ # data in JSONL format.
112110export RUSTC_BOOTSTRAP=1
113111
114112# Build all the packages and tests, and keep track of how long each took to build.
115- # We report build progress to stderr, and the "--timings=json" output goes to stdout.
116113#
117114# The build graph ends up building several bin/test targets that depend on
118115# omicron-nexus at the same time, which uses significant memory to compile on
119116# illumos. To mitigate this we build everything except omicron-nexus's bin/test
120117# targets first, then finish the build after.
121- ptime -m cargo build -Z unstable-options --timings=json \
122- --workspace --exclude=omicron-nexus --tests --locked --verbose \
123- 1>> " $OUTPUT_DIR /crate-build-timings.json"
124- ptime -m cargo build -Z unstable-options --timings=json \
125- --workspace --tests --locked --verbose \
126- 1>> " $OUTPUT_DIR /crate-build-timings.json"
118+ #
119+ # Both invocations use the same flags to avoid cache invalidation.
120+ # We collect timing data only from the second (full workspace) build.
121+ ptime -m cargo --config ' build.analysis.enabled=true' build -Zbuild-analysis \
122+ --workspace --exclude=omicron-nexus --tests --locked --verbose
123+ ptime -m cargo --config ' build.analysis.enabled=true' build -Zbuild-analysis \
124+ --workspace --tests --locked --verbose
125+ cp " $( ls -t " ${CARGO_HOME:- $HOME / .cargo} /log/" * .jsonl | head -1) " \
126+ " $OUTPUT_DIR /cargo-build-analysis.jsonl"
127127
128128#
129129# We apply our own timeout to ensure that we get a normal failure on timeout
0 commit comments