Revert "Restore lost "is_absolute" (#2922)"

This reverts commit 2a85e13c74.

Revert "Use absolute path with "-fsanitize-ignorelist" (#2911)"

This reverts commit 9594fa70b5.
This commit is contained in:
UebelAndre 2024-10-07 13:48:32 -07:00 committed by GitHub
parent 2a85e13c74
commit 7890b42438
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 27 additions and 22 deletions

View File

@ -2,7 +2,7 @@
module(
name = "rules_rust",
version = "0.52.1",
version = "0.52.2",
)
bazel_dep(

View File

@ -153,7 +153,25 @@ def get_cc_compile_args_and_env(cc_toolchain, feature_configuration):
)
return cc_c_args, cc_cxx_args, cc_env
def _pwd_flags(args):
def _pwd_flags_sysroot(args):
"""Prefix execroot-relative paths of known arguments with ${pwd}.
Args:
args (list): List of tool arguments.
Returns:
list: The modified argument list.
"""
res = []
for arg in args:
s, opt, path = arg.partition("--sysroot=")
if s == "" and not paths.is_absolute(path):
res.append("{}${{pwd}}/{}".format(opt, path))
else:
res.append(arg)
return res
def _pwd_flags_isystem(args):
"""Prefix execroot-relative paths of known arguments with ${pwd}.
Args:
@ -164,32 +182,19 @@ def _pwd_flags(args):
"""
res = []
fix_next_arg = False
flags = ["-fsanitize-ignorelist", "-isystem", "--sysroot"]
def split_flag(flag):
if flag in flags:
return (flag, None)
for flag in flags:
s, opt, path = arg.partition(flag + "=")
if s == "":
return (opt, path)
return (None, None)
for arg in args:
if fix_next_arg and not paths.is_absolute(arg):
res.append("${{pwd}}/{}".format(arg))
fix_next_arg = False
else:
opt, path = split_flag(arg)
if opt and path and not paths.is_absolute(path):
res.append("{}${{pwd}}/{}".format(opt, path))
else:
fix_next_arg = (opt != None)
res.append(arg)
res.append(arg)
fix_next_arg = arg == "-isystem"
return res
def _pwd_flags(args):
return _pwd_flags_isystem(_pwd_flags_sysroot(args))
def _feature_enabled(ctx, feature_name, default = False):
"""Check if a feature is enabled.

View File

@ -1,3 +1,3 @@
"""The version of rules_rust."""
VERSION = "0.52.1"
VERSION = "0.52.2"