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