Skip to content
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

refactor: rework toolchain registration for WORKSPACE and bzlmod users #597

Merged
merged 1 commit into from
Oct 10, 2023

Conversation

kormide
Copy link
Collaborator

@kormide kormide commented Oct 8, 2023

Stop automatically registering all of the toolchains in bazel-lib for WORKSPACE users. Make it easier to override toolchain versions under bzlmod.

Closes #593.

Type of change

  • Refactor (a code change that neither fixes a bug or adds a new feature)

For changes visible to end-users

  • Breaking change (this change will force users to change their own code or config)
  • Relevant documentation has been updated
  • Suggested release notes are provided below:
  • BREAKING: Toolchains are no longer automatically registered for WORKSPACE users. Users must call the aspect_bazel_lib_register_toolchains macro or call the register_xyz_toolchain macros individually. See Release for snippets.
  • BREAKING: The host repository has been moved from the extension ext into a differed module extension named host.

Test plan

  • Covered by existing test cases
  • New test cases added
  • Manual testing; please provide instructions so we can reproduce:

@kormide kormide changed the base branch from main to 2.x October 8, 2023 02:26
@kormide kormide changed the title Issue 593 feat: stop autoregistering toolchains Oct 8, 2023
@kormide kormide force-pushed the issue-593 branch 3 times, most recently from 5f80dc5 to a9ff6ca Compare October 8, 2023 02:31
@kormide kormide changed the title feat: stop autoregistering toolchains refactor: stop autoregistering toolchains Oct 8, 2023
@kormide kormide marked this pull request as ready for review October 8, 2023 02:33
@kormide kormide force-pushed the issue-593 branch 10 times, most recently from 61b5ff2 to 1366976 Compare October 8, 2023 03:23
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.

I don't think we need to completely stop registering toolchains. Our goal is just to make sure that users don't download unnecessary binaries, and are able to override our toolchain with whatever one they choose, right?

https://github.com/bazelbuild/rules_go/blob/master/docs/go/core/bzlmod.md#registering-go-sdks suggests we should be able to see how they avoid registration taking precedence over users.

@kormide kormide force-pushed the issue-593 branch 3 times, most recently from 72f09bf to 34d9117 Compare October 10, 2023 00:44
@kormide
Copy link
Collaborator Author

kormide commented Oct 10, 2023

Updated. Under bzlmod, continue autoregistering toolchains as this does not interfere with the ability for someone to override a toolchain in the root module (see https://bazelbuild.slack.com/archives/C014RARENH0/p1696893626545609). Toolchains can be selectively overridden at different versions.

For WORKSPACE users, added an aspect_bazel_lib_register_toolchains macro which can be used to perform all of the registration. Users can optionally register them selectively with the individual toolchain macros.

Made extension_utils private while we work out its utility.

@kormide kormide force-pushed the issue-593 branch 2 times, most recently from 7db1f57 to e85d62f Compare October 10, 2023 00:53
@kormide kormide changed the title refactor: stop autoregistering toolchains refactor: rework toolchain registration for WORKSPACE and bzlmod users Oct 10, 2023
docs/repositories.md Outdated Show resolved Hide resolved
@kormide kormide merged commit 20f1ac3 into bazel-contrib:2.x Oct 10, 2023
23 checks passed
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.0: Refactor toolchain registration
2 participants