dart-sdk/BUILD.gn

290 lines
7.3 KiB
Text
Raw Normal View History

# 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")
targeting_fuchsia = target_os == "fuchsia"
# This target will be built if no target is specified when invoking ninja.
group("default") {
if (targeting_fuchsia) {
# Fuchsia has run_vm_tests marked testonly.
testonly = true
}
deps = [ ":runtime" ]
}
group("most") {
import("runtime/runtime_args.gni")
if (targeting_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 (targeting_fuchsia) {
# Fuchsia has run_vm_tests marked testonly.
testonly = true
}
Fixes for reland for analyze_snapshot program 1. Disable copying of executable for SDK binary signing 2. Fixes for ASAN memory leak in executable TEST=runtime/tests/vm/dart_2/analyze_snapshot_binary_test.dart This is a reland of 5d7d8a377dec742bd388849d139dbabdf9bee767 Original change's description: > Reland "Reland "[vm] Add analyze_snapshot tool for AOT snapshot inspection"" > > This is a reland of 8d1eedca64d29e0e25d4536e4b145bf584c83eed > > Disable builds for Fuchsia > > TEST=runtime/tests/vm/dart_2/analyze_snapshot_binary_test.dart > Original change's description: > > Reland "[vm] Add analyze_snapshot tool for AOT snapshot inspection" > > > > This is a reland of 19e57493088ac57c1f3f45918b9dc97d15de42e0 > > > > TEST=runtime/tests/vm/dart/analyze_snapshot_binary_test.dart > > > > Original change's description: > > > [vm] Add analyze_snapshot tool for AOT snapshot inspection > > > > > > Current skeleton to allow for instrumentation snapshots that can be > > > built alongside Dart compilation artifacts and easily referenced for > > > specific versions between Snapshot hash <-> DartSDK <-> Flutter Engine > > > > > > TEST=runtime/tests/vm/dart/analyze_snapshot_binary_test.dart > > > > > > Change-Id: Ie3757a265bbf457506c72fb62a625fea7bedcb68 > > > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/221087 > > > Reviewed-by: Slava Egorov <vegorov@google.com> > > > Commit-Queue: Slava Egorov <vegorov@google.com> > > > > Change-Id: Ia1ea0071d30818440ae48484ff6c406236af5a4e > > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/224526 > > Reviewed-by: Slava Egorov <vegorov@google.com> > > Commit-Queue: Slava Egorov <vegorov@google.com> > > Change-Id: I769ced4cbe6eb926b8df36a15ca13c3145632082 > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233890 > Reviewed-by: Slava Egorov <vegorov@google.com> > Commit-Queue: Chris Evans <cmevans@google.com> Change-Id: I1e6e57dda56f1710cc3a52e35d4067910930a701 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234500 Reviewed-by: Slava Egorov <vegorov@google.com> Reviewed-by: Chris Evans <cmevans@google.com> Commit-Queue: Chris Evans <cmevans@google.com>
2022-03-09 14:17:44 +00:00
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",
]
}
# This flag is set in runtime/runtime_args.gni
# The analyze_snapshot tool is only supported on 64 bit AOT builds running
# under linux and android platforms
if (build_analyze_snapshot) {
deps += [
# The `analyze_snapshot` tests require the `analyze_snapshot` as well as
# `gen_snapshot` binaries.
"runtime/bin:analyze_snapshot",
"runtime/bin:analyze_snapshot($host_toolchain)",
"runtime/bin:gen_snapshot",
"runtime/bin:gen_snapshot($host_toolchain)",
]
Fixes for reland for analyze_snapshot program 1. Disable copying of executable for SDK binary signing 2. Fixes for ASAN memory leak in executable TEST=runtime/tests/vm/dart_2/analyze_snapshot_binary_test.dart This is a reland of 5d7d8a377dec742bd388849d139dbabdf9bee767 Original change's description: > Reland "Reland "[vm] Add analyze_snapshot tool for AOT snapshot inspection"" > > This is a reland of 8d1eedca64d29e0e25d4536e4b145bf584c83eed > > Disable builds for Fuchsia > > TEST=runtime/tests/vm/dart_2/analyze_snapshot_binary_test.dart > Original change's description: > > Reland "[vm] Add analyze_snapshot tool for AOT snapshot inspection" > > > > This is a reland of 19e57493088ac57c1f3f45918b9dc97d15de42e0 > > > > TEST=runtime/tests/vm/dart/analyze_snapshot_binary_test.dart > > > > Original change's description: > > > [vm] Add analyze_snapshot tool for AOT snapshot inspection > > > > > > Current skeleton to allow for instrumentation snapshots that can be > > > built alongside Dart compilation artifacts and easily referenced for > > > specific versions between Snapshot hash <-> DartSDK <-> Flutter Engine > > > > > > TEST=runtime/tests/vm/dart/analyze_snapshot_binary_test.dart > > > > > > Change-Id: Ie3757a265bbf457506c72fb62a625fea7bedcb68 > > > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/221087 > > > Reviewed-by: Slava Egorov <vegorov@google.com> > > > Commit-Queue: Slava Egorov <vegorov@google.com> > > > > Change-Id: Ia1ea0071d30818440ae48484ff6c406236af5a4e > > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/224526 > > Reviewed-by: Slava Egorov <vegorov@google.com> > > Commit-Queue: Slava Egorov <vegorov@google.com> > > Change-Id: I769ced4cbe6eb926b8df36a15ca13c3145632082 > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233890 > Reviewed-by: Slava Egorov <vegorov@google.com> > Commit-Queue: Chris Evans <cmevans@google.com> Change-Id: I1e6e57dda56f1710cc3a52e35d4067910930a701 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234500 Reviewed-by: Slava Egorov <vegorov@google.com> Reviewed-by: Chris Evans <cmevans@google.com> Commit-Queue: Chris Evans <cmevans@google.com>
2022-03-09 14:17:44 +00:00
}
if (is_linux || is_android) {
deps += [ "runtime/bin:abstract_socket_test" ]
}
}
[test/ffi] Add C++ unit tests for all target ABIs This CL introduces unit tests for the Native* classes in compiler/ffi that can run for all supported target ABIs on any host architecture. The unit tests are compiled for all target ABIs with `tools/build.py run_ffi_unit_tests` and run for all target ABIs with `tools/test.py ffi_unit`. The unit test and tested code do not conceptually depend on having a DartVM. The tests are compiled with a custom `dart::Zone` and `platform/`. This enables compiling for all `TARGET_ARCH_*` and `TARGET_OS_*` on any host, and running unit tests for all target ABIs on any host. Because the `run_ffi_unit_tests` executables do not include the DartVM their build is quick (<10seconds) and they are small (~6MB) when compared to `run_vm_tests` (~250MB). The tests are added to the existing FFI QEMU bot to prevent adding an extra bot which would add checkout overhead. The unit tests themselves are set up to be fairly similar to vm/cc tests. The only difference is the NativeCallingConvention tests which are set up with `.expect` files for easy inspection and updating. TEST=runtime/vm/compiler/ffi/native_calling_convention_test.cc TEST=runtime/vm/compiler/ffi/native_location_test.cc TEST=runtime/vm/compiler/ffi/native_type_test.cc Change-Id: I7b8bf4de9ef070e7546472217e571a60362b9639 Cq-Include-Trybots: luci.dart.try:vm-precomp-ffi-qemu-linux-release-arm-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171725 Commit-Queue: Daco Harkes <dacoharkes@google.com> Reviewed-by: Clement Skau <cskau@google.com> Reviewed-by: Alexander Thomas <athom@google.com>
2020-11-16 16:10:55 +00:00
# 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_platform") {
deps = [
":runtime_precompiled",
"utils/dart2wasm:compile_dart2wasm_js_compatibility_platform",
"utils/dart2wasm:compile_dart2wasm_platform",
"utils/dart2wasm:compile_dart2wasm_stringref_platform",
"utils/dart2wasm:dart2wasm_snapshot",
]
if (defined(is_product)) {
if (is_product) {
deps += [ "utils/dart2wasm:dart2wasm_product_snapshot" ]
} else {
deps += [ "utils/dart2wasm:dart2wasm_asserts_snapshot" ]
}
}
}
group("dart2wasm") {
deps = [
":dart2wasm_platform",
[dart2wasm] Implement Wasm FfiNative support This CL introduces a new kernel-to-kernel pass in Wasm backend to compile `FfiNative`-annotated external functions to external functions with `wasm:import` pragmas. The new pass `WasmFfiNativeTransformer` extends `FfiNativeTransformer`. Some `FfiNativeTransformer` methods made public to allow reuse in the pass. The conversion works like this: when we see a member like: @FfiNative<Int8 Function(Int8, Int8)>("ffi.addInt8") external int addInt8(int a, int b); We generate a Wasm import using Wasm ABI types according to emscripten calling conventions: @pragma('wasm:import', 'ffi.addInt8') external static WasmI32 addInt8_$import(WasmI32 a, WasmI32 b); and convert the original member (`addInt8()`) to a wrapper function that calls the Wasm import, converting the arguments and return values to Dart types: static int addInt8(int a, int b) { return WasmI32.toIntSigned( addInt8_$import( WasmI32::int8FromInt(a), WasmI32::int8FromInt(b), )); } Build, test, and CI changes: - Test runner now uses `// SharedObjects=...` lines in dart2wasm tests to pass extra Wasm modules to d8 command used to run the tests. Support for `// SharedObjects=...` lines were already used in native/AOT FFI tests, not added in this CL. We just start to use those lines in dart2wasm tests. - dart2wasm gn file updated with a target "test_wasm_modules" that builds FFI test Wasm modules to Wasm using emcc (emscripten C compiler). - CI dart2wasm_hostasserts configuration updated to copy the Wasm files generated by the "test_wasm_modules" target to the shards. TEST=tests/web/wasm/ffi_native_test Change-Id: I6527fe4e2ca2b582e16d84fee244e9cbe6dee307 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252822 Reviewed-by: Alexander Thomas <athom@google.com> Commit-Queue: Ömer Ağacan <omersa@google.com> Reviewed-by: Ryan Macnak <rmacnak@google.com> Reviewed-by: Aske Simon Christensen <askesc@google.com>
2022-09-23 09:41:22 +00:00
"utils/dart2wasm:test_wasm_modules",
]
}
group("dart2wasm_benchmark") {
deps = [
":dart2wasm_platform",
"third_party/binaryen:wasm-opt",
]
}
group("dartanalyzer") {
deps = [ "utils/dartanalyzer" ]
}
group("dartdevc") {
deps = [ "utils/dartdevc" ]
}
group("ddc") {
# TODO(nshahan): Update to the dartdevc snapshot target when it gets moved.
deps = [ "utils/ddc:ddc_stable_test" ]
}
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 = invoker.manifest
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") {
manifest = "build/fuchsia/fuchsia_test_component.cmx"
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/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") {
manifest = "build/fuchsia/fuchsia_ffi_test_component.cmx"
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" ]
}
}