| # Copyright 2016 The Fuchsia Authors. 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/package.gni") |
| import("dart_app.gni") |
| |
| template("runner") { |
| assert(defined(invoker.product), "The parameter 'product' must be defined") |
| product_suffix = "" |
| if (invoker.product) { |
| product_suffix = "_product" |
| } |
| invoker_output_name = invoker.output_name |
| extra_defines = invoker.extra_defines |
| extra_deps = invoker.extra_deps |
| |
| executable(target_name) { |
| output_name = invoker_output_name |
| |
| sources = [ |
| "builtin_libraries.cc", |
| "builtin_libraries.h", |
| "dart_component_controller.cc", |
| "dart_component_controller.h", |
| "dart_runner.cc", |
| "dart_runner.h", |
| "main.cc", |
| "mapped_resource.cc", |
| "mapped_resource.h", |
| "service_isolate.cc", |
| "service_isolate.h", |
| ] |
| |
| defines = extra_defines |
| |
| dart_deps = [ |
| "//third_party/dart/runtime/bin:dart_io_api${product_suffix}", |
| |
| # TODO(abarth): We shouldn't need to depend on libdart_builtin but we |
| # fail to link otherwise. |
| "//third_party/dart/runtime/bin:libdart_builtin${product_suffix}", |
| ] |
| |
| deps = [ |
| "//garnet/public/lib/component/cpp", |
| "//garnet/public/lib/fsl", |
| "//garnet/public/lib/fxl", |
| "//garnet/public/lib/svc/cpp", |
| "//topaz/lib/deprecated_loop", |
| "//topaz/runtime/dart/utils", |
| "//third_party/tonic", |
| "//topaz/lib/deprecated_loop", |
| "//topaz/public/dart-pkg/fuchsia", |
| "//zircon/public/lib/trace-provider", |
| ] + dart_deps + extra_deps |
| } |
| } |
| |
| runner("dart_jit_runner_bin") { |
| output_name = "dart_jit_runner" |
| product = false |
| extra_defines = [] |
| extra_deps = [ |
| "//third_party/dart/runtime:libdart_jit", |
| "//third_party/dart/runtime/platform:libdart_platform_jit", |
| ] |
| } |
| |
| runner("dart_jit_product_runner_bin") { |
| output_name = "dart_jit_product_runner" |
| product = true |
| extra_defines = [ "DART_PRODUCT" ] |
| extra_deps = [ |
| "//third_party/dart/runtime:libdart_jit_product", |
| "//third_party/dart/runtime/platform:libdart_platform_jit_product", |
| ] |
| } |
| |
| runner("dart_aot_runner_bin") { |
| output_name = "dart_aot_runner" |
| product = false |
| extra_defines = [ "AOT_RUNTIME" ] |
| extra_deps = [ |
| "//topaz/runtime/dart_runner/embedder:dart_aot_snapshot_cc", |
| "//third_party/dart/runtime:libdart_precompiled_runtime", |
| "//third_party/dart/runtime/platform:libdart_platform_precompiled_runtime", |
| ] |
| } |
| |
| runner("dart_aot_product_runner_bin") { |
| output_name = "dart_aot_product_runner" |
| product = true |
| extra_defines = [ |
| "AOT_RUNTIME", |
| "DART_PRODUCT", |
| ] |
| extra_deps = [ |
| "//topaz/runtime/dart_runner/embedder:dart_aot_product_snapshot_cc", |
| "//third_party/dart/runtime:libdart_precompiled_runtime_product", |
| "//third_party/dart/runtime/platform:libdart_platform_precompiled_runtime_product", |
| ] |
| } |
| |
| observatory_target = |
| "//third_party/dart/runtime/observatory:observatory_archive" |
| observatory_archive_dir = get_label_info(observatory_target, "target_gen_dir") |
| observatory_archive_name = get_label_info(observatory_target, "name") |
| observatory_archive_file = |
| "${observatory_archive_dir}/${observatory_archive_name}.tar" |
| |
| template("aot_runner_package") { |
| assert(defined(invoker.product), "The parameter 'product' must be defined") |
| product_suffix = "" |
| if (invoker.product) { |
| product_suffix = "_product" |
| } |
| package(target_name) { |
| deps = [ |
| ":dart_aot${product_suffix}_runner_bin", |
| ] |
| if (!invoker.product) { |
| deps += [ |
| "vmservice:vmservice_snapshot", |
| observatory_target, |
| ] |
| |
| if (dart_aot_sharing_basis != "") { |
| deps += [ get_label_info(dart_aot_sharing_basis, "label_no_toolchain") + |
| "_snapshot" ] |
| prefix = get_label_info(dart_aot_sharing_basis, "target_gen_dir") + |
| "/" + get_label_info(dart_aot_sharing_basis, "name") |
| shared_snapshot_data_path = "${prefix}_data.aotsnapshot" |
| shared_snapshot_instructions_path = "${prefix}_instructions.aotsnapshot" |
| } else { |
| shared_snapshot_data_path = "//topaz/runtime/dart_runner/empty" |
| shared_snapshot_instructions_path = "//topaz/runtime/dart_runner/empty" |
| } |
| } |
| |
| binary = "dart_aot${product_suffix}_runner" |
| |
| meta = [] |
| if (defined(invoker.meta)) { |
| meta += invoker.meta |
| } |
| |
| resources = [] |
| if (!invoker.product) { |
| resources += [ |
| { |
| path = rebase_path(get_label_info("vmservice:vmservice_snapshot", |
| "target_gen_dir") + |
| "/vmservice_data.aotsnapshot") |
| dest = "vmservice_isolate_snapshot_data.bin" |
| }, |
| { |
| path = rebase_path(get_label_info("vmservice:vmservice_snapshot", |
| "target_gen_dir") + |
| "/vmservice_instructions.aotsnapshot") |
| dest = "vmservice_isolate_snapshot_instructions.bin" |
| }, |
| { |
| path = rebase_path(shared_snapshot_data_path) |
| dest = "vmservice_shared_snapshot_data.bin" |
| }, |
| { |
| path = rebase_path(shared_snapshot_instructions_path) |
| dest = "vmservice_shared_snapshot_instructions.bin" |
| }, |
| { |
| path = rebase_path(observatory_archive_file) |
| dest = "observatory.tar" |
| }, |
| ] |
| } |
| } |
| } |
| |
| template("jit_runner_package") { |
| assert(defined(invoker.product), "The parameter 'product' must be defined") |
| product_suffix = "" |
| if (invoker.product) { |
| product_suffix = "_product" |
| } |
| package(target_name) { |
| deps = [ |
| ":dart_jit${product_suffix}_runner_bin", |
| "kernel:kernel_core_snapshot${product_suffix}", |
| ] |
| if (!invoker.product) { |
| deps += [ observatory_target ] |
| } |
| |
| binary = "dart_jit${product_suffix}_runner" |
| |
| meta = [] |
| if (defined(invoker.meta)) { |
| meta += invoker.meta |
| } |
| |
| resources = [ |
| { |
| path = |
| rebase_path("$target_gen_dir/kernel/vm_data${product_suffix}.bin") |
| dest = "vm_snapshot_data.bin" |
| }, |
| { |
| path = rebase_path( |
| "$target_gen_dir/kernel/vm_instructions${product_suffix}.bin") |
| dest = "vm_snapshot_instructions.bin" |
| }, |
| { |
| path = rebase_path( |
| "$target_gen_dir/kernel/isolate_data${product_suffix}.bin") |
| dest = "isolate_core_snapshot_data.bin" |
| }, |
| { |
| path = rebase_path( |
| "$target_gen_dir/kernel/isolate_instructions${product_suffix}.bin") |
| dest = "isolate_core_snapshot_instructions.bin" |
| }, |
| ] |
| if (!invoker.product) { |
| resources += [ |
| { |
| path = rebase_path(observatory_archive_file) |
| dest = "observatory.tar" |
| }, |
| ] |
| } |
| } |
| } |
| |
| aot_runner_package("dart_aot_runner") { |
| product = dart_force_product |
| |
| meta = [ |
| { |
| path = rebase_path("meta/dart_aot_runner.cmx") |
| dest = "dart_aot_runner.cmx" |
| }, |
| ] |
| } |
| |
| aot_runner_package("dart_aot_product_runner") { |
| product = true |
| meta = [ |
| { |
| path = rebase_path("meta/dart_aot_product_runner.cmx") |
| dest = "dart_aot_product_runner.cmx" |
| }, |
| ] |
| } |
| |
| jit_runner_package("dart_jit_runner") { |
| product = dart_force_product |
| |
| meta = [ |
| { |
| path = rebase_path("meta/dart_jit_runner.cmx") |
| dest = "dart_jit_runner.cmx" |
| }, |
| ] |
| } |
| |
| jit_runner_package("dart_jit_product_runner") { |
| product = true |
| meta = [ |
| { |
| path = rebase_path("meta/dart_jit_product_runner.cmx") |
| dest = "dart_jit_product_runner.cmx" |
| }, |
| ] |
| } |