From d37d7e6d2cc6c8a5dfe722b7b514faa1a3056470 Mon Sep 17 00:00:00 2001 From: Joel Galenson Date: Tue, 13 Jul 2021 09:03:01 -0700 Subject: [PATCH] Rename rust_defaults that contain tests. This patch ensures that rust_defaults for tests have _tests in the name. This can make the Android.bp file a bit more readable. Test: Run on a crate and build it. Change-Id: I5d034c456052b892bd01c3c041b2572bc9364692 --- scripts/cargo2android.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/scripts/cargo2android.py b/scripts/cargo2android.py index 4f828e220..780a09b19 100755 --- a/scripts/cargo2android.py +++ b/scripts/cargo2android.py @@ -554,11 +554,12 @@ class Crate(object): def build_default_name(self): """Return a short and readable name for the rust_defaults module.""" - # Choices: (1) root_pkg + '_defaults', - # (2) root_pkg + '_defaults_' + crate_name - # (3) root_pkg + '_defaults_' + main_src_basename_path - # (4) root_pkg + '_defaults_' + a_positive_sequence_number - name1 = altered_defaults(self.root_pkg) + '_defaults' + # Choices: (1) root_pkg + '_test'? + '_defaults', + # (2) root_pkg + '_test'? + '_defaults_' + crate_name + # (3) root_pkg + '_test'? + '_defaults_' + main_src_basename_path + # (4) root_pkg + '_test'? + '_defaults_' + a_positive_sequence_number + test = "_test" if self.crate_types == ['test'] else "" + name1 = altered_defaults(self.root_pkg) + test + '_defaults' if self.runner.try_claim_module_name(name1, self): return name1 name2 = name1 + '_' + self.crate_name