-
Notifications
You must be signed in to change notification settings - Fork 27
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
fix: ignore unresolved packages in Package.swift #1223
fix: ignore unresolved packages in Package.swift #1223
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain what the benefit is to the user? If I understand correctly, this would only be useful if you add a dep to Package.swift
and not use it in your code.
For us we need this because we have a CLI tool which uses the Package.swift to define deps. This CLI tool also has a command for working with the Package.swift, basically we automate updates for the Package.swift itself via the the CLI tool. As it is today, if I add a new dependency and then try to run |
97c7f56
to
081fd01
Compare
Looks like we need to run |
This fixes an issue where if a brand new dependency is added to the `Package.swift` when `Package.resolved` has not yet been updated, the Bazel build fails. It fails because there is no `pin` available for the `source_control` dependency as the `Package.resolved` has not yet been updated. Failing the build here causes issues for tools which are built & run with Bazel and operate on the same `Package.swift` they are built from. For example, a command line tool built using `rules_swift_package_manager` which has a `Package.swift` for `swift-argument-parser`. If a new dependency is added to the `Package.swift` but not yet used in any of the Bazel targets and a build is run the build will fail with: ``` File bazel-path/external/rules_swift_package_manager~/swiftpkg/bzlmod/swift_deps.bzl", line 152, column 25, in _declare_pkg_from_dependency commit = pin.state.revision, Error: 'NoneType' value has no field or method 'state' ``` This change allows the build to progress by simply ignoring the unresolved dependencies until a `swift package resolve` is run by the user.
788b4fd
to
2d48ed5
Compare
@Mergifyio queue |
✅ The pull request has been merged automaticallyThe pull request has been merged automatically at b81a341 |
…#358) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [rules_swift_package_manager](https://redirect.github.com/cgrindel/rules_swift_package_manager) | http_archive | minor | `v0.37.0` -> `v0.38.2` | --- ### Release Notes <details> <summary>cgrindel/rules_swift_package_manager (rules_swift_package_manager)</summary> ### [`v0.38.2`](https://redirect.github.com/cgrindel/rules_swift_package_manager/releases/tag/v0.38.2) [Compare Source](https://redirect.github.com/cgrindel/rules_swift_package_manager/compare/v0.38.1...v0.38.2) #### What Has Changed #### What's Changed - chore: update README.md for v0.38.1 by [@​cgrindel-app-token-generator](https://redirect.github.com/cgrindel-app-token-generator) in [https://github.com/cgrindel/rules_swift_package_manager/pull/1242](https://redirect.github.com/cgrindel/rules_swift_package_manager/pull/1242) **Full Changelog**: cgrindel/rules_swift_package_manager@v0.38.1...v0.38.2 #### Bazel Module Snippet ```python bazel_dep(name = "rules_swift_package_manager", version = "0.38.2") ``` ### [`v0.38.1`](https://redirect.github.com/cgrindel/rules_swift_package_manager/releases/tag/v0.38.1) [Compare Source](https://redirect.github.com/cgrindel/rules_swift_package_manager/compare/v0.38.0...v0.38.1) #### What Has Changed #### What's Changed - chore(deps): update dependency sdwebimage/sdwebimageswiftui to from: "3.1.2" by [@​cgrindel-self-hosted-renovate](https://redirect.github.com/cgrindel-self-hosted-renovate) in [https://github.com/cgrindel/rules_swift_package_manager/pull/1213](https://redirect.github.com/cgrindel/rules_swift_package_manager/pull/1213) **Full Changelog**: cgrindel/rules_swift_package_manager@v0.38.0...v0.38.1 #### Bazel Module Snippet ```python bazel_dep(name = "rules_swift_package_manager", version = "0.38.1") ``` ### [`v0.38.0`](https://redirect.github.com/cgrindel/rules_swift_package_manager/releases/tag/v0.38.0) [Compare Source](https://redirect.github.com/cgrindel/rules_swift_package_manager/compare/v0.37.0...v0.38.0) #### What Has Changed #### What's Changed - chore: update README.md for v0.37.0 by [@​cgrindel-app-token-generator](https://redirect.github.com/cgrindel-app-token-generator) in [https://github.com/cgrindel/rules_swift_package_manager/pull/1216](https://redirect.github.com/cgrindel/rules_swift_package_manager/pull/1216) - chore(deps): update dependency gazelle to v0.38.0 by [@​cgrindel-self-hosted-renovate](https://redirect.github.com/cgrindel-self-hosted-renovate) in [https://github.com/cgrindel/rules_swift_package_manager/pull/1193](https://redirect.github.com/cgrindel/rules_swift_package_manager/pull/1193) - chore(deps): update dependency rules_apple to v3.8.0 by [@​cgrindel-self-hosted-renovate](https://redirect.github.com/cgrindel-self-hosted-renovate) in [https://github.com/cgrindel/rules_swift_package_manager/pull/1196](https://redirect.github.com/cgrindel/rules_swift_package_manager/pull/1196) - chore(deps): update dependency apple/swift-nio to v2.72.0 by [@​cgrindel-self-hosted-renovate](https://redirect.github.com/cgrindel-self-hosted-renovate) in [https://github.com/cgrindel/rules_swift_package_manager/pull/1219](https://redirect.github.com/cgrindel/rules_swift_package_manager/pull/1219) - fix: generate a `select` statement for each condition by [@​roya1v](https://redirect.github.com/roya1v) in [https://github.com/cgrindel/rules_swift_package_manager/pull/1173](https://redirect.github.com/cgrindel/rules_swift_package_manager/pull/1173) - fix: ignore unresolved packages in Package.swift by [@​luispadron](https://redirect.github.com/luispadron) in [https://github.com/cgrindel/rules_swift_package_manager/pull/1223](https://redirect.github.com/cgrindel/rules_swift_package_manager/pull/1223) - chore(deps): update dependency googlemaps/ios-maps-sdk to from: "9.1.0" by [@​cgrindel-self-hosted-renovate](https://redirect.github.com/cgrindel-self-hosted-renovate) in [https://github.com/cgrindel/rules_swift_package_manager/pull/1208](https://redirect.github.com/cgrindel/rules_swift_package_manager/pull/1208) - chore(deps): update dependency pointfreeco/swift-composable-architecture to from: "1.13.1" by [@​cgrindel-self-hosted-renovate](https://redirect.github.com/cgrindel-self-hosted-renovate) in [https://github.com/cgrindel/rules_swift_package_manager/pull/1210](https://redirect.github.com/cgrindel/rules_swift_package_manager/pull/1210) - chore(deps): update dependency nicklockwood/swiftformat to from: "0.54.4" by [@​cgrindel-self-hosted-renovate](https://redirect.github.com/cgrindel-self-hosted-renovate) in [https://github.com/cgrindel/rules_swift_package_manager/pull/1218](https://redirect.github.com/cgrindel/rules_swift_package_manager/pull/1218) - chore(deps): update dependency bazel to v7.3.1 by [@​cgrindel-self-hosted-renovate](https://redirect.github.com/cgrindel-self-hosted-renovate) in [https://github.com/cgrindel/rules_swift_package_manager/pull/1207](https://redirect.github.com/cgrindel/rules_swift_package_manager/pull/1207) - chore(deps): update dependency iterable/swift-sdk to from: "6.5.7" by [@​cgrindel-self-hosted-renovate](https://redirect.github.com/cgrindel-self-hosted-renovate) in [https://github.com/cgrindel/rules_swift_package_manager/pull/1226](https://redirect.github.com/cgrindel/rules_swift_package_manager/pull/1226) - chore(deps): update dependency googlemaps/ios-maps-sdk to from: "9.1.1" by [@​cgrindel-self-hosted-renovate](https://redirect.github.com/cgrindel-self-hosted-renovate) in [https://github.com/cgrindel/rules_swift_package_manager/pull/1225](https://redirect.github.com/cgrindel/rules_swift_package_manager/pull/1225) - chore(deps): update dependency nicklockwood/swiftformat to from: "0.54.5" by [@​cgrindel-self-hosted-renovate](https://redirect.github.com/cgrindel-self-hosted-renovate) in [https://github.com/cgrindel/rules_swift_package_manager/pull/1227](https://redirect.github.com/cgrindel/rules_swift_package_manager/pull/1227) - chore(deps): update dependency firebase/firebase-ios-sdk to from: "11.2.0" by [@​cgrindel-self-hosted-renovate](https://redirect.github.com/cgrindel-self-hosted-renovate) in [https://github.com/cgrindel/rules_swift_package_manager/pull/1228](https://redirect.github.com/cgrindel/rules_swift_package_manager/pull/1228) - chore(deps): update dependency googlecloudplatform/recaptcha-enterprise-mobile-sdk to from: "18.6.0" by [@​cgrindel-self-hosted-renovate](https://redirect.github.com/cgrindel-self-hosted-renovate) in [https://github.com/cgrindel/rules_swift_package_manager/pull/1229](https://redirect.github.com/cgrindel/rules_swift_package_manager/pull/1229) - chore(deps): update dependency pointfreeco/swift-composable-architecture to from: "1.15.0" by [@​cgrindel-self-hosted-renovate](https://redirect.github.com/cgrindel-self-hosted-renovate) in [https://github.com/cgrindel/rules_swift_package_manager/pull/1230](https://redirect.github.com/cgrindel/rules_swift_package_manager/pull/1230) - chore(deps): update dependency protobuf to v27.4 by [@​cgrindel-self-hosted-renovate](https://redirect.github.com/cgrindel-self-hosted-renovate) in [https://github.com/cgrindel/rules_swift_package_manager/pull/1231](https://redirect.github.com/cgrindel/rules_swift_package_manager/pull/1231) - chore(deps): update dependency vapor/vapor to v4.105.2 by [@​cgrindel-self-hosted-renovate](https://redirect.github.com/cgrindel-self-hosted-renovate) in [https://github.com/cgrindel/rules_swift_package_manager/pull/1235](https://redirect.github.com/cgrindel/rules_swift_package_manager/pull/1235) - chore(deps): update dependency datatheorem/trustkit to from: "3.0.4" by [@​cgrindel-self-hosted-renovate](https://redirect.github.com/cgrindel-self-hosted-renovate) in [https://github.com/cgrindel/rules_swift_package_manager/pull/1148](https://redirect.github.com/cgrindel/rules_swift_package_manager/pull/1148) - chore: remove legacy workspace info from release and readme by [@​cgrindel](https://redirect.github.com/cgrindel) in [https://github.com/cgrindel/rules_swift_package_manager/pull/1237](https://redirect.github.com/cgrindel/rules_swift_package_manager/pull/1237) #### New Contributors - [@​roya1v](https://redirect.github.com/roya1v) made their first contribution in [https://github.com/cgrindel/rules_swift_package_manager/pull/1173](https://redirect.github.com/cgrindel/rules_swift_package_manager/pull/1173) **Full Changelog**: cgrindel/rules_swift_package_manager@v0.37.0...v0.38.0 #### Bazel Module Snippet ```python bazel_dep(name = "rules_swift_package_manager", version = "0.38.0") ``` </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/bazel-contrib/rules_bazel_integration_test). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC44MC4wIiwidXBkYXRlZEluVmVyIjoiMzguODAuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This fixes an issue where if a brand new dependency is added to the
Package.swift
whenPackage.resolved
has not yet been updated, the Bazel build fails. It fails because there is nopin
available for thesource_control
dependency as thePackage.resolved
has not yet been updated.For example, a command line tool built using
rules_swift_package_manager
which has aPackage.swift
forswift-argument-parser
. If a new dependency is added to thePackage.swift
but not yet used in any of the Bazel targets and noswift package resolve
has been run when a build is run the build will fail with:This change allows the build to progress by simply ignoring the unresolved dependencies until a
swift package resolve
is run by the user.