Add web sdk implementation. (flutter/engine#8891)
This commit is contained in:
@@ -255,21 +255,70 @@ FILE: ../../../flutter/lib/io/dart_io.cc
|
||||
FILE: ../../../flutter/lib/io/dart_io.h
|
||||
FILE: ../../../flutter/lib/snapshot/libraries.json
|
||||
FILE: ../../../flutter/lib/snapshot/snapshot.h
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/compositing.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/geometry.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/hash_codes.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/hooks.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/isolate_name_server.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/lerp.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/natives.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/painting.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/plugins.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/pointer.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/semantics.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/text.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/alarm_clock.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/assets.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/bitmap_canvas.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/browser_detection.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/compositor/engine_delegate.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/compositor/layer.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/compositor/layer_scene_builder.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/compositor/layer_tree.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/compositor/platform_message.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/compositor/raster_cache.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/compositor/rasterizer.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/compositor/runtime_delegate.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/compositor/surface.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/compositor/viewport_metrics.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/conic.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/dom_canvas.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/dom_renderer.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/engine_canvas.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/history.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/houdini_canvas.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/html_image_codec.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/keyboard.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/onscreen_logging.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/path_to_svg.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/pointer_binding.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/recording_canvas.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/semantics/checkable.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/semantics/incrementable.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/semantics/label_and_value.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/semantics/scrollable.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/semantics/semantics.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/semantics/tappable.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/semantics/text_field.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/services/message_codec.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/services/message_codecs.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/shadow.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/text/font_collection.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/text/measurement.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/text/ruler.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/text/unicode_range.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/text/word_break_properties.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/text/word_breaker.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/text_editing.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/util.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/validators.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/engine/vector_math.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/ui/browser_location.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/ui/canvas.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/ui/compositing.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/ui/debug_canvas_reuse_overlay.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/ui/geometry.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/ui/hash_codes.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/ui/initialization.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/ui/lerp.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/ui/natives.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/ui/painting.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/ui/pointer.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/ui/semantics.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/ui/text.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/ui/tile_mode.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/src/ui/window.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/ui.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/versions.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/lib/window.dart
|
||||
FILE: ../../../flutter/lib/stub_ui/tool/unicode_sync_script.dart
|
||||
FILE: ../../../flutter/lib/ui/compositing.dart
|
||||
FILE: ../../../flutter/lib/ui/compositing/scene.cc
|
||||
FILE: ../../../flutter/lib/ui/compositing/scene.h
|
||||
@@ -856,9 +905,7 @@ FILE: ../../../flutter/vulkan/vulkan_utilities.h
|
||||
FILE: ../../../flutter/vulkan/vulkan_window.cc
|
||||
FILE: ../../../flutter/vulkan/vulkan_window.h
|
||||
FILE: ../../../flutter/web_sdk/flutter_kernel_sdk.dart
|
||||
FILE: ../../../flutter/web_sdk/libraries.dart
|
||||
FILE: ../../../flutter/web_sdk/libraries.json
|
||||
FILE: ../../../flutter/web_sdk/make_combined_sdk.dart
|
||||
FILE: ../../../flutter/web_sdk/sdk_rewriter.dart
|
||||
----------------------------------------------------------------------------------------------------
|
||||
Copyright 2013 The Flutter Authors. All rights reserved.
|
||||
|
||||
@@ -9,27 +9,80 @@ sdk_dill = "$root_out_dir/flutter_web_sdk/kernel/flutter_ddc_sdk.dill"
|
||||
sdk_libraries_json = "$flutter_root/web_sdk/libraries.json"
|
||||
|
||||
web_ui_sources = [
|
||||
"$flutter_root/lib/stub_ui/lib/compositing.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/geometry.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/hash_codes.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/hooks.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/isolate_name_server.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/lerp.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/natives.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/painting.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/plugins.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/pointer.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/semantics.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/text.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/ui.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/versions.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/window.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/ui/browser_location.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/ui/canvas.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/ui/compositing.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/ui/debug_canvas_reuse_overlay.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/ui/geometry.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/ui/hash_codes.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/ui/lerp.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/ui/natives.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/ui/painting.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/ui/pointer.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/ui/initialization.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/ui/semantics.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/ui/text.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/ui/tile_mode.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/ui/window.dart",
|
||||
]
|
||||
|
||||
web_engine_sources = [
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/assets.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/history.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/compositor/engine_delegate.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/compositor/layer_scene_builder.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/compositor/layer_tree.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/compositor/layer.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/compositor/platform_message.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/compositor/raster_cache.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/compositor/rasterizer.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/compositor/runtime_delegate.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/compositor/surface.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/compositor/viewport_metrics.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/semantics/checkable.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/semantics/incrementable.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/semantics/label_and_value.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/semantics/scrollable.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/semantics/semantics.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/semantics/tappable.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/semantics/text_field.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/services/message_codec.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/services/message_codecs.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/text/font_collection.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/text/measurement.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/text/ruler.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/text/unicode_range.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/text/word_break_properties.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/text/word_breaker.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/alarm_clock.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/bitmap_canvas.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/browser_detection.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/conic.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/pointer_binding.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/dom_canvas.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/dom_renderer.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/engine_canvas.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/houdini_canvas.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/html_image_codec.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/keyboard.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/onscreen_logging.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/path_to_svg.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/recording_canvas.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/shadow.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/text_editing.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/util.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/validators.dart",
|
||||
"$flutter_root/lib/stub_ui/lib/src/engine/vector_math.dart",
|
||||
]
|
||||
|
||||
group("web_sdk") {
|
||||
deps = [
|
||||
":flutter_dartdevc_kernel_sdk",
|
||||
":generate_web_summary_sdk",
|
||||
":web_engine_sources",
|
||||
":web_ui_library",
|
||||
":web_ui_sources",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -39,14 +92,43 @@ prebuilt_dart_action("web_ui_sources") {
|
||||
packages = "//third_party/dart/.packages"
|
||||
script = "sdk_rewriter.dart"
|
||||
output_dir = rebase_path("$root_out_dir/flutter_web_sdk/lib/ui/")
|
||||
input_dir = rebase_path("$flutter_root/lib/stub_ui/lib/")
|
||||
|
||||
args = [ "--output-dir=$output_dir" ]
|
||||
args = [
|
||||
"--output-dir=$output_dir",
|
||||
"--input-dir=$input_dir",
|
||||
"--ui",
|
||||
]
|
||||
|
||||
outputs = [
|
||||
"$root_out_dir/flutter_web_engine_sdk_stamp",
|
||||
]
|
||||
|
||||
foreach(source_file, web_ui_sources) {
|
||||
path = rebase_path(source_file)
|
||||
args += [ "--input=$path" ]
|
||||
}
|
||||
}
|
||||
|
||||
prebuilt_dart_action("web_engine_sources") {
|
||||
inputs = web_engine_sources + [ "sdk_rewriter.dart" ]
|
||||
|
||||
packages = "//third_party/dart/.packages"
|
||||
script = "sdk_rewriter.dart"
|
||||
output_dir = rebase_path("$root_out_dir/flutter_web_sdk/lib/_engine/")
|
||||
input_dir = rebase_path("$flutter_root/lib/stub_ui/lib/src/")
|
||||
|
||||
args = [
|
||||
"--output-dir=$output_dir",
|
||||
"--input-dir=$input_dir",
|
||||
"--engine",
|
||||
]
|
||||
|
||||
outputs = [
|
||||
"$root_out_dir/flutter_web_sdk_stamp",
|
||||
]
|
||||
|
||||
foreach(source_file, web_ui_sources) {
|
||||
foreach(source_file, web_engine_sources) {
|
||||
path = rebase_path(source_file)
|
||||
args += [ "--input=$path" ]
|
||||
}
|
||||
@@ -62,31 +144,6 @@ copy("web_ui_library") {
|
||||
]
|
||||
}
|
||||
|
||||
prebuilt_dart_action("generate_web_summary_sdk") {
|
||||
script = "$flutter_root/web_sdk/make_combined_sdk.dart"
|
||||
|
||||
inputs = [
|
||||
"$flutter_root/web_sdk/make_combined_sdk.dart",
|
||||
"$flutter_root/web_sdk/libraries.dart",
|
||||
]
|
||||
|
||||
packages = "//third_party/dart/.packages"
|
||||
|
||||
args = []
|
||||
|
||||
outputs = [
|
||||
"$root_out_dir/flutter_web_sdk/js/amd/sdk.js",
|
||||
"$root_out_dir/flutter_web_sdk/js/amd/dart_sdk.js.map",
|
||||
"$root_out_dir/flutter_web_sdk/lib/_internal/ddc_sdk.sum",
|
||||
]
|
||||
|
||||
deps = [
|
||||
":web_ui_library",
|
||||
":web_ui_sources",
|
||||
"//third_party/dart:create_sdk",
|
||||
]
|
||||
}
|
||||
|
||||
prebuilt_dart_action("flutter_dartdevc_kernel_sdk") {
|
||||
deps = [
|
||||
"//third_party/dart/pkg:pkg_files_stamp",
|
||||
|
||||
@@ -105,5 +105,6 @@ class FlutterDevCompilerTarget extends DevCompilerTarget {
|
||||
'dart:web_gl',
|
||||
'dart:web_sql',
|
||||
'dart:ui',
|
||||
'dart:_engine',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -1,313 +0,0 @@
|
||||
// Copyright 2013 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
library libraries;
|
||||
|
||||
// Branched from https://github.com/dart-lang/sdk/blob/master/pkg/dev_compiler/tool/input_sdk/libraries.dart
|
||||
// with handling for dart:ui added.
|
||||
|
||||
/**
|
||||
* A bit flag used by [LibraryInfo] indicating that a library is used by dart2js
|
||||
*/
|
||||
const int DART2JS_PLATFORM = 1;
|
||||
|
||||
/**
|
||||
* A bit flag used by [LibraryInfo] indicating that a library is used by the VM
|
||||
*/
|
||||
const int VM_PLATFORM = 2;
|
||||
|
||||
/// The contexts that a library can be used from.
|
||||
enum Category {
|
||||
/// Indicates that a library can be used in a browser context.
|
||||
client,
|
||||
|
||||
/// Indicates that a library can be used in a command line context.
|
||||
server,
|
||||
|
||||
/// Indicates that a library can be used from embedded devices.
|
||||
embedded
|
||||
}
|
||||
|
||||
Category parseCategory(String name) {
|
||||
switch (name) {
|
||||
case "Client":
|
||||
return Category.client;
|
||||
case "Server":
|
||||
return Category.server;
|
||||
case "Embedded":
|
||||
return Category.embedded;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Mapping of "dart:" library name (e.g. "core") to information about that
|
||||
/// library.
|
||||
const Map<String, LibraryInfo> libraries = const {
|
||||
"async": const LibraryInfo("async/async.dart",
|
||||
categories: "Client,Server",
|
||||
maturity: Maturity.STABLE,
|
||||
dart2jsPatchPath: "_internal/js_runtime/lib/async_patch.dart"),
|
||||
"collection": const LibraryInfo("collection/collection.dart",
|
||||
categories: "Client,Server,Embedded",
|
||||
maturity: Maturity.STABLE,
|
||||
dart2jsPatchPath: "_internal/js_runtime/lib/collection_patch.dart"),
|
||||
"convert": const LibraryInfo("convert/convert.dart",
|
||||
categories: "Client,Server",
|
||||
maturity: Maturity.STABLE,
|
||||
dart2jsPatchPath: "_internal/js_runtime/lib/convert_patch.dart"),
|
||||
"core": const LibraryInfo("core/core.dart",
|
||||
categories: "Client,Server,Embedded",
|
||||
maturity: Maturity.STABLE,
|
||||
dart2jsPatchPath: "_internal/js_runtime/lib/core_patch.dart"),
|
||||
"developer": const LibraryInfo("developer/developer.dart",
|
||||
categories: "Client,Server,Embedded",
|
||||
maturity: Maturity.UNSTABLE,
|
||||
dart2jsPatchPath: "_internal/js_runtime/lib/developer_patch.dart"),
|
||||
"html": const LibraryInfo("html/dart2js/html_dart2js.dart",
|
||||
categories: "Client",
|
||||
maturity: Maturity.WEB_STABLE,
|
||||
platforms: DART2JS_PLATFORM),
|
||||
"html_common": const LibraryInfo("html/html_common/html_common.dart",
|
||||
categories: "Client",
|
||||
maturity: Maturity.WEB_STABLE,
|
||||
dart2jsPath: "html/html_common/html_common_dart2js.dart",
|
||||
documented: false,
|
||||
implementation: true),
|
||||
"indexed_db": const LibraryInfo("indexed_db/dart2js/indexed_db_dart2js.dart",
|
||||
categories: "Client",
|
||||
maturity: Maturity.WEB_STABLE,
|
||||
platforms: DART2JS_PLATFORM),
|
||||
"_http":
|
||||
const LibraryInfo("_http/http.dart", categories: "", documented: false),
|
||||
"io": const LibraryInfo("io/io.dart",
|
||||
categories: "Server",
|
||||
dart2jsPatchPath: "_internal/js_runtime/lib/io_patch.dart"),
|
||||
"isolate": const LibraryInfo("isolate/isolate.dart",
|
||||
categories: "Client,Server",
|
||||
maturity: Maturity.STABLE,
|
||||
dart2jsPatchPath: "_internal/js_runtime/lib/isolate_patch.dart"),
|
||||
"js": const LibraryInfo("js/dart2js/js_dart2js.dart",
|
||||
categories: "Client",
|
||||
maturity: Maturity.STABLE,
|
||||
platforms: DART2JS_PLATFORM),
|
||||
"js_util": const LibraryInfo("js_util/dart2js/js_util_dart2js.dart",
|
||||
categories: "Client",
|
||||
maturity: Maturity.STABLE,
|
||||
platforms: DART2JS_PLATFORM),
|
||||
"math": const LibraryInfo("math/math.dart",
|
||||
categories: "Client,Server,Embedded",
|
||||
maturity: Maturity.STABLE,
|
||||
dart2jsPatchPath: "_internal/js_runtime/lib/math_patch.dart"),
|
||||
"mirrors": const LibraryInfo("mirrors/mirrors.dart",
|
||||
categories: "Client,Server",
|
||||
maturity: Maturity.UNSTABLE,
|
||||
dart2jsPatchPath: "_internal/js_runtime/lib/mirrors_patch.dart"),
|
||||
"nativewrappers": const LibraryInfo("html/dartium/nativewrappers.dart",
|
||||
categories: "Client",
|
||||
implementation: true,
|
||||
documented: false,
|
||||
platforms: DART2JS_PLATFORM),
|
||||
"typed_data": const LibraryInfo("typed_data/typed_data.dart",
|
||||
categories: "Client,Server,Embedded",
|
||||
maturity: Maturity.STABLE,
|
||||
dart2jsPatchPath: "_internal/js_runtime/lib/typed_data_patch.dart"),
|
||||
"_native_typed_data": const LibraryInfo(
|
||||
"_internal/js_runtime/lib/native_typed_data.dart",
|
||||
categories: "",
|
||||
implementation: true,
|
||||
documented: false,
|
||||
platforms: DART2JS_PLATFORM),
|
||||
"cli": const LibraryInfo("cli/cli.dart",
|
||||
categories: "Server",
|
||||
dart2jsPatchPath: "_internal/js_runtime/lib/cli_patch.dart"),
|
||||
"svg": const LibraryInfo("svg/dart2js/svg_dart2js.dart",
|
||||
categories: "Client",
|
||||
maturity: Maturity.WEB_STABLE,
|
||||
platforms: DART2JS_PLATFORM),
|
||||
"web_audio": const LibraryInfo("web_audio/dart2js/web_audio_dart2js.dart",
|
||||
categories: "Client",
|
||||
maturity: Maturity.WEB_STABLE,
|
||||
platforms: DART2JS_PLATFORM),
|
||||
"web_gl": const LibraryInfo("web_gl/dart2js/web_gl_dart2js.dart",
|
||||
categories: "Client",
|
||||
maturity: Maturity.WEB_STABLE,
|
||||
platforms: DART2JS_PLATFORM),
|
||||
"web_sql": const LibraryInfo("web_sql/dart2js/web_sql_dart2js.dart",
|
||||
categories: "Client",
|
||||
maturity: Maturity.WEB_STABLE,
|
||||
platforms: DART2JS_PLATFORM),
|
||||
"_internal": const LibraryInfo("internal/internal.dart",
|
||||
categories: "",
|
||||
documented: false,
|
||||
dart2jsPatchPath: "_internal/js_runtime/lib/internal_patch.dart"),
|
||||
"_js_helper": const LibraryInfo("_internal/js_runtime/lib/js_helper.dart",
|
||||
categories: "", documented: false, platforms: DART2JS_PLATFORM),
|
||||
"_interceptors": const LibraryInfo(
|
||||
"_internal/js_runtime/lib/interceptors.dart",
|
||||
categories: "",
|
||||
documented: false,
|
||||
platforms: DART2JS_PLATFORM),
|
||||
"_foreign_helper": const LibraryInfo(
|
||||
"_internal/js_runtime/lib/foreign_helper.dart",
|
||||
categories: "",
|
||||
documented: false,
|
||||
platforms: DART2JS_PLATFORM),
|
||||
"_isolate_helper": const LibraryInfo(
|
||||
"_internal/js_runtime/lib/isolate_helper.dart",
|
||||
categories: "",
|
||||
documented: false,
|
||||
platforms: DART2JS_PLATFORM),
|
||||
"_js_mirrors": const LibraryInfo("_internal/js_runtime/lib/js_mirrors.dart",
|
||||
categories: "", documented: false, platforms: DART2JS_PLATFORM),
|
||||
"_js_primitives": const LibraryInfo(
|
||||
"_internal/js_runtime/lib/js_primitives.dart",
|
||||
categories: "",
|
||||
documented: false,
|
||||
platforms: DART2JS_PLATFORM),
|
||||
"_metadata": const LibraryInfo("html/html_common/metadata.dart",
|
||||
categories: "", documented: false, platforms: DART2JS_PLATFORM),
|
||||
"_debugger": const LibraryInfo("_internal/js_runtime/lib/debugger.dart",
|
||||
category: "", documented: false, platforms: DART2JS_PLATFORM),
|
||||
"_runtime": const LibraryInfo(
|
||||
"_internal/js_runtime/lib/ddc_runtime/runtime.dart",
|
||||
category: "",
|
||||
documented: false,
|
||||
platforms: DART2JS_PLATFORM),
|
||||
"ui": const LibraryInfo("ui/ui.dart", documented: true, platforms:DART2JS_PLATFORM),
|
||||
};
|
||||
|
||||
/**
|
||||
* Information about a "dart:" library.
|
||||
*/
|
||||
class LibraryInfo {
|
||||
/**
|
||||
* Path to the library's *.dart file relative to this file.
|
||||
*/
|
||||
final String path;
|
||||
|
||||
/**
|
||||
* The categories in which the library can be used encoded as a
|
||||
* comma-separated String.
|
||||
*/
|
||||
final String _categories;
|
||||
|
||||
/**
|
||||
* Path to the dart2js library's *.dart file relative to this file
|
||||
* or null if dart2js uses the common library path defined above.
|
||||
* Access using the [#getDart2JsPath()] method.
|
||||
*/
|
||||
final String dart2jsPath;
|
||||
|
||||
/**
|
||||
* Path to the dart2js library's patch file relative to this file
|
||||
* or null if no dart2js patch file associated with this library.
|
||||
* Access using the [#getDart2JsPatchPath()] method.
|
||||
*/
|
||||
final String dart2jsPatchPath;
|
||||
|
||||
/**
|
||||
* True if this library is documented and should be shown to the user.
|
||||
*/
|
||||
final bool documented;
|
||||
|
||||
/**
|
||||
* Bit flags indicating which platforms consume this library.
|
||||
* See [DART2JS_LIBRARY] and [VM_LIBRARY].
|
||||
*/
|
||||
final int platforms;
|
||||
|
||||
/**
|
||||
* True if the library contains implementation details for another library.
|
||||
* The implication is that these libraries are less commonly used
|
||||
* and that tools like Dart Editor should not show these libraries
|
||||
* in a list of all libraries unless the user specifically asks the tool to
|
||||
* do so.
|
||||
*/
|
||||
final bool implementation;
|
||||
|
||||
/**
|
||||
* States the current maturity of this library.
|
||||
*/
|
||||
final Maturity maturity;
|
||||
|
||||
const LibraryInfo(this.path,
|
||||
{String categories: "",
|
||||
this.dart2jsPath,
|
||||
this.dart2jsPatchPath,
|
||||
this.implementation: false,
|
||||
this.documented: true,
|
||||
this.maturity: Maturity.UNSPECIFIED,
|
||||
this.platforms: DART2JS_PLATFORM | VM_PLATFORM})
|
||||
: _categories = categories;
|
||||
|
||||
bool get isDart2jsLibrary => (platforms & DART2JS_PLATFORM) != 0;
|
||||
bool get isVmLibrary => (platforms & VM_PLATFORM) != 0;
|
||||
|
||||
/**
|
||||
* The categories in which the library can be used.
|
||||
*
|
||||
* If no categories are specified, the library is internal and can not be
|
||||
* loaded by user code.
|
||||
*/
|
||||
List<Category> get categories {
|
||||
// `"".split(,)` returns [""] not [], so we handle that case separately.
|
||||
if (_categories == "") return const <Category>[];
|
||||
return _categories.split(",").map(parseCategory).toList();
|
||||
}
|
||||
|
||||
bool get isInternal => categories.isEmpty;
|
||||
|
||||
/// The original "categories" String that was passed to the constructor.
|
||||
///
|
||||
/// Can be used to construct a slightly modified copy of this LibraryInfo.
|
||||
String get categoriesString {
|
||||
return _categories;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Abstraction to capture the maturity of a library.
|
||||
*/
|
||||
class Maturity {
|
||||
final int level;
|
||||
final String name;
|
||||
final String description;
|
||||
|
||||
const Maturity(this.level, this.name, this.description);
|
||||
|
||||
String toString() => "$name: $level\n$description\n";
|
||||
|
||||
static const Maturity DEPRECATED = const Maturity(0, "Deprecated",
|
||||
"This library will be remove before next major release.");
|
||||
|
||||
static const Maturity EXPERIMENTAL = const Maturity(
|
||||
1,
|
||||
"Experimental",
|
||||
"This library is experimental and will likely change or be removed\n"
|
||||
"in future versions.");
|
||||
|
||||
static const Maturity UNSTABLE = const Maturity(
|
||||
2,
|
||||
"Unstable",
|
||||
"This library is in still changing and have not yet endured\n"
|
||||
"sufficient real-world testing.\n"
|
||||
"Backwards-compatibility is NOT guaranteed.");
|
||||
|
||||
static const Maturity WEB_STABLE = const Maturity(
|
||||
3,
|
||||
"Web Stable",
|
||||
"This library is tracking the DOM evolution as defined by WC3.\n"
|
||||
"Backwards-compatibility is NOT guaranteed.");
|
||||
|
||||
static const Maturity STABLE = const Maturity(
|
||||
4,
|
||||
"Stable",
|
||||
"The library is stable. API backwards-compatibility is guaranteed.\n"
|
||||
"However implementation details might change.");
|
||||
|
||||
static const Maturity LOCKED = const Maturity(5, "Locked",
|
||||
"This library will not change except when serious bugs are encountered.");
|
||||
|
||||
static const Maturity UNSPECIFIED = const Maturity(-1, "Unspecified",
|
||||
"The maturity for this library has not been specified.");
|
||||
}
|
||||
@@ -51,6 +51,9 @@
|
||||
"ui": {
|
||||
"uri": "lib/ui/ui.dart"
|
||||
},
|
||||
"_engine": {
|
||||
"uri": "lib/_engine/engine.dart"
|
||||
},
|
||||
"js": {
|
||||
"uri": "../dart-sdk/lib/js/dart2js/js_dart2js.dart"
|
||||
},
|
||||
|
||||
@@ -130,6 +130,9 @@ dart2js:
|
||||
ui:
|
||||
uri: "lib/ui/ui.dart"
|
||||
|
||||
_engine:
|
||||
uri: "lib/_engine/engine.dart"
|
||||
|
||||
async:
|
||||
uri: "../dart-sdk/lib/async/async.dart"
|
||||
patches: "../dart-sdk/lib/_internal/js_runtime/lib/async_patch.dart"
|
||||
|
||||
@@ -1,120 +0,0 @@
|
||||
// Copyright 2013 The Flutter 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:io';
|
||||
|
||||
import 'package:path/path.dart' as path;
|
||||
import 'package:dev_compiler/src/analyzer/command.dart' as command; // ignore: uri_does_not_exist
|
||||
|
||||
// Creates flutter precompiled web sdk and analyzer summary.
|
||||
Future<void> main() async {
|
||||
// create a temporary dart-sdk directory.
|
||||
final Directory tempDartSdk = Directory(path.join('temp_dart_sdk', 'lib'))
|
||||
..createSync(recursive: true);
|
||||
final Directory patchedDartSdk = Directory(path.join(
|
||||
'gen', 'third_party', 'dart', 'utils', 'dartdevc', 'patched_sdk', 'lib'));
|
||||
final Directory flutterWebUi = Directory(path.join(
|
||||
'flutter_web_sdk',
|
||||
'lib',
|
||||
'ui',
|
||||
));
|
||||
|
||||
// Copy this patched dart sdk into the temporary directory.
|
||||
for (FileSystemEntity entity in patchedDartSdk.listSync(recursive: true)) {
|
||||
if (entity is File) {
|
||||
final String targetPath = path.join(tempDartSdk.path,
|
||||
path.relative(entity.path, from: patchedDartSdk.path));
|
||||
File(targetPath).createSync(recursive: true);
|
||||
entity.copySync(path.join(tempDartSdk.path,
|
||||
path.relative(entity.path, from: patchedDartSdk.path)));
|
||||
}
|
||||
}
|
||||
// Copy the dart:ui sources into the temporary directory.
|
||||
for (FileSystemEntity entity in flutterWebUi.listSync(recursive: true)) {
|
||||
if (entity is File) {
|
||||
final String targetPath = path.join(tempDartSdk.path, 'ui',
|
||||
path.relative(entity.path, from: flutterWebUi.path));
|
||||
File(targetPath).createSync(recursive: true);
|
||||
entity.copySync(targetPath);
|
||||
}
|
||||
}
|
||||
// Copy the libraries.dart file into the temporary directory.
|
||||
final File libraries = File(path.join('..', '..', 'flutter', 'web_sdk', 'libraries.dart'));
|
||||
libraries.copySync(path.join(tempDartSdk.path, '_internal', 'libraries.dart'));
|
||||
libraries.copySync(path.join(tempDartSdk.path, '_internal', 'sdk_library_metadata', 'lib', 'libraries.dart'));
|
||||
|
||||
// Prevent regular compilation from leaking into flutter
|
||||
final File ddcSummary =
|
||||
File(path.join(tempDartSdk.path, '_internal', 'ddc_sdk.sum'));
|
||||
final File jsSdk =
|
||||
File(path.join(tempDartSdk.parent.path, 'js', 'amd', 'dart_sdk.js'));
|
||||
final File jsSdkMap =
|
||||
File(path.join(tempDartSdk.parent.path, 'js', 'amd', 'dart_sdk.js.map'));
|
||||
if (ddcSummary.existsSync()) {
|
||||
ddcSummary.deleteSync();
|
||||
}
|
||||
if (jsSdk.existsSync()) {
|
||||
jsSdk.deleteSync();
|
||||
}
|
||||
if (jsSdkMap.existsSync()) {
|
||||
jsSdkMap.deleteSync();
|
||||
}
|
||||
|
||||
// Execute the analyzer summary and sdk generation.
|
||||
final List<String> args = <String>['--no-source-map', '--no-emit-metadata'];
|
||||
args.addAll(<String>[
|
||||
'--dart-sdk=temp_dart_sdk',
|
||||
'--dart-sdk-summary=build',
|
||||
'--summary-out=temp_dart_sdk/lib/_internal/ddc_sdk.sum',
|
||||
'--source-map',
|
||||
'--source-map-comment',
|
||||
'--modules=amd',
|
||||
'-o',
|
||||
'temp_dart_sdk/js/amd/dart_sdk.js'
|
||||
]);
|
||||
args.addAll(<String>[
|
||||
'dart:_runtime',
|
||||
'dart:_debugger',
|
||||
'dart:_foreign_helper',
|
||||
'dart:_interceptors',
|
||||
'dart:_internal',
|
||||
'dart:_isolate_helper',
|
||||
'dart:_js_helper',
|
||||
'dart:_js_mirrors',
|
||||
'dart:_js_primitives',
|
||||
'dart:_metadata',
|
||||
'dart:_native_typed_data',
|
||||
'dart:async',
|
||||
'dart:collection',
|
||||
'dart:convert',
|
||||
'dart:core',
|
||||
'dart:developer',
|
||||
'dart:io',
|
||||
'dart:isolate',
|
||||
'dart:js',
|
||||
'dart:js_util',
|
||||
'dart:math',
|
||||
'dart:mirrors',
|
||||
'dart:typed_data',
|
||||
'dart:indexed_db',
|
||||
'dart:html',
|
||||
'dart:html_common',
|
||||
'dart:svg',
|
||||
'dart:web_audio',
|
||||
'dart:web_gl',
|
||||
'dart:web_sql',
|
||||
'dart:ui',
|
||||
]);
|
||||
final int result = (await command.compile(args)).exitCode;
|
||||
if (result != 0) {
|
||||
throw 'SDK generation failed with exit code $result';
|
||||
}
|
||||
|
||||
// Copy generated sdk and summary back to flutter web sdk.
|
||||
ddcSummary.copySync(
|
||||
path.join('flutter_web_sdk', 'lib', '_internal', 'ddc_sdk.sum'));
|
||||
jsSdk.copySync(path.join('flutter_web_sdk', 'js', 'amd', 'dart_sdk.js'));
|
||||
jsSdkMap
|
||||
.copySync(path.join('flutter_web_sdk', 'js', 'amd', 'dart_sdk.js.map'));
|
||||
}
|
||||
@@ -9,32 +9,66 @@ import 'package:path/path.dart' as path;
|
||||
|
||||
final ArgParser argParser = ArgParser()
|
||||
..addOption('output-dir')
|
||||
..addOption('input-dir')
|
||||
..addFlag('ui', defaultsTo: false)
|
||||
..addFlag('engine', defaultsTo: false)
|
||||
..addMultiOption('input');
|
||||
|
||||
const Pattern packageLibraryName = 'library ui;';
|
||||
const Pattern packagePartName = 'part of ui;';
|
||||
const Pattern coreLibraryName = 'library dart.ui;';
|
||||
const Pattern corePartName = 'part of dart.ui;';
|
||||
const List<List<String>> uiPatterns = <List<String>>[
|
||||
<String>['library ui;', 'library dart.ui;'],
|
||||
<String>['part of ui;', 'part of dart.ui;'],
|
||||
<String>[
|
||||
r'''
|
||||
import 'src/engine.dart' as engine;
|
||||
''',
|
||||
r'''
|
||||
import 'dart:_engine' as engine;
|
||||
'''
|
||||
]
|
||||
];
|
||||
|
||||
const List<List<String>> enginePatterns = <List<String>>[
|
||||
<String>['library engine;', 'library dart._engine;'],
|
||||
<String>['part of engine;', 'part of dart._engine;'],
|
||||
<String>[
|
||||
r'''
|
||||
import '../ui.dart' as ui;
|
||||
''',
|
||||
r'''
|
||||
import 'dart:ui' as ui;
|
||||
'''
|
||||
]
|
||||
];
|
||||
|
||||
const List<List<String>> sharedPatterns = <List<String>>[
|
||||
<String>["import 'package:meta/meta.dart';" ,''],
|
||||
<String>['@required', ''],
|
||||
<String>['@protected', ''],
|
||||
<String>['@mustCallSuper', ''],
|
||||
<String>['@immutable', ''],
|
||||
<String>['@visibleForTesting', '']
|
||||
];
|
||||
|
||||
// Rewrites the "package"-style web ui library into a dart:ui implementation.
|
||||
// So far this only requires a replace of the library declarations.
|
||||
void main(List<String> arguments) {
|
||||
final ArgResults results = argParser.parse(arguments);
|
||||
final Directory directory = Directory(results['output-dir']);
|
||||
if (!directory.existsSync()) {
|
||||
directory.createSync(recursive: true);
|
||||
}
|
||||
final String inputDirectoryPath = results['input-dir'];
|
||||
for (String inputFilePath in results['input']) {
|
||||
final File inputFile = File(inputFilePath);
|
||||
final String fileName = path.split(inputFilePath).last;
|
||||
final File outputFile = File(path.join(directory.path, fileName))
|
||||
..createSync();
|
||||
String source;
|
||||
if (fileName == 'ui.dart') {
|
||||
source = inputFile.readAsStringSync().replaceFirst(packageLibraryName, coreLibraryName);
|
||||
outputFile.writeAsStringSync(source);
|
||||
} else {
|
||||
source = inputFile.readAsStringSync().replaceFirst(packagePartName, corePartName);
|
||||
final File outputFile = File(path.join(directory.path, inputFile.path.substring(inputDirectoryPath.length)))
|
||||
..createSync(recursive: true);
|
||||
String source = inputFile.readAsStringSync();
|
||||
final List<List<String>> replacementPatterns = <List<String>>[];
|
||||
replacementPatterns.addAll(sharedPatterns);
|
||||
if (results['ui']) {
|
||||
replacementPatterns.addAll(uiPatterns);
|
||||
} else if (results['engine']) {
|
||||
replacementPatterns.addAll(enginePatterns);
|
||||
}
|
||||
for (List<String> patterns in replacementPatterns) {
|
||||
source = source.replaceAll(patterns.first, patterns.last);
|
||||
}
|
||||
outputFile.writeAsStringSync(source);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user