-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reland ui_web files in sky_engine (#41169)
Previous attempt was here: #40846 I was including un-rewritten source files, which caused breakage. Now we run out `ui_web` files through the sdk_rewriter script before putting them into sky_engine
- Loading branch information
1 parent
4a603aa
commit 8d92070
Showing
5 changed files
with
102 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# Copyright 2019 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("//flutter/common/config.gni") | ||
import("//third_party/dart/build/dart/dart_action.gni") | ||
|
||
dart_sdk_package_config = "//third_party/dart/.dart_tool/package_config.json" | ||
|
||
template("sdk_rewriter") { | ||
ui = defined(invoker.ui) && invoker.ui | ||
if (!ui) { | ||
assert(defined(invoker.library_name), "Must pass 'library_name'") | ||
assert(defined(invoker.api_file), "Must pass 'api_file'") | ||
} | ||
assert(defined(invoker.input_dir), "Must pass 'input_dir'") | ||
assert(defined(invoker.output_dir), "Must pass 'output_dir'") | ||
|
||
source_dart_files = exec_script("//third_party/dart/tools/list_dart_files.py", | ||
[ | ||
"absolute", | ||
rebase_path(invoker.input_dir), | ||
], | ||
"list lines") | ||
|
||
if (defined(invoker.exclude_patterns)) { | ||
filtered_files = filter_exclude(source_dart_files, invoker.exclude_patterns) | ||
source_dart_files = [] | ||
source_dart_files = filtered_files | ||
} | ||
|
||
prebuilt_dart_action(target_name) { | ||
packages = dart_sdk_package_config | ||
pool = "//flutter/build/dart:dart_pool" | ||
|
||
script = "//flutter/web_sdk/sdk_rewriter.dart" | ||
inputs = source_dart_files + [ script ] | ||
|
||
stamp_location = "$target_gen_dir/$target_name.stamp" | ||
outputs = [ | ||
stamp_location, | ||
invoker.output_dir, | ||
] | ||
|
||
input_dir = rebase_path(invoker.input_dir) | ||
output_dir = rebase_path(invoker.output_dir) | ||
|
||
args = [ | ||
"--output-dir=$output_dir", | ||
"--input-dir=$input_dir", | ||
"--stamp", | ||
rebase_path(stamp_location, root_build_dir), | ||
] | ||
|
||
if (defined(invoker.is_public) && invoker.is_public) { | ||
args += [ "--public" ] | ||
} | ||
|
||
if (ui) { | ||
args += [ "--ui" ] | ||
} else { | ||
library_name = invoker.library_name | ||
api_file = rebase_path(invoker.api_file) | ||
args += [ | ||
"--library-name=$library_name", | ||
"--api-file=$api_file", | ||
] | ||
} | ||
|
||
foreach(source_file, source_dart_files) { | ||
path = rebase_path(source_file) | ||
args += [ "--source-file=$path" ] | ||
} | ||
} | ||
} | ||
|
||
template("web_ui_ui_web_with_output") { | ||
sdk_rewriter(target_name) { | ||
library_name = "ui_web" | ||
is_public = true | ||
api_file = "//flutter/lib/web_ui/lib/ui_web/src/ui_web.dart" | ||
input_dir = "//flutter/lib/web_ui/lib/ui_web/src/ui_web/" | ||
output_dir = invoker.output_dir | ||
} | ||
} |