gn2bp: rename _is_java_target to _is_java_group
In preparation for the CLs that follow.
Test: ./update_results.sh
Change-Id: Ib3154d842b68c68194a097aa0db65eba41b295e1
diff --git a/tools/gn2bp/gn_utils.py b/tools/gn2bp/gn_utils.py
index 130f8ff..1132c06 100644
--- a/tools/gn2bp/gn_utils.py
+++ b/tools/gn2bp/gn_utils.py
@@ -260,11 +260,11 @@
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 @@
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)