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

apple_common may only be used from one of the following repositories or prefixes error in rules_swift #24375

Closed
brentleyjones opened this issue Nov 18, 2024 · 8 comments
Assignees
Labels
P1 I'll work on this now. (Assignee required) team-Rules-API API for writing rules/aspects: providers, runfiles, actions, artifacts type: bug

Comments

@brentleyjones
Copy link
Contributor

Description of the bug:

https://buildkite.com/bazel/rules-swift-swift/builds/5879#01934108-e472-404d-9ee5-8bf41061f175/1476-1494

(20:49:14) ERROR: /workdir/swift/swift_compiler_plugin.bzl:303:51: apple_common may only be used from one of the following repositories or prefixes: @@_builtins//, @@apple_support//, @@bazel_tools//, @@local_config_cc//, @@rules_apple//, @@rules_cc//, @@rules_go//, @@rules_ios//, @@rules_swift//, @@stardoc//, @@tulsi//, test_starlark, tools/osx

But this is rules_swift. Is it because we have repo_name = "build_bazel_rules_swift" set in MODULE.bazel? If so, that's should be supported.

Which category does this issue belong to?

No response

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

No response

Which operating system are you running Bazel on?

No response

What is the output of bazel info release?

89c634f

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse HEAD ?

No response

If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

@brentleyjones
Copy link
Contributor Author

Because of b406bdc.

@fmeum
Copy link
Collaborator

fmeum commented Nov 18, 2024

@pzembrod

@Wyverald
Copy link
Member

Ironically, I think this wouldn't break if rules_swift is being used as a dependency. In your report, rules_swift is your root module, so its repo name is just the empty string. But if rules_swift is a dependency, its repo name would be rules_swift+, which does match one of the regexes (.*\brules_swift\b.*).

@brentleyjones
Copy link
Contributor Author

@bazel-io flag

@bazel-io bazel-io added the potential release blocker Flagged by community members using "@bazel-io flag". Should be added to a release blocker milestone label Nov 19, 2024
@iancha1992
Copy link
Member

@bazel-io fork 8.0.0

@bazel-io bazel-io removed the potential release blocker Flagged by community members using "@bazel-io flag". Should be added to a release blocker milestone label Nov 19, 2024
@Wyverald Wyverald added P1 I'll work on this now. (Assignee required) team-Rules-API API for writing rules/aspects: providers, runfiles, actions, artifacts and removed untriaged labels Nov 19, 2024
@Wyverald Wyverald assigned pzembrod and unassigned iancha1992 and satyanandak Nov 19, 2024
@Wyverald
Copy link
Member

This is breaking rules_android too (because of rules_go). cc @ahumesky @comius

@ahumesky
Copy link
Contributor

Yes also seeing this from rules_android with 8.0.0 release branch at 62493bd:

ERROR: .../.cache/bazel/_bazel_ahumesky/cb1fcf0b7315e9ad5d7a5ab005ad9fdb/external/io_bazel_rules_go/go/platform/apple.bzl:16:25: apple_common may only be used from one of the following repositories or prefixes: @@_builtins//, @@apple_support//, @@bazel_tools//, @@local_config_cc//, @@rules_apple//, @@rules_cc//, @@rules_go//, @@rules_ios//, @@rules_swift//, @@stardoc//, @@tulsi//, test_starlark, tools/osx

rules_go refers to itself as io_bazel_rules_go e.g. here:
https://github.com/bazel-contrib/rules_go/blob/63b0dcb1ebf8678997fea7a6b253214aa4a9f447/go/private/go_toolchain.bzl#L210-L222

copybara-service bot pushed a commit that referenced this issue Nov 20, 2024
*** Reason for rollback ***

This breaks rules_go and rules_swift because they refer to themselves by alias depot names: #24375

*** Original change description ***

In AppleBootstrap.java give several rule repos access to apple_common that need it, and activate the access restriction independent of INCOMPATIBLE_STOP_EXPORTING_LANGUAGE_MODULES

PiperOrigin-RevId: 698310431
Change-Id: I88973163cadca29021af9575d410fcae1eb6c066
pzembrod added a commit to pzembrod/bazel that referenced this issue Nov 20, 2024
*** Reason for rollback ***

This breaks rules_go and rules_swift because they refer to themselves by alias depot names: bazelbuild#24375

*** Original change description ***

In AppleBootstrap.java give several rule repos access to apple_common that need it, and activate the access restriction independent of INCOMPATIBLE_STOP_EXPORTING_LANGUAGE_MODULES

PiperOrigin-RevId: 698310431
Change-Id: I88973163cadca29021af9575d410fcae1eb6c066

# Conflicts:
#	src/test/java/com/google/devtools/build/lib/rules/objc/ObjcStarlarkTest.java
github-merge-queue bot pushed a commit that referenced this issue Nov 20, 2024
*** Reason for rollback ***

This breaks rules_go and rules_swift because they refer to themselves by
alias depot names: #24375

*** Original change description ***

In AppleBootstrap.java give several rule repos access to apple_common
that need it, and activate the access restriction independent of
INCOMPATIBLE_STOP_EXPORTING_LANGUAGE_MODULES

PiperOrigin-RevId: 698310431
Change-Id: I88973163cadca29021af9575d410fcae1eb6c066

Rollback of #24360 on
release-8.0.0
copybara-service bot pushed a commit that referenced this issue Nov 22, 2024
*** Reason for rollback ***

Roll forward with limited, safer scope:
- continue to observe the default-off flag INCOMPATIBLE_STOP_EXPORTING_LANGUAGE_MODULES even for Bazel so by default the allow list isn't relevant
- but update the allow list which repos need access to apple_common, incl. lessons from  #24375
- and adapt ObjcRulesTests to use the test_starlark/ path so the tests should pass even with INCOMPATIBLE_STOP_EXPORTING_LANGUAGE_MODULES set to true

*** Original change description ***

Automated rollback of commit b406bdc.

*** Reason for rollback ***

This breaks rules_go and rules_swift because they refer to themselves by alias depot names: #24375

*** Original change description ***

In AppleBootstrap.java give several rule repos access to apple_common that need it, and activate the access restriction independent of INCOMPATIBLE_STOP_EXPORTING_LANGUAGE_MODULES

PiperOrigin-RevId: 699105907
Change-Id: Ic36cc95182c6b4c0c95aa23db98ebd11864e9f1f
@iancha1992
Copy link
Member

A fix for this issue has been included in Bazel 8.0.0 RC3. Please test out the release candidate and report any issues as soon as possible.
If you're using Bazelisk, you can point to the latest RC by setting USE_BAZEL_VERSION=8.0.0rc3. Thanks!

Wyverald pushed a commit that referenced this issue Nov 27, 2024
*** Reason for rollback ***

This breaks rules_go and rules_swift because they refer to themselves by alias depot names: #24375

*** Original change description ***

In AppleBootstrap.java give several rule repos access to apple_common that need it, and activate the access restriction independent of INCOMPATIBLE_STOP_EXPORTING_LANGUAGE_MODULES

PiperOrigin-RevId: 698310431
Change-Id: I88973163cadca29021af9575d410fcae1eb6c066
meteorcloudy pushed a commit to meteorcloudy/bazel that referenced this issue Dec 6, 2024
*** Reason for rollback ***

Roll forward with limited, safer scope:
- continue to observe the default-off flag INCOMPATIBLE_STOP_EXPORTING_LANGUAGE_MODULES even for Bazel so by default the allow list isn't relevant
- but update the allow list which repos need access to apple_common, incl. lessons from  bazelbuild#24375
- and adapt ObjcRulesTests to use the test_starlark/ path so the tests should pass even with INCOMPATIBLE_STOP_EXPORTING_LANGUAGE_MODULES set to true

*** Original change description ***

Automated rollback of commit b406bdc.

*** Reason for rollback ***

This breaks rules_go and rules_swift because they refer to themselves by alias depot names: bazelbuild#24375

*** Original change description ***

In AppleBootstrap.java give several rule repos access to apple_common that need it, and activate the access restriction independent of INCOMPATIBLE_STOP_EXPORTING_LANGUAGE_MODULES

PiperOrigin-RevId: 699105907
Change-Id: Ic36cc95182c6b4c0c95aa23db98ebd11864e9f1f
ramil-bitrise pushed a commit to bitrise-io/bazel that referenced this issue Dec 18, 2024
*** Reason for rollback ***

This breaks rules_go and rules_swift because they refer to themselves by alias depot names: bazelbuild#24375

*** Original change description ***

In AppleBootstrap.java give several rule repos access to apple_common that need it, and activate the access restriction independent of INCOMPATIBLE_STOP_EXPORTING_LANGUAGE_MODULES

PiperOrigin-RevId: 698310431
Change-Id: I88973163cadca29021af9575d410fcae1eb6c066
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 I'll work on this now. (Assignee required) team-Rules-API API for writing rules/aspects: providers, runfiles, actions, artifacts type: bug
Projects
None yet
Development

No branches or pull requests

8 participants