From d9d13b83090d44e0f461ead5f985e248b790b3a3 Mon Sep 17 00:00:00 2001 From: Joel Galenson Date: Mon, 5 Apr 2021 11:27:55 -0700 Subject: [PATCH] Fix cargo2android's license block preservation The code that preserves license blocks currently also preserves genrules if they come before a rust_ rule, causing them to be duplicated. Let's fix that. Test: Upgrade some crates Change-Id: Ie4f62cd04c2f1dd0de788db0ca5e77502fb3b4c8 --- scripts/cargo2android.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/cargo2android.py b/scripts/cargo2android.py index 786cf8509..b8778cd5a 100755 --- a/scripts/cargo2android.py +++ b/scripts/cargo2android.py @@ -1131,8 +1131,8 @@ class Runner(object): # Firstly skip ANDROID_BP_HEADER while line.startswith('//'): line = intf.readline() - # Read all lines until we see a rust_* rule. - while line != '' and not line.startswith('rust_'): + # Read all lines until we see a rust_* or genrule rule. + while line != '' and not (line.startswith('rust_') or line.startswith('genrule {')): license += line line = intf.readline() return license.strip()