So, short background:
I have a command plugin that has a tool as a dependency that performs the heavy work.
I extract the tool from the command line plugin using:
let benchmarkTool = try context.tool(named: "BenchmarkTool")
print("\(benchmarkTool.path)")
This gives the path:
.../package-benchmark/.build/arm64-apple-macosx/debug/BenchmarkTool
Now, this is getting the tool with the same build configuration that the command plugin is built with (debug), which was running pretty slow, so I wanted to get the dependency as a release built tool.
So, I specify the release configuration:
swift package -c release benchmark export percentiles delta
and this gives
.../package-benchmark/.build/arm64-apple-macosx/release/BenchmarkTool
Great. The only problem here is that SwiftPM will rebuild basically everything each time I would use that invocation (this does not happen with debug builds).
So what would be the appropriate way to get the desired behaviour?
Only workaround I can think of right now is to replace the 'debug' from the context.tool
path with 'release' - does not inspire a clean feeling unfortunately (I have programatically built the tool, so I know it will exist as a release built artifact and it works fine).
Any other ideas how to do this? (or should I just file an issue that benchmark plugins seem to be rebuilt with -c release
, or is that expected behaviour ?)