Index: runtime/bin/BUILD.gn |
diff --git a/runtime/bin/BUILD.gn b/runtime/bin/BUILD.gn |
index fa1b461b316ff0d3947c618b7bea80799b948f57..03187f89dc6b1ff55d7fb7f7127855a681b86b19 100644 |
--- a/runtime/bin/BUILD.gn |
+++ b/runtime/bin/BUILD.gn |
@@ -212,7 +212,16 @@ static_library("libdart_nosnapshot_with_precompiler") { |
] |
} |
-if (!defined(is_fuchsia) || !is_fuchsia) { |
+if ((current_toolchain == host_toolchain) || |
+ (!defined(is_fuchsia) || !is_fuchsia)) { |
+io_impl_sources_gypi = |
+ exec_script("../../tools/gypi_to_gn.py", |
+ [ rebase_path("io_impl_sources.gypi") ], |
+ "scope", |
+ [ "io_impl_sources.gypi" ]) |
+} |
+ |
+if (current_toolchain == host_toolchain) { |
executable("gen_snapshot") { |
configs += ["..:dart_config", |
@@ -250,24 +259,6 @@ executable("gen_snapshot") { |
] |
} |
- |
-source_set("libdart_embedder_noio") { |
- configs += ["..:dart_config", |
- "..:dart_product_config", |
- "..:dart_precompiled_runtime_config"] |
- deps = [ |
- "..:libdart", |
- "../vm:libdart_platform", |
- ] |
-} |
- |
-io_impl_sources_gypi = |
- exec_script("../../tools/gypi_to_gn.py", |
- [ rebase_path("io_impl_sources.gypi") ], |
- "scope", |
- [ "io_impl_sources.gypi" ]) |
- |
- |
# A source set for the implementation of 'dart:io' library |
# (without secure sockets) suitable for linking with gen_snapshot. |
source_set("gen_snapshot_dart_io") { |
@@ -309,6 +300,20 @@ source_set("gen_snapshot_dart_io") { |
] |
} |
+} # current_toolchain == host_toolchain |
+ |
+source_set("libdart_embedder_noio") { |
+ configs += ["..:dart_config", |
+ "..:dart_product_config", |
+ "..:dart_precompiled_runtime_config"] |
+ deps = [ |
+ "..:libdart", |
+ "../vm:libdart_platform", |
+ ] |
+} |
+ |
+if (!defined(is_fuchsia) || !is_fuchsia) { |
+ |
# A source set for the implementation of 'dart:io' library |
# (without secure sockets). |
source_set("embedded_dart_io") { |
@@ -363,6 +368,81 @@ source_set("embedded_dart_io") { |
} |
} # !is_fuchsia |
+ |
+action("generate_snapshot_bin") { |
+ deps = [ |
+ "../bin:gen_snapshot($host_toolchain)", |
+ ] |
+ |
+ vm_isolate_snapshot = "$target_gen_dir/vm_isolate_snapshot.bin" |
+ isolate_snapshot = "$target_gen_dir/isolate_snapshot.bin" |
+ gen_snapshot_stamp_file = "$target_gen_dir/gen_snapshot.stamp" |
+ outputs = [ |
+ vm_isolate_snapshot, |
+ isolate_snapshot, |
+ gen_snapshot_stamp_file, |
+ ] |
+ |
+ gen_snapshot_dir = |
+ get_label_info("../bin:gen_snapshot($host_toolchain)", "root_out_dir") |
+ |
+ script = rebase_path("../tools/create_snapshot_bin.py") |
+ args = [ |
+ "--executable", |
+ rebase_path("$gen_snapshot_dir/gen_snapshot"), |
+ "--vm_output_bin", |
+ rebase_path(vm_isolate_snapshot, root_build_dir), |
+ "--output_bin", |
+ rebase_path(isolate_snapshot, root_build_dir), |
+ "--target_os", |
+ current_os, |
+ "--timestamp_file", |
+ rebase_path(gen_snapshot_stamp_file, root_build_dir), |
+ ] |
+} |
+ |
+ |
+action("generate_snapshot_file") { |
+ deps = [ |
+ ":generate_snapshot_bin", |
+ ] |
+ |
+ snapshot_in_cc_file = "snapshot_in.cc" |
+ inputs = [ |
+ "../tools/create_snapshot_file.py", |
+ snapshot_in_cc_file, |
+ "$target_gen_dir/vm_isolate_snapshot.bin", |
+ "$target_gen_dir/isolate_snapshot.bin", |
+ ] |
+ output = "$root_gen_dir/dart_snapshot.cc" |
+ outputs = [ |
+ output, |
+ ] |
+ |
+ script = "../tools/create_snapshot_file.py" |
+ args = [ |
+ "--vm_input_bin", |
+ rebase_path("$target_gen_dir/vm_isolate_snapshot.bin"), |
+ "--input_bin", |
+ rebase_path("$target_gen_dir/isolate_snapshot.bin"), |
+ "--input_cc", |
+ rebase_path(snapshot_in_cc_file), |
+ "--output", |
+ rebase_path(output), |
+ ] |
+} |
+ |
+ |
+source_set("dart_snapshot_cc") { |
+ sources = [ |
+ "$root_gen_dir/dart_snapshot.cc", |
+ ] |
+ |
+ deps = [ |
+ ":generate_snapshot_file", |
+ ] |
+} |
+ |
if (defined(is_fuchsia) && is_fuchsia) { |
executable("fuchsia_test") { |
configs += ["..:dart_config", |
@@ -379,7 +459,8 @@ if (defined(is_fuchsia) && is_fuchsia) { |
] |
deps = [ |
- ":libdart_nosnapshot" |
+ ":dart_snapshot_cc", |
+ ":libdart_embedder_noio", |
] |
} |
} |