Merge changes Ib62b19c1,I80a6ecd8,I37b9aa96,I4de409b3 am: 126ca5f962

Original change: https://android-review.googlesource.com/c/platform/development/+/2194760

Change-Id: Id8523130b3794c2f8e1e62c18c8ca551bbbe6f68
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot
2022-08-25 18:45:02 +00:00
committed by Automerger Merge Worker

View File

@@ -182,7 +182,7 @@ def test_base_name(path):
def unquote(s): # remove quotes around str
if s and len(s) > 1 and s[0] == '"' and s[-1] == '"':
if s and len(s) > 1 and s[0] == s[-1] and s[0] in ('"', "'"):
return s[1:-1]
return s
@@ -367,8 +367,9 @@ class Crate(object):
"""Find important rustc arguments to convert to Android.bp properties."""
self.line_num = line_num
self.line = line
args = line.split() # Loop through every argument of rustc.
args = list(map(unquote, line.split()))
i = 0
# Loop through every argument of rustc.
while i < len(args):
arg = args[i]
if arg == '--crate-name':
@@ -387,8 +388,8 @@ class Crate(object):
self.target = args[i]
elif arg == '--cfg':
i += 1
if args[i].startswith('\'feature='):
self.features.append(unquote(args[i].replace('\'feature=', '')[:-1]))
if args[i].startswith('feature='):
self.features.append(unquote(args[i].replace('feature=', '')))
else:
self.cfgs.append(args[i])
elif arg == '--extern':
@@ -427,14 +428,17 @@ class Crate(object):
elif arg == '--out-dir' or arg == '--color': # ignored
i += 1
elif arg.startswith('--error-format=') or arg.startswith('--json='):
_ = arg # ignored
pass # ignored
elif arg.startswith('--emit='):
self.emit_list = arg.replace('--emit=', '')
elif arg.startswith('--edition='):
self.edition = arg.replace('--edition=', '')
elif arg.startswith('\'-Aclippy'):
# TODO: Consider storing these to include in the Android.bp.
_ = arg # ignored
elif arg.startswith('-Aclippy') or arg.startswith('-Wclippy'):
pass # TODO: Consider storing these to include in the Android.bp.
elif arg.startswith('-W'):
pass # ignored
elif arg.startswith('-D'):
pass # TODO: Consider storing these to include in the Android.bp.
elif not arg.startswith('-'):
# shorten imported crate main source paths like $HOME/.cargo/
# registry/src/github.com-1ecc6299db9ec823/memchr-2.3.3/src/lib.rs