Add --verbose
to see all the commands being invoked.
That said, I think that if your goal is debug your build script, this is not the way to go. If something doesn’t get built and you don’t understand why, the best way forward is to look at the chain of dependencies of your steps and investigate where a dependency that you would expect to exist, is actually not there.
More concretely, run the build script with --summary all
, that will show you how running each step causes to run other steps as a result.
For example by default zig build
runs the default install step, which in turn normally tries to install your program, which in turn requires to build your program first.
So, if you observe that the install step runs but it doesn’t cause your program to build, it means that you failed to wire that dependency (you’re missing b.installArtifact(exe)
in this case).
A secondary variant of this problem is when one step should only run after another has finished but you didn’t wire that dependency in the build script. For exmple you have a step that copies a directory somewhere but another step needs to write something into that directory first.
In this case what will happen is that the build system will run the steps in parallel, causing a race condition.
You can observe this in the build summary as well. You will see that the two steps don’t reference one another in the output, and that should be your tell.
Fixing this is heavily dependent on the situation. Some build steps have an output file expressed as a lazy path, and using that lazy path as input to another step will create the link, some other times you need to explicitly add a dependency doing something like this:
copy_dir.step.dependOn(©_file_to_dir.step);