Thanks @SDGGiesbrecht - I'll try to clarify.
Package A
Plugin (target + product)
Sourcery.stencil resource (needed/used by Plugin to perform its work)
and
Package B
Target (that depends on plugin)
So while testing the plugin during development in Package A, the plugin has access to the Sourcery.stencil template by accessing it through e.g.
...
let templateFile = context.package.directory.appending("Templates").appending("Sourcery.stencil")
...
let commandArgs:[String] = [
"--templates", templateFile.string,
"--sources", inputDirectory.string,
"--output", outputDirectory.string,
"--disableCache"]
let command: Command = .prebuildCommand(
displayName: "Running Sourcery",
executable: toolPath,
arguments: commandArgs,
outputFilesDirectory: outputDirectory)
return [command]
...
Now, when starting using the plugin in Package B, that path evaluates to B:s package directory (context.package is now in B), which does not have the Sourcery.stencil - it does not even have a Template directory.
So I want the plugin to have access to a resource (Sourcery.stencil) from Package A (which defines the plugin) while executing the plugin in the context of Package B, as it's basically part of the definition of the plugins functionality in this case.
So I feel I am missing (most likely):
A resources: clause for the plugin definition.
This is the closest ;-)
They can have dependencies declared though - e.g. like a executable target.
That was my latest try to work around the problem, by defining a dummy target which the plugin depended on that just had a 'copy resource' phase - didn't get that working though, as it still is unclear how I can access those resources - at which path would they reside at plugin execution time)