Skip to content

Commit

Permalink
Handle use of RUSTC_WORKSPACE_WRAPPER (#1280)
Browse files Browse the repository at this point in the history
* Detect use of RUSTC_WORKSPACE_WRAPPER

Handle the scenario where cargo is being used with sccache as a
RUSTC_WRAPPER and another tool is being used as a
RUSTC_WORKSPACE_WRAPPER, by looking at whether rustc is the first
argument.

Signed-off-by: Tom Fay <[email protected]>

* handle more rustc wrapping scenarios

the wrapped rustc may not just be "rustc", it may have an extension
or more path components

* restructure rustc detection logic

Signed-off-by: Tom Fay <[email protected]>
  • Loading branch information
tofay authored Sep 15, 2022
1 parent 1c88fb1 commit b6d7814
Show file tree
Hide file tree
Showing 3 changed files with 228 additions and 102 deletions.
3 changes: 2 additions & 1 deletion src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -680,13 +680,14 @@ pub fn run_command(cmd: Command) -> Result<i32> {
let runtime = Runtime::new()?;
let jobserver = unsafe { Client::new() };
let creator = ProcessCommandCreator::new(&jobserver);
let args: Vec<_> = env::args_os().collect();
let env: Vec<_> = env::vars_os().collect();
let out_file = File::create(out)?;
let cwd = env::current_dir().expect("A current working dir should exist");

let pool = runtime.handle().clone();
runtime.block_on(async move {
compiler::get_compiler_info(creator, &executable, &cwd, &env, &pool, None)
compiler::get_compiler_info(creator, &executable, &cwd, &args, &env, &pool, None)
.await
.map(|compiler| compiler.0.get_toolchain_packager())
.and_then(|packager| packager.write_pkg(out_file))
Expand Down
Loading

0 comments on commit b6d7814

Please sign in to comment.