I’m writing a plugin in which I need to run a prog...
# plugins
l
I’m writing a plugin in which I need to run a program (could be Scala, Python or Go) which lives in the same repo. It will produce a metadata file which I then need to do further processing with (run a bunch of validations, so essentially a check goal). I’m wondering what the best pattern is? I could make my field set accept a target which can be packaged, and then execute the packaged binary conditionally (depending on what language it is) and grabbing its output. Or is it better to treat it as some sort of codegen where the output is the generated file, and then have language specific targets which can compile a binary, run it and then output codegen’d files?
g
Grug brain solution:
shunit2_test
+
adhoc_tool
.
You don't even need adhoc_tool, technically. You can just run everything in a single shunit2 test using
runtime_package_dependencies
. (I'm assuming there's more nuance here fwiw, but I'm not seeing that in what's described.)
l
Don’t know, haven’t tried, that could work great! 😀
Have never actually used adhoc_tool, so will give it a go
I think the only nuance is that the applications that I need to run are non-trivial and that the subsequent step needs to be a test goal
g
I think adhoc_tool to generate the output and then any test target for analysis is a reasonable approach in that case.
l
I went with sort of an in-between solution, using
adhoc_tool
to run the task for the output & a plugin that calls into an npm tool to do the validation. Works great as soon as I figured out how to get the generated sources into my plugin
Thanks for the help 🙇