-
Notifications
You must be signed in to change notification settings - Fork 31
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 DescriptionPackage resolves targets not exported via products #131
Fix DescriptionPackage resolves targets not exported via products #131
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.
Thank you for this contribution!
Never mind making a new issue about this.
This PR seems to be almost good, but I found some minor points. Could you resolve them?
I'll check this patch for our product and merge this after them.
["SomeBinary"] | ||
[ | ||
"Logging", | ||
"TestingPackage" |
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.
Could you just add a trailing comma here to follow the SwiftLint violation.
"TestingPackage" | |
"TestingPackage", |
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.
Of course, it's fixed now. I forgot to run the linter locally.
@@ -65,17 +65,20 @@ final class DescriptionPackageTests: XCTestCase { | |||
} | |||
|
|||
func testBuildProductsInCreateMode() throws { | |||
let rootPath = fixturePath.appendingPathComponent("BinaryPackage") |
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.
The existing test might aim to test whether it can extract binary targets correctly so it's better to remain the existing tests.
Could you make a new test case for this change and rename the existing tests to testBuildProductsForBinaryPackage
or something?
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.
Sure, my reasoning was that BinaryPackage
was already involved in the integration tests, unlike TestingPackage
, so I felt safer replacing the former. Of course, keeping the previous test in place makes sense for extra peace of mind. Just fixed that.
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.
Let me know if you'd like to change the test name. I thought a package couldn't really be binary, unlike its targets (or wrapping them build products).
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.
Thank you for everything!
I'll check this PR for our product next week and I'll merge this and publish a new release
Released as 0.20.3 🎉 |
Issue
The
DescriptionPackage
increatePackage
mode may currently export internal targets that are not intended to be exported viaproducts
. This occurs because PackageBuilder implicitly generates additional products inResolvedPackage.products
for executable and test targets (in addition to the actually exported products). These generated products may depend on internal targets that must not be built byScipio
.Solution
Unlike
ResolvedPackage
, the Manifest object accurately reflects all the original manifest properties and is not affected by the issue/feature described above. I suggest using theproducts
fromManifest
instead of the ones fromResolvedPackage
.Example
Swift-DocC Plugin
exports two products: "Swift-DocC" and "Swift-DocC Preview", butScipio
in the current implementation resolves (for the reason described above) 4 products:The last two products
SwiftDocCPluginPackageTests
andsnippet-extract
are test and executable targets respectively that were implicitly generated bySwiftPM
. In addition, these generated products export some internal targets that should be ignored and not pre-built byScipio
.Detailed description
products
forResolvedPackage
are constructed in PackageBuilder.constructProducts. During the product construction process the builder treatstest
andexecutable
targets in a special way, including them in the resulting product arrays, namely:PackageTests
prefix is appended to the resulting products .Questions
Issues
first?