Skip to content

Commit

Permalink
Revert #2911 and #2922 (#2925)
Browse files Browse the repository at this point in the history
Revert "Restore lost "is_absolute" (#2922)"

This reverts commit 2a85e13.

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

This reverts commit 9594fa7.
  • Loading branch information
UebelAndre authored Oct 7, 2024
1 parent 2a85e13 commit 7890b42
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 20 deletions.
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module(
name = "rules_rust",
version = "0.52.1",
version = "0.52.2",
)

bazel_dep(
Expand Down
41 changes: 23 additions & 18 deletions cargo/private/cargo_build_script.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ 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:
Expand All @@ -163,33 +163,38 @@ def _pwd_flags(args):
list: The modified argument list.
"""
res = []
fix_next_arg = False
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

flags = ["-fsanitize-ignorelist", "-isystem", "--sysroot"]
def _pwd_flags_isystem(args):
"""Prefix execroot-relative paths of known arguments with ${pwd}.
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)
Args:
args (list): List of tool arguments.
Returns:
list: The modified argument list.
"""
res = []
fix_next_arg = False
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.
Expand Down
2 changes: 1 addition & 1 deletion version.bzl
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""The version of rules_rust."""

VERSION = "0.52.1"
VERSION = "0.52.2"

0 comments on commit 7890b42

Please sign in to comment.