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

bevy run web: only compile default_run target when no binary is specified #237

Merged
merged 1 commit into from
Jan 22, 2025

Conversation

DaAlbrecht
Copy link
Contributor

Objective

Closes #200.

Improve compile time by only compiling the default run target if available and no specific binary is omitted via the --bin or --example flags.

Solution

Check if bevy run was called with either --bin or --example. If not search for the default_run binary name and append it with --bin before calling build_web(&mut build_args)

Testing

Before:

bevy_complex_repo/app
❯ cargo clean
     Removed 2378 files, 2.6GiB total
bevy_complex_repo/app
❯ bevy run web
Compiling to WebAssembly...
   Compiling cplx_core v0.1.0 
   Compiling cplx_teaser v0.1.0
   Compiling cplx v0.1.0 
   Compiling cplx_demo v0.1.0 
    Finished `web` profile [unoptimized + debuginfo] target(s) in 37.09s
Bundling JavaScript bindings...

Now:

bevy_complex_repo/app
❯ cargo clean
     Removed 2724 files, 6.9GiB total
bevy_complex_repo/app
❯ bevy run web
 Compiling bevy v0.14.2
   Compiling cplx v0.1.0 
    Finished `web` profile [unoptimized + debuginfo] target(s) in 39.44s

@DaAlbrecht DaAlbrecht marked this pull request as ready for review January 20, 2025 22:11
Copy link
Collaborator

@TimJentzsch TimJentzsch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I first though this might not work if you have two different packages which contain a binary with the same name.

But it turns out Cargo doesn't allow that in workspaces, at least it prints out a warning in this case.

@TimJentzsch TimJentzsch merged commit 97aa315 into TheBevyFlock:main Jan 22, 2025
8 checks passed
@DaAlbrecht DaAlbrecht deleted the 200-too-many-bin-tarets branch January 23, 2025 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bevy run web compiles too many binary targets
2 participants