Bazel: Migrate to bzlmod (#1530)

This migrates the bazel integration to the new Bazel dependency system
"bzlmod". bzlmod is becoming mandatory this year (see second sentence
here: https://bazel.build/external/migration).

This is a backwards incompatible migration, directly removing the old
WORKSPACE based approach. Users will have to change how they depend on
bzlmod, however I assume pretty much every user will be happy about it,
because they are forced to use bzlmod anyway or add extra flags to
continue to build with newer Bazel versions. Given that users normally
depend on specific git commits in the old system, they won't be hit with
this until they decide to upgrade emsdk.

The basic principle here is simple: I took everything that WORKSPACE did
and searched an alternative in bzlmod. Some interesting bits:

- We have less worries about multiple versions and people depending on
emscripten multiple times in different ways. This is resolved by the new
system: Bazel first iterates through the MODULE.bazel files recursively,
then finds the minimum version needed for each module and then executes
the module extensions that define repos exactly once at that version. So
no more ifs needed to detect multiple inclusions.
- A bunch of nodejs stuff moves to MODULE.bazel, because that is how the
nodejs module works now. As their module extension gets executed only
once you need to declare everything that you could need before that in
the MODULE.bazel file. A side effect of that is that we have to make a
fake repository when emscripten doesn't have an arm64 binary for linux,
because we can't actually figure that out in MODULE.bazel, so we have to
declare that it always exists and then create one in all cases.

There is a bunch of autoformatter changes in here as well, I could try
to revert them if you prefer.

Closes #1509
This commit is contained in:
Conrad Burchert
2025-04-09 23:38:12 +02:00
committed by GitHub
parent 24fc909c0d
commit ed2035a3cc
28 changed files with 11776 additions and 595 deletions

View File

@@ -1,83 +1,7 @@
package(default_visibility = ["//visibility:public"])
config_setting(
name = "linux",
constraint_values = [
"@platforms//os:linux",
"@platforms//cpu:x86_64",
],
)
config_setting(
name = "linux_arm64",
constraint_values = [
"@platforms//os:linux",
"@platforms//cpu:arm64",
],
)
config_setting(
name = "macos",
constraint_values = [
"@platforms//os:macos",
"@platforms//cpu:x86_64",
],
)
config_setting(
name = "macos_arm64",
constraint_values = [
"@platforms//os:macos",
"@platforms//cpu:arm64",
],
)
config_setting(
name = "windows",
constraint_values = [
"@platforms//os:windows",
"@platforms//cpu:x86_64",
],
)
filegroup(name = "empty")
alias(
name = "compiler_files",
actual = select({
":linux": "@emscripten_bin_linux//:compiler_files",
":linux_arm64": "@emscripten_bin_linux_arm64//:compiler_files",
":macos": "@emscripten_bin_mac//:compiler_files",
":macos_arm64": "@emscripten_bin_mac_arm64//:compiler_files",
":windows": "@emscripten_bin_win//:compiler_files",
"//conditions:default": ":empty",
}),
)
alias(
name = "linker_files",
actual = select({
":linux": "@emscripten_bin_linux//:linker_files",
":linux_arm64": "@emscripten_bin_linux_arm64//:linker_files",
":macos": "@emscripten_bin_mac//:linker_files",
":macos_arm64": "@emscripten_bin_mac_arm64//:linker_files",
":windows": "@emscripten_bin_win//:linker_files",
"//conditions:default": ":empty",
}),
)
alias(
name = "ar_files",
actual = select({
":linux": "@emscripten_bin_linux//:ar_files",
":linux_arm64": "@emscripten_bin_linux_arm64//:ar_files",
":macos": "@emscripten_bin_mac//:ar_files",
":macos_arm64": "@emscripten_bin_mac_arm64//:ar_files",
":windows": "@emscripten_bin_win//:ar_files",
"//conditions:default": ":empty",
}),
)
platform(
name = "platform_wasm",
constraint_values = [

View File

@@ -1 +1,79 @@
bazel_dep(name = "platforms", version = "0.0.9")
module(
name = "emsdk",
version = "4.0.6",
)
bazel_dep(name = "platforms", version = "0.0.11")
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "aspect_rules_js", version = "1.42.0")
bazel_dep(name = "rules_nodejs", version = "6.3.2")
bazel_dep(name = "rules_cc", version = "0.1.1")
bazel_dep(name = "rules_python", version = "1.3.0")
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
python_version = "3.13",
)
node = use_extension("@rules_nodejs//nodejs:extensions.bzl", "node")
node.toolchain(node_version = "20.18.0")
use_repo(node, "nodejs")
emscripten_deps = use_extension(
"//:emscripten_deps.bzl",
"emscripten_deps",
)
use_repo(emscripten_deps, "emscripten_bin_linux")
use_repo(emscripten_deps, "emscripten_bin_linux_arm64")
use_repo(emscripten_deps, "emscripten_bin_mac")
use_repo(emscripten_deps, "emscripten_bin_mac_arm64")
use_repo(emscripten_deps, "emscripten_bin_win")
npm = use_extension(
"@aspect_rules_js//npm:extensions.bzl",
"npm",
)
npm.npm_translate_lock(
name = "emscripten_npm_linux",
data = ["@emscripten_bin_linux//:emscripten/package.json"],
npm_package_lock = "@emscripten_bin_linux//:emscripten/package-lock.json",
)
npm.npm_translate_lock(
name = "emscripten_npm_linux_arm64",
data = ["@emscripten_bin_linux_arm64//:emscripten/package.json"],
npm_package_lock = "@emscripten_bin_linux_arm64//:emscripten/package-lock.json",
)
npm.npm_translate_lock(
name = "emscripten_npm_mac",
data = ["@emscripten_bin_mac//:emscripten/package.json"],
npm_package_lock = "@emscripten_bin_mac//:emscripten/package-lock.json",
)
npm.npm_translate_lock(
name = "emscripten_npm_mac_arm64",
data = ["@emscripten_bin_mac_arm64//:emscripten/package.json"],
npm_package_lock = "@emscripten_bin_mac_arm64//:emscripten/package-lock.json",
)
npm.npm_translate_lock(
name = "emscripten_npm_win",
data = ["@emscripten_bin_win//:emscripten/package.json"],
npm_package_lock = "@emscripten_bin_win//:emscripten/package-lock.json",
)
use_repo(
npm,
"emscripten_npm_linux",
"emscripten_npm_linux_arm64",
"emscripten_npm_mac",
"emscripten_npm_mac_arm64",
"emscripten_npm_win",
)
emscripten_cache = use_extension("//:emscripten_cache.bzl", "emscripten_cache")
use_repo(emscripten_cache, "emscripten_cache")
register_toolchains(
"//emscripten_toolchain:cc-toolchain-wasm-emscripten_linux",
"//emscripten_toolchain:cc-toolchain-wasm-emscripten_linux_arm64",
"//emscripten_toolchain:cc-toolchain-wasm-emscripten_mac",
"//emscripten_toolchain:cc-toolchain-wasm-emscripten_mac_arm64",
"//emscripten_toolchain:cc-toolchain-wasm-emscripten_win",
)

3696
bazel/MODULE.bazel.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -2,35 +2,29 @@
## Setup Instructions
In `WORKSPACE` file, put:
Support for depending on emsdk with a WORKSPACE file was removed and last available in [emsdk version 4.0.6](https://github.com/emscripten-core/emsdk/tree/24fc909c0da13ef641d5ae75e89b5a97f25e37aa). Now we only support inclusion as a bzlmod module.
In your `MODULE.bazel` file, put:
```starlark
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
git_repository(
name = "emsdk",
emsdk_version = "4.0.6"
bazel_dep(name = "emsdk", version = emsdk_version)
git_override(
module_name = "emsdk",
remote = "https://github.com/emscripten-core/emsdk.git",
tag = "3.1.64",
strip_prefix = "bazel",
tag = emsdk_version,
)
load("@emsdk//:deps.bzl", emsdk_deps = "deps")
emsdk_deps()
load("@emsdk//:emscripten_deps.bzl", emsdk_emscripten_deps = "emscripten_deps")
emsdk_emscripten_deps(emscripten_version = "3.1.64")
load("@emsdk//:toolchains.bzl", "register_emscripten_toolchains")
register_emscripten_toolchains()
```
The `tag` and `emscripten_version` parameters correspond to the git revision of
[emsdk 3.1.64](https://github.com/emscripten-core/emsdk/releases/tag/3.1.64). To get access to
newer versions, you'll need to update those. To make use of older versions, change the
parameter of `git_repository` and `emsdk_emscripten_deps()`. Supported versions are listed in `revisions.bzl`
Bazel 7+ additionally requires `platforms` dependencies in the `MODULE.bazel` file.
```starlark
bazel_dep(name = "platforms", version = "0.0.9")
```
You can use a different version of this SDK by changing it in your `MODULE.bazel` file. The Emscripten version is by default the same as the SDK version, but you can use a different one as well by adding to your `MODULE.bazel`:
```
emscripten_deps = use_extension(
"@emsdk//:emscripten_deps.bzl",
"emscripten_deps",
)
emscripten_deps.config(version = "4.0.1")
```
## Building
@@ -68,28 +62,29 @@ is the preferred way, since it also unpacks the resulting tarball.
The Emscripten cache shipped by default does not include LTO, 64-bit or PIC
builds of the system libraries and ports. If you wish to use these features you
will need to declare the cache when you register the toolchain as follows. Note
will need to declare the cache in your `MODULE.bazel` as follows. Note
that the configuration consists of the same flags that can be passed to
embuilder. If `targets` is not provided, all system libraries and ports will be
embuilder. If `targets` is not set, all system libraries and ports will be
built, i.e., the `ALL` option to embuilder.
```starlark
load("@emsdk//:toolchains.bzl", "register_emscripten_toolchains")
register_emscripten_toolchains(cache = {
"configuration": ["--lto"],
"targets": [
"crtbegin",
"libprintf_long_double-debug",
"libstubs-debug",
"libnoexit",
"libc-debug",
"libdlmalloc",
"libcompiler_rt",
"libc++-noexcept",
"libc++abi-debug-noexcept",
"libsockets"
]
})
emscripten_cache = use_extension(
"@emsdk//:emscripten_cache.bzl",
"emscripten_cache",
)
emscripten_cache.configuration(flags = ["--lto"])
emscripten_cache.targets(targets = [
"crtbegin",
"libprintf_long_double-debug",
"libstubs-debug",
"libnoexit",
"libc-debug",
"libdlmalloc",
"libcompiler_rt",
"libc++-noexcept",
"libc++abi-debug-noexcept",
"libsockets"
])
```
See `test_external/` for an example using [embind](https://emscripten.org/docs/porting/connecting_cpp_and_javascript/embind.html).

View File

@@ -1,13 +0,0 @@
workspace(name = "emsdk")
load(":deps.bzl", "deps")
deps()
load(":emscripten_deps.bzl", "emscripten_deps")
emscripten_deps()
load(":toolchains.bzl", "register_emscripten_toolchains")
register_emscripten_toolchains()

View File

@@ -1,52 +0,0 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
def deps():
maybe(
http_archive,
name = "platforms",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.9/platforms-0.0.9.tar.gz",
"https://github.com/bazelbuild/platforms/releases/download/0.0.9/platforms-0.0.9.tar.gz",
],
sha256 = "5eda539c841265031c2f82d8ae7a3a6490bd62176e0c038fc469eabf91f6149b",
)
maybe(
http_archive,
name = "bazel_skylib",
sha256 = "c6966ec828da198c5d9adbaa94c05e3a1c7f21bd012a0b29ba8ddbccb2c93b0d",
urls = [
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.1.1/bazel-skylib-1.1.1.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.1.1/bazel-skylib-1.1.1.tar.gz",
],
)
maybe(
http_archive,
name = "aspect_rules_js",
strip_prefix = "rules_js-1.42.0",
sha256 = "5a00869efaeb308245f8132a671fe86524bdfc4f8bfd1976d26f862b316dc3c9",
urls = ["https://github.com/aspect-build/rules_js/releases/download/v1.42.0/rules_js-v1.42.0.tar.gz"],
)
# Transitive dependencies of aspect_rules_js. We explicitly pull them here instead of calling their
# provided function to avoid requiring a call to rules_js_dependencies in WORKSPACE.
maybe(
http_archive,
name = "aspect_bazel_lib",
sha256 = "714cf8ce95a198bab0a6a3adaffea99e929d2f01bf6d4a59a2e6d6af72b4818c",
strip_prefix = "bazel-lib-2.7.8",
url = "https://github.com/aspect-build/bazel-lib/releases/download/v2.7.8/bazel-lib-v2.7.8.tar.gz",
)
maybe(
http_archive,
name = "rules_nodejs",
strip_prefix = "rules_nodejs-6.3.2",
sha256 = "158619723f1d8bd535dd6b93521f4e03cf24a5e107126d05685fbd9540ccad10",
urls = ["https://github.com/bazel-contrib/rules_nodejs/releases/download/v6.3.2/rules_nodejs-v6.3.2.tar.gz"],
)
http_archive(
name = "bazel_features",
sha256 = "f3082bfcdca73dc77dcd68faace806135a2e08c230b02b1d9fbdbd7db9d9c450",
strip_prefix = "bazel_features-0.1.0",
url = "https://github.com/bazel-contrib/bazel_features/releases/download/v0.1.0/bazel_features-v0.1.0.tar.gz",
)

View File

@@ -0,0 +1,93 @@
"""A templated build file for emscripten repositories"""
EMSCRIPTEN_BUILD_FILE_CONTENT_TEMPLATE = """
package(default_visibility = ['//visibility:public'])
filegroup(
name = "all",
srcs = glob(["**"]),
)
filegroup(
name = "includes",
srcs = glob([
"emscripten/cache/sysroot/include/c++/v1/**",
"emscripten/cache/sysroot/include/compat/**",
"emscripten/cache/sysroot/include/**",
"lib/clang/**/include/**",
]),
)
filegroup(
name = "emcc_common",
srcs = [
"emscripten/emcc.py",
"emscripten/embuilder.py",
"emscripten/emscripten-version.txt",
"emscripten/cache/sysroot_install.stamp",
"emscripten/src/settings.js",
"emscripten/src/settings_internal.js",
] + glob(
include = [
"emscripten/third_party/**",
"emscripten/tools/**",
],
exclude = [
"**/__pycache__/**",
],
),
)
filegroup(
name = "compiler_files",
srcs = [
"bin/clang{bin_extension}",
"bin/clang++{bin_extension}",
":emcc_common",
":includes",
],
)
filegroup(
name = "linker_files",
srcs = [
"bin/clang{bin_extension}",
"bin/llvm-ar{bin_extension}",
"bin/llvm-dwarfdump{bin_extension}",
"bin/llvm-nm{bin_extension}",
"bin/llvm-objcopy{bin_extension}",
"bin/wasm-ctor-eval{bin_extension}",
"bin/wasm-emscripten-finalize{bin_extension}",
"bin/wasm-ld{bin_extension}",
"bin/wasm-metadce{bin_extension}",
"bin/wasm-opt{bin_extension}",
"bin/wasm-split{bin_extension}",
"bin/wasm2js{bin_extension}",
":emcc_common",
] + glob(
include = [
"emscripten/cache/sysroot/lib/**",
"emscripten/node_modules/**",
"emscripten/src/**",
],
),
)
filegroup(
name = "ar_files",
srcs = [
"bin/llvm-ar{bin_extension}",
"emscripten/emar.py",
"emscripten/emscripten-version.txt",
"emscripten/src/settings.js",
"emscripten/src/settings_internal.js",
] + glob(
include = [
"emscripten/tools/**",
],
exclude = [
"**/__pycache__/**",
],
),
)
"""

View File

@@ -10,46 +10,48 @@ LLVM_ROOT = '{llvm_root}'
"""
def get_root_and_script_ext(repository_ctx):
if repository_ctx.os.name.startswith('linux'):
if 'amd64' in repository_ctx.os.arch or 'x86_64' in repository_ctx.os.arch:
return (repository_ctx.path(Label("@emscripten_bin_linux//:BUILD.bazel")).dirname, '')
elif 'aarch64' in repository_ctx.os.arch:
return (repository_ctx.path(Label("@emscripten_bin_linux_arm64//:BUILD.bazel")).dirname, '')
if repository_ctx.os.name.startswith("linux"):
if "amd64" in repository_ctx.os.arch or "x86_64" in repository_ctx.os.arch:
return (repository_ctx.path(Label("@emscripten_bin_linux//:BUILD.bazel")).dirname, "")
elif "aarch64" in repository_ctx.os.arch:
return (repository_ctx.path(Label("@emscripten_bin_linux_arm64//:BUILD.bazel")).dirname, "")
else:
fail('Unsupported architecture for Linux')
elif repository_ctx.os.name.startswith('mac'):
if 'amd64' in repository_ctx.os.arch or 'x86_64' in repository_ctx.os.arch:
return (repository_ctx.path(Label("@emscripten_bin_mac//:BUILD.bazel")).dirname, '')
elif 'aarch64' in repository_ctx.os.arch:
return (repository_ctx.path(Label("@emscripten_bin_mac_arm64//:BUILD.bazel")).dirname, '')
fail("Unsupported architecture for Linux")
elif repository_ctx.os.name.startswith("mac"):
if "amd64" in repository_ctx.os.arch or "x86_64" in repository_ctx.os.arch:
return (repository_ctx.path(Label("@emscripten_bin_mac//:BUILD.bazel")).dirname, "")
elif "aarch64" in repository_ctx.os.arch:
return (repository_ctx.path(Label("@emscripten_bin_mac_arm64//:BUILD.bazel")).dirname, "")
else:
fail('Unsupported architecture for MacOS')
elif repository_ctx.os.name.startswith('windows'):
return (repository_ctx.path(Label("@emscripten_bin_win//:BUILD.bazel")).dirname, '.bat')
fail("Unsupported architecture for MacOS")
elif repository_ctx.os.name.startswith("windows"):
return (repository_ctx.path(Label("@emscripten_bin_win//:BUILD.bazel")).dirname, ".bat")
else:
fail('Unsupported operating system')
fail("Unsupported operating system")
def _emscripten_cache_impl(repository_ctx):
def _emscripten_cache_repository_impl(repository_ctx):
# Read the default emscripten configuration file
default_config = repository_ctx.read(
repository_ctx.path(
Label("@emsdk//emscripten_toolchain:default_config")
)
Label("@emsdk//emscripten_toolchain:default_config"),
),
)
if repository_ctx.attr.targets or repository_ctx.attr.configuration:
root, script_ext = get_root_and_script_ext(repository_ctx)
llvm_root = root.get_child("bin")
cache = repository_ctx.path("cache")
# Create configuration file
embuilder_config_content = EMBUILDER_CONFIG_TEMPLATE.format(
cache=cache,
binaryen_root=root,
llvm_root=llvm_root,
cache = cache,
binaryen_root = root,
llvm_root = llvm_root,
)
repository_ctx.file("embuilder_config", embuilder_config_content)
embuilder_config_path = repository_ctx.path("embuilder_config")
embuilder_path = "{}{}".format(root.get_child("emscripten").get_child("embuilder"), script_ext)
# Prepare the command line
if repository_ctx.attr.targets:
targets = repository_ctx.attr.targets
@@ -58,38 +60,54 @@ def _emscripten_cache_impl(repository_ctx):
targets = ["ALL"]
flags = ["--em-config", embuilder_config_path] + repository_ctx.attr.configuration
embuilder_args = [embuilder_path] + flags + ["build"] + targets
# Run embuilder
repository_ctx.report_progress("Building secondary cache")
result = repository_ctx.execute(
embuilder_args,
quiet=True,
quiet = True,
environment = {
"EM_IGNORE_SANITY": "1",
"EM_NODE_JS": "empty",
}
},
)
if result.return_code != 0:
fail("Embuilder exited with a non-zero return code")
# Override Emscripten's cache with the secondary cache
default_config += "CACHE = '{}'\n".format(cache)
# Create the configuration file for the toolchain and export
repository_ctx.file('emscripten_config', default_config)
repository_ctx.file('BUILD.bazel', BUILD_FILE_CONTENT_TEMPLATE)
repository_ctx.file("emscripten_config", default_config)
repository_ctx.file("BUILD.bazel", BUILD_FILE_CONTENT_TEMPLATE)
_emscripten_cache = repository_rule(
implementation = _emscripten_cache_impl,
_emscripten_cache_repository = repository_rule(
implementation = _emscripten_cache_repository_impl,
attrs = {
"configuration": attr.string_list(),
"targets": attr.string_list(),
},
)
def register_emscripten_toolchains(cache = {}):
_emscripten_cache(
def _emscripten_cache_impl(ctx):
all_configuration = []
all_targets = []
for mod in ctx.modules:
for configuration in mod.tags.configuration:
all_configuration += configuration.flags
for targets in mod.tags.targets:
all_targets += targets.targets
_emscripten_cache_repository(
name = "emscripten_cache",
configuration = cache["configuration"] if "configuration" in cache else [],
targets = cache["targets"] if "targets" in cache else [],
configuration = all_configuration,
targets = all_targets,
)
native.register_toolchains(str(Label("//emscripten_toolchain:cc-toolchain-wasm")))
emscripten_cache = module_extension(
tag_classes = {
"configuration": tag_class(attrs = {"flags": attr.string_list()}),
"targets": tag_class(attrs = {"targets": attr.string_list()}),
},
implementation = _emscripten_cache_impl,
)

View File

@@ -1,210 +1,99 @@
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains")
load(":remote_emscripten_repository.bzl", "remote_emscripten_repository")
load(":revisions.bzl", "EMSCRIPTEN_TAGS")
def _parse_version(v):
return [int(u) for u in v.split(".")]
BUILD_FILE_CONTENT_TEMPLATE = """
package(default_visibility = ['//visibility:public'])
def _empty_repository_impl(ctx):
ctx.file("MODULE.bazel", """module(name = "{}")""".format(ctx.name))
ctx.file("BUILD.bazel", "")
filegroup(
name = "all",
srcs = glob(["**"]),
_empty_repository = repository_rule(
implementation = _empty_repository_impl,
)
filegroup(
name = "includes",
srcs = glob([
"emscripten/cache/sysroot/include/c++/v1/**",
"emscripten/cache/sysroot/include/compat/**",
"emscripten/cache/sysroot/include/**",
"lib/clang/**/include/**",
]),
)
def emscripten_repo_name(name):
return "emscripten_bin_{}".format(name)
filegroup(
name = "emcc_common",
srcs = [
"emscripten/emcc.py",
"emscripten/embuilder.py",
"emscripten/emscripten-version.txt",
"emscripten/cache/sysroot_install.stamp",
"emscripten/src/settings.js",
"emscripten/src/settings_internal.js",
] + glob(
include = [
"emscripten/third_party/**",
"emscripten/tools/**",
],
exclude = [
"**/__pycache__/**",
],
),
)
def _emscripten_deps_impl(ctx):
version = None
filegroup(
name = "compiler_files",
srcs = [
"bin/clang{bin_extension}",
"bin/clang++{bin_extension}",
":emcc_common",
":includes",
],
)
filegroup(
name = "linker_files",
srcs = [
"bin/clang{bin_extension}",
"bin/llvm-ar{bin_extension}",
"bin/llvm-dwarfdump{bin_extension}",
"bin/llvm-nm{bin_extension}",
"bin/llvm-objcopy{bin_extension}",
"bin/wasm-ctor-eval{bin_extension}",
"bin/wasm-emscripten-finalize{bin_extension}",
"bin/wasm-ld{bin_extension}",
"bin/wasm-metadce{bin_extension}",
"bin/wasm-opt{bin_extension}",
"bin/wasm-split{bin_extension}",
"bin/wasm2js{bin_extension}",
":emcc_common",
] + glob(
include = [
"emscripten/cache/sysroot/lib/**",
"emscripten/node_modules/**",
"emscripten/src/**",
],
),
)
filegroup(
name = "ar_files",
srcs = [
"bin/llvm-ar{bin_extension}",
"emscripten/emar.py",
"emscripten/emscripten-version.txt",
"emscripten/src/settings.js",
"emscripten/src/settings_internal.js",
] + glob(
include = [
"emscripten/tools/**",
],
exclude = [
"**/__pycache__/**",
],
),
)
"""
def emscripten_deps(emscripten_version = "latest"):
version = emscripten_version
for mod in ctx.modules:
for config in mod.tags.config:
if config.version and version != None:
fail("More than one emscripten version specified!")
version = config.version
if version == None:
version = "latest"
if version == "latest":
version = reversed(sorted(EMSCRIPTEN_TAGS.keys(), key = _parse_version))[0]
if version not in EMSCRIPTEN_TAGS.keys():
error_msg = "Emscripten version {} not found.".format(version)
error_msg += " Look at @emsdk//:revisions.bzl for the list "
error_msg += "of currently supported versions."
fail(error_msg)
revision = EMSCRIPTEN_TAGS[version]
emscripten_url = "https://storage.googleapis.com/webassembly/emscripten-releases-builds/{}/{}/wasm-binaries{}.{}"
# This could potentially backfire for projects with multiple emscripten
# dependencies that use different emscripten versions
excludes = native.existing_rules().keys()
if "nodejs_toolchains" not in excludes:
# Node 16 is the first version that supports darwin_arm64
nodejs_register_toolchains(
node_version = "20.18.0",
)
remote_emscripten_repository(
name = emscripten_repo_name("linux"),
bin_extension = "",
sha256 = revision.sha_linux,
strip_prefix = "install",
type = "tar.xz",
url = emscripten_url.format("linux", revision.hash, "", "tar.xz"),
)
if "emscripten_bin_linux" not in excludes:
http_archive(
name = "emscripten_bin_linux",
# Not all versions have a linux/arm64 release: https://github.com/emscripten-core/emsdk/issues/547
if hasattr(revision, "sha_linux_arm64"):
remote_emscripten_repository(
name = emscripten_repo_name("linux_arm64"),
bin_extension = "",
sha256 = revision.sha_linux_arm64,
strip_prefix = "install",
url = emscripten_url.format("linux", revision.hash, "", "tar.xz"),
sha256 = revision.sha_linux,
build_file_content = BUILD_FILE_CONTENT_TEMPLATE.format(bin_extension = ""),
type = "tar.xz",
)
if "emscripten_bin_linux_arm64" not in excludes:
http_archive(
name = "emscripten_bin_linux_arm64",
strip_prefix = "install",
url = emscripten_url.format("linux", revision.hash, "-arm64", "tar.xz"),
# Not all versions have a linux/arm64 release: https://github.com/emscripten-core/emsdk/issues/547
sha256 = getattr(revision, "sha_linux_arm64", None),
build_file_content = BUILD_FILE_CONTENT_TEMPLATE.format(bin_extension = ""),
type = "tar.xz",
)
else:
_empty_repository(
name = emscripten_repo_name("linux_arm64"),
)
if "emscripten_bin_mac" not in excludes:
http_archive(
name = "emscripten_bin_mac",
strip_prefix = "install",
url = emscripten_url.format("mac", revision.hash, "", "tar.xz"),
sha256 = revision.sha_mac,
build_file_content = BUILD_FILE_CONTENT_TEMPLATE.format(bin_extension = ""),
type = "tar.xz",
)
remote_emscripten_repository(
name = emscripten_repo_name("mac"),
bin_extension = "",
sha256 = revision.sha_mac,
strip_prefix = "install",
type = "tar.xz",
url = emscripten_url.format("mac", revision.hash, "", "tar.xz"),
)
if "emscripten_bin_mac_arm64" not in excludes:
http_archive(
name = "emscripten_bin_mac_arm64",
strip_prefix = "install",
url = emscripten_url.format("mac", revision.hash, "-arm64", "tar.xz"),
sha256 = revision.sha_mac_arm64,
build_file_content = BUILD_FILE_CONTENT_TEMPLATE.format(bin_extension = ""),
type = "tar.xz",
)
remote_emscripten_repository(
name = emscripten_repo_name("mac_arm64"),
bin_extension = "",
sha256 = revision.sha_mac_arm64,
strip_prefix = "install",
type = "tar.xz",
url = emscripten_url.format("mac", revision.hash, "-arm64", "tar.xz"),
)
if "emscripten_bin_win" not in excludes:
http_archive(
name = "emscripten_bin_win",
strip_prefix = "install",
url = emscripten_url.format("win", revision.hash, "", "zip"),
sha256 = revision.sha_win,
build_file_content = BUILD_FILE_CONTENT_TEMPLATE.format(bin_extension = ".exe"),
type = "zip",
)
remote_emscripten_repository(
name = emscripten_repo_name("win"),
bin_extension = ".exe",
sha256 = revision.sha_win,
strip_prefix = "install",
type = "zip",
url = emscripten_url.format("win", revision.hash, "", "zip"),
)
if "emscripten_npm_linux" not in excludes:
npm_translate_lock(
name = "emscripten_npm_linux",
data = ["@emscripten_bin_linux//:emscripten/package.json"],
npm_package_lock = "@emscripten_bin_linux//:emscripten/package-lock.json",
)
if "emscripten_npm_linux_arm64" not in excludes:
npm_translate_lock(
name = "emscripten_npm_linux_arm64",
data = ["@emscripten_bin_linux_arm64//:emscripten/package.json"],
npm_package_lock = "@emscripten_bin_linux_arm64//:emscripten/package-lock.json",
)
if "emscripten_npm_mac" not in excludes:
npm_translate_lock(
name = "emscripten_npm_mac",
data = ["@emscripten_bin_mac//:emscripten/package.json"],
npm_package_lock = "@emscripten_bin_mac//:emscripten/package-lock.json",
)
if "emscripten_npm_mac_arm64" not in excludes:
npm_translate_lock(
name = "emscripten_npm_mac",
data = ["@emscripten_bin_mac_arm64//:emscripten/package.json"],
npm_package_lock = "@emscripten_bin_mac_arm64//:emscripten/package-lock.json",
)
if "emscripten_npm_win" not in excludes:
npm_translate_lock(
name = "emscripten_npm_win",
data = ["@emscripten_bin_win//:emscripten/package.json"],
npm_package_lock = "@emscripten_bin_win//:emscripten/package-lock.json",
)
emscripten_deps = module_extension(
tag_classes = {
"config": tag_class(
attrs = {
"version": attr.string(
doc = "Version to use. 'latest' to use latest.",
values = ["latest"] + EMSCRIPTEN_TAGS.keys(),
),
},
),
},
implementation = _emscripten_deps_impl,
)

View File

@@ -1,101 +1,40 @@
load(":toolchain.bzl", "emscripten_cc_toolchain_config_rule")
load("//:emscripten_deps.bzl", "emscripten_repo_name")
load("//:remote_emscripten_repository.bzl", "create_toolchains", "emscripten_toolchain_name")
load("@rules_python//python:py_binary.bzl", "py_binary")
package(default_visibility = ["//visibility:public"])
filegroup(
name = "common_files",
srcs = [
"@emscripten_cache//:emscripten_config",
"env.sh",
"env.bat",
"@nodejs//:node_files",
],
)
filegroup(
name = "compiler_files",
srcs = [
"emcc.sh",
"emcc.bat",
"@emsdk//:compiler_files",
":common_files",
],
)
filegroup(
name = "linker_files",
srcs = [
"emcc_link.sh",
"emcc_link.bat",
"link_wrapper.py",
"@emsdk//:linker_files",
":common_files",
],
)
filegroup(
name = "ar_files",
srcs = [
"emar.sh",
"emar.bat",
"@emsdk//:ar_files",
":common_files",
],
)
filegroup(
name = "all_files",
srcs = [
":ar_files",
":compiler_files",
":linker_files",
],
)
filegroup(name = "empty")
# dlmalloc.bc is implicitly added by the emscripten toolchain
cc_library(name = "malloc")
emscripten_cc_toolchain_config_rule(
name = "wasm",
cpu = "wasm",
em_config = "@emscripten_cache//:emscripten_config",
emscripten_binaries = "@emsdk//:compiler_files",
nodejs_bin = "@nodejs//:node",
script_extension = select({
"@bazel_tools//src/conditions:host_windows": "bat",
"//conditions:default": "sh",
}),
create_toolchains(
name = emscripten_toolchain_name("linux"),
repo_name = emscripten_repo_name("linux"),
exec_compatible_with = [ "@platforms//os:linux", "@platforms//cpu:x86_64"],
)
cc_toolchain(
name = "cc-compiler-wasm",
all_files = ":all_files",
ar_files = ":ar_files",
as_files = ":empty",
compiler_files = ":compiler_files",
dwp_files = ":empty",
linker_files = ":linker_files",
objcopy_files = ":empty",
strip_files = ":empty",
toolchain_config = "wasm",
toolchain_identifier = "emscripten-wasm",
create_toolchains(
name = emscripten_toolchain_name("linux_arm64"),
repo_name = emscripten_repo_name("linux_arm64"),
exec_compatible_with = ["@platforms//os:linux", "@platforms//cpu:arm64"],
)
cc_toolchain_suite(
name = "everything",
toolchains = {
"wasm": ":cc-compiler-wasm",
"wasm|emscripten": ":cc-compiler-wasm",
},
create_toolchains(
name = emscripten_toolchain_name("mac"),
repo_name = emscripten_repo_name("mac"),
exec_compatible_with = ["@platforms//os:macos", "@platforms//cpu:x86_64"],
)
toolchain(
name = "cc-toolchain-wasm",
target_compatible_with = ["@platforms//cpu:wasm32"],
toolchain = ":cc-compiler-wasm",
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
create_toolchains(
name = emscripten_toolchain_name("mac_arm64"),
repo_name = emscripten_repo_name("mac_arm64"),
exec_compatible_with = ["@platforms//os:macos", "@platforms//cpu:arm64"],
)
create_toolchains(
name = emscripten_toolchain_name("win"),
repo_name = emscripten_repo_name("win"),
exec_compatible_with = ["@platforms//os:windows", "@platforms//cpu:x86_64"],
)
py_binary(

View File

@@ -1,5 +1,5 @@
@ECHO OFF
call external\emsdk\emscripten_toolchain\env.bat
call %~dp0\env.bat
py -3 %EMSCRIPTEN%\emar.py %*

View File

@@ -1,5 +1,5 @@
@ECHO OFF
call external\emsdk\emscripten_toolchain\env.bat
call %~dp0\env.bat
py -3 %EMSCRIPTEN%\emcc.py %*

View File

@@ -1,5 +1,5 @@
@ECHO OFF
call external\emsdk\emscripten_toolchain\env.bat
call %~dp0\env.bat
py -3 external\emsdk\emscripten_toolchain\link_wrapper.py %*
py -3 %~dp0\link_wrapper.py %*

View File

@@ -1,5 +1,6 @@
@ECHO OFF
set ROOT_DIR=%CD%
set ROOT_DIR=%EXT_BUILD_ROOT%
if "%ROOT_DIR%"=="" set ROOT_DIR=%CD%
set EMSCRIPTEN=%ROOT_DIR%\%EM_BIN_PATH%\emscripten
set EM_CONFIG=%ROOT_DIR%\%EM_CONFIG_PATH%

View File

@@ -71,6 +71,7 @@ def _impl(ctx):
cc_target_os = "emscripten"
emscripten_dir = ctx.attr.emscripten_binaries.label.workspace_root
nodejs_path = ctx.file.nodejs_bin.path
builtin_sysroot = emscripten_dir + "/emscripten/cache/sysroot"

View File

@@ -32,12 +32,13 @@ def _wasm_transition_impl(settings, attr):
return {
"//command_line_option:compiler": "emscripten",
"//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": [platform],
# This is hardcoded to an empty cc_library because the malloc library
# is implicitly added by the emscripten toolchain
"//command_line_option:custom_malloc": "@emsdk//emscripten_toolchain:malloc",
}
@@ -50,7 +51,6 @@ _wasm_transition = transition(
outputs = [
"//command_line_option:compiler",
"//command_line_option:cpu",
"//command_line_option:crosstool_top",
"//command_line_option:features",
"//command_line_option:dynamic_mode",
"//command_line_option:linkopt",

View File

@@ -0,0 +1,148 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load(":emscripten_build_file.bzl", "EMSCRIPTEN_BUILD_FILE_CONTENT_TEMPLATE")
load(":revisions.bzl", "EMSCRIPTEN_TAGS")
load("//emscripten_toolchain:toolchain.bzl", "emscripten_cc_toolchain_config_rule")
def remote_emscripten_repository(
name,
bin_extension,
**kwargs,
):
"""Imports an Emscripten from an http archive
Args:
name: A unique name for this Emscripten repository.
bin_extension: Extension for the binaries in this Emscripten repository
**kwargs: Args for http_archive. Refer to http_archive documentation for more info.
"""
http_archive(
name = name,
build_file_content = EMSCRIPTEN_BUILD_FILE_CONTENT_TEMPLATE.format(bin_extension = bin_extension),
**kwargs
)
def emscripten_toolchain_name(name):
return "emscripten_{}".format(name)
def _get_name_and_target(name):
return name, ":" + name
def create_toolchains(name, repo_name, exec_compatible_with):
"""Creates toolchain definition for an Emscripten
Register the toolchains defined by this macro via
`register_toolchains("//<path-to-target>:cc-toolchain-wasm-<name>")`
Args:
name: A unique name for this Emscripten toolchain
repo_name: The name of the Emscripten repository for this toolchain
exec_compatible_with: Execute platform constraints for the Emscripten toolchain associated
with this repository.
**kwargs: Args for http_archive. Refer to http_archive documentation for more info.
"""
common_files_name, common_files_target = _get_name_and_target("common_files_" + name)
compiler_files_name, compiler_files_target = _get_name_and_target("compiler_files_" + name)
linker_files_name, linker_files_target = _get_name_and_target("linker_files_" + name)
ar_files_name, ar_files_target = _get_name_and_target("ar_files_" + name)
all_files_name, all_files_target = _get_name_and_target("all_files_" + name)
cc_wasm_name, cc_wasm_target = _get_name_and_target("cc-compiler-wasm-" + name)
wasm_name = "wasm-" + name
# These are file groups defined by the build_file_content on the Emscripten http_archive
remote_repo = "@{}//".format(repo_name)
repo_compiler_files_target = remote_repo + ":compiler_files"
repo_linker_files_target = remote_repo + ":linker_files"
repo_ar_files_target = remote_repo + ":ar_files"
native.filegroup(
name = common_files_name,
srcs = [
"@emscripten_cache//:emscripten_config",
"@emsdk//emscripten_toolchain:env.sh",
"@emsdk//emscripten_toolchain:env.bat",
"@nodejs//:node_files",
],
)
native.filegroup(
name = compiler_files_name,
srcs = [
"@emsdk//emscripten_toolchain:emcc.sh",
"@emsdk//emscripten_toolchain:emcc.bat",
repo_compiler_files_target,
common_files_target,
],
)
native.filegroup(
name = linker_files_name,
srcs = [
"@emsdk//emscripten_toolchain:emcc_link.sh",
"@emsdk//emscripten_toolchain:emcc_link.bat",
"link_wrapper.py",
repo_linker_files_target,
common_files_target,
],
)
native.filegroup(
name = ar_files_name,
srcs = [
"@emsdk//emscripten_toolchain:emar.sh",
"@emsdk//emscripten_toolchain:emar.bat",
repo_ar_files_target,
common_files_target,
],
)
native.filegroup(
name = all_files_name,
srcs = [
ar_files_target,
compiler_files_target,
linker_files_target,
],
)
emscripten_cc_toolchain_config_rule(
name = wasm_name,
cpu = "wasm",
em_config = "@emscripten_cache//:emscripten_config",
emscripten_binaries = repo_compiler_files_target,
nodejs_bin = "@nodejs//:node",
script_extension = select({
"@bazel_tools//src/conditions:host_windows": "bat",
"//conditions:default": "sh",
}),
)
native.cc_toolchain(
name = cc_wasm_name,
all_files = all_files_target,
ar_files = ar_files_target,
as_files = ":empty",
compiler_files = compiler_files_target,
dwp_files = ":empty",
linker_files = linker_files_target,
objcopy_files = ":empty",
strip_files = ":empty",
toolchain_config = wasm_name,
toolchain_identifier = "emscripten-wasm-" + name,
)
native.toolchain(
name = "cc-toolchain-wasm-" + name,
target_compatible_with = ["@platforms//cpu:wasm32"],
exec_compatible_with = exec_compatible_with,
toolchain = cc_wasm_target,
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
)
native.cc_toolchain_suite(
name = "everything-" + name,
toolchains = {
"wasm": cc_wasm_target,
"wasm|emscripten": cc_wasm_target,
},
)

View File

@@ -5,6 +5,7 @@ EMSCRIPTEN_TAGS = {
"4.0.6": struct(
hash = "14767574a5c37ff9526a253a65ddbe0811cb3667",
sha_linux = "27fc220a9ad98d323cad73531ff563e9838c9e1205f51ee2a5632bb4266a35d2",
sha_linux_arm64 = "2d03f8eb3f81dd94821658eefbb442a92b0b7601f4cfb08590590fd7bc467ef8",
sha_mac = "c06048915595726fc2e2da6a8db3134581a6287645fb818802a9734ff9785e77",
sha_mac_arm64 = "35d743453d0f91857b09f00d721037bb46753aaeae373bd7f64746338db11770",
sha_win = "3b576e825b26426bb72854ed98752df3fcb58cc3ab1dc116566e328b79a8abb3",
@@ -12,6 +13,7 @@ EMSCRIPTEN_TAGS = {
"4.0.5": struct(
hash = "d7f8ff5e2ca3539c33fae81e98f7c56ef9fa1239",
sha_linux = "fdd4d9d6b37e845039b207baaef60cd98fb594ea13a3e6d622c2dcd8f2a48ac6",
sha_linux_arm64 = "0007aec32eee609b91f35c32481ec060ea7dac7151e36344bbcae419907f9240",
sha_mac = "f4e5a6c57ad9de59bff73463972213a299af2bb419dafbdd3959947fa801a342",
sha_mac_arm64 = "b8b93190fa17afe32a5eaa7120b807767b1c9d6e1d4ae6b9a2c6adb231758683",
sha_win = "3b8ed9e298a6d58fee841f5c3f1d3e7b2dff104cc7df314cd329f4c05d470be0",
@@ -19,6 +21,7 @@ EMSCRIPTEN_TAGS = {
"4.0.4": struct(
hash = "ea71afcf5a172125179a07ff1731de6e81c92222",
sha_linux = "f05dab4a6a13a5fe6972e95e918d1483e687faf468e1a653deaa8d7956a97a3a",
sha_linux_arm64 = "95a421f304a7209c6f259754ad15aea5bbbbb1838139b51837aeb2c184fa4a89",
sha_mac = "d8b44aae37224ae76572ad84b60a2adaa126826332864fb689944d5130705d8d",
sha_mac_arm64 = "ade1c1a0c2e5893c6f74079beeae8b7e2a0c3f3b7ae88891064104fd985dfc2b",
sha_win = "342cf9dfb83e95bf678d07e460e093ea61a609d34b4603d9be06d4f31784409d",
@@ -26,6 +29,7 @@ EMSCRIPTEN_TAGS = {
"4.0.3": struct(
hash = "de2109f0e5e7278d470da11de526aed16c527722",
sha_linux = "6480f51d0c24130424c696bf83e9774f42246a0109c8d48b59f4520fdfadb928",
sha_linux_arm64 = "76b1511d550b4f47276b93581ae5122063acbca7c960703637657388cf178636",
sha_mac = "f40851b816b31b3ca3214ebf61cc152625a05c24f43e2b13c2ad9b9e5dca73c0",
sha_mac_arm64 = "6d8ac5ad1f59f71de0927eb2c595dab2f21d9946ca293434359a6db2ab06a138",
sha_win = "3702e4a518057520d4ad9e7cd63a01a829770d090551e00f19f417f55b0170d3",
@@ -33,6 +37,7 @@ EMSCRIPTEN_TAGS = {
"4.0.2": struct(
hash = "cc8eba40de8235f9c33d92463018f87b3edaa09e",
sha_linux = "3c0e3940240709388c24a4262680c18bb1d5979f2337abe53db00fb039606c44",
sha_linux_arm64 = "21ed0c31c1fc972e3509fcb140e0323061b5f2b173fe56d1f8961df2a37e4c11",
sha_mac = "e1bd96ec790968adf583d348158375b76ee0287e348954c3393c82565475b07b",
sha_mac_arm64 = "e5bf9a5efabc114b42636abcea07a1e02d3a9406cd399a29ccbc730586dce465",
sha_win = "78010f8e2f7bb6868bb20e3fc32e24d45e6fca749c388c2d25bea9845512338d",
@@ -40,6 +45,7 @@ EMSCRIPTEN_TAGS = {
"4.0.1": struct(
hash = "5ff495a591978fdf8a16f2d172be3616f3150d1e",
sha_linux = "7b2b64b1bc15555696f78cbcb54c8d75832222d1578270ff5f56a8024c9a0dbc",
sha_linux_arm64 = "5c046a22b933de14be6b2522b75796afffe3940a19422eee483b7f3f1a226d66",
sha_mac = "d089eba9c3cad675bbd7d3318aec166ebe5ba984a6c5291136c09c68324d9818",
sha_mac_arm64 = "c8359b334bad71719e8d29e796ca7b63891e0305987b2572eb5a2f020e34f773",
sha_win = "9cf861339327f3657281c5c8c18aa723323acffe3b3d1c3807b9d4576d097e0e",
@@ -47,6 +53,7 @@ EMSCRIPTEN_TAGS = {
"4.0.0": struct(
hash = "3ebc04a3dab24522a5bf8ced3ce3caea816558f6",
sha_linux = "6836988f0b7ee6ce3df5192dd4375b9eee55be78847ce31cf1d2abfb00f1e991",
sha_linux_arm64 = "d4e6e04b7e2fa1bdffc9c07ab4e0a3f66bde75adb06ebf9cc66a341907b17db4",
sha_mac = "4123e9ff6a699dac303c4fe22529ae0d618c118fcd8267df590363b0fc98c91d",
sha_mac_arm64 = "4b5fb7cc4f5f8526aaa41c8560a00ad6782b97cd3894d856beb635f05a825613",
sha_win = "6b1e5aee4b4a4274712566c845888bdf4eced09a5aaa64c1796cda57cd2854c4",
@@ -54,6 +61,7 @@ EMSCRIPTEN_TAGS = {
"3.1.74": struct(
hash = "c2655005234810c7c42e02a18e4696554abe0352",
sha_linux = "a987bb4cded4f29437e8589accac204ce3c134feaaaf251bb97d0fdf450dce65",
sha_linux_arm64 = "c7fcc532eb7ee1dc7df0eacb49128ded12e4d55a973b8a2a5215da8bb6c4027c",
sha_mac = "04f848f40bd19220a43abde2dd1012d95bf1f89c618c0f631b83d18357e2bb65",
sha_mac_arm64 = "fc71758a5bfb02b8a5c2dd21d6bfc34aa3c64698f6105e204a1f4d11f6d67603",
sha_win = "603b0515e0367ee2718b2f360ef0194663d23a91236910d5f4a90ac4d745a4f2",
@@ -61,6 +69,7 @@ EMSCRIPTEN_TAGS = {
"3.1.73": struct(
hash = "b363a836e75a245c548b7a6a021822d8c9e4c6df",
sha_linux = "4f3bc91cffec9096c3d3ccb11c222e1c2cb7734a0ff9a92d192e171849e68f28",
sha_linux_arm64 = "e6fb8a32889d4e4a3ac3e45d8012641369251ddd1255ada132ff6c70ab62b932",
sha_mac = "8d52ec080834f49996534de26772800dee048ec9bf148bb508be95887e267735",
sha_mac_arm64 = "58e6c984c5a1fb71e0871f0c3bb9e32d41e7553260c6eeb38800a4612623a99d",
sha_win = "d76003fad2146ad1f2289e8b251fbc359406ced0857f141a41f15149c2138302",
@@ -68,6 +77,7 @@ EMSCRIPTEN_TAGS = {
"3.1.72": struct(
hash = "7a360458327cd24c2a7aab428bdbcb5bca8810e4",
sha_linux = "be094d6dd27c27a64116e9c0165d6cade5d329f5137e56696773e98e1df83fa7",
sha_linux_arm64 = "5dba64454809d72d53c432f3c91830d69d413ebd9dcd0ce18df5a79a3af235a6",
sha_mac = "52f713c118717814d2371912ab9019a3605b7d6acc627f3842e6aa7d3ffff7bf",
sha_mac_arm64 = "644593539684f59c635c7eae2e743f5e4e27b1d665f9c71c23dcefd4c2448b3c",
sha_win = "c72623fb68f109d8f122036f25b9fc75353bd1ce28995d9920277d4be4a1d99c",
@@ -75,6 +85,7 @@ EMSCRIPTEN_TAGS = {
"3.1.71": struct(
hash = "7ee0f9488f152e9e9cf0d4d243970e03742f1a5c",
sha_linux = "43f87aa84a73697b905d2a13c89d016af8ec66bed792f37dd5a0059529abee12",
sha_linux_arm64 = "d25f5e57b2e7557df39cd9dec3b0283fb086f66c800af3d9a3f70f36c5fc6b14",
sha_mac = "8dac015c03c4f2e594d8bca25fe35d1e4d808aea81705121e852aff0464c4a9d",
sha_mac_arm64 = "a7797c3d210eda29f88eede261fc8f0aabf22c7b05214916b5b50a1271e9f0b8",
sha_win = "dfe77eaf22278ca975519f0497c8b336c86e52461c478060418fe67b39b6e87c",
@@ -82,6 +93,7 @@ EMSCRIPTEN_TAGS = {
"3.1.70": struct(
hash = "6fa6145af41e835f3d13edf7d308c08e4573357a",
sha_linux = "c29b4a2c6addd5aafa613768d34273a23d8fcd1753c685ff61099506710cd8d7",
sha_linux_arm64 = "b13386975023a06f19057daef3896d480229b144d1e97f8764ed2f3e0fcb7d37",
sha_mac = "bc0edcaaaa19daeda9164d38d36c5f7d7b4b4e1eb7695ad58e776336c571fcc4",
sha_mac_arm64 = "e470d5eeb570850d66a79bd4c06064b9b3a1e90c7c2101e1a444ebcd6466fe5a",
sha_win = "f0118d71fd67583ddcfd39af2ed8bec3d18152fb6aadee085ebec5bcaf4ac4f5",
@@ -89,6 +101,7 @@ EMSCRIPTEN_TAGS = {
"3.1.69": struct(
hash = "8fe01288bc35668c13316324336ea00195dfb814",
sha_linux = "24a786666e6f48ed3c3944b44df5cf146c45cf4faece4cb2686312a3d052a00c",
sha_linux_arm64 = "48e670501d215ac5b6b2680c900c517d9028dbc4de43be5dd6f25211a3640f2b",
sha_mac = "8503fe87dd2f30abff2550e9d6eb8aadeaf30fd3c6972d635b31e67f82e155f7",
sha_mac_arm64 = "995c7b3c84458edf6b8945e81405320c64a25dfe79eaa427fc1fe9a680f56b4f",
sha_win = "3839e0a581ae7b19156f004762a8221585e9a0d6237e468b13a878d1947636c5",
@@ -96,6 +109,7 @@ EMSCRIPTEN_TAGS = {
"3.1.68": struct(
hash = "b52d8c9150dc7d4c8e4a7a08c7a9b4006c9abe49",
sha_linux = "1f2bcb47d85eb31d90fa797b3513221adc50f0656bb37f0962a40fd0f49fcf6a",
sha_linux_arm64 = "de346e7a489aa27a442215945d154d58a0d35c608b6150b2992af0e70c04e1c5",
sha_mac = "b180711544d783121370d2c894703f99d370a864ab147730f82fd59b88fa3481",
sha_mac_arm64 = "5e9b6242b56edc8cb404cbaf6c8bd7eb1f0f168b55b580bd92652f98c5d286f4",
sha_win = "824d37e8a0845f44e4c1111e8365640eea28944f1bdbd1e9e3fea0279b68baea",
@@ -103,6 +117,7 @@ EMSCRIPTEN_TAGS = {
"3.1.67": struct(
hash = "4ae62984ea36ef0e5bfcbd0ed9b62f04bee6426a",
sha_linux = "535b64822916c80124363a5c7a5bd0cafd703f166d5155c0ad0e464e4a879091",
sha_linux_arm64 = "04c5f959702d8c1e5c000752b562271c224dee593e81144280840fed06e36cd9",
sha_mac = "692b8fdc79a47332ba9881966c72517eedf15b2da7bed37a535dfec55e6bbd9c",
sha_mac_arm64 = "ac26753f59fa9c8e92be9c91666014ad9400c91fbd37064105d1b5fcae503985",
sha_win = "8c6af8046ed47386018e42d18b53f57fad0926306dd4315d7f09dfae844b3dd3",
@@ -110,6 +125,7 @@ EMSCRIPTEN_TAGS = {
"3.1.66": struct(
hash = "243eae09cf5c20c4fde51a620b92f483255c8214",
sha_linux = "b10eac37c978b28da2f1f34cdd8a7759c0ed5e5a2d8eb4f4e6790209de33dbf7",
sha_linux_arm64 = "9c78a470f74c24fc1fde2c8d86583ed98847b6cbdd87cd0b36ff2d6b4799d950",
sha_mac = "64fd0603ccbf949967cb0dfd8f1b0b25e018abf8bfe813b53596c4fc78751027",
sha_mac_arm64 = "fd6250f25101957f56086d292263379880c4b3329819a021008b2058f92ef67b",
sha_win = "b24f65a1a1111d8ace6ba47b55e07681cd0620f7bf711d1018ee262c9501defc",
@@ -117,6 +133,7 @@ EMSCRIPTEN_TAGS = {
"3.1.65": struct(
hash = "fdcf56c75a1d27fdff6525a7e03423595485ca19",
sha_linux = "b2b7de13d37c4c5126e6c6a077e6019ebacc78ef1fb1b35b9035f03975f5ffaa",
sha_linux_arm64 = "f838af6495408f3c0a14d233171b4919b62e445c62805a22dea1875cb709a116",
sha_mac = "cc50b829a21a041979e0941cfd2047d30a06e3c4a8fd9f662ecdc12a0ab40535",
sha_mac_arm64 = "db4430db6a085d6ed5284917e632541dad3ce0a9464659fb674055247ad059d0",
sha_win = "e72ae4ec3231d9a492eadbf77ff28c13efd90307a69df04234792e67a001d05e",
@@ -124,6 +141,7 @@ EMSCRIPTEN_TAGS = {
"3.1.64": struct(
hash = "fd61bacaf40131f74987e649a135f1dd559aff60",
sha_linux = "c39de24beca60fd580f6dff0eca0e275016042a30234588b19eda82397e299f3",
sha_linux_arm64 = "61b412135630a60c5517278dc83930e06f80fa286fcc2bb6366c4f620c86e4e0",
sha_mac = "2644772be398c8095621b3d0fe9ff2d122b18b7b0963c0eb702639d94dfb8e90",
sha_mac_arm64 = "47449057c345a09aa8750be1a357c364ffea9f8a066066cb341a7a2a14bac96a",
sha_win = "eb5b59afb420915daab4c383e5f73d456cc14776dce02fdc852c46522cda5531",
@@ -131,6 +149,7 @@ EMSCRIPTEN_TAGS = {
"3.1.63": struct(
hash = "aeb36a44b29e8ca9f4c7efbb4735b69003ac2bb9",
sha_linux = "2a38ac1ea2fe3b7169879f0f666ea278f344cbb5db6e34421b9554939559109c",
sha_linux_arm64 = "f1dd5fe4cd22e89b1f5bfd216f1245f9f40f6ea76651a7f66e925a68ff6f18b8",
sha_mac = "7e192b84aecfade22817b5b38f0c69d1f795a9b990308188d39ed1d218692cd3",
sha_mac_arm64 = "751ef26a3682f5f23dfdc1c2f80cd0604a32cad61e6373c823de774722ecb9af",
sha_win = "947f8e867e781750d374d659644897f2345a133ad3d0f9ade23afcb81eeaddd3",
@@ -138,6 +157,7 @@ EMSCRIPTEN_TAGS = {
"3.1.62": struct(
hash = "d52176ac8e07c47c1773bb2776ebd91e3886c3af",
sha_linux = "fd303a2b2a85c4b3ab8aa29595d70c5fde9df71c5254d56ed19d54e9ee98e881",
sha_linux_arm64 = "233c0df77644472cd322b45b2d7cf709e6c338799b46f6ec5d5f39ca4dbe8aef",
sha_mac = "d9cfef7ba8f44bf21be715244d0d5f909f1ccc2a481a301b3c01d12d1babc049",
sha_mac_arm64 = "de5484d60c858aaa8b93ba6485924adffe734cf4f8296765c089900cf9ce0701",
sha_win = "7455680bf9c19a26fe4868111ac01401023b0f92e862d3cabadf7950b87707fd",
@@ -145,6 +165,7 @@ EMSCRIPTEN_TAGS = {
"3.1.61": struct(
hash = "28e4a74b579b4157bda5fc34f23c7d3905a8bd6c",
sha_linux = "e3e20e09219fd47a0019bb3252e17db4a00ded39b39b41634bc73f840a8ff2be",
sha_linux_arm64 = "a6b858601ca09fb7bb6ddf1a5ffb1a4130454c936ad046d45fef183037828c46",
sha_mac = "1fe69a3c42fb2857b80c8e77bfab780cb212ed7cf81ae57c0c4d235504df5269",
sha_mac_arm64 = "4ba702eea409e2d4bfabc73a68919217d3993e7585d95734e3e40a3c9ce1bd21",
sha_win = "bbafba849ff072a61dd34a8ffc0c85eed20a417854a3ca751b092e3565a92581",
@@ -152,6 +173,7 @@ EMSCRIPTEN_TAGS = {
"3.1.60": struct(
hash = "87709b5747de5b1993fe314285528bf4b65c23e1",
sha_linux = "ff5eb062165920c7cb69935d396f13e9f8ca5b13f2d7f3af2759bcacb5e877e2",
sha_linux_arm64 = "2c291942df4868d3f65b31dd964bda9736bfddcd6a7886158963f797d1b45cf5",
sha_mac = "45586fab1bad65a4293ea8939dafb5ec711ba92ae7b4d1edbaae3b4486f398b5",
sha_mac_arm64 = "8dc27416a378ad07285d380f68717cfe0db1ea6252fdb1ad012af95e4d3f342e",
sha_win = "f3147ef2d4ca48ea2624039969fd0529d0bacb63bf49ee4809c681902768b973",
@@ -159,6 +181,7 @@ EMSCRIPTEN_TAGS = {
"3.1.59": struct(
hash = "e20ee09a8a740544c4bc6de5d4ba5f81f74b74d6",
sha_linux = "ae59d1946cb92e1651cbb904fe824b3f07b39f42fa25f582116b5aaa226fa239",
sha_linux_arm64 = "25b918d6d5ee2af7ef6b28e089dc21d2dc419dca76c8079bb638cb20459eb9e5",
sha_mac = "af175bd559cb80459749e504da314af0163291f195461bf4d376d6980c4c60c3",
sha_mac_arm64 = "e17553bca5d00b30c920595e785281627e973f9e7e14c5dc0a73c355ccafe113",
sha_win = "bb54256fc3b7824cb75d5474f887d9bf8e1e63c15b351bdfbed898aa293ee4ab",
@@ -166,6 +189,7 @@ EMSCRIPTEN_TAGS = {
"3.1.58": struct(
hash = "a4d4afb626c5010f6ccda4638b8d77579a63782e",
sha_linux = "b188249ecb939dadc679aaf2d3d9afd0fe19ab942f91b7bc926b4f252915dd1a",
sha_linux_arm64 = "4aedc8ca641b40d9bd82d85b1dc3458fe1afc9a132da06a09384a5f89c058969",
sha_mac = "2092aa4bef3b9f88d3f343b042a417ba617d4e04454656d8f2e101ba53f854e8",
sha_mac_arm64 = "7a9a15845257629b7602d15bdf7633a8e10472b0fa9b3d9ee7149938aa2f2039",
sha_win = "9fe76b6189566d56f0cf9aecbd23a006778530aa87184a900f5662e39ce7272a",
@@ -173,6 +197,7 @@ EMSCRIPTEN_TAGS = {
"3.1.57": struct(
hash = "523b29e1b99a61069a2fa9f9d3cc9be1c4c53d4d",
sha_linux = "5bc444132258d4404d396f2044a4a334064ad0f1022555cad5ec72804a98ba5a",
sha_linux_arm64 = "f0022413afcc1610deff10921b3f5938bf4d01eba46ce96655f2295bdd84bd6a",
sha_mac = "31ddccb68c86f0a45332982938c49505158860ed4f7e8ccef72a48382e0e3c96",
sha_mac_arm64 = "cc5fdb65b339464f99b9c731cc63c233ec9577268886a856fa49f227ca2a56d1",
sha_win = "b53555420bb9b6e31c153e4c59427000ec692be17ae900f659a9b774d1ecebed",

View File

@@ -1 +1,6 @@
bazel_dep(name = "platforms", version = "0.0.9")
bazel_dep(name = "rules_cc", version = "0.1.1")
bazel_dep(name = "emsdk")
local_path_override(
module_name = "emsdk",
path = "..",
)

3696
bazel/test_external/MODULE.bazel.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,16 +0,0 @@
local_repository(
name = "emsdk",
path = "..",
)
load("@emsdk//:deps.bzl", "deps")
deps()
load("@emsdk//:emscripten_deps.bzl", "emscripten_deps")
emscripten_deps()
load("@emsdk//:toolchains.bzl", "register_emscripten_toolchains")
register_emscripten_toolchains()

View File

@@ -1 +1,25 @@
bazel_dep(name = "platforms", version = "0.0.9")
bazel_dep(name = "rules_cc", version = "0.1.1")
bazel_dep(name = "emsdk")
local_path_override(
module_name = "emsdk",
path = "..",
)
emscripten_cache = use_extension(
"@emsdk//:emscripten_cache.bzl",
"emscripten_cache",
)
emscripten_cache.configuration(flags = ["--lto"])
emscripten_cache.targets(targets = [
"crtbegin",
"libprintf_long_double-debug",
"libstubs-debug",
"libnoexit",
"libc-debug",
"libdlmalloc",
"libcompiler_rt",
"libc++-noexcept",
"libc++abi-debug-noexcept",
"libsockets",
"libdlmalloc-debug",
])

File diff suppressed because it is too large Load Diff

View File

@@ -1,31 +0,0 @@
local_repository(
name = "emsdk",
path = "..",
)
load("@emsdk//:deps.bzl", "deps")
deps()
load("@emsdk//:emscripten_deps.bzl", "emscripten_deps")
emscripten_deps()
load("@emsdk//:toolchains.bzl", "register_emscripten_toolchains")
register_emscripten_toolchains(cache = {
"configuration": ["--lto"],
"targets": [
"crtbegin",
"libprintf_long_double-debug",
"libstubs-debug",
"libnoexit",
"libc-debug",
"libdlmalloc",
"libcompiler_rt",
"libc++-noexcept",
"libc++abi-debug-noexcept",
"libsockets",
"libdlmalloc-debug"
]
})