File tree Expand file tree Collapse file tree 2 files changed +27
-27
lines changed Expand file tree Collapse file tree 2 files changed +27
-27
lines changed Original file line number Diff line number Diff line change @@ -848,6 +848,33 @@ public protocol PackageConditionProtocol: Codable {
848
848
func satisfies( _ environment: BuildEnvironment ) -> Bool
849
849
}
850
850
851
+ /// Wrapper for package condition so it can be conformed to Codable.
852
+ struct PackageConditionWrapper : Codable {
853
+ var platform : PlatformsCondition ?
854
+ var config : ConfigurationCondition ?
855
+
856
+ var condition : PackageConditionProtocol {
857
+ if let platform = platform {
858
+ return platform
859
+ } else if let config = config {
860
+ return config
861
+ } else {
862
+ fatalError ( " unreachable " )
863
+ }
864
+ }
865
+
866
+ init ( _ condition: PackageConditionProtocol ) {
867
+ switch condition {
868
+ case let platform as PlatformsCondition :
869
+ self . platform = platform
870
+ case let config as ConfigurationCondition :
871
+ self . config = config
872
+ default :
873
+ fatalError ( " unknown condition \( condition) " )
874
+ }
875
+ }
876
+ }
877
+
851
878
/// Platforms condition implies that an assignment is valid on these platforms.
852
879
public struct PlatformsCondition : PackageConditionProtocol {
853
880
public let platforms : [ Platform ]
Original file line number Diff line number Diff line change @@ -156,33 +156,6 @@ extension TargetDescription.Dependency: Codable {
156
156
}
157
157
}
158
158
159
- /// Wrapper for package condition so it can be conformed to Codable.
160
- struct PackageConditionWrapper : Codable {
161
- var platform : PlatformsCondition ?
162
- var config : ConfigurationCondition ?
163
-
164
- var condition : PackageConditionProtocol {
165
- if let platform = platform {
166
- return platform
167
- } else if let config = config {
168
- return config
169
- } else {
170
- fatalError ( " unreachable " )
171
- }
172
- }
173
-
174
- init ( _ condition: PackageConditionProtocol ) {
175
- switch condition {
176
- case let platform as PlatformsCondition :
177
- self . platform = platform
178
- case let config as ConfigurationCondition :
179
- self . config = config
180
- default :
181
- fatalError ( " unknown condition \( condition) " )
182
- }
183
- }
184
- }
185
-
186
159
extension BinaryTarget . ArtifactSource : Codable {
187
160
private enum CodingKeys : String , CodingKey {
188
161
case remote, local
You can’t perform that action at this time.
0 commit comments