Skip to content

Commit cc7d2b9

Browse files
authored
Don't store build check rmeta (#375)
* Don't store build check rmeta This ensures the `.rmeta` files generated by `can_compile` are not written to the build output. Those metadata files can create determinism and cache invalidation issues in some build systems. Instead the output -- since it is never actually read -- is written to `/dev/null`. This is a port of bytecodealliance/rustix#1200 to cap-std. * Update CI for wasm32-wasip1.
1 parent c461c07 commit cc7d2b9

File tree

6 files changed

+17
-17
lines changed

6 files changed

+17
-17
lines changed

Diff for: .github/workflows/main.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ jobs:
150150
riscv64gc-unknown-linux-gnu
151151
arm-unknown-linux-gnueabihf
152152
aarch64-linux-android
153-
wasm32-wasi
153+
wasm32-wasip1
154154
- run: cargo check --workspace --all-targets --all-features --release -vv
155155
- run: cargo check --workspace --all-targets --all-features --release -vv --target=x86_64-unknown-linux-musl
156156
- run: cargo check --workspace --all-targets --all-features --release -vv --target=x86_64-unknown-linux-gnux32
@@ -164,7 +164,7 @@ jobs:
164164
- run: cargo check --workspace --all-targets --all-features --release -vv --target=riscv64gc-unknown-linux-gnu
165165
- run: cargo check --workspace --all-targets --all-features --release -vv --target=arm-unknown-linux-gnueabihf
166166
- run: cargo check --workspace --all-targets --all-features --release -vv --target=aarch64-linux-android
167-
- run: cd cap-std && cargo check --features=fs_utf8 --release -vv --target=wasm32-wasi
167+
- run: cd cap-std && cargo check --features=fs_utf8 --release -vv --target=wasm32-wasip1
168168

169169
check_cross_nightly_windows:
170170
name: Check Cross-Compilation on Rust nightly on Windows

Diff for: build.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ fn has_feature(feature: &str) -> bool {
4848
fn can_compile<T: AsRef<str>>(test: T) -> bool {
4949
use std::process::Stdio;
5050

51-
let out_dir = var("OUT_DIR").unwrap();
5251
let rustc = var("RUSTC").unwrap();
5352
let target = var("TARGET").unwrap();
5453

@@ -72,8 +71,9 @@ fn can_compile<T: AsRef<str>>(test: T) -> bool {
7271
.arg("--emit=metadata") // Do as little as possible but still parse.
7372
.arg("--target")
7473
.arg(target)
75-
.arg("--out-dir")
76-
.arg(out_dir); // Put the output somewhere inconsequential.
74+
.arg("-o")
75+
.arg("-")
76+
.stdout(Stdio::null()); // We don't care about the output (only whether it builds or not)
7777

7878
// If Cargo wants to set RUSTFLAGS, use that.
7979
if let Ok(rustflags) = var("CARGO_ENCODED_RUSTFLAGS") {

Diff for: cap-async-std/build.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ fn has_feature(feature: &str) -> bool {
3535
fn can_compile<T: AsRef<str>>(test: T) -> bool {
3636
use std::process::Stdio;
3737

38-
let out_dir = var("OUT_DIR").unwrap();
3938
let rustc = var("RUSTC").unwrap();
4039
let target = var("TARGET").unwrap();
4140

@@ -59,8 +58,9 @@ fn can_compile<T: AsRef<str>>(test: T) -> bool {
5958
.arg("--emit=metadata") // Do as little as possible but still parse.
6059
.arg("--target")
6160
.arg(target)
62-
.arg("--out-dir")
63-
.arg(out_dir); // Put the output somewhere inconsequential.
61+
.arg("-o")
62+
.arg("-")
63+
.stdout(Stdio::null()); // We don't care about the output (only whether it builds or not)
6464

6565
// If Cargo wants to set RUSTFLAGS, use that.
6666
if let Ok(rustflags) = var("CARGO_ENCODED_RUSTFLAGS") {

Diff for: cap-fs-ext/build.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ fn has_feature(feature: &str) -> bool {
3232
fn can_compile<T: AsRef<str>>(test: T) -> bool {
3333
use std::process::Stdio;
3434

35-
let out_dir = var("OUT_DIR").unwrap();
3635
let rustc = var("RUSTC").unwrap();
3736
let target = var("TARGET").unwrap();
3837

@@ -56,8 +55,9 @@ fn can_compile<T: AsRef<str>>(test: T) -> bool {
5655
.arg("--emit=metadata") // Do as little as possible but still parse.
5756
.arg("--target")
5857
.arg(target)
59-
.arg("--out-dir")
60-
.arg(out_dir); // Put the output somewhere inconsequential.
58+
.arg("-o")
59+
.arg("-")
60+
.stdout(Stdio::null()); // We don't care about the output (only whether it builds or not)
6161

6262
// If Cargo wants to set RUSTFLAGS, use that.
6363
if let Ok(rustflags) = var("CARGO_ENCODED_RUSTFLAGS") {

Diff for: cap-primitives/build.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ fn has_feature(feature: &str) -> bool {
4242
fn can_compile<T: AsRef<str>>(test: T) -> bool {
4343
use std::process::Stdio;
4444

45-
let out_dir = var("OUT_DIR").unwrap();
4645
let rustc = var("RUSTC").unwrap();
4746
let target = var("TARGET").unwrap();
4847

@@ -66,8 +65,9 @@ fn can_compile<T: AsRef<str>>(test: T) -> bool {
6665
.arg("--emit=metadata") // Do as little as possible but still parse.
6766
.arg("--target")
6867
.arg(target)
69-
.arg("--out-dir")
70-
.arg(out_dir); // Put the output somewhere inconsequential.
68+
.arg("-o")
69+
.arg("-")
70+
.stdout(Stdio::null()); // We don't care about the output (only whether it builds or not)
7171

7272
// If Cargo wants to set RUSTFLAGS, use that.
7373
if let Ok(rustflags) = var("CARGO_ENCODED_RUSTFLAGS") {

Diff for: cap-std/build.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ fn has_feature(feature: &str) -> bool {
3737
fn can_compile<T: AsRef<str>>(test: T) -> bool {
3838
use std::process::Stdio;
3939

40-
let out_dir = var("OUT_DIR").unwrap();
4140
let rustc = var("RUSTC").unwrap();
4241
let target = var("TARGET").unwrap();
4342

@@ -61,8 +60,9 @@ fn can_compile<T: AsRef<str>>(test: T) -> bool {
6160
.arg("--emit=metadata") // Do as little as possible but still parse.
6261
.arg("--target")
6362
.arg(target)
64-
.arg("--out-dir")
65-
.arg(out_dir); // Put the output somewhere inconsequential.
63+
.arg("-o")
64+
.arg("-")
65+
.stdout(Stdio::null()); // We don't care about the output (only whether it builds or not)
6666

6767
// If Cargo wants to set RUSTFLAGS, use that.
6868
if let Ok(rustflags) = var("CARGO_ENCODED_RUSTFLAGS") {

0 commit comments

Comments
 (0)