diff --git a/engine/src/flutter/lib/snapshot/BUILD.gn b/engine/src/flutter/lib/snapshot/BUILD.gn index 74c40d1e9a..7a792390ce 100644 --- a/engine/src/flutter/lib/snapshot/BUILD.gn +++ b/engine/src/flutter/lib/snapshot/BUILD.gn @@ -5,7 +5,12 @@ import("//flutter/lib/jni/dart_jni.gni") import("//flutter/lib/snapshot/toolchain.gni") import("//flutter/lib/ui/dart_ui.gni") -import("//flutter/lib/ui/dart_ui.gni") + +target_is_fuchsia = target_os == "fuchsia" + +if (target_is_fuchsia) { + import("//lib/fidl/dart/sdk_ext/sdk_ext.gni") +} bindings_output_dir = "$root_gen_dir/sky/bindings" @@ -26,6 +31,12 @@ copy("generate_dart_jni") { } action("generate_snapshot_bin") { + if (target_is_fuchsia) { + snapshot_dart = "snapshot_fuchsia.dart" + } else { + snapshot_dart = "snapshot.dart" + } + deps = [ "//dart/runtime/bin:gen_snapshot($dart_host_toolchain)", ":generate_dart_ui", @@ -33,9 +44,10 @@ action("generate_snapshot_bin") { ] inputs = [ "//dart/runtime/tools/create_snapshot_bin.py", - "snapshot.dart", + snapshot_dart, ] + dart_ui_files + dart_jni_files + vm_isolate_snapshot = "$target_gen_dir/vm_isolate_snapshot.bin" isolate_snapshot = "$target_gen_dir/isolate_snapshot.bin" outputs = [ @@ -57,7 +69,7 @@ action("generate_snapshot_bin") { "--package_root", rebase_path("$root_gen_dir"), "--script", - rebase_path("snapshot.dart"), + rebase_path(snapshot_dart), "--vm_output_bin", rebase_path(vm_isolate_snapshot, root_build_dir), "--output_bin", @@ -67,6 +79,12 @@ action("generate_snapshot_bin") { "--url_mapping=dart:ui,$rebased_dart_ui_path", "--url_mapping=dart:jni,$rebased_dart_jni_path", ] + + if (target_is_fuchsia) { + inputs += fidl_dart_sdk_ext_files + fidl_internal_path = rebase_path(fidl_dart_sdk_ext_lib) + args += [ "--url_mapping=dart:fidl.internal,$fidl_internal_path" ] + } } action("generate_snapshot_file") { diff --git a/engine/src/flutter/lib/snapshot/snapshot.dart b/engine/src/flutter/lib/snapshot/snapshot.dart index 5e1f35159e..042dbaa71d 100644 --- a/engine/src/flutter/lib/snapshot/snapshot.dart +++ b/engine/src/flutter/lib/snapshot/snapshot.dart @@ -11,5 +11,5 @@ import 'dart:io'; import 'dart:isolate'; import 'dart:jni'; import 'dart:math'; -import 'dart:ui'; import 'dart:typed_data'; +import 'dart:ui'; diff --git a/engine/src/flutter/lib/snapshot/snapshot_fuchsia.dart b/engine/src/flutter/lib/snapshot/snapshot_fuchsia.dart new file mode 100644 index 0000000000..74a9501ba6 --- /dev/null +++ b/engine/src/flutter/lib/snapshot/snapshot_fuchsia.dart @@ -0,0 +1,15 @@ +// Copyright 2015 The Chromium 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 'dart:async'; +import 'dart:collection'; +import 'dart:convert'; +import 'dart:core'; +import 'dart:developer'; +import 'dart:fidl.internal'; +import 'dart:io'; +import 'dart:isolate'; +import 'dart:math'; +import 'dart:typed_data'; +import 'dart:ui'; diff --git a/engine/src/flutter/lib/ui/dart_runtime_hooks.cc b/engine/src/flutter/lib/ui/dart_runtime_hooks.cc index f96d035317..f02969d5a8 100644 --- a/engine/src/flutter/lib/ui/dart_runtime_hooks.cc +++ b/engine/src/flutter/lib/ui/dart_runtime_hooks.cc @@ -113,7 +113,7 @@ static void InitDartAsync(Dart_Handle builtin_library, &schedule_microtask)); } -static void InitDartIo(const std::string& script_uri) { +static void InitDartIO(const std::string& script_uri) { if (!script_uri.empty()) { Dart_Handle io_lib = Dart_LookupLibrary(ToDart("dart:io")); DART_CHECK_VALID(io_lib); @@ -132,7 +132,7 @@ void DartRuntimeHooks::Install(IsolateType isolate_type, InitDartInternal(builtin, isolate_type); InitDartCore(builtin, script_uri); InitDartAsync(builtin, isolate_type); - InitDartIo(script_uri); + InitDartIO(script_uri); } // Implementation of native functions which are used for some