Skip to content
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

swift package add-plugin #8169

Open
MahdiBM opened this issue Dec 9, 2024 · 3 comments
Open

swift package add-plugin #8169

MahdiBM opened this issue Dec 9, 2024 · 3 comments

Comments

@MahdiBM
Copy link

MahdiBM commented Dec 9, 2024

Description

A simple swift package add-plugin command to add build plugins to targets.
Similar to the new swift package add-target etc... commands.

Use case: https://arc.net/l/quote/vmglmkzj

@dschaefer2
Copy link
Member

Agreed. I'd love to be able to fully create a package manifest from the command line.

@hi2gage
Copy link
Contributor

hi2gage commented Dec 11, 2024

@dschaefer2 I took a crack at this last night. Do you think this is something I need to write a official proposal for?

For this specific example of adding a plugin to an existing target as mentioned in the attached use case.

Should somehow be able to add plugins (The OpenAPI Generator plugin) to those targets as well?

it would actually mirror swift package add-target-dependency not swift package add-target.

Proposed interface:

> swift package add-target-plugin --help
OVERVIEW: Add a new target plugin to the manifest

USAGE: swift package add-target-plugin <plugin-name> <target-name> [--package <package>]

ARGUMENTS:
  <plugin-name>           The name of the new plugin
  <target-name>           The name of the target to update

OPTIONS:
  --package <package>     The package in which the plugin resides
  --version               Show the version.
  -h, -help, --help       Show help information.

which is similar to add-target-dependency:

> swift package add-target-dependency --help
OVERVIEW: Add a new target dependency to the manifest

USAGE: swift package add-target-dependency <dependency-name> <target-name> [--package <package>]

ARGUMENTS:
  <dependency-name>       The name of the new dependency
  <target-name>           The name of the target to update

OPTIONS:
  --package <package>     The package in which the dependency resides
  --version               Show the version.
  -h, -help, --help       Show help information.

@dschaefer2
Copy link
Member

dschaefer2 commented Dec 11, 2024

I think it would be good to write up a forum post to request for comment at least. It's important to get community feedback whenever we add official commands and options to swiftpm. Not sure this one would be controversial but it's a good habit for us to get into.

And thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants