bazelbuild / bazel

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

`--incompatible_enable_deprecated_label_apis` #23144

Open Wyverald opened 1 month ago

Wyverald commented 1 month ago

Motivation

Several old Starlark APIs related to labels had confusing names and/or behavior. This change deprecates those old APIs in favor of new ones with clearer names and intent.

Description

When --incompatible_enable_deprecated_label_apis is set to False:

Incompatible Flag

--incompatible_enable_deprecated_label_apis

Migration Guide

The newer APIs are only available in 7.1.0+. If backwards compatibility is a concern, use hasattr().

In which Bazel LTS version will this incompatible change be enabled?

Bazel 8

Additional Context

No response

TODO List

fmeum commented 1 month ago

I would like to get rid of workspace_root as well, with a suitably named replacement. Otherwise we would still have mentions of workspace stick around that would require another flag migration to get rid of.

Wyverald commented 1 month ago

What's a good replacement? exec_root or some such?

fmeum commented 1 month ago

I would say repo_root or repo_path. I would prefer the latter as File#root returns a special starlark type, not a string.

fmeum commented 1 month ago

Also, aren't most incompatible flags set up so that they are flipped from off to on? I could see a "disable" version of this being a better fit for .bazelrc files.