Skip to content

Commit

Permalink
Copy canvaskit files directly into flutter_web_sdk (flutter#40951)
Browse files Browse the repository at this point in the history
Copy canvaskit files directly into `flutter_web_sdk`
  • Loading branch information
eyebrowsoffire authored Apr 5, 2023
1 parent 610cdf0 commit 55d7806
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 33 deletions.
24 changes: 22 additions & 2 deletions third_party/canvaskit/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,15 @@ wasm_toolchain("canvaskit") {
}
}

group("canvaskit_group") {
copy("canvaskit_group") {
visibility = [ "//flutter/web_sdk:*" ]
public_deps = [ "//third_party/skia/modules/canvaskit(:canvaskit)" ]

sources = [
"$root_out_dir/canvaskit/canvaskit.js",
"$root_out_dir/canvaskit/canvaskit.wasm",
]
outputs = [ "$root_out_dir/flutter_web_sdk/canvaskit/{{source_file_part}}" ]
}

# This toolchain is only to be used by canvaskit_chromium_group below.
Expand Down Expand Up @@ -57,5 +63,19 @@ copy("canvaskit_chromium_group") {
"$root_out_dir/canvaskit_chromium/canvaskit.js",
"$root_out_dir/canvaskit_chromium/canvaskit.wasm",
]
outputs = [ "$root_out_dir/canvaskit/chromium/{{source_file_part}}" ]
outputs = [
"$root_out_dir/flutter_web_sdk/canvaskit/chromium/{{source_file_part}}",
]
}

copy("skwasm_group") {
visibility = [ "//flutter/web_sdk:*" ]
public_deps = [ "//flutter/lib/web_ui/skwasm" ]

sources = [
"$root_out_dir/skwasm.js",
"$root_out_dir/skwasm.wasm",
"$root_out_dir/skwasm.worker.js",
]
outputs = [ "$root_out_dir/flutter_web_sdk/canvaskit/{{source_file_part}}" ]
}
41 changes: 10 additions & 31 deletions web_sdk/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ if (!is_fuchsia) {
":flutter_platform_dills",
"//flutter/third_party/canvaskit:canvaskit_group",
"//flutter/third_party/canvaskit:canvaskit_chromium_group",
"//flutter/lib/web_ui/skwasm",
"//flutter/third_party/canvaskit:skwasm_group",
] + web_engine_libraries

# flutter_ddc_modules
Expand All @@ -595,6 +595,15 @@ if (!is_fuchsia) {
sources += get_target_outputs(":flutter_dartdevc_kernel_sdk_outline_sound")
sources += get_target_outputs(":flutter_dart2js_kernel_sdk_full_unsound")
sources += get_target_outputs(":flutter_dart2js_kernel_sdk_full_sound")
sources += [
"$root_out_dir/flutter_web_sdk/canvaskit/canvaskit.js",
"$root_out_dir/flutter_web_sdk/canvaskit/canvaskit.wasm",
"$root_out_dir/flutter_web_sdk/canvaskit/chromium/canvaskit.js",
"$root_out_dir/flutter_web_sdk/canvaskit/chromium/canvaskit.wasm",
"$root_out_dir/flutter_web_sdk/canvaskit/skwasm.js",
"$root_out_dir/flutter_web_sdk/canvaskit/skwasm.wasm",
"$root_out_dir/flutter_web_sdk/canvaskit/skwasm.worker.js",
]

# TODO(jacksongardner): remove these once they are no longer used by the flutter tool
# https://github.com/flutter/flutter/issues/113303
Expand All @@ -618,36 +627,6 @@ if (!is_fuchsia) {
},
]
}
tmp_files += [
{
source = rebase_path("$root_out_dir/canvaskit/canvaskit.js")
destination = "canvaskit/canvaskit.js"
},
{
source = rebase_path("$root_out_dir/canvaskit/canvaskit.wasm")
destination = "canvaskit/canvaskit.wasm"
},
{
source = rebase_path("$root_out_dir/canvaskit/chromium/canvaskit.js")
destination = "canvaskit/chromium/canvaskit.js"
},
{
source = rebase_path("$root_out_dir/canvaskit/chromium/canvaskit.wasm")
destination = "canvaskit/chromium/canvaskit.wasm"
},
{
source = rebase_path("$root_out_dir/skwasm.js")
destination = "canvaskit/skwasm.js"
},
{
source = rebase_path("$root_out_dir/skwasm.worker.js")
destination = "canvaskit/skwasm.worker.js"
},
{
source = rebase_path("$root_out_dir/skwasm.wasm")
destination = "canvaskit/skwasm.wasm"
},
]
files = tmp_files
}
}

0 comments on commit 55d7806

Please sign in to comment.