Skip to content

Commit

Permalink
Fix windows dylint build (#690)
Browse files Browse the repository at this point in the history
* Build dylint driver through rustup to fix windows build

* Install required toolchain

* Fmt

* Try --no-self-update

* Oops

* Revert "Oops"

This reverts commit a7f5f58.

* Revert "Try --no-self-update"

This reverts commit 0bcbf03.

* Revert "Fmt"

This reverts commit 8092386.

* Revert "Install required toolchain"

This reverts commit 2edc843.

* Revert "Build dylint driver through rustup to fix windows build"

This reverts commit f4752f0.

* Copy windows workaround from dylint
  • Loading branch information
ascjones authored Aug 15, 2022
1 parent a438350 commit 49f46a5
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
32 changes: 32 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ jsonrpsee = { version = "0.15.1", features = ["ws-client"] }

[build-dependencies]
anyhow = "1.0.61"
dirs = "4.0.0"
zip = { version = "0.6.2", default-features = false }
walkdir = "2.3.2"
substrate-build-script-utils = "3.0.0"
Expand Down
18 changes: 18 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,24 @@ fn build_and_zip_dylint_driver(
dylint_driver_dst_file: PathBuf,
) -> Result<()> {
let mut cmd = Command::new("cargo");
#[cfg(windows)]
{
// copied workaround from dylint for https://github.com/rust-lang/rustup/pull/2978
let cargo_home = match env::var("CARGO_HOME") {
Ok(value) => Ok(PathBuf::from(value)),
Err(error) => {
dirs::home_dir()
.map(|path| path.join(".cargo"))
.ok_or(error)
}
}?;
let old_path = crate::env::var("PATH")?;
let new_path = std::env::join_paths(
std::iter::once(Path::new(&cargo_home).join("bin"))
.chain(std::env::split_paths(&old_path)),
)?;
cmd.envs(vec![("PATH", new_path)]);
}

let manifest_arg = format!(
"--manifest-path={}",
Expand Down

0 comments on commit 49f46a5

Please sign in to comment.