@@ -4,12 +4,6 @@ set -euo pipefail
44SQLITE_PACKAGE=" .build/checkouts/SQLite.swift/Package.swift"
55PHONE_NUMBER_BUNDLE=" .build/checkouts/PhoneNumberKit/PhoneNumberKit/Bundle+Resources.swift"
66
7- if [[ ! -f " $SQLITE_PACKAGE " ]]; then
8- exit 0
9- fi
10-
11- chmod u+w " $SQLITE_PACKAGE " || true
12-
137# Try python3, then python, then fail
148if command -v python3 > /dev/null 2>&1 ; then
159 PYTHON_BIN=" python3"
2014 exit 1
2115fi
2216
23- $PYTHON_BIN - << 'PY '
17+ if [[ -f " $SQLITE_PACKAGE " ]]; then
18+ chmod u+w " $SQLITE_PACKAGE " || true
19+ $PYTHON_BIN - << 'PY '
20+ import sys
2421from pathlib import Path
2522path = Path('.build/checkouts/SQLite.swift/Package.swift')
2623text = path.read_text()
2724if 'PrivacyInfo.xcprivacy' in text:
2825 raise SystemExit(0)
2926needle = 'exclude: [\n "Info.plist"\n ]'
3027replacement = 'exclude: [\n "Info.plist",\n "PrivacyInfo.xcprivacy"\n ]'
31- if needle in text:
32- text = text.replace(needle, replacement)
33- path.write_text(text)
28+ if needle not in text:
29+ print(f"Error: SQLite.swift Package.swift no longer contains the expected resource exclude block: {path}", file=sys.stderr)
30+ raise SystemExit(1)
31+ path.write_text(text.replace(needle, replacement))
3432PY
33+ fi
3534
3635if [[ -f " $PHONE_NUMBER_BUNDLE " ]]; then
3736 chmod u+w " $PHONE_NUMBER_BUNDLE " || true
3837 $PYTHON_BIN - << 'PY '
38+ import sys
3939from pathlib import Path
4040
4141path = Path(".build/checkouts/PhoneNumberKit/PhoneNumberKit/Bundle+Resources.swift")
@@ -45,12 +45,18 @@ updated = False
4545if "#if DEBUG && SWIFT_PACKAGE" in text:
4646 text = text.replace("#if DEBUG && SWIFT_PACKAGE", "#if SWIFT_PACKAGE")
4747 updated = True
48+ elif "#if SWIFT_PACKAGE" not in text:
49+ print(f"Error: PhoneNumberKit bundle guard no longer matches expected Swift package condition: {path}", file=sys.stderr)
50+ raise SystemExit(1)
4851
4952needle = "Bundle.main.bundleURL,\n"
5053insert = "Bundle.main.bundleURL,\n Bundle.main.bundleURL.resolvingSymlinksInPath(),\n"
5154if "resolvingSymlinksInPath()" not in text and needle in text:
5255 text = text.replace(needle, insert)
5356 updated = True
57+ elif "resolvingSymlinksInPath()" not in text:
58+ print(f"Error: PhoneNumberKit bundle URL list no longer contains the expected insertion point: {path}", file=sys.stderr)
59+ raise SystemExit(1)
5460
5561if updated:
5662 path.write_text(text)
0 commit comments