Closed luispadron closed 5 days ago
Could you try this?
override_repo(
swift_deps,
swiftpkg_swift_syntax = "SwiftSyntax",
)
You need to specify apparent repo names, not module names.
Oh, that does work and it overrides the repository as expected. Do you know where SwiftSyntax
is coming from as the repo name?
At a minimum maybe the error message could suggest this if that seems doable
Do you know where SwiftSyntax is coming from as the repo name?
😅 ah the SwiftSyntax
repo name comes from my bazel_dep
use nevermind, that makes sense!
It comes from your module file:
bazel_dep(
name = "swift-syntax",
version = SWIFT_SYNTAX_VERSION,
repo_name = "SwiftSyntax",
)
Let me see what I can do about the error message.
@luispadron Could you test https://github.com/bazelbuild/bazel/pull/23982?
@fmeum Im getting a suggestion now but its suggesting the thing im trying to override (it should suggest the SwiftSyntax
repo instead):
Error in override_repo: The repo exported as 'swiftpkg_swift_syntax' by module extension 'swift_deps' is overridden with 'swift-syntax', but no repo is visible under this name (did you mean 'swiftpkg_swift_syntax'?)
ERROR: Error computing the main repository mapping: error executing MODULE.bazel file for the root module
@luispadron Good catch, should be fixed.
Nice!
Error in override_repo: The repo exported as 'swiftpkg_swift_syntax' by module extension 'swift_deps' is overridden with 'swift-syntax', but no repo is visible under this name (did you mean 'SwiftSyntax'?)
Thanks for your help here!
A fix for this issue has been included in Bazel 7.4.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=7.4.0rc3
. Thanks!
Description of the bug:
I have a dependency on a Bazel module swift-syntax, for reasons we override this module using
archive_override
:I use another Bazel module rules_swift_package_manager which provides a module extension
swift_deps
that provides Bazel repositories for use within the build. Thisswift_deps
extension proxy generates a repository namedswiftpkg_swift_syntax
.I'd like to replace the
swiftpkg_swift_syntax
repository with my overrideswift-syntax
repository, I use the newoverride_repo
feature in Bazel 7.4+:I get the following error:
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
bazel build //...
on the attached zip.override_repo_example.zip
Which operating system are you running Bazel on?
macOS 14.6.1
What is the output of
bazel info release
?