You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
kani-driver: Get json messages from cargo invocations #1598
Instead of simply running cargo build or cargo test --no-run with environment variables set so that cargo invokes kani-compiler appropriately, we should use something like cargo build --build-plan -Z unstable-options to get the build plan, then execute it ourselves. Alternatively, investigate how much of cargo is available as a library. Perhaps we can get cargo to compute a plan, modify it, and then ask cargo to execute that plan via library, rather than by calling out to external executables.
There's a couple of reasons to want this:
We can change invocations of rustc to run kani-compiler directly, instead of trying to bodge things into working with environment variables.
I looked into this a bit yesterday, and unfortunately, it seems that there are no plans to stabilize the --build-plan option anytime soon. In fact, the option even seems to be broken and there's been discussions to delete it: rust-lang/cargo#7614
An alternative heavy-weight approach is to use the cargo crate as a dependency. One downside would be increasing Kani's build time (the cargo crate takes ~45 seconds to build by itself).
For reasons 2 and 3, it might be sufficient to use the cargo_metadata crate, which we're already using in the Kani driver.
changed the title [-]kani-driver: Build ourselves instead of just invoking `cargo build`[/-][+]kani-driver: Get json messages from `cargo` invocations[/+]on Nov 14, 2022
I believe we came to the conclusion we didn't want to build ourselves. Instead, we want to parse the json output from cargo build so we know all the artifacts, etc that were produced.
Activity
zhassan-aws commentedon Aug 26, 2022
I looked into this a bit yesterday, and unfortunately, it seems that there are no plans to stabilize the
--build-planoption anytime soon. In fact, the option even seems to be broken and there's been discussions to delete it: rust-lang/cargo#7614An alternative heavy-weight approach is to use the
cargocrate as a dependency. One downside would be increasing Kani's build time (thecargocrate takes ~45 seconds to build by itself).For reasons 2 and 3, it might be sufficient to use the
cargo_metadatacrate, which we're already using in the Kani driver.celinval commentedon Aug 30, 2022
One thing to be careful about is the compilation of proc_macros and build scripts. One of the reasons we have the hacky
--kani-flagstoday is because we want to compile "host" code with regular rustc, since they will be executed as part of the compilation (this might help us get rid of the hack, but it is unstable: https://doc.rust-lang.org/cargo/reference/unstable.html#host-config).There are a few workarounds described here: rust-lang/cargo#7178 that we could use too.
[-]kani-driver: Build ourselves instead of just invoking `cargo build`[/-][+]kani-driver: Get json messages from `cargo` invocations[/+]tedinski commentedon Nov 14, 2022
I believe we came to the conclusion we didn't want to build ourselves. Instead, we want to parse the json output from
cargo buildso we know all the artifacts, etc that were produced.celinval commentedon Nov 15, 2022
I think our main concern was to depend on
cargo build-plans, since it may eventually get deleted: rust-lang/cargo#7614celinval commentedon Feb 23, 2023
We have changed
kani-driverto parse the messages fromcargoas part of #2166