From 0482cf4da151c81fce96d477d28c7885897a6fd0 Mon Sep 17 00:00:00 2001 From: Zach Anderson Date: Wed, 28 Mar 2018 19:39:49 +0000 Subject: [PATCH] [fuchsia] Add rules to build gen_snapshot targeting Fuchsia This change enables building a gen_snapshot that targets Fuchsia during an SDK build that targets the host (Mac, Linux). Change-Id: I4cfbcbe4e26e4be7108fc40c96122fe9a2fb4c19 Reviewed-on: https://dart-review.googlesource.com/48683 Reviewed-by: Ryan Macnak Commit-Queue: Zach Anderson --- runtime/BUILD.gn | 52 ++++++++++++++++++++-- runtime/bin/BUILD.gn | 93 ++++++++++++++++++++++++++++++++++----- runtime/platform/BUILD.gn | 31 ++++++++++--- runtime/vm/BUILD.gn | 73 +++++++++++++++++++++++++++--- 4 files changed, 222 insertions(+), 27 deletions(-) diff --git a/runtime/BUILD.gn b/runtime/BUILD.gn index 823a47eab4552..6fd1c7638f1aa 100644 --- a/runtime/BUILD.gn +++ b/runtime/BUILD.gn @@ -81,6 +81,13 @@ config("dart_os_config") { } } +# We need to build gen_snapshot targeting Fuchsia during a build of the SDK +# targeting Mac and Linux. This configuration is used to unconditionally target +# Fuchsia. It should not be combined with dart_os_config. +config("dart_os_fuchsia_config") { + defines = [ "TARGET_OS_FUCHSIA" ] +} + config("dart_arch_config") { defines = [] @@ -194,7 +201,6 @@ template("libdart_library") { configs += [ ":dart_arch_config", ":dart_config", - ":dart_os_config", ] + extra_configs if (is_fuchsia) { configs -= [ "//build/config:symbol_visibility_hidden" ] @@ -221,7 +227,10 @@ template("libdart_library") { } libdart_library("libdart_jit") { - extra_configs = [ ":dart_maybe_product_config" ] + extra_configs = [ + ":dart_maybe_product_config", + ":dart_os_config", + ] extra_deps = [ "platform:libdart_platform", "vm:libdart_lib_jit", @@ -230,7 +239,10 @@ libdart_library("libdart_jit") { } libdart_library("libdart_jit_product") { - extra_configs = [ ":dart_product_config" ] + extra_configs = [ + ":dart_product_config", + ":dart_os_config", + ] extra_deps = [ "platform:libdart_platform_product", "vm:libdart_lib_jit_product", @@ -242,6 +254,7 @@ libdart_library("libdart_precompiled_runtime") { extra_configs = [ ":dart_maybe_product_config", ":dart_precompiled_runtime_config", + ":dart_os_config", ] extra_deps = [ "platform:libdart_platform", @@ -254,6 +267,7 @@ libdart_library("libdart_precompiled_runtime_product") { extra_configs = [ ":dart_product_config", ":dart_precompiled_runtime_config", + ":dart_os_config", ] extra_deps = [ "platform:libdart_platform_product", @@ -267,6 +281,7 @@ libdart_library("libdart_nosnapshot_with_precompiler") { ":dart_maybe_product_config", ":dart_no_snapshot_config", ":dart_precompiler_config", + ":dart_os_config", ] extra_deps = [ "platform:libdart_platform", @@ -280,6 +295,7 @@ libdart_library("libdart_nosnapshot_with_precompiler_product") { ":dart_product_config", ":dart_no_snapshot_config", ":dart_precompiler_config", + ":dart_os_config", ] extra_deps = [ "platform:libdart_platform_product", @@ -288,10 +304,39 @@ libdart_library("libdart_nosnapshot_with_precompiler_product") { ] } +libdart_library("libdart_nosnapshot_with_precompiler_fuchsia") { + extra_configs = [ + ":dart_maybe_product_config", + ":dart_no_snapshot_config", + ":dart_precompiler_config", + ":dart_os_fuchsia_config", + ] + extra_deps = [ + "platform:libdart_platform_fuchsia", + "vm:libdart_lib_nosnapshot_with_precompiler_fuchsia", + "vm:libdart_vm_nosnapshot_with_precompiler_fuchsia", + ] +} + +libdart_library("libdart_nosnapshot_with_precompiler_product_fuchsia") { + extra_configs = [ + ":dart_product_config", + ":dart_no_snapshot_config", + ":dart_precompiler_config", + ":dart_os_fuchsia_config", + ] + extra_deps = [ + "platform:libdart_platform_product_fuchsia", + "vm:libdart_lib_nosnapshot_with_precompiler_product_fuchsia", + "vm:libdart_vm_nosnapshot_with_precompiler_product_fuchsia", + ] +} + libdart_library("libdart_with_precompiler") { extra_configs = [ ":dart_maybe_product_config", ":dart_precompiler_config", + ":dart_os_config", ] extra_deps = [ "platform:libdart_platform", @@ -304,6 +349,7 @@ libdart_library("libdart_with_precompiler_product") { extra_configs = [ ":dart_product_config", ":dart_precompiler_config", + ":dart_os_config", ] extra_deps = [ "platform:libdart_platform_product", diff --git a/runtime/bin/BUILD.gn b/runtime/bin/BUILD.gn index 4442c9239a182..4c8d9545c9c1b 100644 --- a/runtime/bin/BUILD.gn +++ b/runtime/bin/BUILD.gn @@ -247,7 +247,6 @@ template("build_libdart_builtin") { configs += [ "..:dart_arch_config", "..:dart_config", - "..:dart_os_config", ] + extra_configs if (is_fuchsia) { configs -= [ "//build/config:symbol_visibility_hidden" ] @@ -293,11 +292,31 @@ template("build_libdart_builtin") { } build_libdart_builtin("libdart_builtin") { - extra_configs = [ "..:dart_maybe_product_config" ] + extra_configs = [ + "..:dart_maybe_product_config", + "..:dart_os_config", + ] } build_libdart_builtin("libdart_builtin_product") { - extra_configs = [ "..:dart_product_config" ] + extra_configs = [ + "..:dart_product_config", + "..:dart_os_config", + ] +} + +build_libdart_builtin("libdart_builtin_fuchsia") { + extra_configs = [ + "..:dart_maybe_product_config", + "..:dart_os_fuchsia_config", + ] +} + +build_libdart_builtin("libdart_builtin_product_fuchsia") { + extra_configs = [ + "..:dart_product_config", + "..:dart_os_fuchsia_config", + ] } template("build_gen_snapshot") { @@ -313,7 +332,6 @@ template("build_gen_snapshot") { configs += [ "..:dart_arch_config", "..:dart_config", - "..:dart_os_config", "..:dart_precompiler_config", ] + extra_configs if (is_fuchsia) { @@ -391,7 +409,10 @@ template("build_gen_snapshot") { } build_gen_snapshot("gen_snapshot") { - extra_configs = [ "..:dart_maybe_product_config" ] + extra_configs = [ + "..:dart_maybe_product_config", + "..:dart_os_config", + ] extra_deps = [ ":gen_snapshot_dart_io", ":libdart_builtin", @@ -400,7 +421,10 @@ build_gen_snapshot("gen_snapshot") { } build_gen_snapshot("gen_snapshot_product") { - extra_configs = [ "..:dart_product_config" ] + extra_configs = [ + "..:dart_product_config", + "..:dart_os_config", + ] extra_deps = [ ":gen_snapshot_dart_io_product", ":libdart_builtin_product", @@ -408,6 +432,30 @@ build_gen_snapshot("gen_snapshot_product") { ] } +build_gen_snapshot("gen_snapshot_fuchsia") { + extra_configs = [ + "..:dart_maybe_product_config", + "..:dart_os_fuchsia_config", + ] + extra_deps = [ + ":gen_snapshot_dart_io_fuchsia", + ":libdart_builtin_fuchsia", + "..:libdart_nosnapshot_with_precompiler_fuchsia", + ] +} + +build_gen_snapshot("gen_snapshot_product_fuchsia") { + extra_configs = [ + "..:dart_product_config", + "..:dart_os_fuchsia_config", + ] + extra_deps = [ + ":gen_snapshot_dart_io_product_fuchsia", + ":libdart_builtin_product_fuchsia", + "..:libdart_nosnapshot_with_precompiler_product_fuchsia", + ] +} + # A source set for the implementation of 'dart:io' library # (without secure sockets) suitable for linking with gen_snapshot. template("build_gen_snapshot_dart_io") { @@ -419,7 +467,6 @@ template("build_gen_snapshot_dart_io") { configs += [ "..:dart_arch_config", "..:dart_config", - "..:dart_os_config", "..:dart_precompiler_config", ] + extra_configs deps = [] @@ -466,11 +513,31 @@ template("build_gen_snapshot_dart_io") { } build_gen_snapshot_dart_io("gen_snapshot_dart_io") { - extra_configs = [ "..:dart_maybe_product_config" ] + extra_configs = [ + "..:dart_maybe_product_config", + "..:dart_os_config", + ] } build_gen_snapshot_dart_io("gen_snapshot_dart_io_product") { - extra_configs = [ "..:dart_product_config" ] + extra_configs = [ + "..:dart_product_config", + "..:dart_os_config", + ] +} + +build_gen_snapshot_dart_io("gen_snapshot_dart_io_fuchsia") { + extra_configs = [ + "..:dart_maybe_product_config", + "..:dart_os_fuchsia_config", + ] +} + +build_gen_snapshot_dart_io("gen_snapshot_dart_io_product_fuchsia") { + extra_configs = [ + "..:dart_product_config", + "..:dart_os_fuchsia_config", + ] } # A source set for the implementation of 'dart:io' library. @@ -1066,9 +1133,11 @@ if (is_fuchsia) { ":hello_fuchsia", ] - binaries = [ { - name = "hello_fuchsia.dart" - } ] + binaries = [ + { + name = "hello_fuchsia.dart" + }, + ] } } diff --git a/runtime/platform/BUILD.gn b/runtime/platform/BUILD.gn index ae4e1df6e9872..32a93393a73a7 100644 --- a/runtime/platform/BUILD.gn +++ b/runtime/platform/BUILD.gn @@ -11,10 +11,9 @@ template("build_libdart_platform") { } static_library(target_name) { configs += [ - "..:dart_arch_config", - "..:dart_config", - "..:dart_os_config", - ] + extra_configs + "..:dart_arch_config", + "..:dart_config", + ] + extra_configs if (is_fuchsia) { configs -= [ "//build/config:symbol_visibility_hidden" ] } @@ -27,9 +26,29 @@ template("build_libdart_platform") { } build_libdart_platform("libdart_platform") { - extra_configs = [ "..:dart_maybe_product_config" ] + extra_configs = [ + "..:dart_maybe_product_config", + "..:dart_os_config", + ] } build_libdart_platform("libdart_platform_product") { - extra_configs = [ "..:dart_product_config" ] + extra_configs = [ + "..:dart_product_config", + "..:dart_os_config", + ] +} + +build_libdart_platform("libdart_platform_fuchsia") { + extra_configs = [ + "..:dart_maybe_product_config", + "..:dart_os_fuchsia_config", + ] +} + +build_libdart_platform("libdart_platform_product_fuchsia") { + extra_configs = [ + "..:dart_product_config", + "..:dart_os_fuchsia_config", + ] } diff --git a/runtime/vm/BUILD.gn b/runtime/vm/BUILD.gn index dc0a5b07214be..5c333da5c0fd5 100644 --- a/runtime/vm/BUILD.gn +++ b/runtime/vm/BUILD.gn @@ -64,7 +64,6 @@ template("build_libdart_vm") { configs += [ "..:dart_arch_config", "..:dart_config", - "..:dart_os_config", ] + extra_configs if (is_fuchsia) { configs -= [ "//build/config:symbol_visibility_hidden" ] @@ -91,17 +90,24 @@ template("build_libdart_vm") { } build_libdart_vm("libdart_vm_jit") { - extra_configs = [ "..:dart_maybe_product_config" ] + extra_configs = [ + "..:dart_maybe_product_config", + "..:dart_os_config", + ] } build_libdart_vm("libdart_vm_jit_product") { - extra_configs = [ "..:dart_product_config" ] + extra_configs = [ + "..:dart_product_config", + "..:dart_os_config", + ] } build_libdart_vm("libdart_vm_precompiled_runtime") { extra_configs = [ "..:dart_maybe_product_config", "..:dart_precompiled_runtime_config", + "..:dart_os_config", ] } @@ -109,6 +115,7 @@ build_libdart_vm("libdart_vm_precompiled_runtime_product") { extra_configs = [ "..:dart_product_config", "..:dart_precompiled_runtime_config", + "..:dart_os_config", ] } @@ -116,6 +123,7 @@ build_libdart_vm("libdart_vm_nosnapshot") { extra_configs = [ "..:dart_maybe_product_config", "..:dart_no_snapshot_config", + "..:dart_os_config", ] } @@ -124,6 +132,7 @@ build_libdart_vm("libdart_vm_nosnapshot_with_precompiler") { "..:dart_maybe_product_config", "..:dart_precompiler_config", "..:dart_no_snapshot_config", + "..:dart_os_config", ] } @@ -132,6 +141,25 @@ build_libdart_vm("libdart_vm_nosnapshot_with_precompiler_product") { "..:dart_product_config", "..:dart_precompiler_config", "..:dart_no_snapshot_config", + "..:dart_os_config", + ] +} + +build_libdart_vm("libdart_vm_nosnapshot_with_precompiler_fuchsia") { + extra_configs = [ + "..:dart_maybe_product_config", + "..:dart_precompiler_config", + "..:dart_no_snapshot_config", + "..:dart_os_fuchsia_config", + ] +} + +build_libdart_vm("libdart_vm_nosnapshot_with_precompiler_product_fuchsia") { + extra_configs = [ + "..:dart_product_config", + "..:dart_precompiler_config", + "..:dart_no_snapshot_config", + "..:dart_os_fuchsia_config", ] } @@ -139,6 +167,7 @@ build_libdart_vm("libdart_vm_with_precompiler") { extra_configs = [ "..:dart_maybe_product_config", "..:dart_precompiler_config", + "..:dart_os_config", ] } @@ -146,6 +175,7 @@ build_libdart_vm("libdart_vm_with_precompiler_product") { extra_configs = [ "..:dart_product_config", "..:dart_precompiler_config", + "..:dart_os_config", ] } @@ -212,7 +242,6 @@ template("build_libdart_lib") { configs += [ "..:dart_arch_config", "..:dart_config", - "..:dart_os_config", ] + extra_configs if (is_fuchsia) { configs -= [ "//build/config:symbol_visibility_hidden" ] @@ -276,6 +305,7 @@ template("generate_core_libraries") { extra_configs = [ "..:dart_maybe_product_config", "..:dart_precompiler_config", + "..:dart_os_config", ] extra_deps = libdeps extra_sources = all_libsources + [ "bootstrap.cc" ] + liboutputs @@ -285,6 +315,27 @@ template("generate_core_libraries") { extra_configs = [ "..:dart_product_config", "..:dart_precompiler_config", + "..:dart_os_config", + ] + extra_deps = libdeps + extra_sources = all_libsources + [ "bootstrap.cc" ] + liboutputs + } + + build_libdart_lib("libdart_lib_nosnapshot_with_precompiler_fuchsia") { + extra_configs = [ + "..:dart_maybe_product_config", + "..:dart_precompiler_config", + "..:dart_os_fuchsia_config", + ] + extra_deps = libdeps + extra_sources = all_libsources + [ "bootstrap.cc" ] + liboutputs + } + + build_libdart_lib("libdart_lib_nosnapshot_with_precompiler_product_fuchsia") { + extra_configs = [ + "..:dart_product_config", + "..:dart_precompiler_config", + "..:dart_os_fuchsia_config", ] extra_deps = libdeps extra_sources = all_libsources + [ "bootstrap.cc" ] + liboutputs @@ -294,6 +345,7 @@ template("generate_core_libraries") { extra_configs = [ "..:dart_maybe_product_config", "..:dart_precompiler_config", + "..:dart_os_config", ] extra_deps = libdeps extra_sources = all_libsources + [ "bootstrap_nocore.cc" ] @@ -303,18 +355,25 @@ template("generate_core_libraries") { extra_configs = [ "..:dart_product_config", "..:dart_precompiler_config", + "..:dart_os_config", ] extra_deps = libdeps extra_sources = all_libsources + [ "bootstrap_nocore.cc" ] } build_libdart_lib("libdart_lib_jit") { - extra_configs = [ "..:dart_maybe_product_config" ] + extra_configs = [ + "..:dart_maybe_product_config", + "..:dart_os_config", + ] extra_sources = all_libsources + [ "bootstrap_nocore.cc" ] } build_libdart_lib("libdart_lib_jit_product") { - extra_configs = [ "..:dart_product_config" ] + extra_configs = [ + "..:dart_product_config", + "..:dart_os_config", + ] extra_sources = all_libsources + [ "bootstrap_nocore.cc" ] } @@ -322,6 +381,7 @@ template("generate_core_libraries") { extra_configs = [ "..:dart_maybe_product_config", "..:dart_precompiled_runtime_config", + "..:dart_os_config", ] extra_sources = all_libsources + [ "bootstrap_nocore.cc" ] } @@ -330,6 +390,7 @@ template("generate_core_libraries") { extra_configs = [ "..:dart_product_config", "..:dart_precompiled_runtime_config", + "..:dart_os_config", ] extra_sources = all_libsources + [ "bootstrap_nocore.cc" ] }