dart-sdk/runtime/configs.gni
Martin Kustermann 21222b64c4 Revert "[vm] Build dart2native dependencies with the normal "create_sdk" target"
This reverts commit a88a328b7f.

Reason for revert: Auto roller hasn't rolled previous changes from
Dart yet. Those changes updated DEPS for icu/boringssl. We have to
wait with this CL until the DEPS changes have been done in the engine.

Original change's description:
> [vm] Build dart2native dependencies with the normal "create_sdk" target
> 
> This removes special logic for creating the `dart-sdk` we distribute
> which used to build release and product mode and copied some binaries
> from the latter into the former, before the SDK was actuallly ready to
> test and distribute.
> 
> This changes the GN build rules to build the necessary
> gen_snapshot/dart_precompiled_runtime product binaries during the normal
> release build.
> 
> Normally during --mode=product builds the global build config in
> //build/config/BUILDCONFIG.gn will set `-fvisibility=false`.
> 
> => Doing so results in much smaller binaries - because only explicitly
>    exported symbols are visible, the rest can be tree shaken by the linker.
> 
> Since we are building --mode=release, the `-fvisibility=false` will not
> be set. In order to set the flag for the 2 special product-mode binaries
> we need to add -fvisibility=hidden manually, in:
> 
>   * dart_product_config: Which is used for compiling VM sources.
>   * 3rd party double-conversion library
>   * 3rd party boringssl library
>   * 3rd party icu library
> 
> The upstream CLs are:
> 
>   * BoringSSL: https://dart-review.googlesource.com/c/boringssl_gen/+/150482
>   * ICU: https://chromium-review.googlesource.com/c/chromium/deps/icu/+/2236407
> 
> Issue https://github.com/dart-lang/sdk/issues/42230
> 
> Change-Id: I3e47664d9fadb9ed1ad033bb17d46e769442f741
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150524
> Commit-Queue: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Alexander Thomas <athom@google.com>
> Reviewed-by: Zach Anderson <zra@google.com>

TBR=kustermann@google.com,zra@google.com,athom@google.com,asiva@google.com

Change-Id: Ied0f2f5b58dceb2b59bc2ac6e11e5fd717c8885e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151382
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-06-16 10:41:27 +00:00

255 lines
7 KiB
Plaintext

# Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
_dart_runtime = get_path_info("../runtime", "abspath")
_base_config = [
"$_dart_runtime:dart_arch_config",
"$_dart_runtime:dart_config",
"$_dart_runtime:dart_os_config",
]
_base_fuchsia_config = [
"$_dart_runtime:dart_arch_config",
"$_dart_runtime:dart_config",
"$_dart_runtime:dart_os_fuchsia_config",
]
_base_host_targeting_host_config = [ "$_dart_runtime:dart_config" ]
_maybe_product = [ "$_dart_runtime:dart_maybe_product_config" ]
_product = [ "$_dart_runtime:dart_product_config" ]
_jit_config = _base_config + _maybe_product
_jit_product_config = _base_config + _product
_base_libfuzzer_config = [ "$_dart_runtime:dart_libfuzzer_config" ]
_libfuzzer_config = _base_config + _base_libfuzzer_config
_precompiled_runtime_config =
_base_config + [
"$_dart_runtime:dart_maybe_product_config",
"$_dart_runtime:dart_precompiled_runtime_config",
]
_precompiled_runtime_product_config =
_base_config + [
"$_dart_runtime:dart_precompiled_runtime_config",
"$_dart_runtime:dart_product_config",
]
_precompiler_base = [ "$_dart_runtime:dart_precompiler_config" ]
_precompiler_config = _base_config + _precompiler_base + _maybe_product
_precompiler_product_config = _base_config + _precompiler_base + _product
_precompiler_fuchsia_config =
_base_fuchsia_config + _precompiler_base + _maybe_product
_precompiler_product_fuchsia_config =
_base_fuchsia_config + _precompiler_base + _product
_precompiler_host_targeting_host_config =
_base_host_targeting_host_config + _precompiler_base + _maybe_product
_precompiler_product_host_targeting_host_config =
_base_host_targeting_host_config + _precompiler_base + _product
_all_configs = [
{
suffix = "_jit"
configs = _jit_config
snapshot = true
compiler = true
},
{
suffix = "_jit_product"
configs = _jit_product_config
snapshot = true
compiler = true
},
{
suffix = "_precompiled_runtime"
configs = _precompiled_runtime_config
snapshot = true
compiler = false
},
{
suffix = "_precompiled_runtime_product"
configs = _precompiled_runtime_product_config
snapshot = true
compiler = false
},
{
suffix = "_precompiler"
configs = _precompiler_config
snapshot = false
compiler = true
},
{
suffix = "_precompiler_product"
configs = _precompiler_product_config
snapshot = false
compiler = true
},
{
suffix = "_precompiler_fuchsia"
configs = _precompiler_fuchsia_config
snapshot = false
compiler = true
},
{
suffix = "_precompiler_product_fuchsia"
configs = _precompiler_product_fuchsia_config
snapshot = false
compiler = true
},
{
suffix = "_precompiler_host_targeting_host"
configs = _precompiler_host_targeting_host_config
snapshot = false
compiler = true
},
{
suffix = "_precompiler_product_host_targeting_host"
configs = _precompiler_product_host_targeting_host_config
snapshot = false
compiler = true
},
{
suffix = "_libfuzzer"
configs = _libfuzzer_config
snapshot = true
compiler = true
},
]
# This template creates a target for each of the configurations listed above.
# For example:
#
# library_for_all_configs("libfoo") {
# target_type = "source_set"
# sources = [ "foo.c" ]
# configurable_deps [ ":libbar" ]
# }
#
# will make a source_set target for libfoo_jit, libfoo_jit_product, etc. that
# depends on libbar_jit, libbar_jit_product etc. respectively.
#
# Parameters
#
# target_type (required):
# The target declaration or template to repeat for each configuration.
#
# configurable_deps (optional):
# Dependencies of this target, which are themselves generated by
# library_for_all_configs(). The listed dependencies will be suffixed with
# a string that matches the configuration.
#
# extra_deps (optional):
# Regular additional deps that don't receive special treatment.
#
# extra_configs (optional):
# Any configs needed in addition to the ones above.
#
# snapshot_sources (optional):
# Additional sources to include when the configuration has a snapshot.
#
template("library_for_all_configs") {
assert(defined(invoker.target_type))
extra_configs = []
if (defined(invoker.extra_configs)) {
extra_configs += invoker.extra_configs
}
configurable_deps = []
if (defined(invoker.configurable_deps)) {
configurable_deps += invoker.configurable_deps
}
extra_deps = []
if (defined(invoker.extra_deps)) {
extra_deps += invoker.extra_deps
}
foreach(conf, _all_configs) {
target(invoker.target_type, "${target_name}${conf.suffix}") {
forward_variables_from(invoker,
"*",
[
"extra_configs",
"extra_deps",
"configurable_deps",
])
configs += conf.configs + extra_configs
configured_deps = []
foreach(dep, configurable_deps) {
configured_deps += [ "${dep}${conf.suffix}" ]
}
if (defined(compiler_lib)) {
if (conf.compiler) {
configured_deps += [ "${compiler_lib}${conf.suffix}" ]
} else {
not_needed([ "compiler_lib" ])
}
}
deps = configured_deps + extra_deps
if (conf.snapshot) {
if (defined(snapshot_sources)) {
sources += snapshot_sources
}
} else {
if (defined(snapshot_sources)) {
not_needed([ "snapshot_sources" ])
}
}
}
}
}
template("library_for_all_configs_with_compiler") {
assert(defined(invoker.target_type))
extra_configs = []
if (defined(invoker.extra_configs)) {
extra_configs += invoker.extra_configs
}
configurable_deps = []
if (defined(invoker.configurable_deps)) {
configurable_deps += invoker.configurable_deps
}
extra_deps = []
if (defined(invoker.extra_deps)) {
extra_deps += invoker.extra_deps
}
foreach(conf, _all_configs) {
if (conf.compiler) {
target(invoker.target_type, "${target_name}${conf.suffix}") {
forward_variables_from(invoker,
"*",
[
"extra_configs",
"extra_deps",
"configurable_deps",
])
configs += conf.configs + extra_configs
configured_deps = []
foreach(dep, configurable_deps) {
configured_deps += [ "${dep}${conf.suffix}" ]
}
deps = configured_deps + extra_deps
if (conf.snapshot) {
if (defined(snapshot_sources)) {
sources += snapshot_sources
}
} else {
if (defined(snapshot_sources)) {
not_needed([ "snapshot_sources" ])
}
}
}
}
}
}