# Copyright 2021 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
group("webgpu-cts") {
public_deps = [
":compile_src",
":copy_resources",
":verify_gen_ts_dep_list",
":verify_regenerate_internal_cts_html",
]
}
list_from_ts_sources_txt = read_file("ts_sources.txt", "list lines")
ts_source_inputs = [ "src/tsconfig.json" ]
foreach(file, list_from_ts_sources_txt) {
ts_source_inputs += [ "src/$file" ]
}
js_outputs = []
foreach(ts_file, filter_exclude(list_from_ts_sources_txt, [ "*.d.ts" ])) {
js_file = string_replace(ts_file, ".ts", ".js")
js_node_file = string_replace(js_file, "src/", "src-node/")
js_outputs += [ "$target_gen_dir/$js_file" ]
if (js_node_file != "src-node/common/runtime/wpt.js" &&
js_node_file != "src-node/common/runtime/standalone.js" &&
js_node_file != "src-node/common/runtime/helper/test_worker.js" &&
js_node_file !=
"src-node/webgpu/web_platform/worker/worker_launcher.js") {
js_outputs += [ "$target_gen_dir/$js_node_file" ]
}
}
action("compile_src") {
script = "scripts/compile_src.py"
inputs = [
"//third_party/node/node_modules/typescript/lib/tsc.js",
"//third_party/node/node.py",
"//third_party/node/node_modules.tar.gz.sha1",
"scripts/tsc_ignore_errors.py",
# If the only change is that a file is deleted, we still need to
# rebuild so that listing.js gets updated.
"ts_sources.txt",
] + ts_source_inputs
outputs = js_outputs
data = js_outputs
args = [ rebase_path("$target_gen_dir", 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 += [ "src/src/resources/$resource_file" ]
# Copy into resources/, instead of src/resources/, because compile_src
# wipes src/ before running.
data += [ "$target_gen_dir/resources/$resource_file" ]
}
outputs = [ "$target_gen_dir/resources/{{source_file_part}}" ]
}
action("verify_gen_ts_dep_list") {
script = "scripts/gen_ts_dep_lists.py"
inputs = [
"resource_files.txt",
"ts_sources.txt",
]
outputs = [ "$target_out_dir/run_$target_name.stamp" ]
args = [
"--check",
"--stamp",
rebase_path(outputs[0], root_build_dir),
]
}
action("verify_regenerate_internal_cts_html") {
script = "scripts/run_regenerate_internal_cts_html.py"
inputs = [ "scripts/regenerate_internal_cts_html.py" ] + ts_source_inputs
outputs = [ "$target_out_dir/run_$target_name.stamp" ]
args = [
"--check",
"--stamp",
rebase_path(outputs[0], root_build_dir),
]
}