[Bazel] Support for a custom prebuilt emscripten cache#1620
Conversation
|
@walkingeyerobot can you recommend anyone else who might be good to review this? |
f260754 to
89182a9
Compare
89182a9 to
ac529c0
Compare
ac529c0 to
831b9fb
Compare
831b9fb to
94c0b19
Compare
94c0b19 to
b8fe27f
Compare
Since @walkingeyerobot didn't respond for a very long time, I added @mmorel-35 as a reviewer for this. He reviewed other Bazel-related emsdk PRs, so I'm confident he can take a look at this one as well. We've been using this patch for over 5 months now in our company and haven't found any issues with it so far. |
|
This is incredibly useful. We added this patch to our usage as well. |
b2e5dc8 to
82c0cbb
Compare
82c0cbb to
52e489a
Compare
|
I don't really feel qualified to review this. Maybe @mmorel-35 can chime in? |
There was a problem hiding this comment.
Pull request overview
Adds support for supplying Emscripten’s frozen cache as a prebuilt archive (downloaded during repository setup) and makes the cache available as an explicit toolchain input to improve hermeticity and CI performance.
Changes:
- Extend
emscripten_cachemodule extension to optionally download/extract a prebuilt cache archive and wire it intoemscripten_config. - Add a
builtin_cachefilegroup and anemscripten_cachetarget so the toolchain always carries cache files into the sandbox (builtin or secondary/prebuilt). - Document
prebuilt_cacheusage in the Bazel README.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| bazel/remote_emscripten_repository.bzl | Adds cache filegroup target to toolchain “common files” inputs. |
| bazel/emscripten_cache.bzl | Adds prebuilt_cache support and switches cache path computation to be machine-independent. |
| bazel/emscripten_build_file.bzl | Exposes the builtin Emscripten cache as a filegroup for toolchain inputs. |
| bazel/README.md | Documents configuring a prebuilt cache archive via Bzlmod. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
52e489a to
7c999bb
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Applied suggestion by CoPilot Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This adds support for using a prebuilt cache as an archive instead of building it from scratch every time.
This solves multiple problems:
thinlto,lto, and other cache combinations on demand. This doesn't work in the Bazel world, where the cache needs to be frozen.emscripten_configfile that contained full path to the cache.emscripten_configfile is always same, regardless of the machineAfter applying this patch to our internal codebase, the regular builds of WASM code went down from 12-15 minutes to cca 30 seconds, regardless on which machine it runs, as long as remote cache is warm.