Check the CloudKit schema when packaging and show broken iCloud sync
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user