Skip to content

Commit bea805d

Browse files
authored
fix(hydro_deploy): use --target-dir instead of environment variable to improve caching (#1943)
sccache includes all environment variables starting with `CARGO_` in the cache key, so this would cause misses for all trybuild compilation. Along with mozilla/sccache#2424, this improves compilation caching.
1 parent 4d15ff1 commit bea805d

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

  • hydro_deploy/core/src/rust_crate

hydro_deploy/core/src/rust_crate/build.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,12 @@ pub async fn build_crate_memoized(params: BuildParams) -> Result<&'static BuildO
136136

137137
command.arg("--message-format=json-diagnostic-rendered-ansi");
138138

139-
if let Some(rustflags) = params.rustflags.as_ref() {
140-
command.env("RUSTFLAGS", rustflags);
139+
if let Some(target_dir) = params.target_dir.as_ref() {
140+
command.args(["--target-dir", target_dir.to_str().unwrap()]);
141141
}
142142

143-
if let Some(target_dir) = params.target_dir.as_ref() {
144-
command.env("CARGO_TARGET_DIR", target_dir);
143+
if let Some(rustflags) = params.rustflags.as_ref() {
144+
command.env("RUSTFLAGS", rustflags);
145145
}
146146

147147
for (k, v) in params.build_env {

0 commit comments

Comments
 (0)