Skip to content

Add option to purge BuildDirectory on drop #28

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

Closed
wants to merge 1 commit into from

Conversation

jyn514
Copy link
Member

@jyn514 jyn514 commented Jun 6, 2020

I tried adding an integration test, but I couldn't get the path because build_dir() and all related methods are private. This doesn't really seem like a unit test, but I can add it if you like.

Also, it seems like rustwide runs cargo clean without arguments during tests? I'd really rather it didn't do that, if I use a shared CARGO_TARGET_DIR it means I have to rebuild rustwide (and all other crates) from scratch for every test. Instead it could call cargo clean -p <package>.

use failure::Error;

const WORKSPACE_NAME: &str = "test-drop";

#[test]
fn test_build_dir_drop() -> Result<(), Error> {
    let workspace = crate::utils::init_named_workspace(WORKSPACE_NAME)?;
	let mut build_dir = workspace.build_dir("drop-dir");
	build_dir.purge_on_drop(true);
	let path = build_dir.build_dir();
	drop(build_dir);
	assert!(!path.exists());
	Ok(())
}

@jyn514
Copy link
Member Author

jyn514 commented Jun 6, 2020

Addresses rust-lang/docs.rs#820; docs.rs will need a follow-up PR updating rustwide and using the new API.

@pietroalbini
Copy link
Member

We decided not to do this.

@jyn514 jyn514 deleted the drop branch June 8, 2020 15:03
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.

2 participants