gn2bp: move target.type check into _is_java_target
Cleanup -- makes the code more readable.
Test: //components/cronet/android:cronet
Change-Id: I4bb68137ac21f6204143c4fb9c74e57e9db8c5d7
diff --git a/tools/gn2bp/gn_utils.py b/tools/gn2bp/gn_utils.py
index 6fcc0f8..e90b500 100644
--- a/tools/gn2bp/gn_utils.py
+++ b/tools/gn2bp/gn_utils.py
@@ -192,7 +192,7 @@
# 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 re.match('.*_java$', target.name)
+ return target.type == 'group' and re.match('.*_java$', target.name)
def get_target(self, gn_target_name):
@@ -254,7 +254,7 @@
elif target.type == 'copy':
# TODO: copy rules are not currently implemented.
self.actions[gn_target_name] = target
- elif target.type == 'group' and self._is_java_target(target):
+ elif self._is_java_target(target):
# 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)