Cross-platform Xcode replacement. Build and deploy iOS apps with SwiftPM on Linux, Windows, macOS.
More migration
Kabir Oberai68cb7bd46415
diff --git a/Sources/Supersign/DeveloperServices/App Groups/DeveloperServicesAssignAppGroupRequest.swift b/Sources/Supersign/DeveloperServices/App Groups/DeveloperServicesAssignAppGroupRequest.swiftindex c41370e..713afdb 100644--- a/Sources/Supersign/DeveloperServices/App Groups/DeveloperServicesAssignAppGroupRequest.swift+++ b/Sources/Supersign/DeveloperServices/App Groups/DeveloperServicesAssignAppGroupRequest.swift@@ -15,14 +15,14 @@ public final class DeveloperServicesAssignAppGroupRequest: DeveloperServicesPlatpublic let platform: DeveloperServicesPlatformpublic let teamID: DeveloperServicesTeam.ID- public let appIDID: DeveloperServicesAppID.ID+ public let appIDID: Stringpublic let groupID: DeveloperServicesAppGroup.IDvar subAction: String { return "assignApplicationGroupToAppId" }var subParameters: [String: Any] {return ["teamId": teamID.rawValue,- "appIdId": appIDID.rawValue,+ "appIdId": appIDID,"applicationGroups": groupID.rawValue]}@@ -30,7 +30,7 @@ public final class DeveloperServicesAssignAppGroupRequest: DeveloperServicesPlatpublic init(platform: DeveloperServicesPlatform,teamID: DeveloperServicesTeam.ID,- appIDID: DeveloperServicesAppID.ID,+ appIDID: String,groupID: DeveloperServicesAppGroup.ID) {self.platform = platformdiff --git a/Sources/Supersign/DeveloperServices/App Groups/DeveloperServicesAssignAppGroupsOperation.swift b/Sources/Supersign/DeveloperServices/App Groups/DeveloperServicesAssignAppGroupsOperation.swiftindex d52bcc8..274ec67 100644--- a/Sources/Supersign/DeveloperServices/App Groups/DeveloperServicesAssignAppGroupsOperation.swift+++ b/Sources/Supersign/DeveloperServices/App Groups/DeveloperServicesAssignAppGroupsOperation.swift@@ -7,13 +7,18 @@//import Foundation+import DeveloperAPIpublic struct DeveloperServicesAssignAppGroupsOperation: DeveloperServicesOperation {public let context: SigningContextpublic let groupIDs: [DeveloperServicesAppGroup.GroupID]- public let appID: DeveloperServicesAppID- public init(context: SigningContext, groupIDs: [DeveloperServicesAppGroup.GroupID], appID: DeveloperServicesAppID) {+ public let appID: Components.Schemas.BundleId+ public init(+ context: SigningContext,+ groupIDs: [DeveloperServicesAppGroup.GroupID],+ appID: Components.Schemas.BundleId+ ) {self.context = contextself.groupIDs = groupIDsself.appID = appID@@ -21,8 +26,7 @@ public struct DeveloperServicesAssignAppGroupsOperation: DeveloperServicesOperatprivate func upsertAppGroup(_ groupID: DeveloperServicesAppGroup.GroupID,- existingGroups: [String: DeveloperServicesAppGroup],- appID: DeveloperServicesAppID+ existingGroups: [String: DeveloperServicesAppGroup]) async throws -> DeveloperServicesAppGroup.GroupID {let sanitized = ProvisioningIdentifiers.sanitize(groupID: groupID)let group: DeveloperServicesAppGroup@@ -37,9 +41,14 @@ public struct DeveloperServicesAssignAppGroupsOperation: DeveloperServicesOperatgroup = try await context.client.send(request)}- _ = try await context.client.send(DeveloperServicesAssignAppGroupRequest(- platform: context.platform, teamID: context.teamID, appIDID: appID.id, groupID: group.id- ))+ _ = try await context.client.send(+ DeveloperServicesAssignAppGroupRequest(+ platform: context.platform,+ teamID: context.teamID,+ appIDID: appID.id,+ groupID: group.id+ )+ )return group.groupID}@@ -53,7 +62,7 @@ public struct DeveloperServicesAssignAppGroupsOperation: DeveloperServicesOperatreturn try await withThrowingTaskGroup(of: DeveloperServicesAppGroup.GroupID.self) { group infor groupID in groupIDs {group.addTask {- try await upsertAppGroup(groupID, existingGroups: dict, appID: appID)+ try await upsertAppGroup(groupID, existingGroups: dict)}}return try await group.reduce(into: []) { $0.append($1) }diff --git a/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesAddAppOperation.swift b/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesAddAppOperation.swiftindex d180434..55d088c 100644--- a/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesAddAppOperation.swift+++ b/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesAddAppOperation.swift@@ -52,10 +52,10 @@ public struct DeveloperServicesAddAppOperation: DeveloperServicesOperation {entitlements: Entitlements,isFreeTeam: Bool,appIDs: [String: Components.Schemas.BundleId]- ) async throws -> DeveloperServicesAppID {- let appIDID: String- if let appID = appIDs[bundleID] {- appIDID = appID.id+ ) async throws -> Components.Schemas.BundleId {+ let appID: Components.Schemas.BundleId+ if let existing = appIDs[bundleID] {+ appID = existing} else {let newBundleID = ProvisioningIdentifiers.identifier(fromSanitized: bundleID, context: self.context)let name = ProvisioningIdentifiers.appName(fromSanitized: bundleID)@@ -73,18 +73,20 @@ public struct DeveloperServicesAddAppOperation: DeveloperServicesOperation {)))- appIDID = try createResponse.created.body.json.data.id+ appID = try createResponse.created.body.json.data}let request = DeveloperServicesUpdateAppIDRequest(platform: self.context.platform,teamID: self.context.teamID,- appIDID: .init(rawValue: appIDID),+ appIDID: appID.id,entitlements: entitlements,additionalFeatures: [],isFree: isFreeTeam)- return try await context.client.send(request)+ _ = try await context.client.send(request)++ return appID}/// Registers the app and creates a profile. Returns the resultant entitlements as well as@@ -122,8 +124,12 @@ public struct DeveloperServicesAddAppOperation: DeveloperServicesOperation {}let appID = try await upsertApp(bundleID: bundleID, entitlements: entitlements, isFreeTeam: isFreeTeam, appIDs: appIDs)+ let newBundleID = appID.attributes!.identifier!- try entitlements.update(teamID: self.context.teamID, bundleID: appID.bundleID)+ try entitlements.update(+ teamID: self.context.teamID,+ bundleID: newBundleID+ )// set get-task-allow to YES, required for dev certstry entitlements.updateEntitlements { ents inif let getTaskAllow = ents.firstIndex(where: { $0 is GetTaskAllowEntitlement }) {@@ -148,9 +154,15 @@ public struct DeveloperServicesAddAppOperation: DeveloperServicesOperation {try entitlements.setEntitlements(entitlementsArray)}- let mobileprovision = try await DeveloperServicesFetchProfileOperation(context: self.context, bundleID: appID.bundleID).perform()+ let mobileprovision = try await DeveloperServicesFetchProfileOperation(+ context: self.context,+ bundleID: newBundleID+ ).perform()+return ProvisioningInfo(- newBundleID: appID.bundleID, entitlements: entitlements, mobileprovision: mobileprovision+ newBundleID: newBundleID,+ entitlements: entitlements,+ mobileprovision: mobileprovision)}diff --git a/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesAppID.swift b/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesAppID.swiftdeleted file mode 100644index 05de452..0000000--- a/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesAppID.swift+++ /dev/null@@ -1,47 +0,0 @@-//-// DeveloperServiceAppID.swift-// Supercharge-//-// Created by Kabir Oberai on 29/07/19.-// Copyright © 2019 Kabir Oberai. All rights reserved.-//--import Foundation-import ProtoCodable--public struct DeveloperServicesAppID: Decodable, Sendable {- public struct ID: RawRepresentable, Decodable, Sendable {- public let rawValue: String- public init(rawValue: String) { self.rawValue = rawValue }- }-- public let id: ID- public let name: String- public let platform: DeveloperServicesPlatform- public let bundleID: String- public let isWildCard: Bool-- private let _features: DeveloperServicesFeatures- public var features: [DeveloperServicesFeature] { return _features.values }-- private let _enabledFeatures: [String]?- public var enabledFeatures: [DeveloperServicesFeature.Type] {- guard let enabledFeatures = _enabledFeatures else { return [] }- return enabledFeatures.compactMap { identifier in- let type = ProtoCodableIdentifierMapper.shared.type(- for: identifier, in: DeveloperServicesFeatureContainer.self- )- return type as? DeveloperServicesFeature.Type- }- }-- private enum CodingKeys: String, CodingKey {- case id = "appIdId"- case name- case platform = "appIdPlatform"- case bundleID = "identifier"- case isWildCard- case _features = "features"- case _enabledFeatures = "enabledFeatures"- }-}diff --git a/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesAppIDRequestApplier.swift b/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesAppIDRequestApplier.swiftdeleted file mode 100644index 651fe79..0000000--- a/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesAppIDRequestApplier.swift+++ /dev/null@@ -1,33 +0,0 @@-//-// DeveloperServicesAppIDRequestApplier.swift-// Supersign-//-// Created by Kabir Oberai on 11/10/19.-// Copyright © 2019 Kabir Oberai. All rights reserved.-//--import Foundation--enum DeveloperServicesAppIDRequestApplier {-- static func apply(- entitlements: Entitlements, additionalFeatures: [DeveloperServicesFeature],- to dict: inout [String: Any], isFree: Bool- ) {- var entitlements = entitlements- try? entitlements.updateEntitlements {- $0.removeAll {- let type = Swift.type(of: $0)- return !type.canList || (isFree && !type.isFree)- }- }- dict["entitlements"] = try? entitlements.plistValue()-- let entFeatures = (try? entitlements.entitlements().compactMap { $0.feature() }) ?? []- let allFeatures = entFeatures + additionalFeatures- guard let features = try? DeveloperServicesFeatures(values: allFeatures).plistValue() as? [String: Any]- else { return }- dict.merge(features) { a, _ in a }- }--}diff --git a/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesUpdateAppIDRequest.swift b/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesUpdateAppIDRequest.swiftindex acfdb1f..bc22ac1 100644--- a/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesUpdateAppIDRequest.swift+++ b/Sources/Supersign/DeveloperServices/App IDs/DeveloperServicesUpdateAppIDRequest.swift@@ -10,14 +10,11 @@ import Foundationpublic struct DeveloperServicesUpdateAppIDRequest: DeveloperServicesPlatformRequest {- public struct Response: Decodable, Sendable {- let appId: DeveloperServicesAppID- }- public typealias Value = DeveloperServicesAppID+ public typealias Value = EmptyResponsepublic let platform: DeveloperServicesPlatformpublic let teamID: DeveloperServicesTeam.ID- public let appIDID: DeveloperServicesAppID.ID+ public let appIDID: Stringpublic let entitlements: Entitlementspublic let additionalFeatures: [DeveloperServicesFeature]public let isFree: Bool@@ -26,27 +23,31 @@ public struct DeveloperServicesUpdateAppIDRequest: DeveloperServicesPlatformRequvar subParameters: [String: Any] {var parameters: [String: Any] = ["teamId": teamID.rawValue,- "appIdId": appIDID.rawValue+ "appIdId": appIDID]- DeveloperServicesAppIDRequestApplier.apply(- entitlements: entitlements,- additionalFeatures: additionalFeatures,- to: ¶meters,- isFree: isFree- )+ var entitlements = entitlements+ try? entitlements.updateEntitlements {+ $0.removeAll {+ let type = Swift.type(of: $0)+ return !type.canList || (isFree && !type.isFree)+ }+ }+ parameters["entitlements"] = try? entitlements.plistValue()++ let entFeatures = (try? entitlements.entitlements().compactMap { $0.feature() }) ?? []+ let allFeatures = entFeatures + additionalFeatures+ if let features = try? DeveloperServicesFeatures(values: allFeatures).plistValue() as? [String: Any] {+ parameters.merge(features) { a, _ in a }+ }return parameters}- public func parse(_ response: Response) -> DeveloperServicesAppID {- response.appId- }-public init(platform: DeveloperServicesPlatform,teamID: DeveloperServicesTeam.ID,- appIDID: DeveloperServicesAppID.ID,+ appIDID: String,entitlements: Entitlements,additionalFeatures: [DeveloperServicesFeature],isFree: Bool