Support entitlements with XcodePacker (#88)
- Commit
693e60faef9f7f02bd92ef267612800655c61593- Author
- Kabir Oberai <[email protected]>
- When
- 2025-05-23 20:58 UTC (1 year ago)
- Parents
6df7e40
Diff
Sources/PackLib/Planner.swift
diff --git a/Sources/PackLib/Planner.swift b/Sources/PackLib/Planner.swiftindex ccfdb59..ae87063 100644--- a/Sources/PackLib/Planner.swift+++ b/Sources/PackLib/Planner.swift@@ -153,7 +153,8 @@ public struct Planner: Sendable { bundleID: bundleID, infoPlist: infoPlist, resources: resources,- iconPath: self.schema.base.iconPath+ iconPath: self.schema.base.iconPath,+ entitlementsPath: self.schema.base.entitlementsPath ) } @@ -217,6 +218,7 @@ public struct Plan: Sendable { public var infoPlist: [String: any Sendable] public var resources: [Resource] public var iconPath: String?+ public var entitlementsPath: String? } public enum Resource: Codable, Sendable {
Sources/PackLib/XcodePacker.swift
diff --git a/Sources/PackLib/XcodePacker.swift b/Sources/PackLib/XcodePacker.swiftindex 1a56d28..80bb1b5 100644--- a/Sources/PackLib/XcodePacker.swift+++ b/Sources/PackLib/XcodePacker.swift@@ -42,6 +42,15 @@ public struct XcodePacker { throw StringError("Could not parse deployment target '\(plan.deploymentTarget)'") } + var buildSettings: [String: Any] = [+ "PRODUCT_BUNDLE_IDENTIFIER": plan.bundleID,+ "TARGETED_DEVICE_FAMILY": families.map { "\($0)" }.joined(separator: ","),+ ]++ if let entitlementsPath = plan.entitlementsPath {+ buildSettings["CODE_SIGN_ENTITLEMENTS"] = fromProjectToRoot + Path(entitlementsPath)+ }+ let project = Project( name: plan.product, targets: [@@ -50,10 +59,7 @@ public struct XcodePacker { type: .application, platform: .iOS, deploymentTarget: deploymentTarget,- settings: Settings(buildSettings: [- "PRODUCT_BUNDLE_IDENTIFIER": plan.bundleID,- "TARGETED_DEVICE_FAMILY": families.map { "\($0)" }.joined(separator: ","),- ]),+ settings: Settings(buildSettings: buildSettings), sources: [ TargetSource(path: (fromProjectToRoot + emptyFile).string), ],
Sources/XToolSupport/DevCommand.swift
diff --git a/Sources/XToolSupport/DevCommand.swift b/Sources/XToolSupport/DevCommand.swiftindex f5e4cf5..4a8c685 100644--- a/Sources/XToolSupport/DevCommand.swift+++ b/Sources/XToolSupport/DevCommand.swift@@ -64,7 +64,7 @@ struct PackOperation { ) let bundle = try await packer.pack() - if let entitlementsPath = schema.base.entitlementsPath {+ if let entitlementsPath = plan.entitlementsPath { let data = try await Data(reading: URL(fileURLWithPath: entitlementsPath)) let decoder = PropertyListDecoder() let entitlements = try decoder.decode(Entitlements.self, from: data)