PulseCanvas / app · pulsecanvas.ai / scripts / verify-mobile-artifact.py
| 1 | #!/usr/bin/env python3 |
| 2 | """Check the actual native-only iOS app bundle against this checkout.""" |
| 3 | import hashlib |
| 4 | import json |
| 5 | from pathlib import Path |
| 6 | import plistlib |
| 7 | import subprocess |
| 8 | import sys |
| 9 | |
| 10 | app = Path(sys.argv[1]).resolve() |
| 11 | info = plistlib.loads((app / 'Info.plist').read_bytes()) |
| 12 | assert set(info['UIDeviceFamily']) == {1, 2}, 'Both iPhone and iPad must be supported' |
| 13 | assert info['MinimumOSVersion'] == '18.0' |
| 14 | assert info.get('UIBackgroundModes') == ['audio'], 'Background playback mode is missing or overbroad' |
| 15 | root = app / 'NativeAssets' |
| 16 | catalog = json.loads((root / 'NativeVisualizers.json').read_text()) |
| 17 | expected = json.loads(subprocess.check_output([sys.executable, 'scripts/native-visualizer-catalog.py'], text=True)) |
| 18 | assert catalog == expected, 'Native catalog does not match source' |
| 19 | for name, digest in catalog['shaders'].items(): |
| 20 | assert hashlib.sha256((root / name).read_bytes()).hexdigest() == digest, name |
| 21 | assert hashlib.sha256((root / 'Audio/PulseCanvas.mp3').read_bytes()).digest() == hashlib.sha256(Path('Sources/PulseCanvas/Resources/Audio/PulseCanvas.mp3').read_bytes()).digest() |
| 22 | assert (app / 'Legal/PulseCanvas-LICENSE.txt').read_bytes() == Path('LICENSE').read_bytes() |
| 23 | assert (app / 'PrivacyInfo.xcprivacy').read_bytes() == Path('macOS/PrivacyInfo.xcprivacy').read_bytes() |
| 24 | assert not list(app.rglob('*.milk')) |
| 25 | assert not any('sparkle' in p.name.lower() or 'projectm' in p.name.lower() for p in app.rglob('*')) |
| 26 | binary = app / info['CFBundleExecutable'] |
| 27 | release_bytes = binary.read_bytes() |
| 28 | assert all(marker not in release_bytes for marker in (b'PCMobileQA', b'PCMobileRadioQA')), 'Debug fixture leaked into Release' |
| 29 | linked = subprocess.check_output(['otool', '-L', str(binary)], text=True) |
| 30 | assert 'OpenGL' not in linked and 'projectM' not in linked |
| 31 | print(json.dumps({'app': str(app), 'version': info['CFBundleShortVersionString'], 'build': info['CFBundleVersion'], |
| 32 | 'deviceFamilies': info['UIDeviceFamily'], 'activeEffects': catalog['activeCount'], 'resourcesMatchSource': True, |
| 33 | 'externalEffectsAbsent': True, 'debugFixtureAbsent': True, 'signing': 'not assessed'}, indent=2)) |