1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift open source project
//
// Copyright (c) 2025 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
public import SWBUtil
public struct ProvisioningSourceData: Serializable, Sendable {
public let configurationName: String
public let provisioningStyle: ProvisioningStyle
public let bundleIdentifierFromInfoPlist: String
public init(configurationName: String, provisioningStyle: ProvisioningStyle, bundleIdentifierFromInfoPlist: String) {
self.configurationName = configurationName
self.provisioningStyle = provisioningStyle
self.bundleIdentifierFromInfoPlist = bundleIdentifierFromInfoPlist
}
}
extension ProvisioningSourceData: Encodable, Decodable {
enum CodingKeys: String, CodingKey {
case configurationName
case provisioningStyle
case bundleIdentifierFromInfoPlist
}
public init(from decoder: any Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
guard let provisioningStyle = try ProvisioningStyle(rawValue: container.decode(ProvisioningStyle.RawValue.self, forKey: .provisioningStyle)) else {
throw DecodingError.dataCorruptedError(forKey: .provisioningStyle, in: container, debugDescription: "invalid provisioning style")
}
self.init(configurationName: try container.decode(String.self, forKey: .configurationName), provisioningStyle: provisioningStyle, bundleIdentifierFromInfoPlist: try container.decode(String.self, forKey: .bundleIdentifierFromInfoPlist))
}
}
// MARK: SerializableCodable
extension ProvisioningSourceData: PendingSerializableCodable {
public func legacySerialize<T: Serializer>(to serializer: T) {
serializer.serializeAggregate(3) {
serializer.serialize(configurationName)
serializer.serialize(provisioningStyle)
serializer.serialize(bundleIdentifierFromInfoPlist)
}
}
public init(fromLegacy deserializer: any Deserializer) throws {
let count = try deserializer.beginAggregate(3...5)
self.configurationName = try deserializer.deserialize()
self.provisioningStyle = try deserializer.deserialize()
if count > 3 {
_ = try deserializer.deserialize() as Bool // appIDHasFeaturesEnabled
}
if count > 4 {
_ = try deserializer.deserialize() as String // legacyTeamID
}
self.bundleIdentifierFromInfoPlist = try deserializer.deserialize()
}
}
|