I am working on a project that calls cargo internally to perform a build, and then calls it again, with almost exactly the same parameters, but with the unstable option --build-plan
, so that it can parse the JSON output and find the details about what has been built.
The problem I am having is that after calling cargo once with --build-plan
, next cargo build rebuilds everything from scratch. Why is it doing it and how can I prevent it?
To reproduce it, just go to some rust project and run:
$ cargo +nightly build -Z unstable-options
$ cargo +nightly build -Z unstable-options --build-plan
$ cargo +nightly build -Z unstable-options
if, like me, you suffer from the problem, you will see the third call will rebuild everything.