From df3c20cdabe78472afbaf8b5bf9ffbeacf3dd367 Mon Sep 17 00:00:00 2001 From: Patrick Rohr Date: Mon, 12 Dec 2022 20:19:26 -0800 Subject: [PATCH] gn2bp: rename _is_java_target to _is_java_group In preparation for the CLs that follow. Test: ./update_results.sh Change-Id: Ib3154d842b68c68194a097aa0db65eba41b295e1 --- tools/gn2bp/gn_utils.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/gn2bp/gn_utils.py b/tools/gn2bp/gn_utils.py index 130f8ff715..1132c063d9 100644 --- a/tools/gn2bp/gn_utils.py +++ b/tools/gn2bp/gn_utils.py @@ -260,11 +260,11 @@ class GnParser(object): return ' '.join(formatted_flags) - def _is_java_target(self, target): + def _is_java_group(self, type_, target_name): # Per https://chromium.googlesource.com/chromium/src/build/+/HEAD/android/docs/java_toolchain.md # java target names must end in "_java". # TODO: There are some other possible variations we might need to support. - return target.type == 'group' and re.match('.*_java$', target.name) + return type_ == 'group' and re.match('.*_java$', target_name) def _get_arch(self, toolchain): if toolchain == '//build/toolchain/android:android_clang_x86': @@ -342,7 +342,8 @@ class GnParser(object): elif target.type in LINKER_UNIT_TYPES: self.linker_units[gn_target_name] = target target.arch[arch].sources.update(desc.get('sources', [])) - elif desc.get("script", "") in JAVA_BANNED_SCRIPTS or self._is_java_target(target): + elif (desc.get("script", "") in JAVA_BANNED_SCRIPTS + or self._is_java_group(target.type, target.name)): # java_group identifies the group target generated by the android_library # or java_library template. A java_group must not be added as a dependency, but sources are collected log.debug('Found java target %s', target.name)