Skip to content

CLI build: do not clean and rebuild the model it just built - #1371

Merged
Frotty merged 1 commit into
masterfrom
cli-skip-redundant-rebuild
Oct 6, 2026
Merged

Frotty merged 1 commit into
masterfrom
cli-skip-redundant-rebuild

Conversation

@Frotty

@Frotty Frotty commented Oct 6, 2026

Copy link
Copy Markdown
Member

Split out of #1353.

Main builds and typechecks the project model for -build, and MapRequest.compileScript then cleaned it and parsed and typechecked the whole project a second time ("it is safer to rebuild the project, instead of taking the current editor state"). That protects the language server from unsaved editor state; the CLI has none. CliBuildMap now skips the clean and rebuild. It still compiles a copy of the model and still typechecks early in Main, so an erroneous project fails exactly as before.

Measured on wurst-castle-fight (Lua, -inline -localOptimizations -runcompiletimefunctions -injectobjects -noExtractMapScript -compiletimeCache, same machine, one build at a time, whole java -jar ... -build wall time):

master this branch
runs (s) 82.4, 82.5, 83.3, 82.3 72.9, 74.7, 77.2, 74.2
mean 82.6 74.8

About 8 s (roughly 10%) per CLI build. The emitted Lua is byte-identical to master's.

Error behaviour: on a project with a code error, the output of -build is identical to master's (Fix errors in your code before building a release. plus the first error, exit code 2).

Not done: a variant that also skipped the model copy (QuickAndDirty) was faster still, but produced different Lua (the compile-time state init was inlined instead of split), so it is not used. A variant that skipped the early typecheck changed which error is reported first. No automated test exercises the CLI build path.

Main builds and typechecks the project model, then compileScript cleaned it and
parsed and typechecked it again, which only makes sense for the language server,
where the model may hold unsaved editor state. The CLI now skips that rebuild and
still compiles a copy of the model.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-06T13:06:58.308882Z 8543c14 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Frotty added a commit to Code-Fixxers/WurstScript that referenced this pull request Oct 6, 2026
… own CLI changes

wurstscript#1371 skips the redundant model rebuild for CLI builds. The PR's earlier CLI
changes (buildProject(false) in Main, QuickAndDirty in CliBuildMap, and the rebuild
without typecheck in compileScript) are dropped: the first skipped the early
typecheck and changed which error is reported first, the second skipped the model
copy and changed the emitted Lua.
@Frotty
Frotty merged commit c8c4f8e into master Oct 6, 2026
3 checks passed
@Frotty
Frotty deleted the cli-skip-redundant-rebuild branch October 6, 2026 14:11
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.

1 participant