PulseCanvas / app · pulsecanvas.ai / scripts / xcode_zipfoundation.py
| 1 | from collections.abc import Callable |
| 2 | from typing import Any |
| 3 | |
| 4 | |
| 5 | def add_zipfoundation(objects: dict[str, Any], obj: Callable[..., str], target: str, project: str) -> None: |
| 6 | package = obj('zipfoundation-package', 'XCRemoteSwiftPackageReference', |
| 7 | repositoryURL='https://github.com/weichsel/ZIPFoundation.git', |
| 8 | requirement={'kind': 'exactVersion', 'version': '0.9.20'}) |
| 9 | product = obj('zipfoundation-product', 'XCSwiftPackageProductDependency', package=package, productName='ZIPFoundation') |
| 10 | framework = obj('zipfoundation-framework', 'PBXBuildFile', productRef=product) |
| 11 | objects[target].setdefault('packageProductDependencies', []).append(product) |
| 12 | objects[project].setdefault('packageReferences', []).append(package) |
| 13 | phase = next(objects[key] for key in objects[target]['buildPhases'] |
| 14 | if objects[key]['isa'] == 'PBXFrameworksBuildPhase') |
| 15 | phase['files'].append(framework) |