Repository navigation
Conversation
56b850a to
1a6226a
Compare
|
@LNPANDY rebased onto current main, CI green. It changes what a build leaves on disk for players: after a successful build the game's build folder is removed (with a setting to keep it), which saves space but means the next build of that game starts from scratch. It can merge after the 48 hours, from 2026-10-31 23:38 UTC, unless you have objections. |
|
Reviewed the diff against current main (df71372). The cleanup itself holds up: it reuses Three things before this merges:
Minor: the protected-path list at No need to re-argue the default: silent multi-GB deletion after a successful build is a product decision and it is declared. Once 1 and 2 are settled I will merge. |
|
Follow-up to the review above: #213 is closed (its useful half moved to #261, and it needed no That leaves points 1 and 3: the |
1a6226a to
504ed69
Compare
|
@LNPANDY thanks, all three points and the minor ones are in 504ed69 (rebased onto current main, Qt table regenerated).
Minor: New tests in BuildCleanupTests: the hint and note strings per language, the shared protected list, and that only |
|
@LNPANDY understood, #213 is closed, so point 2 is handled by dropping the hook: |
5f63c93 to
b755b57
Compare
…s keeps it A player builds a game once and plays it: the app or IPA and the game data hold everything the game needs, and the build folder (about 31 GB next to a 17 GB app for Breath of the Wild) only serves the next build. After a build that succeeded as a whole, including the archive step and an install on a device, the launcher now removes the parts the Free space sheet offers. Settings has Keep build files (off by default) for whoever rebuilds often. Scratch files go either way. A game installed through Xcode keeps its project and derived data for Reinstall and Renew, and Renew now signs with DM_COPY_GAME_RESOURCES=NO so it no longer reads the removed game files and shaders. A failed or stopped build removes nothing. The build page says once that a rebuild without build files starts from nothing, and the log names what was removed and the space freed.
The shared app signs from its own project outside the build folder, so the cleanup no longer keeps xcode/ for Renew, the re-sign parameters and the IPA packing leftovers are gone, and the Keep build files note no longer says a copy installed earlier loses Renew and Reinstall. cleanup.item is the same text in English and German (a format with two values), so GermanLocalizationTests lists it with the other keys that match.
b755b57 to
5fd0957
Compare
Clean up an iPhone or iPad build folder only when the game's framework mirror in the shell folder is complete.
|
@v0lumehi I checked this against main at Could you port the cleanup into the current build flow, carry the strings into |
|
Thank you for the implementation, tests and time you put into this. We have decided against automatic removal of build files. Deleting the cache after a successful build can turn the next small rebuild into a lengthy extraction and shader compilation. We will keep explicit cleanup with an explanation of the space saved and the rebuild cost. This is a product-scope decision, not a judgment on the effort behind the contribution. We are closing it rather than keeping it in a waiting state. |
What and why
A player builds a game once and plays it. The app on the Mac, or the game inside the shared app on the iPhone or iPad, holds everything the game needs. Breath of the Wild's
01007EF00011E000.appis 17 GB, and its build folder01007EF00011E000_buildholds another ~31 GB that only a rebuild uses (extract/14 GB,shader/12 GB,aoc/1.3 GB,tmp/1.1 GB,ipa/1 GB,pso/650 MB). Developers who rebuild often want to keep it: a new host takes minutes with the folder, and without it the game is extracted again and every shader translated again (~25 minutes for BotW's Mac shaders, hours for big iOS builds).keepBuildFiles), off by default. The note under it names the cost both ways: off frees tens of GB and a rebuild takes much longer, on makes rebuilds fast but each game keeps tens of GB.BuildFolder.remove) for every part: extracted game files, shader output, Xcode project and app build, other caches. Old shader versions are inside the shader output, and the script prunes them itself since Remove stale shader library folders after a build and offer them in Free space #231, so nothing here duplicates that.tmp/.DmGame<title ID>.frameworkinto the shell folder (ShellInstall.mirrorFramework,<shell folder>/frameworks/), and that copy is the primary one since The shell's framework mirror is the primary copy, and the installer makes it #406. The cleanup removes the build folder only when this mirror is complete, meaning the framework folder holds its binaryDmGame<title ID>andgame.manifest.json. If the mirror is missing or incomplete, the build folder stays as it is and the log says so in one line. The check isBuildCleanup.mirrorComplete, andBuildCleanup.runmakes it. It does not apply when Keep build files is on, because then no part is removed..appholds everything.extract/andshader/are gone.BuildCleanup.swift. ContentView gets a few lines (the setting, arming the cleanup when the script succeeds, the status line, the Settings row).FreeSpace.removeTreeandBuildModel.saylostprivate.Kept, and why the install flows stay intact
Never touched: the game app, the IPA,
games/<title ID>/(romfs.img,aoc/), the NSPs, the library entry. Also never a part:logs/,profile/,run/,nsp/and the staged inputs.Install on the iPhone copies
games/<title ID>/romfs.imgandaoc/from the output folder, not from the build folder (they are copied there by the archive step before the install), so removingextract/andaoc/in the build folder is safe.Reinstall and Renew work on the shared app, which signs from its own project outside the build folder (
ShellInstall,BuildModel.resignOnDevice). Nothing in the build folder is needed for them, so the cleanup keeps no Xcode folder back. The framework the game built stays inshell-framework/, which no part names.No
gameDataImagehook. Nothing reads the Mac-side game data image after a build, soextract/<v>/RomFS.imgstays a build intermediate that this PR may delete. The hook (Plan.gameDataImage) and its test are removed.The protected paths come from one list now:
BuildFolder.protectedPaths(app:ipa:iosApp:archive:output:titleID:inputs:)(FreeSpace.swift) serves the Free space sheet andarmCleanup, so the installed app and the archive folder with itsromfs.imgare protected in both.tmp.keyandtmp.partialare not inalwaysRemoved: nothing in the build scripts writes them.The Build page hint
msg.workdirHint(under Save to) describes the new behaviour in zh, en, sv, de and fr: the build folder is removed after a successful build unless Keep build files is on, and reuse by pointing back at the same folder only holds with it on.Checked
cd frontend && swift build -c release && swift testpasses (697 tests, 17 skipped, 0 failures). NewBuildCleanupTests(temporary folders only): the setting's default, every part removed with the setting off, the outputs and logs kept, only scratch files removed with the setting on, nothing removed for a failed or stopped build or while the build goes on, the log line, the rebuild note's condition, the strings in zh, en, sv, de and fr without semicolons, the iPhone or iPad folder removed when the mirror is complete (testIPhoneBuildFolderIsRemovedWhenTheMirrorIsComplete), kept when the mirror is missing or has no binary (testIPhoneBuildFolderStaysWhenTheMirrorIsMissing,testIPhoneBuildFolderStaysWhenTheMirrorHasNoBinary), no mirror needed for the Mac app or with the setting on, and the whole flow for an iPhone build (testTheIPhoneBuildFolderGoesOnlyAfterTheMirrorExists).python3 -m unittest discover -s frontend-qt/testspasses.python3 tools/engine.py checkok.NX_LAUNCHER_CAPTURE_DIR=/tmp/build-cleanup swift test --filter BuildCleanupTests. Captures on the author's machine:/tmp/build-cleanup/settings-keep-off.png,settings-keep-on.png,build-rebuild-note-crop.png,build-no-note-crop.png(full pagesbuild-rebuild-note.png,build-no-note.png). The CLI cannot upload them.installShell,packArchive), and the cleanup runs after that. The user's game folders were not touched.Notes
gen_localization.py).cleanup.keptNoMirrortoo) have text in zh, en, sv, de and fr.GermanLocalizationTestsandFrenchLocalizationTestslistcleanup.item(a format of two values, the same in English) with the keys that match on purpose. The Frenchmsg.workdirHintwas still the old text and is updated.shell-framework/, so the cleanup does not delete the framework in the build folder itself. The mirror condition makes sure that a later install never depends on a folder that was cleaned.Scope
dm/,scripts/,docs/,ref/,AGENTS.md) is edited directlyProduct change: waiting 48h before merge.