Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
159 changes: 157 additions & 2 deletions web_sdk/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import("//third_party/dart/build/dart/dart_action.gni")
import("//third_party/dart/utils/compile_platform.gni")

sdk_dill = "$root_out_dir/flutter_web_sdk/kernel/flutter_ddc_sdk.dill"
sdk_dill_sound =
"$root_out_dir/flutter_web_sdk/kernel/flutter_ddc_sdk_sound.dill"

web_ui_sources = exec_script("//third_party/dart/tools/list_dart_files.py",
[
Expand All @@ -29,8 +31,11 @@ web_engine_sources += [ "//flutter/lib/web_ui/lib/src/engine.dart" ]
group("web_sdk") {
deps = [
":flutter_dartdevc_canvaskit_kernel_sdk",
":flutter_dartdevc_canvaskit_kernel_sdk_sound",
Comment on lines 33 to +34
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the canvaskit version need outlines?

":flutter_dartdevc_kernel_sdk",
":flutter_dartdevc_kernel_sdk_outline",
":flutter_dartdevc_kernel_sdk_outline_sound",
":flutter_dartdevc_kernel_sdk_sound",
":web_engine_sources",
":web_ui_library",
":web_ui_sources",
Expand Down Expand Up @@ -164,7 +169,6 @@ prebuilt_dart_action("flutter_dartdevc_kernel_sdk") {

args = [
"--enable-experiment=non-nullable",
"-k",
"--compile-sdk",
"dart:core",

Expand Down Expand Up @@ -216,7 +220,6 @@ prebuilt_dart_action("flutter_dartdevc_canvaskit_kernel_sdk") {

args = [
"--enable-experiment=non-nullable",
"-k",
"--compile-sdk",
"dart:core",

Expand Down Expand Up @@ -248,3 +251,155 @@ prebuilt_dart_action("flutter_dartdevc_canvaskit_kernel_sdk") {
"$root_out_dir/flutter_web_sdk/kernel/legacy-canvaskit/dart_sdk.js"),
]
}

# Compiles the DDC CanvasKit SDK's JS code for null safety.
prebuilt_dart_action("flutter_dartdevc_canvaskit_kernel_sdk_sound") {
deps = [
"//third_party/dart:create_sdk",
"//third_party/dart/pkg:pkg_files_stamp",
"//third_party/dart/utils/dartdevc:dartdevc_files_stamp",
"//third_party/dart/utils/dartdevc:dartdevc_sdk_patch_stamp",
]

inputs = [ "sdk_rewriter.dart" ] + web_ui_sources + web_engine_sources

packages = "//third_party/dart/.packages"

script = "//third_party/dart/pkg/dev_compiler/bin/dartdevc.dart"

outputs = [
"$root_out_dir/flutter_web_sdk/kernel/amd-canvaskit-sound/dart_sdk.js",
"$root_out_dir/flutter_web_sdk/kernel/amd-canvaskit-sound/dart_sdk.js.map",
]

args = [
"--enable-experiment=non-nullable",
"--sound-null-safety",
"--compile-sdk",
"dart:core",

# Additional Flutter web dart libraries
"dart:ui",
"dart:_engine",
"--no-summarize",
"--packages",
"file:///" + rebase_path("//third_party/dart/.packages"),
"--multi-root-scheme",
"org-dartlang-sdk",
"--multi-root",
"file:///" + rebase_path("$root_out_dir"),
"--multi-root-output-path",
rebase_path("$root_out_dir/"),
"--libraries-file",
"org-dartlang-sdk:///flutter_web_sdk/libraries.json",
"--inline-source-map",
"-DFLUTTER_WEB_USE_SKIA=true",
"--modules",
"amd",
"-o",
rebase_path(
"$root_out_dir/flutter_web_sdk/kernel/amd-canvaskit-sound/dart_sdk.js"),
"--modules",
"legacy",
"-o",
rebase_path(
"$root_out_dir/flutter_web_sdk/kernel/legacy-canvaskit-sound/dart_sdk.js"),
]
}

# Compiles the DDC SDK's JS code for null safety.
prebuilt_dart_action("flutter_dartdevc_kernel_sdk_sound") {
deps = [
"//third_party/dart:create_sdk",
"//third_party/dart/pkg:pkg_files_stamp",
"//third_party/dart/utils/dartdevc:dartdevc_files_stamp",
"//third_party/dart/utils/dartdevc:dartdevc_sdk_patch_stamp",
]

inputs = [ "sdk_rewriter.dart" ] + web_ui_sources + web_engine_sources

packages = "//third_party/dart/.packages"

script = "//third_party/dart/pkg/dev_compiler/bin/dartdevc.dart"

outputs = [
"$root_out_dir/flutter_web_sdk/kernel/amd-sound/dart_sdk.js",
"$root_out_dir/flutter_web_sdk/kernel/amd-sound/dart_sdk.js.map",
]

args = [
"--enable-experiment=non-nullable",
"--sound-null-safety",
"--compile-sdk",
"dart:core",

# Additional Flutter web dart libraries
"dart:ui",
"dart:_engine",
"--no-summarize",
"--packages",
"file:///" + rebase_path("//third_party/dart/.packages"),
"--multi-root-scheme",
"org-dartlang-sdk",
"--multi-root",
"file:///" + rebase_path("$root_out_dir"),
"--multi-root-output-path",
rebase_path("$root_out_dir/"),
"--libraries-file",
"org-dartlang-sdk:///flutter_web_sdk/libraries.json",
"--inline-source-map",
"--modules",
"amd",
"-o",
rebase_path("$root_out_dir/flutter_web_sdk/kernel/amd-sound/dart_sdk.js"),
"--modules",
"legacy",
"-o",
rebase_path(
"$root_out_dir/flutter_web_sdk/kernel/legacy-sound/dart_sdk.js"),
]
}

# Compile the DDC SDK's summary.
prebuilt_dart_action("flutter_dartdevc_kernel_sdk_outline_sound") {
deps = [
"//third_party/dart:create_sdk",
"//third_party/dart/pkg:pkg_files_stamp",
"//third_party/dart/utils/dartdevc:dartdevc_files_stamp",
"//third_party/dart/utils/dartdevc:dartdevc_sdk_patch_stamp",
]

inputs = [ "sdk_rewriter.dart" ] + web_ui_sources + web_engine_sources

outputs = [
sdk_dill_sound,
]

script = "//third_party/dart/utils/bazel/kernel_worker.dart"

args = [
"--enable-experiment=non-nullable",
"--sound-null-safety ",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar with the kernel_worker.dart script and I'm not using it when I build the .dill files in the sdk build target. Does it already support the --sound-null-safety flag? I didn't see it in the args in a quick search.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought It worked locally but I might have missed some flags. At any rate, everything still fails when compiling, I'll double check what dart_sdk is doing and update though

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

everything seems to work OK

"--summary-only",
"--target",
"ddc",
"--packages-file",
"file:///" + rebase_path("//third_party/dart/.packages"),
"--multi-root-scheme",
"org-dartlang-sdk",
"--multi-root",
"file:///" + rebase_path("$root_out_dir"),
"--libraries-file",
"org-dartlang-sdk:///flutter_web_sdk/libraries.json",
"--output",
rebase_path(sdk_dill_sound),
"--source",
"dart:core",

# Additional Flutter web dart libraries
"--source",
"dart:ui",
"--source",
"dart:_engine",
]
}