-
Notifications
You must be signed in to change notification settings - Fork 806
[Bazel] Support for a custom prebuilt emscripten cache #1620
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
cc59466
support defining custom Emscripten cache archive
DoDoENT 53341a8
make toolchain hermetic in case when secondary cache is used
DoDoENT 961b27e
update README
DoDoENT 77eb9cd
apply PR review suggestion
DoDoENT bd51eec
apply PR review suggestion
DoDoENT 55f3e37
Potential fix for pull request finding
DoDoENT 8ade2ca
output embuilder's output when embuilder fails
DoDoENT 0a46a54
add test for prebuilt cache feature to the current bazel integration …
DoDoENT a34996d
fix compatibility with bazel 7
DoDoENT 6ebf8b2
yet another fix for Bazel 7
DoDoENT a5b8e2a
fix grammar issue detected by copilot
DoDoENT a633036
remove no-longer-needed --incompatible_enable_cc_toolchain_resolution…
DoDoENT File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| bazel-bin | ||
| bazel-out | ||
| bazel-test_prebuilt_cache | ||
| bazel-testlogs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| load("@emsdk//emscripten_toolchain:wasm_rules.bzl", "wasm_cc_binary") | ||
| load("@rules_cc//cc:defs.bzl", "cc_binary") | ||
|
|
||
| cc_binary( | ||
| name = "hello-world", | ||
| srcs = ["hello-world.cc"], | ||
| copts = [ | ||
| "-flto=thin", | ||
| ], | ||
| linkopts = [ | ||
| "-sAUTO_NATIVE_LIBRARIES=0", | ||
| "-flto=thin", | ||
| ], | ||
| ) | ||
|
|
||
| wasm_cc_binary( | ||
| name = "hello-world-wasm", | ||
| cc_target = ":hello-world", | ||
| outputs = [ | ||
| "hello-world.js", | ||
| "hello-world.wasm", | ||
| ], | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| bazel_dep(name = "rules_cc", version = "0.2.16") | ||
| bazel_dep(name = "emsdk") | ||
| local_path_override( | ||
| module_name = "emsdk", | ||
| path = "..", | ||
| ) | ||
|
|
||
| emscripten_deps = use_extension( | ||
| "@emsdk//:emscripten_deps.bzl", | ||
| "emscripten_deps", | ||
| ) | ||
|
|
||
| # Need to use the same version of Emscripten as the prebuilt cache was built with to ensure compatibility even when future versions of Emscripten are released. | ||
| emscripten_deps.config( | ||
| version = "5.0.7", | ||
| ) | ||
|
|
||
| emscripten_cache = use_extension( | ||
| "@emsdk//:emscripten_cache.bzl", | ||
| "emscripten_cache", | ||
| ) | ||
|
|
||
| # This cache was built with Emscripten 5.0.7, and contains opt-thinlto build. | ||
| # It has been built according to these instructions: https://github.com/DoDoENT/bazel-playground/blob/master/tools/emsdk-cache-builder/README.md | ||
| emscripten_cache.prebuilt_cache( | ||
| http_archive_url = "https://github.com/DoDoENT/bazel-playground/releases/download/emsdk-cache/emsdk-cache-5.0.7.tar.gz", | ||
| sha256 = "bbfdab09ae64769c4aa977b1d88f776490c459c87e7ed7e31fe00190cd56b14a", | ||
| strip_prefix = "emsdk-cache", | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| #include <iostream> | ||
|
|
||
| int main(int argc, char** argv) { | ||
| std::cout << "hello world!" << std::endl; | ||
| return 0; | ||
| } |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent suggestion! Thank you. I added tests that uncovered incompatibilities with Bazel 7, which I now fixed.