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

Clean build previous artifacts after successful build #69

Closed
wants to merge 3 commits into from

Conversation

ranile
Copy link
Contributor

@ranile ranile commented Oct 4, 2020

Closes #49

This is a recreation of my previous PR #61. I had to recreate this because I mess up (to my knowledge, irreversibly) on the last (master) branch. I apologize for any inconvenience I caused.

Checklist

  • Updated CHANGELOG.md describing pertinent changes.
  • Updated README.md with pertinent info (may not always apply).

if entry.path().to_string_lossy() != bindgen_out.to_string_lossy() {
let path = entry.path();
if path.is_dir().await {
fs::remove_dir_all(&path).await.context("Deleting directory after build failed")?
Copy link
Contributor

@MartinKavik MartinKavik Oct 23, 2020

Choose a reason for hiding this comment

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

It isn't reliable on Windows. We should use something like https://github.com/XAMPPRocky/remove_dir_all.
See https://blog.qwaz.io/chat/issues-of-rusts-remove-dir-all-implementation-on-windows for more info.

Note: The comment is valid for all fs::remove_dir_all calls in the code-base.

Copy link
Member

Choose a reason for hiding this comment

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

@MartinKavik do you know if that applies to just the std implementation, or also to the async_std::remove_dir_all implementation?

Copy link
Contributor

@rakshith-ravi rakshith-ravi Jan 8, 2021

Choose a reason for hiding this comment

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

Looking at the async-std source code (https://github.com/async-rs/async-std/blob/master/src/fs/remove_dir_all.rs#L31-L38), it doesn't seem to do that. It just uses std::fs implementation directly, and exposes it in an async way. So I don't think it would work in async-std either

// wasm-bindgen build succeeded so delete everything in `dist`,
// copy everything from `dist/.current` to `dist` and
// delete `dist/.current`
let mut entries = fs::read_dir(self.bindgen_out.as_path()).await?;
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems to be walking target/wasm-bindgen/debug instead of dist.

@ranile
Copy link
Contributor Author

ranile commented Jan 23, 2021

Superseded by #108

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.

Clean old build artifacts
5 participants