Skip to content

Launcher: update the build tools when the app opens - #60

Merged
LNPANDY merged 1 commit into
LNPANDY:mainfrom
v0lumehi:repo-auto-pull
Oct 27, 2026
Merged

LNPANDY merged 1 commit into
LNPANDY:mainfrom
v0lumehi:repo-auto-pull

Conversation

@v0lumehi

Copy link
Copy Markdown
Collaborator

The launcher builds from its own repository checkout, and that checkout stays where it was until someone presses Pull. Builds from an old checkout use tools that main has already fixed. Mine was 208 commits behind: its spirv-cross still had no x bit (#41), so an iPhone build stopped right away with spirv-cross is missing or not executable.

Change

On launch. The launcher already runs a silent check when the app opens (git fetch, then count the commits behind origin/main). When the checkout is behind, it now fast-forwards it (git pull --ff-only origin main), but only when all of these hold:

  • the checkout is on main;
  • no tracked files have changes;
  • no build is running.

So a checkout someone is working in is never touched. A pull that would overwrite an untracked file fails as a fast-forward and reports it.

Settings. A switch, Update automatically when the app opens, on by default. The status line under the build tools says what happened, or why nothing did ("the checkout has local changes or is not on main").

Library. For the rest of the session, the activity line names the new commits: "Build tools updated: 208 new commits".

Checked

  • swift test: 26 tests pass.
  • New RepoAutoUpdateTests, with a local bare repository as origin:
    • a clean checkout on main fast-forwards;
    • a checkout with a local change stays as it is;
    • only main without tracked changes may be moved.

Note: with #59 open, this would also have pulled main's current patch_nso.py NameError. That is a reason to merge #59 first, not a reason against updating.

The repository checkout the launcher builds with stays where it was
until someone presses Pull, so a checkout days behind builds with tools
main had already fixed: it was 208 commits behind and its spirv-cross
had no x bit (fixed by LNPANDY#41), so an iPhone build stopped at once.

When the app opens, the check it already ran (fetch, count the commits
behind origin/main) now fast-forwards the checkout when it is behind:
only on main, with no changes to tracked files and no build running, so
a checkout someone works in is never touched (a pull that would
overwrite an untracked file fails as a fast-forward and says so).
Settings has a switch for it (on by default) and says what happened or
why not; the library's activity line names the new commits for the
session ("Build tools updated: 208 new commits").

RepoAutoUpdateTests uses a local bare repository as origin: a clean
checkout on main is fast-forwarded, one with a local change is left as
it is, and only main without tracked changes may be moved.
@LNPANDY
LNPANDY merged commit 79a8b19 into LNPANDY:main Oct 27, 2026
6 checks passed
LNPANDY added a commit that referenced this pull request Oct 27, 2026
The update machinery was already here — checkAppUpdate finds the newest release, performAppUpdate
downloads it, swaps the bundle and relaunches — but the only signal was a status line naming a
tag. A user whose app worked had no way to judge whether the new version mattered, so "Update to
v0.4.8" was a leap of faith, and most people took the leap only when something broke.

Now a found update opens a sheet: the version they have, the one on offer, the release notes for
their interface language, Open the release page, Later, and Update now. It opens from the launch
check and from Check for updates, so an old install learns what changed without visiting GitHub.

The notes are the release body, which this project writes in both languages
(docs/RELEASE-NOTES-GUIDE.md). UpdateSheet.lines splits them by the `**中文**` / `**English**`
markers rather than by looking for Han characters — the first version did the latter and handed an
English reader the Chinese paragraph, because that line contains both. A body with no markers is
shown whole instead of being split in half.

Six tests cover the split, including the two cases that failed on the first attempt (a monolingual
body, and inline **bold** inside a marked paragraph). Checked against the real v0.4.7 body: 19 lines
each way, aligned.

appVersion 0.4.7 → 0.4.8: today's merges (#28, #48, #54–#57, #59, #60 and the #52/#53 fixes) were
shipping under a version number that also names the 0.4.7 release, so a bug report could not say
which one it came from.
v0lumehi added a commit to v0lumehi/NX2Apple that referenced this pull request Oct 27, 2026
…build (LNPANDY#65)

A game built last month keeps running on the host, rewriter and shaders
of last month, whatever the checkout has fixed since: the automatic pull
(LNPANDY#60) brings the fixes into the repository, not into the games already
built. Nothing in the library said which games a pull had left behind
(idea from seedds/nxnative#209).

A finished build now records the checkout's commit in its library entry
(toolsCommit, taken when the build starts; only for a git checkout, and
decoded with decodeIfPresent, so older library files load). When the
checkout has moved on, ToolsAge runs `git diff --name-only <commit> HEAD`
off the main thread and marks a game when a file a build reads changed:
dm/host, dm/gfx, dm/tools, dm/ios, dm/mac, dm/third_party, the build
script, game.py, profile_guess.py, the launch settings, and the game's
own profile (dm/games/<title ID>/), without notes (*.md) and tests. One
diff per recorded commit; it runs when the app opens, after a clone,
pull or update check finished (the automatic pull among them), when
the checkout changes and after a build was recorded, not on a render.
A game with no recorded commit, or a commit the checkout does not have,
shows nothing.

A marked game's card says "Older tools" beside its status, the hero
"Built with older tools" with a Rebuild button, and Manage's Build again
reads "Rebuild with current tools…"; both open the game's build as
Build again does.

Checked: swift build -c release; swift test, 54 tests (OlderToolsTests
uses a local git repository: a change under dm/host marks the game, a
docs-only change does not, a game without a recorded commit is not
marked, another game's profile does not count, an unknown commit marks
nothing, the check publishes off the main thread, and an old library
file loads); the visual QA renders library-older-tools at 1440 and 900
points wide.
@v0lumehi
v0lumehi deleted the repo-auto-pull branch November 1, 2026 05:10
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.

2 participants