@@ -3,18 +3,16 @@ use std::error::Error;
33use std:: path:: PathBuf ;
44
55fn main ( ) -> Result < ( ) , Box < dyn Error > > {
6- let target_os = std :: env:: var ( "CARGO_CFG_TARGET_OS" ) ?;
7- let target_arch = std :: env:: var ( "CARGO_CFG_TARGET_ARCH" ) ?;
6+ let target_os = env:: var ( "CARGO_CFG_TARGET_OS" ) ?;
7+ let target_arch = env:: var ( "CARGO_CFG_TARGET_ARCH" ) ?;
88 println ! ( "cargo:rerun-if-changed=build.rs" ) ;
99 println ! ( "cargo:rerun-if-env-changed=CARGO_CFG_TARGET_OS" ) ;
1010 println ! ( "cargo:rerun-if-env-changed=CARGO_CFG_TARGET_ARCH" ) ;
11- // While OUT_DIR is set for both build.rs and compiling the crate, PROFILE is only set in
12- // build.rs. So, export it to crate compilation as well.
13- let profile = env:: var ( "PROFILE" ) . unwrap ( ) ;
14- println ! ( "cargo:rustc-env=PROFILE={profile}" ) ;
11+
1512 if target_os != "android" && target_arch != "wasm32" {
1613 return Ok ( ( ) ) ;
1714 }
15+ let profile = env:: var ( "PROFILE" ) . unwrap ( ) ;
1816 let mut dir = PathBuf :: from ( env:: var_os ( "OUT_DIR" ) . unwrap ( ) ) ;
1917 // Strip `$profile/build/*/out`.
2018 let ok = dir. ends_with ( "out" )
@@ -25,10 +23,6 @@ fn main() -> Result<(), Box<dyn Error>> {
2523 && dir. ends_with ( profile)
2624 && dir. pop ( ) ;
2725 assert ! ( ok) ;
28- // NOTE(eddyb) this needs to be distinct from the `--target-dir` value that
29- // `spirv-builder` generates in a similar way from `$OUT_DIR` and `$PROFILE`,
30- // otherwise repeated `cargo build`s will cause build script reruns and the
31- // rebuilding of `rustc_codegen_spirv` (likely due to common proc macro deps).
3226 let dir = dir. join ( "example-runner-wgpu-builder" ) ;
3327 let status = std:: process:: Command :: new ( "cargo" )
3428 . args ( [
0 commit comments