Commit Graph

14 Commits

Author SHA1 Message Date
Sam Clegg
833fa33421 [emsdk] Remove references to old output files such as .worker.js. NFC (#1585)
Fixes: #1584
2025-08-19 12:56:30 -04:00
Conrad Burchert
ed2035a3cc 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
2025-04-09 14:38:12 -07:00
William Izzo
d29161158e [Bazel] Let audio workout bootstrap js file be generated. (#1404)
* Allows generation of audio worklet bootstrap js file

In order to allow users to generate the file, the allowed extension list in `link_wrapper.py` has been updated accordingly.

* adds audio worklet js to wasm_cc_binary too

---------

Co-authored-by: William Izzo <william.izzo@hey.com>
2024-06-14 12:13:50 -04:00
walkingeyerobot
399e5396df [bazel] add tarball as an optional output (#1383)
Usage would be something like:
```
filegroup(
    name = "hello-world-tarball",
    srcs = [":hello-world-wasm"],
    output_group = "_wasm_tar",
)
```
2024-05-15 17:20:54 -04:00
martijneken
ef2a8e929d wasm_cc_binary: Specify a default OS. Allow users to override platform. (#1262)
* wasm_cc_binary: Specify a default OS. Allow users to override platform.

Problem: https://github.com/proxy-wasm/proxy-wasm-cpp-sdk/pull/157#discussion_r1277763118

This is solving the problem in two different ways. Please let me know
your thoughts about both approaches, as either will work.

Signed-off-by: Martijn Stevenson <mstevenson@google.com>

* Rework platform selection to trigger os:wasi off standalone attr

Signed-off-by: Martijn Stevenson <mstevenson@google.com>

---------

Signed-off-by: Martijn Stevenson <mstevenson@google.com>
2023-07-28 21:08:04 +00:00
Robbert van Ginkel
bd7842e4ba Add standalone_wasm feature to bazel emscripten_toolchain (#1145) 2022-12-06 15:22:11 -08:00
Trevor Hickey
e8606a7e3b remove "name" attribute from bazel rules (#1131) 2022-11-14 13:32:13 -08:00
John Firebaugh
005063304b [bazel] Switch to platforms-based toolchain resolution (#1036) 2022-11-08 14:21:06 -08:00
Ezekiel Warren
71f5fb0247 Explicit outputs for wasm_cc_binary (#1047)
* Explicit outputs for wasm_cc_binary

* Backwards compatibility

* data_runfiles restore

* restore test_bazel.sh

* Using wrong path on accident

* two separate rules for legacy support

* Added name attribute to wasm_cc_binary rule
2022-05-20 01:09:46 -04:00
Piotr Sikora
0ea8f8a870 Provide "executable" in wasm_cc_binary's DefaultInfo. (#998)
This is needed to allow custom rules and/or transitions on top of wasm_cc_binary (e.g. to workaround #972).

It's debatable whether .wasm is the correct executable target for non-standalone Wasm builds, but we don't have a way to differentiate those in wasm_cc_binary, and considering that this attribute isn't exported now, it shouldn't break anything.
2022-03-09 07:09:39 -08:00
Ezekiel Warren
774b871eca Bazel Windows Support (#929) 2021-12-20 14:24:56 -05:00
Tim Talashok
c1589b5564 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
2021-03-24 16:50:44 -07:00
walkingeyerobot
848260ed58 Bazel add html support (#765)
* allow the bazel toolchain to output html files

* allow for cc_binary rule names to end in .js

* fix python name

* continue to call emcc instead of em++ for now

* small cleanup

Co-authored-by: Mitch Foley <mitchfoley@chromium.org>
2021-03-21 20:08:54 -04:00
walkingeyerobot
5f630def2a add a wasm bazel toolchain (#603) 2020-09-10 18:42:46 -07:00