dart-sdk/utils/dart2wasm/BUILD.gn
Joshua Litt 1ed2a07022 [dart2wasm] Build product snapshot when building for the SDK.
The `dartaotruntime` is built in `product` mode even when we do a release build. This CL wires up a product flag so we always build the Dart2Wasm product snapshot when creating the SDK.

Change-Id: Ic8c6a6da180a47a19ba818d7c449f712c9e60123
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/264887
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
2022-10-26 17:04:17 +00:00

68 lines
1.8 KiB
Text

# Copyright (c) 2022, 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("../aot_snapshot.gni")
import("../compile_platform.gni")
sdk_root = "../../sdk"
template("wasm_module") {
action(target_name) {
script = rebase_path("//build/gn_run_binary.py")
args = [
"compiled_action",
rebase_path("//third_party/emsdk/upstream/emscripten/emcc"),
"--no-entry",
rebase_path("//tests/web/wasm/${invoker.module_name}.c"),
"-o",
rebase_path("$root_out_dir/wasm/${invoker.module_name}.wasm"),
"-O",
]
outputs = [ "$root_out_dir/wasm/${invoker.module_name}.wasm" ]
}
}
aot_snapshot("dart2wasm_snapshot") {
main_dart = "../../pkg/dart2wasm/bin/dart2wasm.dart"
name = "dart2wasm"
}
aot_snapshot("dart2wasm_asserts_snapshot") {
main_dart = "../../pkg/dart2wasm/bin/dart2wasm.dart"
name = "dart2wasm_asserts"
gen_kernel_args = [ "--enable-asserts" ]
gen_snapshot_args = [ "--enable-asserts" ]
}
aot_snapshot("dart2wasm_product_snapshot") {
main_dart = "../../pkg/dart2wasm/bin/dart2wasm.dart"
name = "dart2wasm_product"
force_product_mode = true
}
compile_platform("compile_dart2wasm_platform") {
single_root_scheme = "org-dartlang-sdk"
single_root_base = rebase_path("$sdk_root/")
libraries_specification_uri = "org-dartlang-sdk:///lib/libraries.json"
outputs = [
"$root_out_dir/dart2wasm_platform.dill",
"$root_out_dir/dart2wasm_outline.dill",
]
args = [
"--target=dart2wasm",
"--no-defines",
"dart:core",
"--nnbd-strong",
]
}
wasm_module("ffi_native_test_wasm_module") {
module_name = "ffi_native_test_module"
}
group("test_wasm_modules") {
deps = [ ":ffi_native_test_wasm_module" ]
}