From ae5da710b33779e1eb5452c7a99e9b8c0244c4ab Mon Sep 17 00:00:00 2001 From: Matthew Maurer Date: Mon, 12 Sep 2022 12:55:47 -0700 Subject: [PATCH 1/2] c2a: Parse new cargo output Cargo now outputs 'unittests src/lib.rs' where before it output 'unittests'. Bug: 246384761 Test: Add "test": true to argh_derive, regenerate, observe same bp file Change-Id: Ieeab83761f5fe7cff88af1ce8293818736a6bb9b --- scripts/cargo2android.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/cargo2android.py b/scripts/cargo2android.py index 48158fd1e..9f116b3e7 100755 --- a/scripts/cargo2android.py +++ b/scripts/cargo2android.py @@ -1547,7 +1547,7 @@ class Runner(object): return '' def add_empty_test(self, name): - if name == 'unittests': + if name.startswith('unittests'): self.empty_unittests = True else: self.empty_tests.add(name) From b59698e2e96981609e0452ba7ac687949a675fb7 Mon Sep 17 00:00:00 2001 From: Matthew Maurer Date: Mon, 12 Sep 2022 13:03:32 -0700 Subject: [PATCH 2/2] c2a: Legacy cleanup * Removed import of print function - we only support py3 now * Switched from set() to a set literal Bug: None Test: Regenerated argh_derive Change-Id: I78bc86ad22c747c5f6ad88e2caa5e707e1ffc381 --- scripts/cargo2android.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/cargo2android.py b/scripts/cargo2android.py index 9f116b3e7..6764c89f2 100755 --- a/scripts/cargo2android.py +++ b/scripts/cargo2android.py @@ -43,8 +43,6 @@ If there are rustc warning messages, this script will add a warning comment to the owner crate module in Android.bp. """ -from __future__ import print_function - import argparse import glob import json @@ -58,7 +56,7 @@ import sys # Some Rust packages include extra unwanted crates. # This set contains all such excluded crate names. -EXCLUDED_CRATES = set(['protobuf_bin_gen_rust_do_not_use']) +EXCLUDED_CRATES = {'protobuf_bin_gen_rust_do_not_use'} RENAME_MAP = { # This map includes all changes to the default rust module names