Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use <target>/kani as the target directory and clean at every build #1847

Merged
merged 6 commits into from
Nov 4, 2022

Conversation

celinval
Copy link
Contributor

@celinval celinval commented Nov 3, 2022

Description of changes:

We can't really handle caching compilation artifacts today. So we are going to perform a cargo clean before building the goto program. I also changed our target to use the kani subfolder inside target.

We currently put cargo-kani compilation artifacts inside regular cargo target. This can conflict with users compilation artifacts and unnecessarily rebuild code). Now we force rebuild without modifying the target, that would always delete the entire user build folder, which seems like a terrible UX.

Resolved issues:

Resolves #1821.

Related RFC:

Call-outs:

Testing:

  • How is this change tested? Existing tests + manually tests.

  • Is this a refactor change? No

Checklist

  • Each commit message has a non-empty body, explaining why the change was made
  • Methods or procedures are documented
  • Regression or unit tests are included, or existing tests cover the modified code
  • My PR is restricted to a single feature or bugfix

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.

We currently put cargo-kani compilation artifacts inside regular cargo
target.

This can conflict with users compilation artifacts and unnecessarily
rebuild code).

This can also cause `cargo kani` to fail compilation if users
try to run `cargo kani` and `cargo kani --legacy-linker`
without cleaning their target directory.
@celinval celinval requested a review from a team as a code owner November 3, 2022 22:25
let outdir = target_dir.join(build_target).join("debug/deps");

// Clean directory before building since we are unable to handle cache today.
// TODO: https://github.com/model-checking/kani/issues/1736
self.cargo_clean(&target_dir)?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would deleting the <target>/kani directory instead work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. cargo clean seems like a good way to clean stuff generated by cargo build, but the effect is the same, so if you prefer, I can just remove the folder.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I think the advantage of just removing the kani directory is to not wipe out the artifacts of a normal (non-kani) cargo build.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which would hopefully make the UX a bit "less-terrible".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, we were providing the correct target directory to cargo clean, so it was only wiping out target/kani not the entire target. Anyway, not a biggie.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I missed that.

Copy link
Contributor

@zhassan-aws zhassan-aws left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Having another approval on this PR would be useful since this impacts the UX.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Target directories should be cleaned before codegen
3 participants