Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions cargo/private/cargo_build_script.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def _prefix_pwd_to_flag(args, flag_variations):

# Check for concatenated form (flag with path)
if arg.startswith(flag):
path = arg[len(flag):]
path = arg[len(flag):].strip()

# Don't prefix absolute paths
if paths.is_absolute(path):
Expand All @@ -208,8 +208,8 @@ def _prefix_pwd_to_flag(args, flag_variations):
break

# Check for space-separated form (only for flags without '=' or ':')
if not flag.endswith("=") and not flag.endswith(":") and prefix_next_arg and not paths.is_absolute(arg):
res.append("${{pwd}}/{}".format(arg))
if not flag.endswith("=") and not flag.endswith(":") and prefix_next_arg and not paths.is_absolute(arg.strip()):
res.append("${{pwd}}/{}".format(arg.strip()))
handled = True
break

Expand All @@ -233,6 +233,7 @@ def _prefix_pwd_to_paths(args):
"""
res = []
for path in args:
path = path.strip()
if not paths.is_absolute(path):
res.append("${{pwd}}/{}".format(path))
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -519,8 +519,8 @@ def include_relative_test(name):
cargo_build_script_with_extra_cc_compile_flags(
name = "%s/cargo_build_script" % name,
extra_include_paths = select({
"@platforms//os:windows": "test/relative/include;another/relative/path",
"//conditions:default": "test/relative/include:another/relative/path",
"@platforms//os:windows": "test/relative/include; another/relative/path",
"//conditions:default": "test/relative/include: another/relative/path",
}),
)
cc_args_and_env_analysis_test(
Expand Down