| # Copyright (c) 2018, 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/dart/dart_action.gni") |
| |
| _dart_root = get_path_info("..", "abspath") |
| |
| # Template to generate entry points JSON file using dart_bootstrap tool. |
| # List of entry points is generated as a by-product while doing precompilation. |
| # |
| # This template expects the following arguments: |
| # - input: Name of the input dart script for precompilation. |
| # - output: Name of the output entry points JSON file. |
| # - extra_args: Extra arguments to pass to dart_bootstrap (optional). |
| # |
| template("generate_entry_points_json_with_dart_bootstrap") { |
| assert(defined(invoker.input), "Must define input dart script") |
| assert(defined(invoker.output), "Must define output json file") |
| extra_args = [] |
| if (defined(invoker.extra_args)) { |
| extra_args += invoker.extra_args |
| } |
| dart_bootstrap_action(target_name) { |
| # Printing precompiler entry points is folded into precompilation, so dart_bootstrap is invoked |
| # with correct arguments to generate app-aot snapshot. |
| script = invoker.input |
| output = invoker.output |
| outputs = [ |
| output, |
| ] |
| vm_args = [ |
| "--print-precompiler-entry-points=" + rebase_path(output), |
| "--snapshot=" + rebase_path("$target_gen_dir/dummy.snapshot"), |
| "--snapshot-kind=app-aot", |
| "--use-blobs", |
| "--snapshot-kind=app-aot", |
| ] + extra_args |
| args = [] |
| } |
| } |
| |
| # Template to copy checked-in extra entry points JSON file. |
| # |
| # This template expects the following argument: |
| # - output: Target destination for the extra entry points JSON file. |
| # |
| template("copy_entry_points_extra_json") { |
| assert(defined(invoker.output), "Must define output json file") |
| copy(target_name) { |
| sources = [ "$_dart_root/pkg/vm/lib/transformations/type_flow/entry_points_extra.json" ] |
| outputs = [ invoker.output ] |
| } |
| } |