It remains unclear how you intend this to work.
I’m sorry for not expressing it clearly.
Here’s a longer description, hopefully being more explicit helps:
host is a developer laptop, device is the embedded device.
The build.zig file has a main application that only gets built for the device. We build various libraries that need to be loaded on the device for it to run as well. The build.zig file for the project also builds some tooling. Some for the host and some for the device.
One of those tools, call it harness for the sake of the example, facilitates communication between the two machines during development. harness --server <program> runs a server that forks off program into a child process, then accepts various remote commands. harness --client <command> [args] sends a command to the server.
When setting up a new dev machine or doing a clean build, we build harness for both the host and the device and load the software on the device offline. The device runs harness --server main after startup.
During active development, the build system has a zig build update step, where the host runs harness --client --upload-files [generated build artifacts], then harness --client --restart-server. Zig’s caching does work in this case - only artifacts with cache misses get rebuilt and transferred, the device restarts harness --server main, running the new version of the program.
It takes about three minutes and faffing about in several GUI tools to do the offline software update, whereas the slowest runs of zig build update take on the order of 30 seconds, so the dev cycle is much nicer with the update harness.
When there’s a cache miss on harness itself, I’d like to be able to do something like
[previous host version] --client --upload-files [new device version]
[previous host version] --client --restart-server
[new host version] --client --upload-files [artifacts]
[new host version] --client --restart-server
That way, the code for harness can have breaking changes applied without breaking the dev experience. As long as each version can transfer files to itself, it should work. That’s much easier to test than always ensuring no breaking changes between versions.