Skip to content

Commit c6299e7

Browse files
committed
Use ${pwd} prefix for INCLUDE path values
1 parent 2200992 commit c6299e7

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

cargo/private/cargo_build_script.bzl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,10 @@ def _pwd_flags_resource_dir(args):
252252
"""Prefix execroot-relative paths in -resource-dir arguments with ${pwd}."""
253253
return _prefix_pwd_to_flag_flexible(args, "-resource-dir")
254254

255+
def _pwd_paths(args):
256+
"""Prefix execroot-relative paths with ${pwd}."""
257+
return _prefix_pwd_to_paths(args)
258+
255259
def _pwd_flags(args):
256260
return _pwd_flags_fsanitize_ignorelist(_pwd_flags_isystem(_pwd_flags_L(_pwd_flags_B(_pwd_flags_resource_dir(_pwd_flags_sysroot(args))))))
257261

@@ -462,7 +466,11 @@ def _cargo_build_script_impl(ctx):
462466
cc_c_args, cc_cxx_args, cc_env = get_cc_compile_args_and_env(cc_toolchain, feature_configuration)
463467
include = cc_env.get("INCLUDE")
464468
if include:
465-
env["INCLUDE"] = include
469+
if toolchain.exec_triple.str.find("windows") > 0:
470+
path_separator = ";"
471+
else:
472+
path_separator = ":"
473+
env["INCLUDE"] = path_separator.join(_pwd_paths(include.split(path_separator)))
466474

467475
toolchain_tools.append(cc_toolchain.all_files)
468476

0 commit comments

Comments
 (0)