bazelbuild / bazel

a fast, scalable, multi-language and extensible build system
https://bazel.build
Apache License 2.0
23.25k stars 4.08k forks source link

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

Open brentleyjones opened 3 hours ago

brentleyjones commented 3 hours ago

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?

89c634ff601a367b9f55a90868f13c35fbe57d61

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 commented 2 hours ago

Because of https://github.com/bazelbuild/bazel/commit/b406bdcbe95dd23ca623f807d5113f18b724611a.

fmeum commented 2 hours ago

@pzembrod

Wyverald commented 2 hours ago

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.*).