2022-03-24 00:21:55 +00:00
|
|
|
# Copyright 2022 The Dawn Authors
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
2022-03-17 21:43:17 +00:00
|
|
|
|
|
|
|
# Note: This file is intentionally not used by any other BUILD.gn in Dawn.
|
|
|
|
# Instead, Chromium depends directly on this file to build the WebGPU CTS.
|
|
|
|
# Scripts called from this file assume Dawn is checked out inside Chromium.
|
|
|
|
|
2022-03-24 00:21:55 +00:00
|
|
|
import("../../../scripts/dawn_overrides_with_defaults.gni")
|
|
|
|
|
2022-03-17 21:43:17 +00:00
|
|
|
group("webgpu-cts") {
|
|
|
|
public_deps = [
|
|
|
|
":compile_src",
|
|
|
|
":copy_resources",
|
2022-11-21 15:16:51 +00:00
|
|
|
":gen_cache",
|
2022-03-17 21:43:17 +00:00
|
|
|
":verify_gen_ts_dep_list",
|
|
|
|
]
|
2022-08-11 15:16:38 +00:00
|
|
|
data = [ "test_list.txt" ]
|
2022-03-17 21:43:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
list_from_ts_sources_txt = read_file("ts_sources.txt", "list lines")
|
|
|
|
|
|
|
|
ts_source_inputs = [ "../../webgpu-cts/tsconfig.json" ]
|
|
|
|
foreach(file, list_from_ts_sources_txt) {
|
|
|
|
ts_source_inputs += [ "../../webgpu-cts/$file" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
js_outputs = []
|
2022-09-13 22:22:02 +00:00
|
|
|
foreach(ts_file, filter_exclude(list_from_ts_sources_txt, [ "*.d.ts" ])) {
|
2022-03-17 21:43:17 +00:00
|
|
|
js_file = string_replace(ts_file, ".ts", ".js")
|
|
|
|
js_node_file = string_replace(js_file, "src/", "src-node/")
|
|
|
|
|
|
|
|
js_outputs += [ "$target_gen_dir/../../webgpu-cts/$js_file" ]
|
|
|
|
|
|
|
|
if (js_node_file != "src-node/common/runtime/wpt.js" &&
|
|
|
|
js_node_file != "src-node/common/runtime/standalone.js" &&
|
2022-03-19 00:50:18 +00:00
|
|
|
js_node_file != "src-node/common/runtime/helper/test_worker.js" &&
|
|
|
|
js_node_file !=
|
|
|
|
"src-node/webgpu/web_platform/worker/worker_launcher.js") {
|
2022-03-17 21:43:17 +00:00
|
|
|
js_outputs += [ "$target_gen_dir/../../webgpu-cts/$js_node_file" ]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
action("compile_src") {
|
2022-03-24 00:21:55 +00:00
|
|
|
script = "${dawn_root}/webgpu-cts/scripts/compile_src.py"
|
2022-03-17 21:43:17 +00:00
|
|
|
|
|
|
|
inputs = [
|
|
|
|
"//third_party/node/node_modules/typescript/lib/tsc.js",
|
|
|
|
"//third_party/node/node.py",
|
2022-03-24 00:21:55 +00:00
|
|
|
"${dawn_root}/webgpu-cts/scripts/tsc_ignore_errors.py",
|
2022-10-05 00:00:05 +00:00
|
|
|
|
|
|
|
# If the only change is that a file is deleted, we still need to
|
|
|
|
# rebuild so that listing.js gets updated.
|
|
|
|
"ts_sources.txt",
|
2022-03-17 21:43:17 +00:00
|
|
|
] + ts_source_inputs
|
|
|
|
|
|
|
|
outputs = js_outputs
|
|
|
|
data = js_outputs
|
|
|
|
|
|
|
|
args = [ rebase_path("$target_gen_dir/../../webgpu-cts", root_build_dir) ]
|
|
|
|
}
|
|
|
|
|
|
|
|
list_from_resource_files_txt = read_file("resource_files.txt", "list lines")
|
|
|
|
resource_file_inputs = []
|
|
|
|
foreach(file, list_from_resource_files_txt) {
|
|
|
|
resource_file_inputs += [ "$file" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
copy("copy_resources") {
|
|
|
|
sources = []
|
|
|
|
data = []
|
|
|
|
foreach(resource_file, resource_file_inputs) {
|
|
|
|
sources += [ "../../webgpu-cts/src/resources/$resource_file" ]
|
|
|
|
|
|
|
|
# Copy into resources/, instead of src/resources/, because compile_src
|
|
|
|
# wipes src/ before running.
|
|
|
|
data += [ "$target_gen_dir/../../webgpu-cts/resources/$resource_file" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
outputs =
|
|
|
|
[ "$target_gen_dir/../../webgpu-cts/resources/{{source_file_part}}" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
action("verify_gen_ts_dep_list") {
|
2022-03-24 00:21:55 +00:00
|
|
|
script = "${dawn_root}/webgpu-cts/scripts/gen_ts_dep_lists.py"
|
2022-03-17 21:43:17 +00:00
|
|
|
inputs = [
|
2022-04-20 02:34:55 +00:00
|
|
|
"../../../DEPS",
|
2022-03-17 21:43:17 +00:00
|
|
|
"resource_files.txt",
|
|
|
|
"ts_sources.txt",
|
|
|
|
]
|
|
|
|
outputs = [ "$target_out_dir/run_$target_name.stamp" ]
|
|
|
|
args = [
|
|
|
|
"--check",
|
|
|
|
"--stamp",
|
|
|
|
rebase_path(outputs[0], root_build_dir),
|
|
|
|
]
|
|
|
|
}
|
2022-11-21 15:16:51 +00:00
|
|
|
|
|
|
|
action("gen_cache") {
|
|
|
|
script = "${dawn_root}/webgpu-cts/scripts/gen_cache.py"
|
|
|
|
|
|
|
|
deps = [ ":compile_src" ]
|
|
|
|
_gen_cache_js =
|
|
|
|
"$target_gen_dir/../../webgpu-cts/src-node/common/tools/gen_cache.js"
|
|
|
|
inputs = get_target_outputs(":compile_src") + [ _gen_cache_js ]
|
|
|
|
args = [
|
|
|
|
rebase_path(_gen_cache_js, root_build_dir),
|
|
|
|
rebase_path("$target_gen_dir/../../webgpu-cts/cache", root_build_dir),
|
|
|
|
]
|
|
|
|
|
|
|
|
_outputs = read_file("cache_list.txt", "list lines")
|
|
|
|
outputs = []
|
|
|
|
foreach(file, _outputs) {
|
|
|
|
outputs += [ "$target_gen_dir/../../webgpu-cts/cache/$file" ]
|
|
|
|
}
|
|
|
|
data = outputs
|
|
|
|
}
|