Merge infoPath instead of overwriting
- Commit
88886e9ae42a25c7d607d28bb163916a9812774d- Author
- Kabir Oberai <[email protected]>
- When
- 2025-05-05 11:21 UTC (1 year ago)
- Parents
fc01305
Diff
Sources/PackLib/Planner.swift
diff --git a/Sources/PackLib/Planner.swift b/Sources/PackLib/Planner.swiftindex 4aeb431..90dac15 100644--- a/Sources/PackLib/Planner.swift+++ b/Sources/PackLib/Planner.swift@@ -109,39 +109,38 @@ public struct Planner: Sendable { let bundleID = schema.idSpecifier.formBundleID(product: library.name) - let infoPlist: [String: Sendable]+ var infoPlist: [String: Sendable] = [+ "CFBundleInfoDictionaryVersion": "6.0",+ "UIRequiredDeviceCapabilities": ["arm64"],+ "LSRequiresIPhoneOS": true,+ "CFBundleSupportedPlatforms": ["iPhoneOS"],+ "CFBundlePackageType": "APPL",+ "UIDeviceFamily": [1, 2],+ "CFBundleDevelopmentRegion": "en",+ "UISupportedInterfaceOrientations": ["UIInterfaceOrientationPortrait"],+ "UISupportedInterfaceOrientations~ipad": [+ "UIInterfaceOrientationPortrait",+ "UIInterfaceOrientationPortraitUpsideDown",+ "UIInterfaceOrientationLandscapeLeft",+ "UIInterfaceOrientationLandscapeRight"+ ],+ "UILaunchScreen": [:] as [String: Sendable],+ "CFBundleVersion": "1",+ "CFBundleShortVersionString": "1.0.0",+ "MinimumOSVersion": deploymentTarget,+ "CFBundleIdentifier": bundleID,+ "CFBundleName": "\(library.name)",+ "CFBundleExecutable": "\(library.name)",+ ]+ if let plist = self.schema.base.infoPath { let data = try await Data(reading: URL(fileURLWithPath: plist)) let info = try PropertyListSerialization.propertyList(from: data, format: nil) if let info = info as? [String: Sendable] {- infoPlist = info+ infoPlist.merge(info, uniquingKeysWith: { $1 }) } else { throw StringError("Info.plist has invalid format: expected a dictionary.") }- } else {- infoPlist = [- "CFBundleInfoDictionaryVersion": "6.0",- "UIRequiredDeviceCapabilities": ["arm64"],- "LSRequiresIPhoneOS": true,- "CFBundleSupportedPlatforms": ["iPhoneOS"],- "CFBundlePackageType": "APPL",- "UIDeviceFamily": [1, 2],- "CFBundleDevelopmentRegion": "en",- "UISupportedInterfaceOrientations": ["UIInterfaceOrientationPortrait"],- "UISupportedInterfaceOrientations~ipad": [- "UIInterfaceOrientationPortrait",- "UIInterfaceOrientationPortraitUpsideDown",- "UIInterfaceOrientationLandscapeLeft",- "UIInterfaceOrientationLandscapeRight"- ],- "UILaunchScreen": [:] as [String: Sendable],- "CFBundleVersion": "1",- "CFBundleShortVersionString": "1.0.0",- "MinimumOSVersion": deploymentTarget,- "CFBundleIdentifier": bundleID,- "CFBundleName": "\(library.name)",- "CFBundleExecutable": "\(library.name)",- ] } return Plan(