Merge changes Idc0f61a5,I678779c2,I28bbe094

* changes:
  gn2bp: Add cronet_package to update_results.sh
  gn2bp: Fix parsing java sources for multi-arch
  gn2bp: Convert `source_set` with rtti to static_libraries
This commit is contained in:
Patrick Rohr
2022-11-23 03:41:29 +00:00
committed by Gerrit Code Review
4 changed files with 1056 additions and 245 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -127,9 +127,6 @@ additional_args = {
'cronet_aml_net_third_party_quiche_quiche',
'cronet_aml_crypto_crypto',
}),
# When a code is compiled under rtti(cronet) that depends on another code(net)
# that doesn't depend on rtti. undefined symbol: typeinfo 'class' errors appears.
('rtti', True), # go/undefined-symbol-typeinfo
],
}
@@ -967,8 +964,6 @@ def set_module_flags(module, cflags, defines):
for flag in cflags:
if '-std=' in flag:
module.cpp_std = flag[len('-std='):]
if '-frtti' in flag:
module.rtti = True
if '-fexceptions' in flag:
module.cppflags.add('-fexceptions')
@@ -1072,6 +1067,8 @@ def create_modules_from_target(blueprint, gn, gn_target_name):
for src in arch.sources
if is_supported_source_file(src) and not src.startswith("//out/test"))
module.rtti = target.rtti
if target.type in gn_utils.LINKER_UNIT_TYPES:
set_module_flags(module, target.cflags, target.defines)
set_module_include_dirs(module, target.cflags, target.include_dirs)

View File

@@ -36,8 +36,9 @@ ODR_VIOLATION_IGNORE_TARGETS = {
'//test/cts:perfetto_cts_deps',
'//:perfetto_integrationtests',
}
ARCH_REGEX = r'(android_x86_64|android_x86|android_arm|android_arm64|host)'
DEX_REGEX = '.*__dex__%s$' % ARCH_REGEX
COMPILE_JAVA_REGEX = '.*__compile_java__%s$' % ARCH_REGEX
def repo_root():
"""Returns an absolute path to the repository root."""
return os.path.join(
@@ -144,6 +145,7 @@ class GnParser(object):
self.source_set_deps = set() # Transitive set of source_set deps.
self.proto_deps = set()
self.transitive_proto_deps = set()
self.rtti = False
# TODO: come up with a better way to only run this once.
# is_finalized tracks whether finalize() was called on this target.
@@ -346,7 +348,10 @@ class GnParser(object):
target.ldflags.update(desc.get('ldflags', []))
target.arch[arch].defines.update(desc.get('defines', []))
target.arch[arch].include_dirs.update(desc.get('include_dirs', []))
if "-frtti" in target.arch[arch].cflags:
target.rtti = True
if target.type == "source_set":
target.type = "static_library"
# Recurse in dependencies.
for gn_dep_name in desc.get('deps', []):
dep = self.parse_gn_desc(gn_desc, gn_dep_name)
@@ -357,6 +362,9 @@ class GnParser(object):
target.transitive_proto_deps.update(dep.transitive_proto_deps)
elif dep.type == 'source_set':
target.source_set_deps.add(dep.name)
if "-frtti" in target.arch[arch].cflags:
# This must not be propagated upward as it effects all of the dependencies
target.arch[arch].cflags -= {"-frtti"}
target.update(dep, arch) # Bubble up source set's cflags/ldflags etc.
elif dep.type == 'group':
target.update(dep, arch) # Bubble up groups's cflags/ldflags etc.
@@ -369,6 +377,7 @@ class GnParser(object):
# Explicitly break dependency chain when a java_group is added.
# Java sources are collected and eventually compiled as one large
# java_library.
#print(dep.name, target.deps)
pass
if dep.type == 'static_library':
@@ -387,10 +396,11 @@ class GnParser(object):
# dependency of the __dex target)
# Note: this skips prebuilt java dependencies. These will have to be
# added manually when building the jar.
if re.match('.*__dex$', target.name):
if re.match('.*__compile_java$', dep.name):
if re.match(DEX_REGEX, target.name):
if re.match(COMPILE_JAVA_REGEX, dep.name):
log.debug('Adding java sources for %s', dep.name)
java_srcs = [src for src in dep.inputs if os.path.splitext(src)[1] == '.java']
java_srcs = [src for src in dep.inputs
if os.path.splitext(src)[1] == '.java' and not src.startswith("//out/test/gen/")]
self.java_sources.update(java_srcs)
return target

View File

@@ -13,6 +13,7 @@ set -eux
TARGETS=(
"//components/cronet/android:cronet"
"//components/cronet:cronet_package"
)
BASEDIR=$(dirname "$0")