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

Consider moving resolved_toolchain into the "mylang" workspace #47

Closed
aherrmann opened this issue Feb 6, 2023 · 0 comments · Fixed by #48
Closed

Consider moving resolved_toolchain into the "mylang" workspace #47

aherrmann opened this issue Feb 6, 2023 · 0 comments · Fixed by #48

Comments

@aherrmann
Copy link
Member

The mylang_register_toolchains macro invokes toolchains_repo which generates a toolchain target for each platform as well as a resolved_toolchains target that acts as an alias for the currently resolved toolchain. This is intended as a workaround for bazelbuild/bazel#14009 to expose make variables to rules that want to directly depend on the "mylang" toolchain, e.g. genrule.

Because the resolved_toolchains target is generated as part of toolchains_repo users have to know and use the name given to that external workspace. E.g. in the example setup a user would have to use the label @mylang1_14_toolchains//:resolved_toolchain. This is problematic:

  • If the target is needed by a Bazel workspace other than the main workspace, that workspace has to either anticipate the name that the main workspace will assign to that toolchain repository, or import its own "mylang" toolchain which may conflict with that needed by the main workspace or another workspace.
  • If a project needs a custom toolchain and doesn't invoke mylang_register_toolchains or toolchains_repo at all, then there will be no resolved_toolchains target.

There is no reason why resolved_toolchains has to part of or linked to toolchains_repo or mylang_register_toolchain. I propose that resolved_toolchains should be defined in com_myorg_rules_mylang directly, instead.

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 a pull request may close this issue.

1 participant