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

Bzlmod prerequisites #1885

Merged
merged 5 commits into from
Apr 3, 2023
Merged

Bzlmod prerequisites #1885

merged 5 commits into from
Apr 3, 2023

Conversation

ylecornec
Copy link
Member

@ylecornec ylecornec commented Mar 31, 2023

This PR contains some changes in preparation for bzlmod support.

Repository rules

Under bzlmod repository rules cannot register toolchains (this has to be done in the MODULE.bazel file). So some of them are updated with an extra register parameter to optionally disable the registration.

Workspace names

Under bzlmod folders for external repositories have a different (mangled) name. So these changes were needed:

  • In the following directive from rules_python.python.runfiles import runfiles, the rules_python prefix corresponds to the repository folder which can now have a different name. But the python module can be accessed directly (See rules_python example)

  • These mangled repository names includes tilde symbols so this case was added to the _zencode function.

  • The platform_of_constraints function was comparing stringified labels which contain these non predictable workspace names. So it was modified to only use label names.

With bzlmod workspace_root can now contain tilde symbols
With bzlmod, stringified labels contain non predictable workspace names. Here is should be fine to ignore  the workspace name for `os` and `cpu` constraints (which should always be `@platform`) and rely only on the name of the label.
The rules_python prefix corresponds to the folder of the external repository which can change with bzlmod.
@ylecornec ylecornec force-pushed the ylecornec/prepare_bzlmod branch from c8f39d8 to 8373615 Compare March 31, 2023 13:51
@ylecornec ylecornec marked this pull request as ready for review April 3, 2023 06:27
@ylecornec ylecornec requested a review from avdv as a code owner April 3, 2023 06:27
@ylecornec ylecornec mentioned this pull request Apr 3, 2023
14 tasks
Copy link
Member

@avdv avdv left a comment

Choose a reason for hiding this comment

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

Thank you!

@ylecornec ylecornec added the merge-queue merge on green CI label Apr 3, 2023
@mergify mergify bot merged commit 2da6a31 into master Apr 3, 2023
@mergify mergify bot deleted the ylecornec/prepare_bzlmod branch April 3, 2023 12:39
@mergify mergify bot removed the merge-queue merge on green CI label Apr 3, 2023
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