Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

Treat the package's warnings as errors in every build, and refuse a build with any

Țugui Dragoș5bde38fb498c
diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml
index 9f285b40..23d87367 100644
--- a/.github/workflows/checks.yml
+++ b/.github/workflows/checks.yml
@@ -40,8 +40,9 @@ jobs:
exit 1
fi
- # The app's targets treat warnings as errors in the project; the package is held to the same here. The tests
- # write to a file, since a test that writes a line waits for whoever reads it, and the log is read late here.
+ # The app's targets treat warnings as errors in the project, and the package in its manifest, for every build;
+ # the flag here names it on the command line too. The tests write to a file, since a test that writes a line
+ # waits for whoever reads it, and the log is read late here.
- name: Test PeelCore
run: |
log="$RUNNER_TEMP/test.log"
@@ -56,11 +57,22 @@ jobs:
- name: Build Sparkle
run: zsh Scripts/build_sparkle.sh
+ # A build with a warning fails here: the compiler refuses one in Peel's own code, and the log is read for the
+ # rest, such as the linker's.
- name: Build the app
run: |
- xcodebuild -project Peel.xcodeproj -scheme Peel -configuration Debug \
+ log="$RUNNER_TEMP/debug.log"
+ if ! xcodebuild -project Peel.xcodeproj -scheme Peel -configuration Debug \
-destination "platform=macOS,arch=$(uname -m)" -derivedDataPath build/DerivedData \
- CODE_SIGNING_ALLOWED=NO build
+ CODE_SIGNING_ALLOWED=NO build > "$log" 2>&1; then
+ cat "$log"
+ exit 1
+ fi
+ if grep -q "warning:" "$log"; then
+ grep "warning:" "$log"
+ echo "::error::The Debug build has warnings."
+ exit 1
+ fi
# Release builds every binary for Apple silicon, with pointer authentication (arm64e) and without, and for Intel,
# with the optimizer a Debug build leaves off. The settings are given here too, since only the command line
@@ -68,9 +80,18 @@ jobs:
# data unsigned, and the linker then leaves the class data of the whole binary unsigned.
- name: Build the app for release
run: |
- xcodebuild -project Peel.xcodeproj -scheme Peel -configuration Release \
+ log="$RUNNER_TEMP/release.log"
+ if ! xcodebuild -project Peel.xcodeproj -scheme Peel -configuration Release \
-destination 'generic/platform=macOS' -derivedDataPath build/Release CODE_SIGNING_ALLOWED=NO \
- ENABLE_POINTER_AUTHENTICATION=YES MACOSX_DEPLOYMENT_TARGET=26.0 build
+ ENABLE_POINTER_AUTHENTICATION=YES MACOSX_DEPLOYMENT_TARGET=26.0 build > "$log" 2>&1; then
+ cat "$log"
+ exit 1
+ fi
+ if grep -q "warning:" "$log"; then
+ grep "warning:" "$log"
+ echo "::error::The Release build has warnings."
+ exit 1
+ fi
app=build/Release/Build/Products/Release/Peel.app
# Every program and library in the app, found rather than listed, so one added later is checked too.
checked=0
diff --git a/Packages/PeelCore/Package.swift b/Packages/PeelCore/Package.swift
index a628e993..b2012272 100644
--- a/Packages/PeelCore/Package.swift
+++ b/Packages/PeelCore/Package.swift
@@ -8,6 +8,7 @@ let swiftSettings: [SwiftSetting] = [
.enableUpcomingFeature("InferIsolatedConformances"),
.enableUpcomingFeature("NonisolatedNonsendingByDefault"),
.enableUpcomingFeature("ImmutableWeakCaptures"),
+ .treatAllWarnings(as: .error),
]
let package = Package(
diff --git a/Scripts/release.sh b/Scripts/release.sh
index bf83f4a9..083be7b0 100755
--- a/Scripts/release.sh
+++ b/Scripts/release.sh
@@ -69,7 +69,12 @@ then
echo "REFUSED: the archive failed. The whole log is $build/archive.log"
exit 1
fi
-grep -E "warning:|ARCHIVE" "$build/archive.log" || true
+if grep -q "warning:" "$build/archive.log"; then
+ grep "warning:" "$build/archive.log"
+ echo "REFUSED: the archive has warnings. The whole log is $build/archive.log"
+ exit 1
+fi
+grep -E "ARCHIVE" "$build/archive.log" || true
echo "== Exporting with Developer ID"
cat > "$build/ExportOptions.plist" <<'PLIST'
@@ -98,6 +103,11 @@ then
echo "REFUSED: the export failed. The whole log is $build/export.log"
exit 1
fi
+if grep -q "warning:" "$build/export.log"; then
+ grep "warning:" "$build/export.log"
+ echo "REFUSED: the export has warnings. The whole log is $build/export.log"
+ exit 1
+fi
grep -E "EXPORT" "$build/export.log" || true
echo "== What every program is signed with"