Repository navigation
Move the build into a BuildStore and remove BuildModel - #473
Merged
Merged
Conversation
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.
…o an EngineSyncStore (#387)
…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.
…s into a DependencyStore (#387)
…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.
3 of 4 tasks
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).
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.
…o an EngineSyncStore (#387)
…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.
…s into a DependencyStore (#387)
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Part of the agreed plan in #387, so it needs no separate go from
@LNPANDY.What and why
BuildModelwas 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 intoBuildStoreinNXModeland removesBuildModel.BuildStoreis@MainActor, owns its@Publishedstate and checks the conditions for its own actions (canBuild, the checks at the top ofstartBuild). It is split over sixBuildStore+files, because no file may pass 800 lines.RepoLocation,DependencyInstalling(DependencyStatusplus the install the fix buttons run),EngineSyncingandInstallTarget.DependencyStore,EngineSyncStoreandDeviceStoreconform.targetChanged.LauncherStoresin 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 ofBuildModel(repoPath,pythonPath,installDeviceand the rest) and theobjectWillChangeforwarding are gone. Views observe the stores they show.NXCoregot what the store needs:ShellInstall,ShellLibraryandShellInstaller,BuildFailureClassifier,BannerCache,VolumePath,RomFSArchiveandBuildCommands.ShellCLIstays in the app target.ContentView.swiftwent from 2049 to 720 lines. It now only holdsBuilderViewand what belongs to step 8. I did not start step 8.BuildLog.onMainis gone because the store is@MainActor.Checked
cd frontend && swift testthree times in full, green. 865 tests in total (NXModelTests 115, NXCoreTests 113, NX2AppleTests 637 with 17 skipped), 846 before, 19 new inBuildStoreTests.python3 -m unittest discover -s frontend-qt/testspasses.LauncherPerformanceTests"1000 log lines in a build": 0 cards, 105 ms.LibraryTestsrun in the suite, nothing compared by eye.Screenshots
None, no visible change.
Scope
dm/,scripts/,docs/,ref/) is added to the repository