Skip to content

Conversation

@fmeum
Copy link
Member

@fmeum fmeum commented Jun 3, 2025

What type of PR is this?

Adapt to a Bazel breaking change

What does this PR do? Why is it needed?

The local_config_platform repo is no longer available with Bazel@HEAD, so the host constraints have to be loaded from @platforms//host.

Also prepare the BCR test repo for Bazel@HEAD with --incompatible_autoload_externally= by applying buildifier lint fixes.

Which issues(s) does this PR fix?

Other notes for review

The `local_config_platform` repo is no longer available with Bazel@HEAD.
@fmeum fmeum force-pushed the fix-local-config-platform branch from 44bc6fb to 91402a1 Compare June 8, 2025 07:16
@fmeum fmeum changed the title Replace @local_config_platform with @platforms//host Fix breakages with Bazel@HEAD and incompatible flags Jun 8, 2025
@fmeum fmeum requested review from jayconrod and linzhp June 8, 2025 07:27
@fmeum
Copy link
Member Author

fmeum commented Jun 8, 2025

FYI @jayconrod @linzhp I'm going to merge this now to unblock dependent projects, but please take a look and let me know what I should change in a follow-up PR.

@fmeum fmeum merged commit ae5ce49 into master Jun 8, 2025
4 checks passed
@fmeum fmeum deleted the fix-local-config-platform branch June 8, 2025 12:26
go_register_toolchains(version = "%[3]s")`, version, shasum, goVersion)
go_register_toolchains(version = "%[3]s")
# Create the host platform repository transitively required by rules_go.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Changing the boilerplate is a pretty substantial change that will cause friction for WORKSPACE users. Is there a way to roll this into go_rules_dependencies? I guess not if we need this host_platform_repo.

Copy link
Member Author

@fmeum fmeum Jun 9, 2025

Choose a reason for hiding this comment

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

I agree, but I don't see another way. We would need to add a new macro and at that point it's much more transparent to have the user instantiate the repo directly.

I would consider this the cost of staying with a pure WORKSPACE setup - if you get at least rules_go via Bzlmod, this is not an issue for you.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm, will this actually affect Bazel WORKSPACE users? If the Bazel authors indeed remove WORKSPACE support in 9, then WORKSPACE users will be on older versions, not affected by this change.

Maybe it's best to keep the boilerplate simple for them and disable the WORKSPACE-mode tests for newer versions of Bazel?

Copy link
Member Author

Choose a reason for hiding this comment

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

The change in go/private/rules/go_bin_for_host.bzl does affect WORKSPACE users as it requires the new repo to be defined. We could indirect the load through a repo rule of our own in which we dynamically generate this label based on the Bazel version.

But this is a dep of many other rulesets and users only have to call this once, so that additional complexity may very well not be worth it. It's not just the load after all, we would also need to make sure that stardoc deps are declared correctly for each variant.

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.

3 participants