i have an SPM command plugin that i need to add as a dependency and run for several dozen projects, as part of an automation workflow. since each project has a separate Package.swift manifest, this would require re-compiling the plugin for every project.
is there a way to cache the build somehow, or distribute the plugin as a binary to avoid recompilation? the tool needs to be an SPM plugin because it needs access to the PackagePlugin context.
One approach could be to move the majority of the code for the plugin into an executable and just use the plugin to forward arguments, then you could a binary target for the executable itself (see SE-305).
that’s a great idea, the tool i am trying to invoke is already a module, so i could just distribute the module as a binary. i can’t believe i didn’t think of that, thanks!
generate checksum, bit weird to me but you have to do this in the root of your project where your package.swift is swift package compute-checksum /path/to/some.xcframework.zip
This works out grate for iOS targets too as you do not run into problems that your plugin is being build when you build or run tests on iOS targets. Also not the whole dependency tree needs to be loaded in.