Use emsdk as external bazel dependency (#766)

* Makes provided bazel rules look up @emsdk workspace instead of local workspace
* Uses system-specific emscripten binaries instead of defaulting to linux
* Provides macros for loading emsdk dependencies (nodejs and emscripten binaries)
* Unhardcodes paths in bazel rules and .sh wrappers
* `update_bazel_workspace.sh` now updates `revisions.bzl`
* `emscripten_deps()` can be fed with specific emscripten version
* Adds external usage test

Addresses #650 and #696
This commit is contained in:
Tim Talashok
2021-03-25 00:50:44 +01:00
committed by GitHub
parent fdda8524ce
commit c1589b5564
21 changed files with 333 additions and 100 deletions

View File

@@ -27,13 +27,13 @@ def _wasm_transition_impl(settings, attr):
return {
"//command_line_option:compiler": "emscripten",
"//command_line_option:crosstool_top": "//emscripten_toolchain:everything",
"//command_line_option:crosstool_top": "@emsdk//emscripten_toolchain:everything",
"//command_line_option:cpu": "wasm",
"//command_line_option:features": features,
"//command_line_option:dynamic_mode": "off",
"//command_line_option:linkopt": linkopts,
"//command_line_option:platforms": [],
"//command_line_option:custom_malloc": "//emscripten_toolchain:malloc",
"//command_line_option:custom_malloc": "@emsdk//emscripten_toolchain:malloc",
}
_wasm_transition = transition(
@@ -145,7 +145,7 @@ wasm_cc_binary = rule(
executable = True,
allow_files = True,
cfg = "exec",
default = Label("//emscripten_toolchain:wasm_binary"),
default = Label("@emsdk//emscripten_toolchain:wasm_binary"),
),
},
outputs = _wasm_binary_outputs,