dart-sdk/BUILD.gn
Aske Simon Christensen 6c7604291c [dart2wasm] Build platform dill and compile dart2wasm to AOT snapshots
This adds a --platform= option to dart2wasm to read the SDK libraries
from that dill file instead of compiling them from source every time.
If the option is not given, the SDK libraries are compiled, like before.

Also adds a "dart2wasm" build target, which will build the dart2wasm
platform dill and compile dart2wasm to two AOT snapshots (with and
without asserts). The dart2wasm scripts in sdk/bin are updated to run
via these snapshots and use this platform dill.

This speeds up test runs for the dart2wasm-hostasserts-linux-x64-d8
configuration by approximately 45x.

Change-Id: If2c7750a6eb39725310745f887792784d0dfc583
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243624
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2022-05-10 10:06:06 +00:00

258 lines
6.4 KiB
Plaintext

# Copyright (c) 2016, 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.
import("build/config/gclient_args.gni")
import("sdk_args.gni")
targetting_fuchsia = target_os == "fuchsia"
# This target will be built if no target is specified when invoking ninja.
group("default") {
if (targetting_fuchsia) {
# Fuchsia has run_vm_tests marked testonly.
testonly = true
}
deps = [ ":runtime" ]
}
group("most") {
import("runtime/runtime_args.gni")
if (targetting_fuchsia) {
# Fuchsia has run_vm_tests marked testonly.
testonly = true
}
deps = [
":analysis_server",
":create_sdk",
":dart2js",
":dartanalyzer",
":dartdevc",
":runtime",
]
}
group("runtime") {
import("runtime/runtime_args.gni")
if (targetting_fuchsia) {
# Fuchsia has run_vm_tests marked testonly.
testonly = true
}
deps = [
"runtime/bin:dart",
"runtime/bin:entrypoints_verification_test",
"runtime/bin:ffi_test_dynamic_library",
"runtime/bin:ffi_test_functions",
"runtime/bin:process_test",
"runtime/bin:run_vm_tests",
"runtime/vm:kernel_platform_files($host_toolchain)",
"utils/kernel-service:kernel-service",
]
# TODO(bkonyi): this dep causes a segfault on Android XARM_X64 builds.
# See issue #41776.
if (dart_target_arch != "arm") {
deps += [
"utils/dartdev:dartdev",
"utils/dds:dds",
]
}
# We do not support AOT on ia32 and should therefore not provide native
# snapshot tooling.
if (dart_target_arch != "ia32" && dart_target_arch != "x86") {
if (dart_runtime_mode == "release") {
deps += [ "runtime/bin:analyze_snapshot_product" ]
} else {
deps += [ "runtime/bin:analyze_snapshot" ]
}
}
if (is_linux || is_android) {
deps += [ "runtime/bin:abstract_socket_test" ]
}
}
# A separate target and not included in group("runtime"). This way the target\
# "runtime" does not get many executables extra as build output.
group("run_ffi_unit_tests") {
deps = [ "runtime/bin/ffi_unit_test:run_ffi_unit_tests" ]
}
group("runtime_precompiled") {
deps = [
"runtime/bin:dart_precompiled_runtime",
"runtime/bin:process_test",
]
if (is_linux || is_android) {
deps += [ "runtime/bin:abstract_socket_test" ]
}
}
group("create_sdk") {
public_deps = [ "sdk:create_sdk" ]
}
group("create_platform_sdk") {
public_deps = [ "sdk:create_platform_sdk" ]
}
group("dart2js") {
deps = [ "utils/compiler:dart2js" ]
}
group("dart2wasm") {
deps = [
":runtime_precompiled",
"utils/dart2wasm:compile_dart2wasm_platform",
"utils/dart2wasm:dart2wasm_asserts_snapshot",
"utils/dart2wasm:dart2wasm_snapshot",
]
}
group("dartanalyzer") {
deps = [ "utils/dartanalyzer" ]
}
group("dartdevc") {
deps = [ "utils/dartdevc" ]
}
group("analysis_server") {
deps = [ "utils/analysis_server" ]
}
# This is the target that is built on the dart2js build bots.
# It must depend on anything that is required by the dart2js
# test suites.
group("dart2js_bot") {
deps = [ ":create_sdk" ]
}
# This rule and the compressed_observatory_archive rule are for the Fuchsia
# bots that pre-build the Observatory. They copy the observatory tar files to
# the root build output directory for convenient access by the Fuchsia buildbot
# scripts.
group("observatory_archive") {
deps = [ "runtime/observatory:copy_observatory_archive" ]
}
group("compressed_observatory_archive") {
deps = [ "runtime/observatory:copy_compressed_observatory_archive" ]
}
if (is_fuchsia) {
import("third_party/fuchsia/sdk/${host_os}/build/component.gni")
import("third_party/fuchsia/sdk/${host_os}/build/package.gni")
template("dart_fuchsia_test_package") {
fuchsia_package(target_name) {
package_name = invoker.package_name
if (is_debug) {
package_name += "_debug"
} else if (is_release) {
package_name += "_release"
} else if (is_product) {
package_name += "_product"
}
testonly = true
deps = invoker.deps
}
}
template("dart_fuchsia_test_component") {
fuchsia_component(target_name) {
testonly = true
data_deps = [ "runtime/bin:dart" ]
if (defined(invoker.data_deps)) {
data_deps += invoker.data_deps
}
manifest = "build/fuchsia/dart.cmx"
library_files = []
if (defined(invoker.library_files)) {
library_files += invoker.library_files
}
resource_files = [
".dart_tool/package_config.json",
"pkg/testing/test/hello_test.dart",
"tools/addlatexhash.dart",
]
resource_dirs = invoker.resource_dirs
resources = []
foreach(file, library_files) {
resources += [
{
path = root_out_dir + "/" + file
dest = "lib/" + file
},
]
}
foreach(file, resource_files) {
resources += [
{
path = file
dest = "data/" + file
},
]
}
resources +=
exec_script("tools/fuchsia/find_resources.py", resource_dirs, "json")
}
}
dart_fuchsia_test_component("fuchsia_test_component") {
resource_dirs = [
"tests/standalone_2",
"pkg/async_helper",
"pkg/expect",
"pkg/meta",
"pkg/native_stack_traces",
"pkg/smith",
"third_party/pkg/args",
"third_party/pkg/async",
"third_party/pkg/charcode",
"third_party/pkg/collection",
"third_party/pkg/convert",
"third_party/pkg/crypto",
"third_party/pkg/http",
"third_party/pkg/http_parser",
"third_party/pkg/path",
"third_party/pkg/pool",
"third_party/pkg/stack_trace",
"third_party/pkg/string_scanner",
"third_party/pkg/typed_data",
]
}
dart_fuchsia_test_package("fuchsia_test_package") {
package_name = "dart_test"
deps = [ ":fuchsia_test_component" ]
}
dart_fuchsia_test_component("fuchsia_ffi_test_component") {
data_deps = [
"runtime/bin:ffi_test_dynamic_library",
"runtime/bin:ffi_test_functions",
]
library_files = [
"libffi_test_dynamic_library.so",
"libffi_test_functions.so",
]
resource_dirs = [
"pkg/expect",
"pkg/meta",
"tests/ffi",
"third_party/pkg/ffi",
]
}
dart_fuchsia_test_package("fuchsia_ffi_test_package") {
package_name = "dart_ffi_test"
deps = [ ":fuchsia_ffi_test_component" ]
}
}