SwiftPM plugin dependency on ArgumentParser?

is there a way for an SPM plugin to import ArgumentParser?

Not as I understand it - got a nice summary here: SPM build tool plugins - bringing resources to the target? - #5 by SDGGiesbrecht

For the benchmark plugin I just extract the command line arguments and pass the on to the tool that performs the work (which uses ArgumentParser) - I guess you could get even more hardcore - just pass on the command line unparsed from the plugin to your ‘worker tool’ as-is and use argumentparser in the tool….

well that’s what i usually do, but in this case the logic pertains to the layout of the package itself, which can only be done in the vicinity of a PackagePlugin import. the PluginContext data is very complex and i haven’t figured out a way to bootstrap handing it off to the executable tool.

1 Like