gn2bp: target.name does not include toolchain anymore
Clean up use of label_without_toolchain which is now mostly unnecessary.
I am not sure why the Android.bp.swp changed on me. Something to look
into.
Test: //components/cronet/android:cronet
Change-Id: Ic8ee9c8796872a7221c54e4093c6b35c2363bf89
diff --git a/tools/gn2bp/Android.bp.swp b/tools/gn2bp/Android.bp.swp
index ff3fc0e..2821a8c 100644
--- a/tools/gn2bp/Android.bp.swp
+++ b/tools/gn2bp/Android.bp.swp
@@ -167,9 +167,9 @@
"buildtools/third_party/libc++/trunk/include",
"buildtools/third_party/libc++abi/trunk/include",
"third_party/android_ndk/sources/android/cpufeatures/",
+ "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
"build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
"build/linux/debian_bullseye_amd64-sysroot/usr/include",
- "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
],
cpp_std: "c++20",
arch: {
@@ -968,9 +968,9 @@
"third_party/boringssl/src/include/",
"third_party/icu/source/common/",
"third_party/icu/source/i18n/",
+ "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
"build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
"build/linux/debian_bullseye_amd64-sysroot/usr/include",
- "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
],
header_libs: [
"jni_headers",
@@ -1296,9 +1296,9 @@
"buildtools/third_party/libc++/",
"buildtools/third_party/libc++/trunk/include",
"buildtools/third_party/libc++abi/trunk/include",
+ "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
"build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
"build/linux/debian_bullseye_amd64-sysroot/usr/include",
- "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
],
cpp_std: "c++20",
}
@@ -1627,9 +1627,9 @@
"buildtools/third_party/libc++/",
"buildtools/third_party/libc++/trunk/include",
"buildtools/third_party/libc++abi/trunk/include",
+ "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
"build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
"build/linux/debian_bullseye_amd64-sysroot/usr/include",
- "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
],
cpp_std: "c++20",
}
@@ -1671,9 +1671,9 @@
"buildtools/third_party/libc++/",
"buildtools/third_party/libc++/trunk/include",
"buildtools/third_party/libc++abi/trunk/include",
+ "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
"build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
"build/linux/debian_bullseye_amd64-sysroot/usr/include",
- "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
],
cpp_std: "c++20",
}
@@ -2640,9 +2640,9 @@
"buildtools/third_party/libc++abi/trunk/include",
"third_party/abseil-cpp/",
"third_party/boringssl/src/include/",
+ "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
"build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
"build/linux/debian_bullseye_amd64-sysroot/usr/include",
- "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
],
cpp_std: "c++20",
target: {
@@ -5184,9 +5184,9 @@
"buildtools/third_party/libc++/trunk/include",
"buildtools/third_party/libc++abi/trunk/include",
"third_party/boringssl/src/include/",
+ "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
"build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
"build/linux/debian_bullseye_amd64-sysroot/usr/include",
- "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
],
cpp_std: "c++20",
arch: {
@@ -5764,9 +5764,9 @@
],
}
-// GN: //third_party/boringssl:boringssl_asm
+// GN: //third_party/boringssl:boringssl_asm(//build/toolchain/android:android_clang_x86)
filegroup {
- name: "cronet_aml_third_party_boringssl_boringssl_asm_x86",
+ name: "cronet_aml_third_party_boringssl_boringssl_asm___build_toolchain_android_android_clang_x86__x86",
srcs: [
"third_party/boringssl/linux-x86_64/crypto/chacha/chacha-x86_64.S",
"third_party/boringssl/linux-x86_64/crypto/cipher_extra/aes128gcmsiv-x86_64.S",
@@ -6181,9 +6181,9 @@
"buildtools/third_party/libc++abi/trunk/include",
"third_party/icu/source/common/",
"third_party/icu/source/i18n/",
+ "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
"build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
"build/linux/debian_bullseye_amd64-sysroot/usr/include",
- "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
],
cpp_std: "c++20",
rtti: true,
@@ -6442,9 +6442,9 @@
"buildtools/third_party/libc++abi/trunk/include",
"third_party/icu/source/common/",
"third_party/icu/source/i18n/",
+ "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
"build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
"build/linux/debian_bullseye_amd64-sysroot/usr/include",
- "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
],
cpp_std: "c++20",
rtti: true,
@@ -6508,9 +6508,9 @@
"buildtools/third_party/libc++abi/trunk/include",
"third_party/libevent/android/",
"third_party/libevent/linux/",
+ "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
"build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
"build/linux/debian_bullseye_amd64-sysroot/usr/include",
- "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
],
cpp_std: "c++20",
}
@@ -6693,9 +6693,9 @@
"buildtools/third_party/libc++/",
"buildtools/third_party/libc++/trunk/include",
"buildtools/third_party/libc++abi/trunk/include",
+ "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
"build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
"build/linux/debian_bullseye_amd64-sysroot/usr/include",
- "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
],
cpp_std: "c++20",
}
@@ -6769,9 +6769,9 @@
"buildtools/third_party/libc++abi/trunk/include",
"third_party/android_ndk/sources/android/cpufeatures/",
"third_party/zlib/",
+ "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
"build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
"build/linux/debian_bullseye_amd64-sysroot/usr/include",
- "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
],
cpp_std: "c++20",
}
diff --git a/tools/gn2bp/gen_android_bp b/tools/gn2bp/gen_android_bp
index ce6d1ac..2479813 100755
--- a/tools/gn2bp/gen_android_bp
+++ b/tools/gn2bp/gen_android_bp
@@ -339,7 +339,7 @@
self.gn_target = gn_target
self.name = name
self.srcs = set()
- self.comment = 'GN: ' + gn_utils.label_without_toolchain(gn_target)
+ self.comment = 'GN: ' + gn_target
self.shared_libs = set()
self.static_libs = set()
self.whole_static_libs = set()
@@ -491,11 +491,7 @@
def label_to_module_name(label):
"""Turn a GN label (e.g., //:perfetto_tests) into a module name."""
- # If the label is explicibly listed in the default target list, don't prefix
- # its name and return just the target name. This is so tools like
- # "traceconv" stay as such in the Android tree.
- label_without_toolchain = gn_utils.label_without_toolchain(label)
- module = re.sub(r'^//:?', '', label_without_toolchain)
+ module = re.sub(r'^//:?', '', label)
module = re.sub(r'[^a-zA-Z0-9_]', '_', module)
# If it's required to support multi toolchain for more targets, it's better to avoid hardcoding.
@@ -1071,7 +1067,6 @@
target = gn.get_target(gn_target_name)
log.info('create modules for %s (%s)', target.name, target.type)
- name_without_toolchain = gn_utils.label_without_toolchain(target.name)
if target.type == 'executable':
if target.testonly:
module_type = 'cc_test'
@@ -1096,10 +1091,10 @@
elif target.type == 'action':
if 'gen_amalgamated_sql_metrics' in target.name:
module = create_amalgamated_sql_metrics_module(blueprint, target)
- elif re.match('.*gen_cc_.*_descriptor$', name_without_toolchain):
+ elif re.match('.*gen_cc_.*_descriptor$', target.name):
module = create_cc_proto_descriptor_module(blueprint, target)
elif target.type == 'action' and \
- name_without_toolchain == gn_utils.GEN_VERSION_TARGET:
+ target.name == gn_utils.GEN_VERSION_TARGET:
module = create_gen_version_module(blueprint, target, bp_module_name)
else:
module = create_action_module(blueprint, target)
@@ -1195,8 +1190,8 @@
for dep_name in all_deps:
# |builtin_deps| override GN deps with Android-specific ones. See the
# config in the top of this file.
- if gn_utils.label_without_toolchain(dep_name) in builtin_deps:
- builtin_deps[gn_utils.label_without_toolchain(dep_name)](module)
+ if dep_name in builtin_deps:
+ builtin_deps[dep_name](module)
continue
dep_module = create_modules_from_target(blueprint, gn, dep_name)