bazelbuild/bazel

incompatible_disable_starlark_host_transitions

gregestren opened this issue · 9 comments

Change:

--incompatible_disable_starlark_host_transitions makes this Starlark syntax illegal:

cfg = "host"

Instead use:

cfg = "exec"

Rationale:

Rules can't be configured for the host configuration, which is the machine Bazel rules on. They must be configured for the exec configuration, which is the machine that runs builds actions. Sometimes these are the same (local builds), but not always (remote execution builds). exec correctly captures these differences.

Even with this flag disabled, cfg = "host" is an alias for cfg = "exec". So this is a no-op beyond the syntax cleanup.

Expected error for unmigrated code:

Error in label: 'cfg = "host"' is deprecated and should no longer be used. Please use 'cfg = "exec"' instead.

Early evidence is this breaks Bazel's own tests: //src/test/shell/bazel:bazel_bootstrap_distfile_test fails because of a grpc repo dependency with cfg="host".

For tracking:

Failures: https://buildkite.com/bazel/bazelisk-plus-incompatible-flags/builds/1365

image

To fix:

I think this breaks rules_docker too, could you add that to the tests on buildkite?

@mostynb Unfortunately, rules_docker still uses Bazel 4.0.0, and is disabled in the Bazel's downstream pipeline due to bazelbuild/rules_docker#1988. You'll need to fix that one before we can add rules_docker back to Bazel's downstream

shahms commented

As of Bazel 6.2, this flag remains almost entirely unusable as the included version of rules_license still specifies cfg = "host" and that will be triggered by any use of http_archive, which is likely to cover most repositories at this point.

aiuto commented
aiuto commented

Yeech. Bazel at head and 6.x is using rules_license 0.0.3. I'll have 0.0.5 out later this week. We can upgrade both to that.