Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.
Swift cache-cleanercleanerclideveloper-toolsdisk-cleanupdisk-spaceduplicate-finderhomebrewliquid-glassmac-cleanermacosmacos-appmacos-golden-gatemacos-tahoemacos-tweaksswiftswiftuiterminal-themesuninstalluninstaller
Carry the test host in Debug builds alone
Țugui Dragoșcfa3bf85001e
diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.ymlindex 65dea5f4..82701050 100644--- a/.github/workflows/checks.yml+++ b/.github/workflows/checks.yml@@ -157,6 +157,10 @@ jobs:if [ -n "$(find "$app/Contents/Frameworks/Sparkle.framework" -name '*.xpc')" ]; thenecho "::error::Sparkle.framework carries XPC services."; exit 1fi+ # The host the PeelTests scheme runs the hosted tests in is a Debug build's alone.+ if strings "$app/Contents/MacOS/Peel" | grep -q PEEL_HOSTS_TESTS; then+ echo "::error::The Release build carries the test host."; exit 1+ fi# The accessibility audit drives the pointer, so it runs by hand before a release. Here it is only built.- name: Build the accessibility auditdiff --git a/ARCHITECTURE.md b/ARCHITECTURE.mdindex fc637a1c..35f291e0 100644--- a/ARCHITECTURE.md+++ b/ARCHITECTURE.md@@ -554,8 +554,9 @@ its place (`SettingsView`), whose zap takes Peel's whole folder, `Terminal/` incown state.- `PeelTests` holds the tests of the app's own models, run inside Peel, which the scheme launches with`PEEL_HOSTS_TESTS` set: Peel then starts none of its work, opens no window, and shows no menu bar item, so the tests- drive the models alone and leave the Mac's own Peel as it was. `xcodebuild test -project Peel.xcodeproj -scheme- PeelTests -destination "platform=macOS,arch=$(uname -m)" -derivedDataPath build/DerivedData` runs them.+ drive the models alone and leave the Mac's own Peel as it was. Only a Debug build answers that variable; a release+ carries nothing of the host. `xcodebuild test -project Peel.xcodeproj -scheme PeelTests -destination+ "platform=macOS,arch=$(uname -m)" -derivedDataPath build/DerivedData` runs them.- Scanners take their slow parts as parameters (how to measure a folder, how to run a tool), so a test canstand in for a folder that never answers or a tool that fails.- The `Attack*Tests` files try to get past the safety rules on purpose: another case, a link, a `/.vol` path, adiff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex a902a69d..8360d4ce 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -36,8 +36,8 @@ xcodebuild -project Peel.xcodeproj -scheme Peel -configuration Debug -destinatioswift test --package-path Packages/PeelCore -Xswiftc -warnings-as-errors```-The app's own models are tested inside Peel, which the PeelTests scheme launches with `PEEL_HOSTS_TESTS` set, so that-it starts nothing and shows nothing:+The app's own models are tested inside Peel, which the PeelTests scheme launches with `PEEL_HOSTS_TESTS` set, which+only a Debug build answers, so that it starts nothing and shows nothing:```bashxcodebuild -project Peel.xcodeproj -scheme PeelTests -configuration Debug \diff --git a/Peel/Launch.swift b/Peel/Launch.swiftindex c6cdeb21..574bac20 100644--- a/Peel/Launch.swift+++ b/Peel/Launch.swift@@ -1,18 +1,22 @@import AppKitimport SwiftUI-/// Where Peel starts: Peel itself, or, for the PeelTests scheme, a host that only runs the tests.+/// Where Peel starts: Peel itself, or, for the PeelTests scheme, a host that only runs the tests, which only a+/// Debug build carries.@mainenum Launch {static func main() {+ #if DEBUGif PeelApp.isHostingTests {TestHost.main()- } else {- PeelApp.main()+ return}+ #endif+ PeelApp.main()}}+#if DEBUG/// The app the tests of Peel's models run in. It builds none of Peel's scenes, so nothing of Peel's starts or shows,/// and AppKit records nothing under Peel's name, such as whether its menu bar item is hidden.struct TestHost: App {@@ -33,3 +37,4 @@ final class TestHostDelegate: NSObject, NSApplicationDelegate {false}}+#endifdiff --git a/Peel/PeelApp.swift b/Peel/PeelApp.swiftindex e7c53f02..963047db 100644--- a/Peel/PeelApp.swift+++ b/Peel/PeelApp.swift@@ -20,8 +20,10 @@ final class PeelAppDelegate: NSObject, NSApplicationDelegate {}struct PeelApp: App {+ #if DEBUG/// Set by the PeelTests scheme for the Peel that hosts the tests, which then runs `TestHost` in Peel's place.static let isHostingTests = ProcessInfo.processInfo.environment["PEEL_HOSTS_TESTS"] != nil+ #endif@NSApplicationDelegateAdaptor(PeelAppDelegate.self) private var delegatestatic let mainWindowID = "main"