|  | # 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/ffi/${invoker.module_name}.c"), | 
|  | "-o", | 
|  | rebase_path("$root_out_dir/wasm/${invoker.module_name}.wasm"), | 
|  | "-O", | 
|  | ] | 
|  | inputs = [ "//tests/web/wasm/ffi/${invoker.module_name}.c" ] | 
|  | 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", | 
|  | "dart:core", | 
|  | "--nnbd-strong", | 
|  | ] | 
|  | } | 
|  |  | 
|  | compile_platform("compile_dart2wasm_js_compatibility_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_js_compatibility_platform.dill", | 
|  | "$root_out_dir/dart2wasm_js_compatibility_outline.dill", | 
|  | ] | 
|  |  | 
|  | args = [ | 
|  | "--target=dart2wasm_js_compatibility", | 
|  | "-Ddart.wasm.js_compatibility=true", | 
|  | "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" ] | 
|  | } |