Update CI scripts to support dependency overrides where traits are used#902
Merged
simonjbeaumont merged 2 commits intoMay 5, 2026
Merged
Conversation
FranzBusch
approved these changes
May 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
This project has CI for example projects and an integration test. These use a standalone package with a dependency on
swift-openapi-generator. The scripts driving this CI usedswift package editto override this dependency to thecheckout of the PR under test.
Unfortunately this does not work in the presence of package traits. In open PR #875 the OpenAPIKit dependency is being
bumped and is switched to disabling default traits. However, the CI is failing to perform the
swift package editcommand. The root cause is that
swift package editperforms dependency resolution in order to edit the dependency.This resolves OpenAPIKit to a version satisfying the constraints on main -- a version of OpenAPIKit that has no traits.
After the override, the build fails because SwiftPM forbids disabling traits on a package that has no declared traits.
This is because OpenAPIKit is not re-resolved to the version declared in the local PR branch, even though it has been
bumped. After quite some investigation, it appears there's no way to influence this behaviour or to defer resolution
until after the dependency edit. This thesis aligns with the open SwiftPM issue tracking support for traits for
swift package edit1Modifications
Workaround the lack of trait-aware
swift package editby updating the examples and integration test CI scripts toinstead inject an override block into the package manifest.
Result
The scripts should now work as intended, even when the minimum version of a transitive dependency is bumped and/or when
transitive dependencies make use of package traits.
Test Plan
Reproduced the original error in #875:
With this patch applied we can run the script fine on the PR branch:
Footnotes
https://github.com/swiftlang/swift-package-manager/issues/8354 ↩