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

Forcibly use the bundled version of @platforms for loading the host platform repo rule #21902

Closed
wants to merge 2 commits into from

Conversation

Wyverald
Copy link
Member

@Wyverald Wyverald commented Apr 4, 2024

#21877 happened because, even though we define @platforms to be the bundled version shipped with Bazel (which is 0.0.9 on HEAD), people tend to define their own versions of @platforms in WORKSPACE. If this ends up being a lower version (very likely), the subsequent load to use the host_platform_repo repo rule (which is a Starlark version of local_config_platform) will fail because that repo rule was only introduced in platforms version 0.0.9.

To resolve this conundrum, we define a new repo @internal_platforms_do_not_use that also points to the bundled version of @platforms. Nobody is likely to define this repo, so we can fairly reliably get the Starlark repo rule, and also still allow people to override the actual @platforms targets they use.

This only affects WORKSPACE users; if --enable_bzlmod is set, the @host_platform seen by @bazel_tools will come from the module extension instead.

Work towards #18285.

Fixes #21877.

… platform repo rule

#21877 happened because, even though we define `@platforms` to be the bundled version shipped with Bazel (which is 0.0.9 on HEAD), people tend to define their own versions of `@platforms` in WORKSPACE. If this ends up being a lower version (very likely), the subsequent `load` to use the `host_platform_repo` repo rule (which is a Starlark version of `local_config_platform`) will fail because that repo rule was only introduced in `platforms` version 0.0.9.

To solve this conundrum, we define a new repo `@internal_platforms_do_not_use` that _also_ points to the bundled version of `@platforms`. Nobody is likely to define this repo, so we can fairly reliably get the Starlark repo rule, and also still allow people to override the actual `@platforms` targets they use.

Work towards #18285.

Fixes #21877.
@Wyverald Wyverald requested a review from fmeum April 4, 2024 20:32
@github-actions github-actions bot added team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. awaiting-review PR is awaiting review from an assigned reviewer labels Apr 4, 2024
Copy link
Collaborator

@fmeum fmeum left a comment

Choose a reason for hiding this comment

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

Nice trick! I don't see any issues with it.

@Wyverald Wyverald requested a review from a team as a code owner April 4, 2024 20:52
@Wyverald Wyverald requested review from katre and removed request for a team April 4, 2024 20:52
@Wyverald Wyverald added awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally and removed awaiting-review PR is awaiting review from an assigned reviewer labels Apr 4, 2024
Copy link
Member

@katre katre left a comment

Choose a reason for hiding this comment

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

Is this intended as a short-term stopgap (which will be removed), or as a permanent change?

If the former, add a TODO about when it can be removed.

@Wyverald
Copy link
Member Author

Wyverald commented Apr 5, 2024

This is "permanent" as in "until WORKSPACE is removed".

@copybara-service copybara-service bot closed this in 77469e0 Apr 5, 2024
@Wyverald Wyverald deleted the wyv-local-config-platform-workspace branch April 5, 2024 19:18
fweikert pushed a commit to fweikert/bazel that referenced this pull request Apr 8, 2024
… platform repo rule

bazelbuild#21877 happened because, even though we define `@platforms` to be the bundled version shipped with Bazel (which is 0.0.9 on HEAD), people tend to define their own versions of `@platforms` in WORKSPACE. If this ends up being a lower version (very likely), the subsequent `load` to use the `host_platform_repo` repo rule (which is a Starlark version of `local_config_platform`) will fail because that repo rule was only introduced in `platforms` version 0.0.9.

To resolve this conundrum, we define a new repo `@internal_platforms_do_not_use` that _also_ points to the bundled version of `@platforms`. Nobody is likely to define this repo, so we can fairly reliably get the Starlark repo rule, and also still allow people to override the actual `@platforms` targets they use.

This only affects WORKSPACE users; if `--enable_bzlmod` is set, the `@host_platform` seen by `@bazel_tools` will come from the module extension instead.

Work towards bazelbuild#18285.

Fixes bazelbuild#21877.

Closes bazelbuild#21902.

PiperOrigin-RevId: 622238362
Change-Id: I6335ab1bc26ba9ef54473d8a21fc5a8510a3ace5
Wyverald added a commit that referenced this pull request Apr 25, 2024
… platform repo rule

#21877 happened because, even though we define `@platforms` to be the bundled version shipped with Bazel (which is 0.0.9 on HEAD), people tend to define their own versions of `@platforms` in WORKSPACE. If this ends up being a lower version (very likely), the subsequent `load` to use the `host_platform_repo` repo rule (which is a Starlark version of `local_config_platform`) will fail because that repo rule was only introduced in `platforms` version 0.0.9.

To resolve this conundrum, we define a new repo `@internal_platforms_do_not_use` that _also_ points to the bundled version of `@platforms`. Nobody is likely to define this repo, so we can fairly reliably get the Starlark repo rule, and also still allow people to override the actual `@platforms` targets they use.

This only affects WORKSPACE users; if `--enable_bzlmod` is set, the `@host_platform` seen by `@bazel_tools` will come from the module extension instead.

Work towards #18285.

Fixes #21877.

Closes #21902.

PiperOrigin-RevId: 622238362
Change-Id: I6335ab1bc26ba9ef54473d8a21fc5a8510a3ace5
@sgowroji sgowroji removed the awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally label Apr 26, 2024
Wyverald added a commit that referenced this pull request Apr 29, 2024
… platform repo rule

#21877 happened because, even though we define `@platforms` to be the bundled version shipped with Bazel (which is 0.0.9 on HEAD), people tend to define their own versions of `@platforms` in WORKSPACE. If this ends up being a lower version (very likely), the subsequent `load` to use the `host_platform_repo` repo rule (which is a Starlark version of `local_config_platform`) will fail because that repo rule was only introduced in `platforms` version 0.0.9.

To resolve this conundrum, we define a new repo `@internal_platforms_do_not_use` that _also_ points to the bundled version of `@platforms`. Nobody is likely to define this repo, so we can fairly reliably get the Starlark repo rule, and also still allow people to override the actual `@platforms` targets they use.

This only affects WORKSPACE users; if `--enable_bzlmod` is set, the `@host_platform` seen by `@bazel_tools` will come from the module extension instead.

Work towards #18285.

Fixes #21877.

Closes #21902.

PiperOrigin-RevId: 622238362
Change-Id: I6335ab1bc26ba9ef54473d8a21fc5a8510a3ace5
Wyverald added a commit that referenced this pull request Apr 30, 2024
… platform repo rule

#21877 happened because, even though we define `@platforms` to be the bundled version shipped with Bazel (which is 0.0.9 on HEAD), people tend to define their own versions of `@platforms` in WORKSPACE. If this ends up being a lower version (very likely), the subsequent `load` to use the `host_platform_repo` repo rule (which is a Starlark version of `local_config_platform`) will fail because that repo rule was only introduced in `platforms` version 0.0.9.

To resolve this conundrum, we define a new repo `@internal_platforms_do_not_use` that _also_ points to the bundled version of `@platforms`. Nobody is likely to define this repo, so we can fairly reliably get the Starlark repo rule, and also still allow people to override the actual `@platforms` targets they use.

This only affects WORKSPACE users; if `--enable_bzlmod` is set, the `@host_platform` seen by `@bazel_tools` will come from the module extension instead.

Work towards #18285.

Fixes #21877.

Closes #21902.

PiperOrigin-RevId: 622238362
Change-Id: I6335ab1bc26ba9ef54473d8a21fc5a8510a3ace5
Kila2 pushed a commit to Kila2/bazel that referenced this pull request May 13, 2024
… platform repo rule

bazelbuild#21877 happened because, even though we define `@platforms` to be the bundled version shipped with Bazel (which is 0.0.9 on HEAD), people tend to define their own versions of `@platforms` in WORKSPACE. If this ends up being a lower version (very likely), the subsequent `load` to use the `host_platform_repo` repo rule (which is a Starlark version of `local_config_platform`) will fail because that repo rule was only introduced in `platforms` version 0.0.9.

To resolve this conundrum, we define a new repo `@internal_platforms_do_not_use` that _also_ points to the bundled version of `@platforms`. Nobody is likely to define this repo, so we can fairly reliably get the Starlark repo rule, and also still allow people to override the actual `@platforms` targets they use.

This only affects WORKSPACE users; if `--enable_bzlmod` is set, the `@host_platform` seen by `@bazel_tools` will come from the module extension instead.

Work towards bazelbuild#18285.

Fixes bazelbuild#21877.

Closes bazelbuild#21902.

PiperOrigin-RevId: 622238362
Change-Id: I6335ab1bc26ba9ef54473d8a21fc5a8510a3ace5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bazel CI] Error with Label '@@platforms//host:extension.bzl' is invalid because 'host' is not a package
4 participants