diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml new file mode 100644 index 00000000..29c819f1 --- /dev/null +++ b/.gitea/workflows/build.yaml @@ -0,0 +1,31 @@ +# Gitea CI on the shared KofTwentyTwo/ci-workflows macOS workflow (grogu). The .github workflows keep +# running on the GitHub mirror (release, notarization, appcast); this one is build only and unsigned. +# +# Guard B the de-paywall marker and the if-false wrap are still in computeState() (docs/PLAN-maintained-fork.md §4.4) +# Guard C no unresolved merge conflict markers in the tree +# build the Release scheme, unsigned (a compile check at macOS 12.0: grogu has only Xcode 27) +# Guard A the Test scheme is compiled (build-for-testing) but not run: the grogu runner has no GUI session for +# testmanagerd. Run scripts/run_tests.sh locally before merging (docs/contributing.md). +name: build +on: + push: + branches: ['**'] +jobs: + macos: + uses: self:KofTwentyTwo/ci-workflows/.gitea/workflows/macos.yaml@v1 + with: + commands: | + F=src/pro/license/LicenseManager.swift + [ -f "$F" ] || { echo "::error::Guard B: $F not found; chokepoint moved? Refresh the de-paywall patch (§6.2)."; exit 1; } + grep -q 'depaywall' "$F" || { echo "::error::PAYWALL RELOCKED: 'depaywall' marker missing from $F (§6.2)."; exit 1; } + grep -Eq 'guard[[:space:]]+false[[:space:]]+else' "$F" || { echo "::error::PAYWALL RELOCKED: 'if false { … }' wrap missing from $F (§6.2)."; exit 1; } + echo "Guard B OK" + if git -c grep.lineNumber=false grep -nE '^(<<<<<<<|=======|>>>>>>>)' -- . ':(exclude)docs/'; then + echo "::error::UNRESOLVED CONFLICT MARKERS present; resolve before merge (§4.4 Guard C)."; exit 1 + fi + echo "Guard C OK" + # grogu has only Xcode 27.2, which rejects the app's 10.13 deployment target (the shipping build is the GitHub + # mirror's, on Xcode 26.0.1). This compile check builds at 12.0 with the same deprecation downgrade as + # config/test-base.xcconfig; every other Swift warning stays an error. + xcodebuild -quiet -project alt-tab-macos.xcodeproj -scheme Release -derivedDataPath DerivedData CODE_SIGN_IDENTITY=- CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO MACOSX_DEPLOYMENT_TARGET=12.0 SWIFT_TREAT_WARNINGS_AS_ERRORS=NO 'OTHER_SWIFT_FLAGS=$(inherited) -warnings-as-errors -Wwarning DeprecatedDeclaration' build + xcodebuild -quiet -project alt-tab-macos.xcodeproj -scheme Test -configuration Release -derivedDataPath DerivedData build-for-testing diff --git a/config/test-base.xcconfig b/config/test-base.xcconfig index 985ae51e..5d24ca7c 100644 --- a/config/test-base.xcconfig +++ b/config/test-base.xcconfig @@ -1,8 +1,11 @@ // docs: https://help.apple.com/xcode/mac/11.4/#/itcaec37c2a6 SWIFT_VERSION = 5.8 -SWIFT_TREAT_WARNINGS_AS_ERRORS = YES -MACOSX_DEPLOYMENT_TARGET = 10.13 +SWIFT_TREAT_WARNINGS_AS_ERRORS = NO // replaced by the explicit flags below so the deprecation group can be downgraded after them +// Raising the unit-test target to 12.0 turns uses of APIs deprecated in macOS 11/12 (kept for the 10.13 app) into warnings; only that +// group is downgraded here (after -warnings-as-errors, which would otherwise win); every other warning stays an error. +OTHER_SWIFT_FLAGS = $(inherited) -warnings-as-errors -Wwarning DeprecatedDeclaration +MACOSX_DEPLOYMENT_TARGET = 12.0 // unit-tests only: Xcode 27 supports 12.0+; the shipping app keeps 10.13 in base.xcconfig CODE_SIGNING_REQUIRED = NO // no need for codesign CODE_SIGNING_ALLOWED = NO // no need for codesign ONLY_ACTIVE_ARCH = YES // only need to run on the host machine diff --git a/docs/contributing.md b/docs/contributing.md index a0c60250..7091128b 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -11,6 +11,12 @@ This project has minimal dependency on Xcode-only features (e.g. InterfaceBuilde * `scripts/codesign/setup_local.sh` to generate a local self-signed certificate, to avoid having to re-check the `System Preferences > Security & Privacy` permissions on every build * Either open `alt-tab-macos.xcodeproj` with Xcode, or use the CLI: `xcodebuild -project alt-tab-macos.xcodeproj -scheme Debug` to build the .app with the `Debug` build configuration +### Tests (run locally before merging) + +The Gitea CI (`.gitea/workflows/build.yaml`) runs Guards B and C (the de-paywall markers and conflict markers), builds the `Release` scheme unsigned and compiles the `Test` scheme (`build-for-testing`), but does not run the tests: its macOS runner has no GUI session, so `xcodebuild test` cannot reach `testmanagerd`. Run them, including the anti-relock tests in `src/pro/license/LicenseManagerTests.swift` (Guard A, `docs/PLAN-maintained-fork.md` §4.4), locally before merging, especially an upstream sync: + +* `scripts/run_tests.sh` (the `Test` scheme, `-configuration Release`) + ## Mac development Mac development ecosystem is pretty terrible in general. They keep piling on the tech stacks on top of each other, so you have C APIs, ObjC APIs, Swift APIs, Interface builder, Playgrounds, Swift UI, Mac Catalyst. All these are bridging with each other with a bunch of macros, SDKs glue, compiler flags, compatibility mode, XCode legacy build system, etc. For alt-tab, we are on Swift 5.0. Note that swift just recently started being stable, but overall any change of version breaks a lot of stuff. Swift itself is the mainstream language with the worst governance I’ve seen in modern times. diff --git a/src/preferences/settings-window/tabs/ExceptionEditorView.swift b/src/preferences/settings-window/tabs/ExceptionEditorView.swift index 953f9c90..63719ad7 100644 --- a/src/preferences/settings-window/tabs/ExceptionEditorView.swift +++ b/src/preferences/settings-window/tabs/ExceptionEditorView.swift @@ -291,7 +291,7 @@ class ExceptionEditorView: NSView { } private func resolveHeaderAsync(for bundleId: String) { - DispatchQueue.global(qos: .userInitiated).async { + DispatchQueue.global(qos: .userInitiated).async { [weak self] in let info = AppDisplayInfo.resolve(bundleId: bundleId) DispatchQueue.main.async { [weak self] in guard let self, self.entry.bundleIdentifier == bundleId else { return } diff --git a/src/preferences/settings-window/tabs/ExceptionsTab.swift b/src/preferences/settings-window/tabs/ExceptionsTab.swift index 99456631..d0a55bf8 100644 --- a/src/preferences/settings-window/tabs/ExceptionsTab.swift +++ b/src/preferences/settings-window/tabs/ExceptionsTab.swift @@ -319,7 +319,7 @@ class ExceptionsTab { // BundleId changed (or first paint): show a synchronous placeholder, then resolve async. row.setIcon(AppDisplayInfo.genericIcon, size: iconSize) row.setContent(bundleId, summary) - DispatchQueue.global(qos: .userInitiated).async { + DispatchQueue.global(qos: .userInitiated).async { [weak row] in let info = AppDisplayInfo.resolve(bundleId: bundleId) DispatchQueue.main.async { [weak row] in guard let row else { return }