Skip to content

refactor: Minor compatibility fixes #1044

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

EdSchouten
Copy link

I am writing an experimental analysis tool that is capable of parsing BUILD/.bzl files. In the process I ran into some minor issues processing some of the code in bazel-lib. In many cases I obviously fixed up my tool, but I was left with some breakages where I think it makes sense to alter bazel-lib instead, because the Bazel documentation indicates that the feature at hand is deprecated. Merging such changes prevent potential breakages in the future.

According to the Bazel documentation, this option has already been
deprecated for quite a long time. It already defaults to True.
Ever since Bazel 7.2, the officially documented method for accessing the
host constraints is to load @platforms//host:constraints.bzl.

More details:

https://bazel.build/extending/platforms#specifying-build-platform
https://bazel.build/concepts/platforms#default-platforms
Ever since bzlmod, @// has lost any official meaning:

https://bazel.build/concepts/labels

Bazel still seems to allow it, but given the fact that this format is no longer
documented we should stop using it. In this specific case it also doesn't
matter. As long as we provide a label that is valid.
@EdSchouten EdSchouten changed the title Minor compatibility fixes refactor: Minor compatibility fixes Feb 5, 2025
@EdSchouten
Copy link
Author

Friendly ping!

Copy link
Collaborator

@alexeagle alexeagle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@alexeagle
Copy link
Collaborator

Hm, we still support Bazel 6 in bazel-lib 2.x, and CI failure there is

ERROR: /home/runner/work/bazel-lib/bazel-lib/e2e/smoke/BUILD.bazel:97:10: While resolving toolchains for target //:bats: invalid registered toolchain '@bsd_tar_toolchains//:darwin_amd64_toolchain': error loading package '@bsd_tar_toolchains//': at /home/runner/.cache/bazel/_bazel_runner/68984a6c613740a8d824f7719855966f/external/platforms/host/constraints.bzl:1:6: Unable to find package for @host_platform//:constraints.bzl: The repository '@host_platform' could not be resolved: Repository '@host_platform' is not defined.

Maybe we still need @local_config_platform? Perhaps it can be conditional based on something in @bazel_features

@alexeagle
Copy link
Collaborator

@EdSchouten we're playing with https://github.com/google/triage-party today. It says I should ask you to merge - even though I should probably do the work myself :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants