-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[Plugins] Include Plugins in Manifest.targetsRequired
#3623
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
Conversation
Fixes SR-14343. As Plugins are modeled as a dependency they also must be included the list of required targets for a product.
@swift-ci please smoke test |
|
||
let plugins: [String] = target.pluginUsages?.compactMap { pluginUsage in | ||
switch pluginUsage { | ||
case .plugin(name: let name, package: nil): |
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.
should this be .plugin(name: let name, _):
?
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.
My understanding is, that if package is not nil
.plugin(...)
declares a dependency to a target in another package. Therefore it's not relevant in this context
Maybe interesting for @yim-lee |
@swift-ci please smoke test macOS |
https://ci.swift.org/job/swift-package-manager-with-xcode-self-hosted-PR-osx/2239/console Hard to tell what happened with This should help prevent it: #3629 |
Motivation: Some of the package collection tests don't require search and finish quickly, so when background thread tries to `populateTargetTrie` it results in signal 4. For [example](swiftlang#3623 (comment)): ``` 10:23:08 Test Suite 'PackageCollectionsTests' started at 2021-07-20 10:21:53.935 10:23:08 Test Case '-[PackageCollectionsTests.PackageCollectionsTests testCollectionPendingTrustConfirmIsKeptOnAdd]' started. 10:23:08 Test Case '-[PackageCollectionsTests.PackageCollectionsTests testCollectionPendingTrustConfirmIsKeptOnAdd]' passed (0.105 seconds). 10:23:08 Exited with signal code 4 ``` Modifications: Set `initializeTargetTrie` to `false` for these tests such that `populateTargetTrie` is not called.
Motivation: Some of the package collection tests don't require search and finish quickly, so when background thread tries to `populateTargetTrie` it results in signal 4. For [example](#3623 (comment)): ``` 10:23:08 Test Suite 'PackageCollectionsTests' started at 2021-07-20 10:21:53.935 10:23:08 Test Case '-[PackageCollectionsTests.PackageCollectionsTests testCollectionPendingTrustConfirmIsKeptOnAdd]' started. 10:23:08 Test Case '-[PackageCollectionsTests.PackageCollectionsTests testCollectionPendingTrustConfirmIsKeptOnAdd]' passed (0.105 seconds). 10:23:08 Exited with signal code 4 ``` Modifications: Set `initializeTargetTrie` to `false` for these tests such that `populateTargetTrie` is not called.
Motivation: Some of the package collection tests don't require search and finish quickly, so when background thread tries to `populateTargetTrie` it results in signal 4. For [example](swiftlang#3623 (comment)): ``` 10:23:08 Test Suite 'PackageCollectionsTests' started at 2021-07-20 10:21:53.935 10:23:08 Test Case '-[PackageCollectionsTests.PackageCollectionsTests testCollectionPendingTrustConfirmIsKeptOnAdd]' started. 10:23:08 Test Case '-[PackageCollectionsTests.PackageCollectionsTests testCollectionPendingTrustConfirmIsKeptOnAdd]' passed (0.105 seconds). 10:23:08 Exited with signal code 4 ``` Modifications: Set `initializeTargetTrie` to `false` for these tests such that `populateTargetTrie` is not called.
* [Collections] Disable target trie in some of the tests Motivation: Some of the package collection tests don't require search and finish quickly, so when background thread tries to `populateTargetTrie` it results in signal 4. For [example](#3623 (comment)): ``` 10:23:08 Test Suite 'PackageCollectionsTests' started at 2021-07-20 10:21:53.935 10:23:08 Test Case '-[PackageCollectionsTests.PackageCollectionsTests testCollectionPendingTrustConfirmIsKeptOnAdd]' started. 10:23:08 Test Case '-[PackageCollectionsTests.PackageCollectionsTests testCollectionPendingTrustConfirmIsKeptOnAdd]' passed (0.105 seconds). 10:23:08 Exited with signal code 4 ``` Modifications: Set `initializeTargetTrie` to `false` for these tests such that `populateTargetTrie` is not called. * [Collections] Don't queue populateTargetTrie if there is no data Motivation: `populateTargetTrie`, potentially because it's done in a background queue, causes a lot of random crashes in tests (not just in SwiftPM but other projects as well). The exception happens inside SQLite C library and it's not yet clear what the real cause is. However, since most tests do not use the package collections feature at all, `populateTargetTrie` is basically a no-op and therefore doesn't need to be queued. Modification: Queue `populateTargetTrie` only if there is package collection data. This code change doesn't actually fix anything but may perhaps reduce the chance of crashing. rdar://80840989
Thanks for the fix, @fourplusone! The fix looks good... it would be great to also have a unit test for it. There are some test fixtures for plugins in the Fixtures/Miscellaneous/Plugins subdirectory that could be useful for this purpose. |
@fourplusone do you need any additional info on adding unit tests? |
Extended a unit test to cover this. It's at abertelrud@c7fd9ec. @fourplusone, do you mind if I add that to this branch? |
@abertelrud Feel free to add it 🙂 |
…lved # Conflicts: # Tests/PackageModelTests/ManifestTests.swift
Great, thanks! I pushed a commit extending an existing test to cover this case. Thank you for the fix! |
@swift-ci please smoke test |
@swift-ci please smoke test linux |
Looks like all the tests pass and the reviews are in place, so merging this. Thank you for the fix! |
Include Plugins in
Manifest.targetsRequired
Motivation:
Fixes SR-14343. As Plugins are modeled as a dependency they also must be included the list of required targets for a product.
Modifications:
Changed the implementation of
Manifest.targetsRequired
to include pluginsResult:
SR-14343 is fixed