`bazel mod tidy` removes a transitive Swift package repo from use_repo and breaks builds
bug
With `rules_swift_package_manager` `1.14.0`, `bazel mod tidy` removes a transitive Swift package repo from `use_repo(...)`, and a subsequent Bazel build fails when a target depends on that repo directly.
## Repro
https://github.com/bc-lee/rules-swift-package-manager-mod-tidy-repro
```bash
git clone https://github.com/bc-lee/rules-swift-package-manager-mod-tidy-repro.git
cd rules-swift-package-manager-mod-tidy-repro
bazelisk build //...
bazelisk mod tidy
git diff -- MODULE.bazel
bazelisk build //...
```
## Actual
After `bazel mod tidy`, a transitive Swift package repo is removed from `use_repo(...)`.
In this repro, `swiftpkg_grdb.swift` is removed, and the next build fails because `//:repro`
depends on `@swiftpkg_grdb.swift//:GRDB-dynamic`.
## Expected
`bazel mod tidy` should not remove a Swift package repo that is still needed by Bazel targets
in the root module.
## Notes
In this repro, `swiftpkg_grdb.swift` comes from the resolved transitive SwiftPM dependency
graph, not from the root `Package.swift` dependency list.
0 条评论