I am making a SPM plugin for code parsing and generation (a toy Sourcery clone to parse Swift files, render a stencil template and output a Swift file).
This is made in two parts: the first part is the generation tool itself, depending on SwiftSyntax and Stencil. The second part is the build tool plugin that makes a build command for every Swift file of the target to run the tool on.
The stencil files are declared as resources inside the generation tool. I can read them from the bundle without any problem.
However I have a problem: the plugin isn't run again by SPM when the stencil file changes. After all why would it? The build command only has a Swift file as an input. The result is that I need to clean the project every time I change the templates, which is unpractical.
How could I fix this? Is there any way for me to get the path to the stencil file from the plugin (stencil file which belongs to an entirely different target)?
I thought about making the tool executable an input of the build command too, but it doesn't work because the tool isn't actually rebuilt, the resource is copied to the bundle again and it stops there (as it should).
Thanks in advance o7