Merge changes Ic8ee9c87,If0193d54,Iab86261a,Ic7b7eb85,I72bbbec7, ...

* changes:
  gn2bp: target.name does not include toolchain anymore
  gn2bp: remove unused toolchain property
  gn2bp: fix host and device support properties
  gn2bp: add device_supported property
  gn2bp: use proper target annotation
  gn2bp: toolchain propery is always present
This commit is contained in:
Motomu Utsumi
2022-11-16 07:09:05 +00:00
committed by Gerrit Code Review
3 changed files with 74 additions and 50 deletions

View File

@@ -117,6 +117,7 @@ genrule {
// GN: //base/allocator/partition_allocator:partition_alloc // GN: //base/allocator/partition_allocator:partition_alloc
cc_library_static { cc_library_static {
name: "cronet_aml_base_allocator_partition_allocator_partition_alloc", name: "cronet_aml_base_allocator_partition_allocator_partition_alloc",
host_supported: true,
generated_headers: [ generated_headers: [
"cronet_aml_base_allocator_partition_allocator_chromecast_buildflags", "cronet_aml_base_allocator_partition_allocator_chromecast_buildflags",
"cronet_aml_base_allocator_partition_allocator_chromeos_buildflags", "cronet_aml_base_allocator_partition_allocator_chromeos_buildflags",
@@ -166,9 +167,9 @@ cc_library_static {
"buildtools/third_party/libc++/trunk/include", "buildtools/third_party/libc++/trunk/include",
"buildtools/third_party/libc++abi/trunk/include", "buildtools/third_party/libc++abi/trunk/include",
"third_party/android_ndk/sources/android/cpufeatures/", "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/x86_64-linux-gnu",
"build/linux/debian_bullseye_amd64-sysroot/usr/include", "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", cpp_std: "c++20",
arch: { arch: {
@@ -844,10 +845,6 @@ cc_library_static {
"base/version.cc", "base/version.cc",
"base/vlog.cc", "base/vlog.cc",
], ],
shared_libs: [
"libandroid",
"liblog",
],
static_libs: [ static_libs: [
"cronet_aml_base_allocator_partition_allocator_partition_alloc", "cronet_aml_base_allocator_partition_allocator_partition_alloc",
"cronet_aml_base_base_static", "cronet_aml_base_base_static",
@@ -862,6 +859,7 @@ cc_library_static {
"cronet_aml_third_party_libevent_libevent", "cronet_aml_third_party_libevent_libevent",
"cronet_aml_third_party_modp_b64_modp_b64", "cronet_aml_third_party_modp_b64_modp_b64",
], ],
host_supported: true,
generated_headers: [ generated_headers: [
"cronet_aml_base_allocator_buildflags", "cronet_aml_base_allocator_buildflags",
"cronet_aml_base_allocator_partition_allocator_chromecast_buildflags", "cronet_aml_base_allocator_partition_allocator_chromecast_buildflags",
@@ -970,14 +968,22 @@ cc_library_static {
"third_party/boringssl/src/include/", "third_party/boringssl/src/include/",
"third_party/icu/source/common/", "third_party/icu/source/common/",
"third_party/icu/source/i18n/", "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/x86_64-linux-gnu",
"build/linux/debian_bullseye_amd64-sysroot/usr/include", "build/linux/debian_bullseye_amd64-sysroot/usr/include",
"third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
], ],
header_libs: [ header_libs: [
"jni_headers", "jni_headers",
], ],
cpp_std: "c++20", cpp_std: "c++20",
target: {
android: {
shared_libs: [
"libandroid",
"liblog",
],
},
},
} }
// GN: //base:base_jni_headers // GN: //base:base_jni_headers
@@ -1251,6 +1257,7 @@ cc_library_static {
srcs: [ srcs: [
"base/base_switches.cc", "base/base_switches.cc",
], ],
host_supported: true,
generated_headers: [ generated_headers: [
"cronet_aml_build_chromeos_buildflags", "cronet_aml_build_chromeos_buildflags",
], ],
@@ -1289,9 +1296,9 @@ cc_library_static {
"buildtools/third_party/libc++/", "buildtools/third_party/libc++/",
"buildtools/third_party/libc++/trunk/include", "buildtools/third_party/libc++/trunk/include",
"buildtools/third_party/libc++abi/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/x86_64-linux-gnu",
"build/linux/debian_bullseye_amd64-sysroot/usr/include", "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", cpp_std: "c++20",
} }
@@ -1587,6 +1594,7 @@ cc_library_static {
"base/third_party/double_conversion/double-conversion/string-to-double.cc", "base/third_party/double_conversion/double-conversion/string-to-double.cc",
"base/third_party/double_conversion/double-conversion/strtod.cc", "base/third_party/double_conversion/double-conversion/strtod.cc",
], ],
host_supported: true,
defaults: [ defaults: [
"cronet_aml_defaults", "cronet_aml_defaults",
], ],
@@ -1619,9 +1627,9 @@ cc_library_static {
"buildtools/third_party/libc++/", "buildtools/third_party/libc++/",
"buildtools/third_party/libc++/trunk/include", "buildtools/third_party/libc++/trunk/include",
"buildtools/third_party/libc++abi/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/x86_64-linux-gnu",
"build/linux/debian_bullseye_amd64-sysroot/usr/include", "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", cpp_std: "c++20",
} }
@@ -1632,6 +1640,7 @@ cc_library_static {
srcs: [ srcs: [
"base/third_party/dynamic_annotations/dynamic_annotations.c", "base/third_party/dynamic_annotations/dynamic_annotations.c",
], ],
host_supported: true,
defaults: [ defaults: [
"cronet_aml_defaults", "cronet_aml_defaults",
], ],
@@ -1662,9 +1671,9 @@ cc_library_static {
"buildtools/third_party/libc++/", "buildtools/third_party/libc++/",
"buildtools/third_party/libc++/trunk/include", "buildtools/third_party/libc++/trunk/include",
"buildtools/third_party/libc++abi/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/x86_64-linux-gnu",
"build/linux/debian_bullseye_amd64-sysroot/usr/include", "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", cpp_std: "c++20",
} }
@@ -1676,6 +1685,8 @@ cc_library_static {
"base/third_party/symbolize/demangle.cc", "base/third_party/symbolize/demangle.cc",
"base/third_party/symbolize/symbolize.cc", "base/third_party/symbolize/symbolize.cc",
], ],
host_supported: true,
device_supported: false,
defaults: [ defaults: [
"cronet_aml_defaults", "cronet_aml_defaults",
], ],
@@ -1724,6 +1735,8 @@ cc_library_static {
"base/third_party/xdg_mime/xdgmimemagic.c", "base/third_party/xdg_mime/xdgmimemagic.c",
"base/third_party/xdg_mime/xdgmimeparent.c", "base/third_party/xdg_mime/xdgmimeparent.c",
], ],
host_supported: true,
device_supported: false,
defaults: [ defaults: [
"cronet_aml_defaults", "cronet_aml_defaults",
], ],
@@ -1764,6 +1777,8 @@ cc_library_static {
srcs: [ srcs: [
"base/third_party/xdg_user_dirs/xdg_user_dir_lookup.cc", "base/third_party/xdg_user_dirs/xdg_user_dir_lookup.cc",
], ],
host_supported: true,
device_supported: false,
defaults: [ defaults: [
"cronet_aml_defaults", "cronet_aml_defaults",
], ],
@@ -2562,10 +2577,6 @@ cc_library_static {
"crypto/unexportable_key.cc", "crypto/unexportable_key.cc",
"crypto/unexportable_key_metrics.cc", "crypto/unexportable_key_metrics.cc",
], ],
shared_libs: [
"libandroid",
"liblog",
],
static_libs: [ static_libs: [
"cronet_aml_base_allocator_partition_allocator_partition_alloc", "cronet_aml_base_allocator_partition_allocator_partition_alloc",
"cronet_aml_base_base", "cronet_aml_base_base",
@@ -2581,6 +2592,7 @@ cc_library_static {
"cronet_aml_third_party_libevent_libevent", "cronet_aml_third_party_libevent_libevent",
"cronet_aml_third_party_modp_b64_modp_b64", "cronet_aml_third_party_modp_b64_modp_b64",
], ],
host_supported: true,
generated_headers: [ generated_headers: [
"cronet_aml_build_chromeos_buildflags", "cronet_aml_build_chromeos_buildflags",
"cronet_aml_components_nacl_common_buildflags", "cronet_aml_components_nacl_common_buildflags",
@@ -2628,11 +2640,19 @@ cc_library_static {
"buildtools/third_party/libc++abi/trunk/include", "buildtools/third_party/libc++abi/trunk/include",
"third_party/abseil-cpp/", "third_party/abseil-cpp/",
"third_party/boringssl/src/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/x86_64-linux-gnu",
"build/linux/debian_bullseye_amd64-sysroot/usr/include", "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", cpp_std: "c++20",
target: {
android: {
shared_libs: [
"libandroid",
"liblog",
],
},
},
} }
// GN: //gn:default_deps // GN: //gn:default_deps
@@ -5126,6 +5146,7 @@ filegroup {
// GN: //third_party/boringssl:boringssl // GN: //third_party/boringssl:boringssl
cc_library_static { cc_library_static {
name: "cronet_aml_third_party_boringssl_boringssl", name: "cronet_aml_third_party_boringssl_boringssl",
host_supported: true,
defaults: [ defaults: [
"cronet_aml_defaults", "cronet_aml_defaults",
], ],
@@ -5163,9 +5184,9 @@ cc_library_static {
"buildtools/third_party/libc++/trunk/include", "buildtools/third_party/libc++/trunk/include",
"buildtools/third_party/libc++abi/trunk/include", "buildtools/third_party/libc++abi/trunk/include",
"third_party/boringssl/src/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/x86_64-linux-gnu",
"build/linux/debian_bullseye_amd64-sysroot/usr/include", "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", cpp_std: "c++20",
arch: { arch: {
@@ -5743,9 +5764,9 @@ filegroup {
], ],
} }
// GN: //third_party/boringssl:boringssl_asm // GN: //third_party/boringssl:boringssl_asm(//build/toolchain/android:android_clang_x86)
filegroup { 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: [ srcs: [
"third_party/boringssl/linux-x86_64/crypto/chacha/chacha-x86_64.S", "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", "third_party/boringssl/linux-x86_64/crypto/cipher_extra/aes128gcmsiv-x86_64.S",
@@ -6115,6 +6136,7 @@ cc_library_static {
static_libs: [ static_libs: [
"cronet_aml_third_party_icu_icuuc_private", "cronet_aml_third_party_icu_icuuc_private",
], ],
host_supported: true,
defaults: [ defaults: [
"cronet_aml_defaults", "cronet_aml_defaults",
], ],
@@ -6159,9 +6181,9 @@ cc_library_static {
"buildtools/third_party/libc++abi/trunk/include", "buildtools/third_party/libc++abi/trunk/include",
"third_party/icu/source/common/", "third_party/icu/source/common/",
"third_party/icu/source/i18n/", "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/x86_64-linux-gnu",
"build/linux/debian_bullseye_amd64-sysroot/usr/include", "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", cpp_std: "c++20",
rtti: true, rtti: true,
@@ -6372,6 +6394,7 @@ cc_library_static {
"third_party/icu/source/common/wintz.cpp", "third_party/icu/source/common/wintz.cpp",
"third_party/icu/source/stubdata/stubdata.cpp", "third_party/icu/source/stubdata/stubdata.cpp",
], ],
host_supported: true,
defaults: [ defaults: [
"cronet_aml_defaults", "cronet_aml_defaults",
], ],
@@ -6419,9 +6442,9 @@ cc_library_static {
"buildtools/third_party/libc++abi/trunk/include", "buildtools/third_party/libc++abi/trunk/include",
"third_party/icu/source/common/", "third_party/icu/source/common/",
"third_party/icu/source/i18n/", "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/x86_64-linux-gnu",
"build/linux/debian_bullseye_amd64-sysroot/usr/include", "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", cpp_std: "c++20",
rtti: true, rtti: true,
@@ -6451,6 +6474,7 @@ cc_library_static {
"third_party/libevent/signal.c", "third_party/libevent/signal.c",
"third_party/libevent/strlcpy.c", "third_party/libevent/strlcpy.c",
], ],
host_supported: true,
defaults: [ defaults: [
"cronet_aml_defaults", "cronet_aml_defaults",
], ],
@@ -6484,9 +6508,9 @@ cc_library_static {
"buildtools/third_party/libc++abi/trunk/include", "buildtools/third_party/libc++abi/trunk/include",
"third_party/libevent/android/", "third_party/libevent/android/",
"third_party/libevent/linux/", "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/x86_64-linux-gnu",
"build/linux/debian_bullseye_amd64-sysroot/usr/include", "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", cpp_std: "c++20",
} }
@@ -6636,6 +6660,7 @@ cc_library_static {
srcs: [ srcs: [
"third_party/modp_b64/modp_b64.cc", "third_party/modp_b64/modp_b64.cc",
], ],
host_supported: true,
defaults: [ defaults: [
"cronet_aml_defaults", "cronet_aml_defaults",
], ],
@@ -6668,9 +6693,9 @@ cc_library_static {
"buildtools/third_party/libc++/", "buildtools/third_party/libc++/",
"buildtools/third_party/libc++/trunk/include", "buildtools/third_party/libc++/trunk/include",
"buildtools/third_party/libc++abi/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/x86_64-linux-gnu",
"build/linux/debian_bullseye_amd64-sysroot/usr/include", "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", cpp_std: "c++20",
} }
@@ -6701,6 +6726,7 @@ cc_library_static {
"third_party/zlib/uncompr.c", "third_party/zlib/uncompr.c",
"third_party/zlib/zutil.c", "third_party/zlib/zutil.c",
], ],
host_supported: true,
defaults: [ defaults: [
"cronet_aml_defaults", "cronet_aml_defaults",
], ],
@@ -6743,9 +6769,9 @@ cc_library_static {
"buildtools/third_party/libc++abi/trunk/include", "buildtools/third_party/libc++abi/trunk/include",
"third_party/android_ndk/sources/android/cpufeatures/", "third_party/android_ndk/sources/android/cpufeatures/",
"third_party/zlib/", "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/x86_64-linux-gnu",
"build/linux/debian_bullseye_amd64-sysroot/usr/include", "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", cpp_std: "c++20",
} }

View File

@@ -339,7 +339,7 @@ class Module(object):
self.gn_target = gn_target self.gn_target = gn_target
self.name = name self.name = name
self.srcs = set() self.srcs = set()
self.comment = 'GN: ' + gn_utils.label_without_toolchain(gn_target) self.comment = 'GN: ' + gn_target
self.shared_libs = set() self.shared_libs = set()
self.static_libs = set() self.static_libs = set()
self.whole_static_libs = set() self.whole_static_libs = set()
@@ -347,6 +347,7 @@ class Module(object):
self.tools = set() self.tools = set()
self.cmd = None self.cmd = None
self.host_supported = False self.host_supported = False
self.device_supported = True
self.vendor_available = False self.vendor_available = False
self.init_rc = set() self.init_rc = set()
self.out = set() self.out = set()
@@ -400,6 +401,8 @@ class Module(object):
self._output_field(output, 'cmd', sort=False) self._output_field(output, 'cmd', sort=False)
if self.host_supported: if self.host_supported:
self._output_field(output, 'host_supported') self._output_field(output, 'host_supported')
if not self.device_supported:
self._output_field(output, 'device_supported')
if self.vendor_available: if self.vendor_available:
self._output_field(output, 'vendor_available') self._output_field(output, 'vendor_available')
self._output_field(output, 'init_rc') self._output_field(output, 'init_rc')
@@ -488,11 +491,7 @@ class Blueprint(object):
def label_to_module_name(label): def label_to_module_name(label):
"""Turn a GN label (e.g., //:perfetto_tests) into a module name.""" """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 module = re.sub(r'^//:?', '', label)
# 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'[^a-zA-Z0-9_]', '_', module) 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. # If it's required to support multi toolchain for more targets, it's better to avoid hardcoding.
@@ -1068,13 +1067,11 @@ def create_modules_from_target(blueprint, gn, gn_target_name):
target = gn.get_target(gn_target_name) target = gn.get_target(gn_target_name)
log.info('create modules for %s (%s)', target.name, target.type) 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.type == 'executable':
if target.toolchain == gn_utils.HOST_TOOLCHAIN: if target.testonly:
module_type = 'cc_binary_host'
elif target.testonly:
module_type = 'cc_test' module_type = 'cc_test'
else: else:
# Can be used for both host and device targets.
module_type = 'cc_binary' module_type = 'cc_binary'
module = Module(module_type, bp_module_name, gn_target_name) module = Module(module_type, bp_module_name, gn_target_name)
elif target.type == 'static_library': elif target.type == 'static_library':
@@ -1094,10 +1091,10 @@ def create_modules_from_target(blueprint, gn, gn_target_name):
elif target.type == 'action': elif target.type == 'action':
if 'gen_amalgamated_sql_metrics' in target.name: if 'gen_amalgamated_sql_metrics' in target.name:
module = create_amalgamated_sql_metrics_module(blueprint, target) 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) module = create_cc_proto_descriptor_module(blueprint, target)
elif target.type == 'action' and \ 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) module = create_gen_version_module(blueprint, target, bp_module_name)
else: else:
module = create_action_module(blueprint, target) module = create_action_module(blueprint, target)
@@ -1116,7 +1113,6 @@ def create_modules_from_target(blueprint, gn, gn_target_name):
raise Error('Unknown target %s (%s)' % (target.name, target.type)) raise Error('Unknown target %s (%s)' % (target.name, target.type))
blueprint.add_module(module) blueprint.add_module(module)
module.host_supported = (name_without_toolchain in target_host_supported)
module.init_rc = target_initrc.get(target.name, []) module.init_rc = target_initrc.get(target.name, [])
module.srcs.update( module.srcs.update(
gn_utils.label_to_path(src) gn_utils.label_to_path(src)
@@ -1160,6 +1156,9 @@ def create_modules_from_target(blueprint, gn, gn_target_name):
module_is_compiled = module.type not in ('genrule', 'filegroup') module_is_compiled = module.type not in ('genrule', 'filegroup')
if module_is_compiled: if module_is_compiled:
module.host_supported = target.host_supported()
module.device_supported = target.device_supported()
# Don't try to inject library/source dependencies into genrules or # Don't try to inject library/source dependencies into genrules or
# filegroups because they are not compiled in the traditional sense. # filegroups because they are not compiled in the traditional sense.
module.defaults = [defaults_module] module.defaults = [defaults_module]
@@ -1191,8 +1190,8 @@ def create_modules_from_target(blueprint, gn, gn_target_name):
for dep_name in all_deps: for dep_name in all_deps:
# |builtin_deps| override GN deps with Android-specific ones. See the # |builtin_deps| override GN deps with Android-specific ones. See the
# config in the top of this file. # config in the top of this file.
if gn_utils.label_without_toolchain(dep_name) in builtin_deps: if dep_name in builtin_deps:
builtin_deps[gn_utils.label_without_toolchain(dep_name)](module) builtin_deps[dep_name](module)
continue continue
dep_module = create_modules_from_target(blueprint, gn, dep_name) dep_module = create_modules_from_target(blueprint, gn, dep_name)

View File

@@ -29,8 +29,6 @@ import sys
BUILDFLAGS_TARGET = '//gn:gen_buildflags' BUILDFLAGS_TARGET = '//gn:gen_buildflags'
GEN_VERSION_TARGET = '//src/base:version_gen_h' GEN_VERSION_TARGET = '//src/base:version_gen_h'
TARGET_TOOLCHAIN = '//gn/standalone/toolchain:gcc_like_host'
HOST_TOOLCHAIN = '//gn/standalone/toolchain:gcc_like_host'
LINKER_UNIT_TYPES = ('executable', 'shared_library', 'static_library') LINKER_UNIT_TYPES = ('executable', 'shared_library', 'static_library')
# TODO(primiano): investigate these, they require further componentization. # TODO(primiano): investigate these, they require further componentization.
@@ -155,6 +153,12 @@ class GnParser(object):
self.is_finalized = False self.is_finalized = False
self.arch = dict() self.arch = dict()
def host_supported(self):
return 'host' in self.arch
def device_supported(self):
return any([name.startswith('android') for name in self.arch.keys()])
def __lt__(self, other): def __lt__(self, other):
if isinstance(other, self.__class__): if isinstance(other, self.__class__):
return self.name < other.name return self.name < other.name
@@ -223,17 +227,14 @@ class GnParser(object):
return target.type == 'group' and re.match('.*_java$', target.name) return target.type == 'group' and re.match('.*_java$', target.name)
def _get_arch(self, toolchain): def _get_arch(self, toolchain):
if toolchain is None: if toolchain == '//build/toolchain/android:android_clang_x86':
# TODO: throw an exception instead of defaulting to x86_64. return 'android_x86'
return 'x86_64'
elif toolchain == '//build/toolchain/android:android_clang_x86':
return 'x86'
elif toolchain == '//build/toolchain/android:android_clang_x64': elif toolchain == '//build/toolchain/android:android_clang_x64':
return 'x86_64' return 'android_x86_64'
elif toolchain == '//build/toolchain/android:android_clang_arm': elif toolchain == '//build/toolchain/android:android_clang_arm':
return 'arm' return 'android_arm'
elif toolchain == '//build/toolchain/android:android_clang_arm64': elif toolchain == '//build/toolchain/android:android_clang_arm64':
return 'arm64' return 'android_arm64'
else: else:
return 'host' return 'host'
@@ -259,7 +260,7 @@ class GnParser(object):
target_name = label_without_toolchain(gn_target_name) target_name = label_without_toolchain(gn_target_name)
target = self.all_targets.get(target_name) target = self.all_targets.get(target_name)
desc = gn_desc[gn_target_name] desc = gn_desc[gn_target_name]
arch = self._get_arch(desc.get('toolchain', None)) arch = self._get_arch(desc['toolchain'])
if target is None: if target is None:
target = GnParser.Target(target_name, desc['type']) target = GnParser.Target(target_name, desc['type'])
self.all_targets[target_name] = target self.all_targets[target_name] = target
@@ -270,8 +271,6 @@ class GnParser(object):
return target # Target already processed. return target # Target already processed.
target.testonly = desc.get('testonly', False) target.testonly = desc.get('testonly', False)
# TODO: remove toolchain from Target object
target.toolchain = desc.get('toolchain', None)
proto_target_type, proto_desc = self.get_proto_target_type(gn_desc, gn_target_name) proto_target_type, proto_desc = self.get_proto_target_type(gn_desc, gn_target_name)
if proto_target_type is not None: if proto_target_type is not None: