From 0d6d010cf1ebd1f65db0c0967840d3ec74c943cb Mon Sep 17 00:00:00 2001 From: Michael Mueller Date: Fri, 25 Feb 2022 09:57:53 +0100 Subject: [PATCH] Unset `RUSTC_WRAPPER` only where needed --- .gitlab-ci.yml | 8 +++----- build.rs | 6 ++++++ src/cmd/build.rs | 5 +++++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3a687921..0129a27b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -45,11 +45,6 @@ workflow: # global RUSTFLAGS overrides the linker args so this way is better to pass the flags - printf '[build]\nrustflags = ["-C", "link-dead-code"]\n' > ${CARGO_HOME}/config - sccache -s - - # needed until https://github.com/mozilla/sccache/issues/1000 is fixed. - # this is unfortunate, since it disables `sccache` for this entire file. - - unset RUSTC_WRAPPER - - git show rules: - if: $CI_PIPELINE_SOURCE == "web" @@ -105,6 +100,9 @@ test-dylint: - cargo fmt --verbose --all -- --check - cargo clippy --verbose -- -D warnings; + # Needed until https://github.com/mozilla/sccache/issues/1000 is fixed. + - unset RUSTC_WRAPPER + - cargo test --verbose --all-features test: diff --git a/build.rs b/build.rs index be646624..513df6cc 100644 --- a/build.rs +++ b/build.rs @@ -139,6 +139,12 @@ fn build_and_zip_dylint_driver( &manifest_arg, ]); + // There are generally problems with having a custom `rustc` wrapper, while + // executing `dylint` (which has a custom linker). Especially for `sccache` + // there is this bug: https://github.com/mozilla/sccache/issues/1000. + // Until we have a justification for leaving the wrapper we should unset it. + cmd.env_remove("RUSTC_WRAPPER"); + // We need to remove those environment variables because `dylint` uses a // fixed Rust toolchain via the `ink_linting/rust-toolchain` file. By removing // these env variables we avoid issues with different Rust toolchains diff --git a/src/cmd/build.rs b/src/cmd/build.rs index f0136753..99faf956 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -332,6 +332,11 @@ fn exec_cargo_dylint(crate_metadata: &CrateMetadata, verbosity: Verbosity) -> Re // removing this env variable we avoid issues with different Rust toolchains // interfering with each other. ("CARGO_TARGET_DIR", None), + // There are generally problems with having a custom `rustc` wrapper, while + // executing `dylint` (which has a custom linker). Especially for `sccache` + // there is this bug: https://github.com/mozilla/sccache/issues/1000. + // Until we have a justification for leaving the wrapper we should unset it. + ("RUSTC_WRAPPER", None), ]; let working_dir = crate_metadata .manifest_path -- GitLab