| load("//infra-sk:index.bzl", "bool_flag", "extract_files_from_skia_wasm_container") |
| |
| bool_flag( |
| default = True, |
| flag_name = "use_libraries_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_canvaskit_wasm", |
| testonly = True, |
| container = "@pinned_jsfiddle", |
| container_files = { |
| "/usr/local/share/jsfiddle/dist/index.d.ts": "from_container/canvaskit.d.ts", |
| "/usr/local/share/jsfiddle/dist/canvaskit.js": "from_container/canvaskit.js", |
| "/usr/local/share/jsfiddle/dist/canvaskit.wasm": "from_container/canvaskit.wasm", |
| "/usr/local/share/jsfiddle/dist/pathkit.js": "from_container/pathkit.js", |
| "/usr/local/share/jsfiddle/dist/pathkit.wasm": "from_container/pathkit.wasm", |
| }, |
| enabled_flag = ":use_libraries_from_container", |
| visibility = ["//jsfiddle:__subpackages__"], |
| ) |
| |
| filegroup( |
| name = "canvaskit.d.ts", |
| srcs = select({ |
| ":use_libraries_from_container_true": ["from_container/canvaskit.d.ts"], |
| ":use_libraries_from_container_false": ["local_build/canvaskit.d.ts"], |
| }), |
| visibility = ["//jsfiddle:__subpackages__"], |
| ) |
| |
| filegroup( |
| name = "canvaskit.js", |
| srcs = select({ |
| ":use_libraries_from_container_true": ["from_container/canvaskit.js"], |
| ":use_libraries_from_container_false": ["local_build/canvaskit.js"], |
| }), |
| visibility = ["//jsfiddle:__subpackages__"], |
| ) |
| |
| filegroup( |
| name = "canvaskit.wasm", |
| srcs = select({ |
| ":use_libraries_from_container_true": ["from_container/canvaskit.wasm"], |
| ":use_libraries_from_container_false": ["local_build/canvaskit.wasm"], |
| }), |
| visibility = ["//jsfiddle:__subpackages__"], |
| ) |
| |
| filegroup( |
| name = "pathkit.js", |
| srcs = select({ |
| ":use_libraries_from_container_true": ["from_container/pathkit.js"], |
| ":use_libraries_from_container_false": ["local_build/pathkit.js"], |
| }), |
| visibility = ["//jsfiddle:__subpackages__"], |
| ) |
| |
| filegroup( |
| name = "pathkit.wasm", |
| srcs = select({ |
| ":use_libraries_from_container_true": ["from_container/pathkit.wasm"], |
| ":use_libraries_from_container_false": ["local_build/pathkit.wasm"], |
| }), |
| visibility = ["//jsfiddle:__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 = ["//jsfiddle:__subpackages__"], |
| ) |