Skip to content
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

Allow bevy build web to bundle multiple binary targets #230

Open
TimJentzsch opened this issue Jan 16, 2025 · 0 comments
Open

Allow bevy build web to bundle multiple binary targets #230

TimJentzsch opened this issue Jan 16, 2025 · 0 comments
Labels
A-Build Related to the bevy build command A-Web Building or running Bevy apps targeting the browser C-Bug A bug in the program S-Ready-for-Implementation This issue is ready for an implementation PR. Go for it!

Comments

@TimJentzsch
Copy link
Collaborator

cargo build can build multiple packages at once.

bevy build web only partially supports this: As it wraps cargo build, all the Wasm binaries will be built as intended, but the bindgen creation and folder bundling currently uses the bevy run web logic and only selects a single target.

Instead, we should create the bindings and bundle the folders for all binaries compiled by cargo build.

Note that we should only do this for binary targets (and examples), not libraries, benchmarks and tests.

@TimJentzsch TimJentzsch added A-Build Related to the bevy build command A-Web Building or running Bevy apps targeting the browser C-Bug A bug in the program labels Jan 16, 2025
TimJentzsch added a commit that referenced this issue Jan 16, 2025
# Objective

Closes #229.

The `bevy run web` command cannot just wrap `cargo run`, as we don't
want to run a native application, but run the code in the user's
browser.
Hence, we have to manually build with `cargo build` instead.

This causes quite a lot of code (also including calling `wasm-bindgen`)
to be duplicated between `bevy build web` and `bevy run web`.

To ensure consistency and aid development, the code should be shared
where possible.
This will enable us to build more complex features like #226.

# Solution

- Extract reusable part of `bevy build web` into dedicated function.
- Add a conversion from run args to build args.
- Call the `bevy build web` logic in `bevy run web` as well.

The functionality _should_ be equivalent.

In the future, we might refine how exactly the shared build function is
called.
For example, I assume that we will pass the binary targets we want to
build from the outside instead of determining it in the function itself,
that will enable us to implement changes like #200 and #230.
@TimJentzsch TimJentzsch added the S-Ready-for-Implementation This issue is ready for an implementation PR. Go for it! label Jan 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Build Related to the bevy build command A-Web Building or running Bevy apps targeting the browser C-Bug A bug in the program S-Ready-for-Implementation This issue is ready for an implementation PR. Go for it!
Projects
None yet
Development

No branches or pull requests

1 participant