| load("//infra-sk:index.bzl", "bool_flag", "extract_files_from_skia_wasm_container") |
| load("@build_bazel_rules_nodejs//:index.bzl", "js_library") |
| |
| bool_flag( |
| default = True, |
| flag_name = "use_debugger_from_container", |
| ) |
| |
| # This target makes the wasm binaries and js files available for tests. This is not the same |
| # as ../build because we want to be able to control which binaries get used when we deploy a |
| # container, but we are less stringent when running tests on the infra CI. |
| extract_files_from_skia_wasm_container( |
| name = "fetch_debugger_wasm", |
| testonly = True, |
| outs = [ |
| "from_container/canvaskit.d.ts", |
| "from_container/canvaskit.js", |
| "from_container/canvaskit.wasm", |
| ], |
| container_files = [ |
| "/tmp/canvaskit/canvaskit.d.ts", |
| "/tmp/canvaskit/canvaskit.js", |
| "/tmp/canvaskit/canvaskit.wasm", |
| ], |
| enabled_flag = ":use_debugger_from_container", |
| ) |
| |
| filegroup( |
| name = "canvaskit.js", |
| srcs = select({ |
| ":use_debugger_from_container_true": ["from_container/canvaskit.js"], |
| ":use_debugger_from_container_false": ["local_build/canvaskit.js"], |
| }), |
| visibility = ["//debugger-app:__subpackages__"], |
| ) |
| |
| filegroup( |
| name = "canvaskit.wasm", |
| srcs = select({ |
| ":use_debugger_from_container_true": ["from_container/canvaskit.wasm"], |
| ":use_debugger_from_container_false": ["local_build/canvaskit.wasm"], |
| }), |
| visibility = ["//debugger-app:__subpackages__"], |
| ) |
| |
| filegroup( |
| name = "canvaskit.d.ts", |
| srcs = select({ |
| ":use_debugger_from_container_true": ["from_container/canvaskit.d.ts"], |
| ":use_debugger_from_container_false": ["local_build/canvaskit.d.ts"], |
| }), |
| visibility = ["//debugger-app:__subpackages__"], |
| ) |
| |
| genrule( |
| name = "make version file", |
| outs = ["version.js"], |
| # We use LATEST here to make Puppeteer tests more deterministic. |
| cmd = """echo "const SKIA_VERSION = 'LATEST';" > $@""", |
| visibility = ["//debugger-app:__subpackages__"], |
| ) |
| |
| # This js_library rule makes the source a viable dependency of ts_library rules (and thus visible |
| # during compilation). |
| js_library( |
| name = "canvaskit_types", |
| srcs = [ |
| "types/canvaskit.d.ts", |
| ], |
| visibility = ["//debugger-app:__subpackages__"], |
| ) |
| |
| # This copy rule makes it so we can import from '../../wasm_libs/types/canvaskit' and not |
| # '../../wasm_libs/from_container/canvaskit', which does not make the source easily toggleable. |
| genrule( |
| name = "copy_canvaskit_types", |
| srcs = ["canvaskit.d.ts"], |
| outs = ["types/canvaskit.d.ts"], |
| # Copy the one input file to the one output location |
| cmd = "cp $< $@", |
| ) |