gn2bp: Duplicate modules reachable from test targets
* The current testing situation for Cronet is dire due to the presence of Cronet on the platform,
As cronet is on the platform, we can't run any unit-tests as they'll link against the platform version
and not the statically-linked cronet. We could avoid this by jarjaring the code however this is impossible.
* It's impossible to jar-jar the code as the C++ code which does JNI expects jar-jared java classes. So the
only possible solution here would be to duplicate the C++ modules, one for testing(with no jarjar) and another
for platform(with jarjar)
* Java sources/actions are not collected for testing modules until a proper solution has been figured out.
Test: None
Change-Id: I20bbad13d83e9e3c7956f028f3f0493b24d0f8bc
diff --git a/tools/gn2bp/gn_utils.py b/tools/gn2bp/gn_utils.py
index 9fcbcf7..bda2754 100644
--- a/tools/gn2bp/gn_utils.py
+++ b/tools/gn2bp/gn_utils.py
@@ -46,6 +46,7 @@
}
ARCH_REGEX = r'(android_x86_64|android_x86|android_arm|android_arm64|host)'
RESPONSE_FILE = '{{response_file_name}}'
+TESTING_SUFFIX = "__testing"
AIDL_INCLUDE_DIRS_REGEX = r'--includes=\[(.*)\]'
def repo_root():
@@ -339,6 +340,9 @@
if self._is_java_group(type_, target_name):
java_group_name = target_name
+ if is_test_target:
+ target_name += TESTING_SUFFIX
+
target = self.all_targets.get(target_name)
if target is None:
target = GnParser.Target(target_name, type_)