Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix builds for filegroup targets with incompatible dependencies
When building a `filegroup` with incompatible dependencies, the logic was such that the incompatible dependencies would actually be built by bazel. These dependencies only expose `FailAction`s so the build failed. This is caused by bazel skipping the incompatibility check for any rules that don't participate in toolchain resolution. For example, without the fix in `RuleContextConstraintSemantics.java`, the added unit test fails with: ERROR: /home/phil/.cache/bazel/_bazel_phil/b4868b516be4e3bea4d221937a55ced4/sandbox/linux-sandbox/46/execroot/io_bazel/_tmp/c749fd38ac9a4ad6bd41e9653bbceab5/workspace/target_skipping/BUILD:103:10: Reporting failed target //target_skipping:binary located at /home/phil/.cache/bazel/_bazel_phil/b4868b516be4e3bea4d221937a55ced4/sandbox/linux-sandbox/46/execroot/io_bazel/_tmp/c749fd38ac9a4ad6bd41e9653bbceab5/workspace/target_skipping/BUILD:103:10 failed: Can't build this. This target is incompatible. Please file a bug upstream. caused by //target_skipping:binary Target //target_skipping:filegroup failed to build This patch makes it so targets that don't use toolchain resolution skip the check for the `target_compatible_with` attribute, but still check for incompatible dependencies. Closes bazelbuild#12601. PiperOrigin-RevId: 345263391
- Loading branch information