Skip to content

Move the build into a BuildStore and remove BuildModel - #473

Merged
v0lumehi merged 45 commits into
v0lumehi/device-storefrom
v0lumehi/build-store
Nov 2, 2026
Merged

v0lumehi merged 45 commits into
v0lumehi/device-storefrom
v0lumehi/build-store

Conversation

@v0lumehi

@v0lumehi v0lumehi commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #471 (stack #459), retarget to main after the ones below merge.

Part of #387, step 7 (build). This is the last store of step 7.

Fix or feature

  • Fix
  • Feature

Part of the agreed plan in #387, so it needs no separate go from @LNPANDY.

What and why

BuildModel was the last big object in the app target. It held the build inputs, the target, the stages, the run, the archive step, the install hand-off, the failure and "Build anyway". This PR moves all of it into BuildStore in NXModel and removes BuildModel.

  • BuildStore is @MainActor, owns its @Published state and checks the conditions for its own actions (canBuild, the checks at the top of startBuild). It is split over six BuildStore+ files, because no file may pass 800 lines.
  • It reads the other stores through narrow protocols: RepoLocation, DependencyInstalling (DependencyStatus plus the install the fix buttons run), EngineSyncing and InstallTarget. DependencyStore, EngineSyncStore and DeviceStore conform.
  • AppKit reaches it as closures: the open, folder and save panels, the shader chain notice, the Finder and targetChanged.
  • LauncherStores in the app target creates the services and the stores, connects them and hands them to the views. It holds no logic and no state. The forwarders of BuildModel (repoPath, pythonPath, installDevice and the rest) and the objectWillChange forwarding are gone. Views observe the stores they show.
  • NXCore got what the store needs: ShellInstall, ShellLibrary and ShellInstaller, BuildFailureClassifier, BannerCache, VolumePath, RomFSArchive and BuildCommands. ShellCLI stays in the app target.
  • ContentView.swift went from 2049 to 720 lines. It now only holds BuilderView and what belongs to step 8. I did not start step 8.
  • BuildLog.onMain is gone because the store is @MainActor.
  • The Qt test that compares the failure table reads the classifier at its new place.

Checked

  • Tests: cd frontend && swift test three times in full, green. 865 tests in total (NXModelTests 115, NXCoreTests 113, NX2AppleTests 637 with 17 skipped), 846 before, 19 new in BuildStoreTests. python3 -m unittest discover -s frontend-qt/tests passes.
  • LauncherPerformanceTests "1000 log lines in a build": 0 cards, 105 ms.
  • Visual QA: the captures of LibraryTests run in the suite, nothing compared by eye.
  • Run on a device or Mac: not run. No app was launched and no real build was started.

Screenshots

None, no visible change.

Scope

  • No engine file (dm/, scripts/, docs/, ref/) is added to the repository
  • No keys, game files or data extracted from a game in the change or the attachments

TitleID, GameInputs, BuildProgress and Toolchain (with Dep, Stage and StepState) are
value types and static functions in NXCore now. NXCoreTests tests them without SwiftUI.
ProcessRunner is the place that starts a process: capture, stream and start (with a process group). ProcessGroups moves the group tracking out of BuildModel. GitCheckout holds clone, fetch, pull, behind count, the automatic pull and the adoption of a ZIP copy, GitRules the pure decisions. BuildModel takes both in its initializer. Toolchain, Diagnostics, OlderTools, Uninstall and the update staging take a runner or a checkout as a parameter.
…387)

AppUpdateStore (NXModel) owns the release check, the staged update, the update sheet, the uninstall plan and appVersion. It is @mainactor, gets a ProcessRunner and a ReleaseSource through init, and has tests with fakes for both, without SwiftUI.

Release parsing, the version compare and the staging of a download move into AppUpdate (NXCore). ReleaseSource is the second service, Uninstall moves to NXCore, and the quarantine flag is cleared through the runner.

appVersion moves with the store to NXModel/AppUpdateStore.swift. build-mac-app.yml, sync-upstream.yml, tools/try-local, its test and RELEASING.md read it there, and tools/tests/test_app_version.py fails when a reader names a file without the line. ARCHITECTURE.md describes the store pattern.
RepoStore (NXModel) owns the repository path, its status line, the update check, the pull, the automatic update and the adoption of a ZIP copy. RepoLayout and the file-system part of EngineLayout move to NXCore. Settings, the library's activity line and the launcher observe the store. RepoLocation is the narrow protocol for other stores.
…6 compiles it (#387)

The closure expects Void and the single expression returned a Task. Xcode 27.2 accepts it, the Xcode of the build job reports conflicting arguments to generic parameter T.
…a DeviceStore (#387)

DeviceStore (NXModel) owns the paired devices, the signing teams, the chosen device and team and the copy flow of the shared app. DeviceTools, AppSignature, DeviceControl and ShellInstaller start their tools through ProcessRunner, which got a timeout, an input and one primitive, streamLines. xcrunPath and volumesRoot are injected through BuildModel.init. Behavior does not change.
BuildStore (NXModel) owns the build inputs, the target, the stages, the run, the archive step, the install hand-off, the failure and Build anyway. It reads the other stores through narrow protocols and gets AppKit as closures. LauncherStores wires the stores in the app target. The shared app install, the failure classifier and the archive helpers moved to NXCore.
@v0lumehi v0lumehi added this to the v1.0.2 milestone Nov 2, 2026
@v0lumehi v0lumehi added enhancement New feature or request launcher The NX2Apple launcher app mac Mac labels Nov 2, 2026
@github-actions github-actions Bot added documentation Improvements or additions to documentation windows Windows (the Qt front end) labels Nov 2, 2026
@v0lumehi
v0lumehi added this pull request to stack #459 November 2, 2026 02:17
Port of #493 (ShellRoot.swift, a BuildModel extension) into the stores: shellCachePath, shellRootParent, shellRoot and shellRootProblem() now live in BuildStore+ShellRoot.swift, the preflight is called in BuildStore+Run.swift before the long steps. ShellLibrary and ShellInstall changes of #493 applied to NXCore/ShellInstall.swift (package access). ContentView.swift keeps this branch's version (BuildModel is gone).
@github-actions github-actions Bot added the ci Workflows and repository tooling label Nov 2, 2026
RepoStore (NXModel) owns the repository path, its status line, the update check, the pull, the automatic update and the adoption of a ZIP copy. RepoLayout and the file-system part of EngineLayout move to NXCore. Settings, the library's activity line and the launcher observe the store. RepoLocation is the narrow protocol for other stores.
…6 compiles it (#387)

The closure expects Void and the single expression returned a Task. Xcode 27.2 accepts it, the Xcode of the build job reports conflicting arguments to generic parameter T.
…a DeviceStore (#387)

DeviceStore (NXModel) owns the paired devices, the signing teams, the chosen device and team and the copy flow of the shared app. DeviceTools, AppSignature, DeviceControl and ShellInstaller start their tools through ProcessRunner, which got a timeout, an input and one primitive, streamLines. xcrunPath and volumesRoot are injected through BuildModel.init. Behavior does not change.
# Conflicts:
#	frontend/Tests/NX2AppleTests/BuildNotificationsTests.swift
#	frontend/Tests/NX2AppleTests/FrameTimesTests.swift
#	frontend/Tests/NX2AppleTests/KeyCheckTests.swift
#	frontend/Tests/NX2AppleTests/LauncherPerformanceTests.swift
#	frontend/Tests/NX2AppleTests/LibraryTests.swift
#	frontend/Tests/NX2AppleTests/ReleaseNotesTests.swift
@v0lumehi
v0lumehi merged commit d9ae970 into main Nov 2, 2026
14 checks passed
@v0lumehi
v0lumehi deleted the v0lumehi/build-store branch November 2, 2026 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Workflows and repository tooling documentation Improvements or additions to documentation enhancement New feature or request launcher The NX2Apple launcher app mac Mac windows Windows (the Qt front end)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant