bazelbuild / bazel

a fast, scalable, multi-language and extensible build system
https://bazel.build
Apache License 2.0
23.3k stars 4.09k forks source link

incompatible_disable_starlark_host_transitions #17032

Open gregestren opened 1 year ago

gregestren commented 1 year ago

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.
gregestren commented 1 year ago

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".

meteorcloudy commented 1 year ago

Testing this flag at https://buildkite.com/bazel/bazelisk-plus-incompatible-flags/builds/1365#_

keertk commented 1 year ago

For tracking:

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

image

To fix:

mostynb commented 1 year ago

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

meteorcloudy commented 1 year ago

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

shahms commented 1 year ago

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.

meteorcloudy commented 1 year ago

/cc @aiuto

aiuto commented 1 year ago

Not near desk right now, but it sounds like we've got to upgrade a basal 62X release to a fresher rooms license. I'll take a look at that later this week.

On Mon, May 15, 2023, 12:11 PM Yun Peng @.***> wrote:

/cc @aiuto https://github.com/aiuto

— Reply to this email directly, view it on GitHub https://github.com/bazelbuild/bazel/issues/17032#issuecomment-1548154932, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXHHHEG3XU42SLKXB6OJR3XGJIU5ANCNFSM6AAAAAAS7BEDJE . You are receiving this because you were mentioned.Message ID: @.***>

aiuto commented 1 year ago

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.