Expand description
web [--release] [--<feature>...]: builds the game’s binary
(crate::project::Web) for wasm32-unknown-unknown and packages it
with the web shell into the project’s web.dist folder: the page
(web/index.html, with the game’s title and binary written in), the
vendored JS loaders (web/mq_js_bundle.js, and web/sapp_jsutils.js
with web/quad-storage.js for localStorage) and the engine’s own
plugins (web/gamepad.js for controllers, web/page-files.js for the
files the page hands the game, and the rest). The shell is built into this tool; see
web/README.md, which also says how a game’s binary gets the link
argument these plugins need. Each --<feature> turns on a feature of
the game’s package that web.features lists (a debug build’s tools,
say). The game’s music tracks (.ogg in web.music, not embedded) are
copied beside the page into a folder of the same name, which exists
even when there are none; its voice clips (web.voice, .ogg and
.ron) are copied the same way when there is such a folder.
Every build also writes NOTICES.txt beside the page (notices):
the crates compiled in, the shell’s files (SHELL_NOTICES) and the
game’s own license texts.
A build is made whole in a staging folder beside web.dist, then
replaces everything in web.dist, so nothing of an older build stays
and a failed build leaves the last one as it was. The folder itself
stays, so a server running in it keeps serving. A web.dist that holds
the project, a source of the build or a repository is refused.
Structs§
- Options
- Parsed
webarguments.
Functions§
- copy_
tree - Copies the files under
srcthatkeepaccepts to the same places underdst(made if missing), folders included. Returns how many files were copied. - parse_
args - Parses the arguments after
web:--releaseand a--<feature>for each featureruleslist, each at most once, in any order. The error is the usage line. - run
- Builds and packages the web build, returning a one-line summary on
success.
gameis what the project adds toNOTICES.txt(its own license texts,notices::game_texts); the crates compiled in and the shell’s files are found here. A crate with no license text found is named in a warning. - shell_
works - The shell’s files as works of
NOTICES.txt, in the shell’s order. - target_
dir - The folder cargo builds the project at
rootinto:CARGO_TARGET_DIRwhen it is set (fromroot, if relative), elsetargetbeside the workspace’s manifest, since a project may be one folder of a bigger workspace (cargo locate-project --workspace), elseroot/target. - usage
- The usage line, with
commandas the tool’s name. - workspace_
root - The root of the workspace the project at
rootbuilds in: the folder ofcargo locate-project --workspace’s manifest, elseroot.