Check the CloudKit schema when packaging and show broken iCloud sync

This commit is contained in:
Ian Gulliver
2026-10-20 08:55:37 -07:00
parent e7724977c8
commit 8f3226350e
14 changed files with 502 additions and 288 deletions
+16
View File
@@ -5,6 +5,22 @@ sparkle_version=2.10.0
sparkle=$HOME/Library/Caches/byre/sparkle-$sparkle_version
identity="Developer ID Application"
fields=$(mktemp -d)
team=$(security cms -D -i "$mac/byre.provisionprofile" | plutil -extract TeamIdentifier.0 raw -o - -)
xcrun cktool export-schema --team-id "$team" --container-id iCloud.run.fc.byre.mac --environment production --output-file "$fields/schema"
awk '$1 == "RECORD" && $2 == "TYPE" { type = $3; next } type != "" && $1 ~ /^CD_/ { print type "." $1 } /\);/ { type = "" }' "$fields/schema" |
sort > "$fields/production"
awk '/^@Model/ { model = 1; next } model && /^final class/ { type = $3; next } model && /^ var / { print "CD_" type ".CD_" $2 } /^}/ { model = 0 }' "$mac/Sources/Byre/Persistence.swift" |
sort > "$fields/models"
missing=$(comm -23 "$fields/models" "$fields/production")
rm -rf "$fields"
if [ -n "$missing" ]; then
echo "CloudKit's Production schema lacks these SwiftData fields, so iCloud would reject them:" >&2
echo "$missing" >&2
echo "Add them to Development and deploy them (docs/operations.md, \"Storage\")." >&2
exit 1
fi
if [ ! -x "$sparkle/bin/sign_update" ]; then
mkdir -p "$sparkle"
curl -fsSL "https://github.com/sparkle-project/Sparkle/releases/download/$sparkle_version/Sparkle-$sparkle_version.tar.xz" | tar -xJ -C "$sparkle"