From e88e4d6a5f104ca1f077bf5bd9059bdb85faa41b Mon Sep 17 00:00:00 2001 From: Andrei Homescu Date: Thu, 24 Aug 2023 22:11:50 +0000 Subject: [PATCH] cargo2rulesmk.py: Support customizing rustc Port aosp/2633771 to cargo2rulesmk.py. Bug: 281857510 Test: Run in sandbox on bitflags crate Change-Id: I85b884351f621a6d96cd2b01ee5113687eb72f32 --- scripts/cargo2rulesmk.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/cargo2rulesmk.py b/scripts/cargo2rulesmk.py index 3a68131d2..714b80b12 100755 --- a/scripts/cargo2rulesmk.py +++ b/scripts/cargo2rulesmk.py @@ -88,13 +88,13 @@ DRY_RUN_NOTE = ( ) # Cargo -v output of a call to rustc. -RUSTC_PAT = re.compile("^ +Running `rustc (.*)`$") +RUSTC_PAT = re.compile("^ +Running `(.*\/)?rustc (.*)`$") # Cargo -vv output of a call to rustc could be split into multiple lines. # Assume that the first line will contain some CARGO_* env definition. RUSTC_VV_PAT = re.compile("^ +Running `.*CARGO_.*=.*$") # The combined -vv output rustc command line pattern. -RUSTC_VV_CMD_ARGS = re.compile("^ *Running `.*CARGO_.*=.* rustc (.*)`$") +RUSTC_VV_CMD_ARGS = re.compile("^ *Running `.*CARGO_.*=.* (.*\/)?rustc (.*)`$") # Cargo -vv output of a "cc" or "ar" command; all in one line. CC_AR_VV_PAT = re.compile(r'^\[([^ ]*)[^\]]*\] running:? "(cc|ar)" (.*)$') @@ -1019,7 +1019,7 @@ class Runner(object): if not line.endswith("`\n") or (new_rustc.count("`") % 2) != 0: return new_rustc if match := RUSTC_VV_CMD_ARGS.match(new_rustc): - args = match.group(1) + args = match.group(2) self.add_crate(Crate(self, outf_name).parse(n, args)) else: self.assert_empty_vv_line(new_rustc) @@ -1086,7 +1086,7 @@ class Runner(object): continue new_rustc = "" if match := RUSTC_PAT.match(line): - args_line = match.group(1) + args_line = match.group(2) self.add_crate(Crate(self, outf_name).parse(n, args_line)) self.assert_empty_vv_line(rustc_line) elif rustc_line or RUSTC_VV_PAT.match(line):