-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add swift package add-target-plugin
command
#8432
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
base: main
Are you sure you want to change the base?
Conversation
@swift-ci please test |
@swift-ci please test self hosted windows |
@swift-ci please test windows |
swift package add-target-plugin
command
31f2020
to
d0fe9a8
Compare
@dschaefer2 @bkhouri just want to bump this, I rebased the new changes. |
@swift-ci please test self hosted windows |
@swift-ci please test |
@swift-ci test self hosted windows |
1 similar comment
@swift-ci test self hosted windows |
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 I ask that we add a bit more automated tests?
let contents: String = try fs.readFileContents(manifest) | ||
|
||
XCTAssertMatch(contents, .contains(#".plugin(name: "other-product"#)) | ||
} |
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.
praise: I really appreciate the automated tests to validate the behaviour we want. Could I trouble you to add a few more that would check different use cases and fault injections?
- Calling
add-target-plugin
on a non-existing package - Calling
add-target-plugin
providing all four combination of a valid/invalid plugin name and target 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.
Hi @bkhouri,
Thanks for the feedback! I've added two additional tests to cover this scenario:
Calling
add-target-plugin
on a non-existing package
Regarding your second request about validating the plugin and target names: the CLI currently just passes those strings through to the Package.swift manifest without performing validation, similar to how add-target-dependency
behaves. Because of that, it's not currently possible to add meaningful tests that assert on the existence of the plugin or target.
That being said, I'm happy to discuss adding validation to some of these commands, but I believe it's outside the scope of this PR.
d0fe9a8
to
f1ab936
Compare
@swift-ci test |
@swift-ci test self hosted windows |
Though I don't see how, for some reason, the Windows Self hosted pipeline seems to hang with this change. |
@swift-ci test |
@swift-ci test self hosted windows |
@swift-ci test windows |
7f54d24
to
c3a3b5d
Compare
@bkhouri ok I think I figured it out. Messed up the naming of the files. Let's try it again! |
@swift-ci test |
@swift-ci test self hosted windows |
@swift-ci test windows |
c3a3b5d
to
d2ef799
Compare
@bkhouri I think the |
@swift-ci test |
@swift-ci test self hosted windows |
@swift-ci test |
Adds
swift package add-target-plugin
command for adding plugins to target from CLIMotivation:
Featured requested in #8169
Allows users to add package plugins to targets via command line.
Forums Discussion
Modifications:
Add new
add-target-plugin
command which aligns with the existingadd-target-dependency
commandResult:
After running the following command:
The following addition will be made to the
Package.swift
manifest: