Skip to content

Commit

Permalink
[fuchsia] Add rules to build gen_snapshot targeting Fuchsia
Browse files Browse the repository at this point in the history
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 <[email protected]>
Commit-Queue: Zach Anderson <[email protected]>
  • Loading branch information
zanderso authored and [email protected] committed Mar 28, 2018
1 parent 2de8241 commit 0482cf4
Show file tree
Hide file tree
Showing 4 changed files with 222 additions and 27 deletions.
52 changes: 49 additions & 3 deletions runtime/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []

Expand Down Expand Up @@ -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" ]
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down
93 changes: 81 additions & 12 deletions runtime/bin/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
Expand Down Expand Up @@ -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") {
Expand All @@ -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) {
Expand Down Expand Up @@ -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",
Expand All @@ -400,14 +421,41 @@ 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",
"..:libdart_nosnapshot_with_precompiler_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") {
Expand All @@ -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 = []
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -1066,9 +1133,11 @@ if (is_fuchsia) {
":hello_fuchsia",
]

binaries = [ {
name = "hello_fuchsia.dart"
} ]
binaries = [
{
name = "hello_fuchsia.dart"
},
]
}
}

Expand Down
31 changes: 25 additions & 6 deletions runtime/platform/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
}
Expand All @@ -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",
]
}
Loading

0 comments on commit 0482cf4

Please sign in to comment.