gn2bp: Set the output name for libcronet.so
.so file name needs to match with CronetLibraryLoader.java
(e.g. libcronet.109.0.5386.0.so)
Test: m, atest CtsCronetTestCases
Change-Id: I82285c32e82fc27ba5233e1bef7195ec57c35bea
diff --git a/tools/gn2bp/gen_android_bp b/tools/gn2bp/gen_android_bp
index b357b58..4c60bfa 100755
--- a/tools/gn2bp/gen_android_bp
+++ b/tools/gn2bp/gen_android_bp
@@ -308,6 +308,8 @@
self.stubs = {}
self.cppflags = set()
self.rtti = False
+ # Name of the output. Used for setting .so file name for libcronet
+ self.stem = None
def to_string(self, output):
if self.comment:
@@ -354,6 +356,7 @@
self._output_field(output, 'proto')
self._output_field(output, 'linker_scripts')
self._output_field(output, 'cppflags')
+ self._output_field(output, 'stem')
if self.rtti:
self._output_field(output, 'rtti')
@@ -963,6 +966,13 @@
if module.type == 'cc_library_static':
module.export_generated_headers = module.generated_headers
+ if module.name == 'cronet_aml_components_cronet_android_cronet':
+ if target.output_name is None:
+ raise Error('Failed to get output_name for libcronet name')
+ # .so file name needs to match with CronetLibraryLoader.java (e.g. libcronet.109.0.5386.0.so)
+ # So setting the output name based on the output_name from the desc.json
+ module.stem = 'lib' + target.output_name
+
# dep_name is an unmangled GN target name (e.g. //foo:bar(toolchain)).
# Currently, only one module is generated from target even target has multiple toolchains.
# And module is generated based on the first visited target.