You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bazel: validate foreign_cc outputs before the action exits (#1517)
When a foreign build's outputs are set up wrong, Bazel fails with an
opaque "output ... was not created" error. That skips the existing
foreign_cc failure path, so users lose both the build log and the usual
--sandbox_debug workflow.
Teach the generated build script to validate every expected installed
output before the action completes. Missing outputs now fail the
original action, print the build log, and keep the temp tree around for
postmortem debug.
The failure output looks something like:
```
_____ BEGIN OUTPUT VALIDATION _____
rules_foreign_cc: install root: /[...]/execroot/_main/bazel-out/k8-fastbuild/bin/test/output_validation/repro
rules_foreign_cc: validating expected installed outputs
rules_foreign_cc: missing expected installed output: lib/librepro.a
rules_foreign_cc: other files in the same directory (max 5):
rules_foreign_cc: librepro-renamed.a
rules_foreign_cc: other files in the install root with the same name (max 5):
rules_foreign_cc: wrong/librepro.a
rules_foreign_cc: missing expected installed output: lib/librepro_same_dir.a
rules_foreign_cc: other files in the same directory (max 5):
rules_foreign_cc: librepro-renamed.a
rules_foreign_cc: expected output validation failed
_____ END OUTPUT VALIDATION _____
```
Because it's awful to sit through an entire build just to have it fail,
then realize you didn't set --sandbox_debug and have to do the entire
build again to learn anything, it also performs two checks:
- what other files are in the same dir? (max 5)
- what other files are in the install tree with the same name? (max 5)
This makes it more likely you learn something from the failed build.
If this malfunctions for a specific target, you can disable it by
setting the attribute: `experimental_validate_outputs_in_action=False`.
It defaults to True.
0 commit comments