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

Handle RUSTC_WRAPPER properly #180

Merged
merged 1 commit into from
Jun 2, 2022
Merged

Handle RUSTC_WRAPPER properly #180

merged 1 commit into from
Jun 2, 2022

Conversation

taiki-e
Copy link
Owner

@taiki-e taiki-e commented Jun 2, 2022

No description provided.

Comment on lines +52 to +55
// The following priorities are not documented, but at as of cargo
// 1.63.0-nightly (2022-05-31), `RUSTC*` are preferred over `CARGO_BUILD_RUSTC*`.
// 1. RUSTC
// 2. build.rustc (CARGO_BUILD_RUSTC)
Copy link
Owner Author

@taiki-e taiki-e Jun 2, 2022

Choose a reason for hiding this comment

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

$ tail -n +1  a.sh b.sh    
==> a.sh <==
#!/bin/bash
echo "$(basename "$0") called with arguments: $*"

==> b.sh <==
#!/bin/bash
echo "$(basename "$0") called with arguments: $*"

$ RUSTC="$(pwd)/a.sh" CARGO_BUILD_RUSTC="$(pwd)/b.sh" cargo build
error: `rustc -vV` didn't have a line for `host:`, got:
a.sh called with arguments: -vV

$ RUSTC_WRAPPER="$(pwd)/a.sh" CARGO_BUILD_RUSTC_WRAPPER="$(pwd)/b.sh" cargo build
error: malformed output when learning about crate-type rlib information
command was: `/Users/taiki/projects/cargo-llvm-cov/a.sh rustc - --crate-name ___ --print=file-names --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg`

--- stdout
a.sh called with arguments: rustc - --crate-name ___ --print=file-names --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg

$ RUSTC_WORKSPACE_WRAPPER="$(pwd)/a.sh" CARGO_BUILD_RUSTC_WORKSPACE_WRAPPER="$(pwd)/b.sh" cargo build
error: malformed output when learning about crate-type rlib information
command was: `/Users/taiki/projects/cargo-llvm-cov/a.sh rustc - --crate-name ___ --print=file-names --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg`

--- stdout
a.sh called with arguments: rustc - --crate-name ___ --print=file-names --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg

$ RUSTC_WRAPPER="$(pwd)/a.sh" RUSTC_WORKSPACE_WRAPPER="$(pwd)/b.sh" cargo build
error: malformed output when learning about crate-type rlib information
command was: `/Users/taiki/projects/cargo-llvm-cov/a.sh /Users/taiki/projects/cargo-llvm-cov/b.sh rustc - --crate-name ___ --print=file-names --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg`

--- stdout
a.sh called with arguments: /Users/taiki/projects/cargo-llvm-cov/b.sh rustc - --crate-name ___ --print=file-names --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg

$ CARGO_BUILD_RUSTC_WRAPPER="$(pwd)/a.sh" RUSTC_WORKSPACE_WRAPPER="$(pwd)/b.sh" cargo build
error: malformed output when learning about crate-type rlib information
command was: `/Users/taiki/projects/cargo-llvm-cov/a.sh /Users/taiki/projects/cargo-llvm-cov/b.sh rustc - --crate-name ___ --print=file-names --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg`

--- stdout
a.sh called with arguments: /Users/taiki/projects/cargo-llvm-cov/b.sh rustc - --crate-name ___ --print=file-names --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg

RUSTC vs RUSTC_WRAPPER is more complex.
When rustc -vV fails:

$ tail -n +1  a.sh b.sh    
==> a.sh <==
#!/bin/bash
echo "$(basename "$0") called with arguments: $*"

==> b.sh <==
#!/bin/bash
echo "$(basename "$0") called with arguments: $*"

$ RUSTC="$(pwd)/a.sh" RUSTC_WRAPPER="$(pwd)/b.sh" cargo build
error: `rustc -vV` didn't have a line for `host:`, got:
a.sh called with arguments: -vV

But when if sucsees:

$ tail -n +1  a.sh b.sh    
==> a.sh <==
#!/bin/bash
echo "$(basename "$0") called with arguments: $*"
echo "rustc 1.63.0-nightly (12cd71f4d 2022-06-01)
binary: rustc
commit-hash: 12cd71f4d3ea6df9c2093781d55134cd9651d754
commit-date: 2022-06-01
host: x86_64-apple-darwin
release: 1.63.0-nightly
LLVM version: 14.0.4"

==> b.sh <==
#!/bin/bash
echo "$(basename "$0") called with arguments: $*"
echo "rustc 1.63.0-nightly (12cd71f4d 2022-06-01)
binary: rustc
commit-hash: 12cd71f4d3ea6df9c2093781d55134cd9651d754
commit-date: 2022-06-01
host: x86_64-apple-darwin
release: 1.63.0-nightly
LLVM version: 14.0.4"

$ RUSTC="$(pwd)/a.sh" RUSTC_WRAPPER="$(pwd)/b.sh" cargo build
error: output of --print=file-names has changed in the compiler, cannot parse
command was: `/Users/taiki/projects/cargo-llvm-cov/b.sh /Users/taiki/projects/cargo-llvm-cov/a.sh - --crate-name ___ --print=file-names --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg`

--- stdout
b.sh called with arguments: /Users/taiki/projects/cargo-llvm-cov/a.sh - --crate-name ___ --print=file-names --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg
rustc 1.63.0-nightly (12cd71f4d 2022-06-01)
binary: rustc
commit-hash: 12cd71f4d3ea6df9c2093781d55134cd9651d754
commit-date: 2022-06-01
host: x86_64-apple-darwin
release: 1.63.0-nightly
LLVM version: 14.0.4

@taiki-e
Copy link
Owner Author

taiki-e commented Jun 2, 2022

bors r+

@bors
Copy link
Contributor

bors bot commented Jun 2, 2022

Build succeeded:

@bors bors bot merged commit 1d3214a into main Jun 2, 2022
@bors bors bot deleted the wrapper branch June 2, 2022 13:10
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.

1 participant