@@ -1038,9 +1038,6 @@ def construct_arguments(
1038
1038
data_paths ,
1039
1039
))
1040
1040
1041
- # Ensure the sysroot is set for the target platform
1042
- env ["SYSROOT" ] = toolchain .sysroot
1043
-
1044
1041
if toolchain ._rename_first_party_crates :
1045
1042
env ["RULES_RUST_THIRD_PARTY_DIR" ] = toolchain ._third_party_dir
1046
1043
@@ -1267,14 +1264,22 @@ def rustc_compile_action(
1267
1264
dsym_folder = ctx .actions .declare_directory (crate_info .output .basename + ".dSYM" , sibling = crate_info .output )
1268
1265
action_outputs .append (dsym_folder )
1269
1266
1267
+ rustc_sysroot_arg = ctx .actions .args ()
1268
+ rustc_sysroot_arg .add ("--sysroot" , toolchain .sysroot )
1269
+
1270
1270
if ctx .executable ._process_wrapper :
1271
1271
# Run as normal
1272
1272
ctx .actions .run (
1273
1273
executable = ctx .executable ._process_wrapper ,
1274
1274
inputs = compile_inputs ,
1275
1275
outputs = action_outputs ,
1276
1276
env = env ,
1277
- arguments = args .all ,
1277
+ arguments = [
1278
+ args .process_wrapper_flags ,
1279
+ args .rustc_path ,
1280
+ rustc_sysroot_arg ,
1281
+ args .rustc_flags ,
1282
+ ],
1278
1283
mnemonic = "Rustc" ,
1279
1284
progress_message = "Compiling Rust {} {}{} ({} files)" .format (
1280
1285
crate_info .type ,
@@ -1290,7 +1295,12 @@ def rustc_compile_action(
1290
1295
inputs = compile_inputs ,
1291
1296
outputs = [build_metadata ],
1292
1297
env = env ,
1293
- arguments = args_metadata .all ,
1298
+ arguments = [
1299
+ args_metadata .process_wrapper_flags ,
1300
+ args_metadata .rustc_path ,
1301
+ rustc_sysroot_arg ,
1302
+ args_metadata .rustc_flags ,
1303
+ ],
1294
1304
mnemonic = "RustcMetadata" ,
1295
1305
progress_message = "Compiling Rust metadata {} {}{} ({} files)" .format (
1296
1306
crate_info .type ,
@@ -1309,7 +1319,7 @@ def rustc_compile_action(
1309
1319
inputs = compile_inputs ,
1310
1320
outputs = action_outputs ,
1311
1321
env = env ,
1312
- arguments = [args .rustc_path , args .rustc_flags ],
1322
+ arguments = [args .rustc_path , rustc_sysroot_arg , args .rustc_flags ],
1313
1323
mnemonic = "Rustc" ,
1314
1324
progress_message = "Compiling Rust (without process_wrapper) {} {}{} ({} files)" .format (
1315
1325
crate_info .type ,
0 commit comments