| # 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("../../sdk_args.gni") | 
 | import("../../utils/compile_platform.gni") | 
 | import("../aot_snapshot.gni") | 
 | import("../application_snapshot.gni") | 
 | import("../create_timestamp.gni") | 
 |  | 
 | create_timestamp_file("dart2js_files_stamp") { | 
 |   path = rebase_path("../../pkg/compiler/lib") | 
 |   output = "$target_gen_dir/dart2js_files.stamp" | 
 | } | 
 |  | 
 | create_timestamp_file("runtime_lib_files_stamp") { | 
 |   path = rebase_path("../../runtime/lib") | 
 |   output = "$target_gen_dir/runtime_lib_files.stamp" | 
 | } | 
 |  | 
 | create_timestamp_file("dartdoc_files_stamp") { | 
 |   path = rebase_path("../../sdk/lib/_internal/dartdoc") | 
 |   output = "$target_gen_dir/dartdoc_files.stamp" | 
 | } | 
 |  | 
 | prebuilt_dart_action("dart2js_create_snapshot_entry") { | 
 |   deps = [ | 
 |     ":dart2js_files_stamp", | 
 |     ":dartdoc_files_stamp", | 
 |     ":runtime_lib_files_stamp", | 
 |   ] | 
 |  | 
 |   output_dir = rebase_path(target_gen_dir) | 
 |  | 
 |   script = "create_snapshot_entry.dart" | 
 |  | 
 |   inputs = [ | 
 |     "$target_gen_dir/dart2js_files.stamp", | 
 |     "../../tools/make_version.py", | 
 |     "../../tools/VERSION", | 
 |   ] | 
 |  | 
 |   outputs = [ "$target_gen_dir/dart2js.dart" ] | 
 |  | 
 |   packages = "../../.dart_tool/package_config.json" | 
 |  | 
 |   args = [ "--output_dir=$output_dir" ] | 
 |   if (!dart_version_git_info) { | 
 |     args += [ "--no-git-hash" ] | 
 |   } | 
 | } | 
 |  | 
 | sdk_root = "../../sdk" | 
 |  | 
 | application_snapshot("dart2js") { | 
 |   deps = [ ":dart2js_create_snapshot_entry" ] | 
 |   training_deps = [ ":compile_dart2js_platform" ] | 
 |   training_inputs = [ | 
 |     "$root_out_dir/dart2js_platform.dill", | 
 |     "$root_out_dir/dart2js_outline.dill", | 
 |   ] | 
 |   main_dart = "$target_gen_dir/dart2js.dart" | 
 |   training_args = [ | 
 |     "--invoker=gn_build", | 
 |     "--packages=" + | 
 |         rebase_path("../../.dart_tool/package_config.json", root_build_dir), | 
 |     "--libraries-spec=" + | 
 |         rebase_path("$sdk_root/lib/libraries.json", root_build_dir), | 
 |  | 
 |     # Specifying the platform explicitly elides running the CFE on the sdk | 
 |     # sources. | 
 |     "--platform-binaries=" + rebase_path("$root_out_dir/", root_build_dir), | 
 |  | 
 |     rebase_path("../../pkg/compiler/lib/src/util/memory_compiler.dart"), | 
 |   ] | 
 | } | 
 |  | 
 | aot_snapshot("dart2js_aot") { | 
 |   deps = [ ":dart2js_create_snapshot_entry" ] | 
 |  | 
 |   main_dart = "$target_gen_dir/dart2js.dart" | 
 |   name = "dart2js_aot" | 
 | } | 
 |  | 
 | aot_snapshot("dart2js_sdk_aot") { | 
 |   deps = [ ":dart2js_create_snapshot_entry" ] | 
 |  | 
 |   main_dart = "$target_gen_dir/dart2js.dart" | 
 |   name = "dart2js_aot.dart" | 
 |   output = "$root_gen_dir/dart2js_aot.dart.snapshot" | 
 | } | 
 |  | 
 | aot_snapshot("dart2js_sdk_aot_product") { | 
 |   deps = [ ":dart2js_create_snapshot_entry" ] | 
 |  | 
 |   main_dart = "$target_gen_dir/dart2js.dart" | 
 |   name = "dart2js_aot_product.dart" | 
 |   output = "$root_gen_dir/dart2js_aot_product.dart.snapshot" | 
 |  | 
 |   # dartaotruntime in the dart sdk has dart_product_config applied to it, | 
 |   # so it is built in product mode in both release and | 
 |   # product sdks, and is built in debug mode in debug | 
 |   # builds. The following line ensures that the dartaotruntime | 
 |   # and dart2js aot snapshot in an SDK build are | 
 |   # always compatible with each other. | 
 |   force_product_mode = !dart_debug | 
 | } | 
 |  | 
 | compile_platform("compile_dart2js_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/dart2js_platform.dill", | 
 |     "$root_out_dir/dart2js_outline.dill", | 
 |   ] | 
 |  | 
 |   args = [ | 
 |     "--target=dart2js", | 
 |     "--no-defines", | 
 |     "dart:core", | 
 |   ] | 
 | } | 
 | compile_platform("compile_dart2js_server_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/dart2js_server_platform.dill", | 
 |     "$root_out_dir/dart2js_server_outline.dill", | 
 |   ] | 
 |  | 
 |   args = [ | 
 |     "--target=dart2js_server", | 
 |     "--no-defines", | 
 |     "dart:core", | 
 |   ] | 
 | } |