Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Allow building examples locally using helper script and zola config#2275

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
laundmo wants to merge8 commits intobevyengine:main
base:main
Choose a base branch
Loading
fromlaundmo:build-examples-locally

Conversation

@laundmo
Copy link
Contributor

The intention behind this PR is to allow contributors to easily build wasm examples locally, useful for example to include debug info.

For contributors, that means they now have access to:

  • A script to build a number of examples, and generate the examples pages only for those built.
  • A separate Zola config for serving the local assets, to be used after the above script.

There are a number of things about this (and the current setup as a whole) that I feel are not ideal:

  • Mixture of bash scripts and multiple small rust CLIs, spread across both repos. This means theres no central place for some kinds of modifications to go, and some changes I would think are useful will require PRs against both repos. Thats enough of a hurdle I don't want to attempt those.
  • The new script can only limit the amount of examples built, theres no way to choose a sepecific example. This is a limitation of tools/example-showcase in the bevy repo, which I did not want to touche. See first point.
  • I had to write code to compare the different structures for example betweeen the pathsexample-showcase build-wasm-examples generates:2D Rendering/Bloom 2D and the onesexample-showcase build-website-list generates:2d-rendering/bloom-2d

@alice-i-cecilealice-i-cecile added C-Usability A-Examples X-ContentiousThere are nontrivial implications that should be thought through labelsOct 1, 2025
@@ -0,0 +1,34 @@
# Zola config for compiling examples locally
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO we shouldn't maintain a separate nearly identical copy of this file just for this purpose. I would move the local versions ofwasm_webgl2_base_url to comments inconfig.toml.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Personally, i'd love to not need either, but Zola is limited in this regard. Maybe comments can work, but my goal was that there won't be a need to edit a git tracked file for at least the basic usecases.

Copy link
Contributor

Choose a reason for hiding this comment

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

Was just working with these changes myself to help troubleshoot another issue, and having the config predefined absolutely helped smooth out the process.

I don't think it's particularly uncommon to have a local config file for this sort of thing, and it doesn't look like Zola supports extending configs.

How often do these config files change? Will having an additional config file meaningfully increase maintenance costs?

Comment on lines +31 to +32
CARGO_PROFILE_RELEASE_OPT_LEVEL='z' CARGO_PROFILE_RELEASE_DEBUG="true" cargo run -p example-showcase -- --per-page$1 --page 0 build-wasm-examples --content-folder ../../static/assets/examples/wasm_webgl2 --api webgl2 --website-hacks
CARGO_PROFILE_RELEASE_OPT_LEVEL='z' CARGO_PROFILE_RELEASE_DEBUG="true" cargo run -p example-showcase -- --per-page$1 --page 0 build-wasm-examples --content-folder ../../static/assets/examples/wasm_webgpu --api webgpu
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO, it's a bit unfortunate to repeat these invocations here in this new script. Would prefer thatgenerate_wasm_example.sh handle the limiting.

Also, I think I or someone may have added a--debug option toexample-showcase.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

but generate_wasm_examples.sh never callsexample-showcase build-wasm-example? only the CI yaml has another version of this.

Copy link
ContributorAuthor

@laundmolaundmoOct 1, 2025
edited
Loading

Choose a reason for hiding this comment

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

Also, I think I or someone may have added a --debug option to example-showcase.

Just tried this: the option does exist, but its not implemented for thebuild-wasm-example command and silently gets ignored. Its only applied for therun command as far as I can tell:https://github.com/bevyengine/bevy/blob/0b8844a3a060b2a5b7c3302bd951e39fbf6aa1c3/tools/example-showcase/src/main.rs#L723

Copy link
Contributor

@rparrettrparrettOct 1, 2025
edited
Loading

Choose a reason for hiding this comment

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

ah right, sorry!

And yeah, looks like the new debug option isn't piped through fromexample-showcase.

README.md Outdated

These pages need to be generated in a separate step by running the shell scripts in the`generate-assets`,`generate-errors`, and`generate-wasm-examples` directories. On Windows, you can use[WSL](https://learn.microsoft.com/en-us/windows/wsl/install) or[git bash](https://gitforwindows.org/).

The Examples page uses the same WASM binaries ashttps://bevy.org/examples by default. To build examples locally, have a look at`generate-wasm-examples/build_wasm_examples_debug.sh`. After running it, start zola with`zola --config config.local.toml serve` to use the locally built examples.
Copy link
Contributor

Choose a reason for hiding this comment

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

The first sentence isslightly confusing for me. I would suggest something like "uses the same pre-built Wasm binaries" to clarify a tiny bit.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I've just pushed a re-wording

Copy link
Contributor

@RodhlannRodhlann left a comment

Choose a reason for hiding this comment

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

This is currently in a usable state for those trying to build and run the UI locally with examples, I think it would be good to merge as is and discuss additional improvements in a new Issue.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@mockersfmockersfAwaiting requested review from mockersf

2 more reviewers

@rparrettrparrettrparrett left review comments

@RodhlannRodhlannRodhlann approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

A-ExamplesC-UsabilityS-Needs-ReviewX-ContentiousThere are nontrivial implications that should be thought through

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@laundmo@rparrett@Rodhlann@alice-i-cecile

[8]ページ先頭

©2009-2025 Movatter.jp