File tree 4 files changed +17
-5
lines changed
swift-tools-support-core/Sources/TSCUtility
4 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,8 @@ public final class Package: Codable {
55
55
}
56
56
57
57
/// The targets contained in the package.
58
- public let targets : [ Target ]
58
+ @PolymorphicCodableArray
59
+ public var targets : [ Target ]
59
60
60
61
/// The products produced by the package.
61
62
public let products : [ Product ]
@@ -80,7 +81,7 @@ public final class Package: Codable {
80
81
) {
81
82
self . manifest = manifest
82
83
self . path = path
83
- self . targets = targets
84
+ self . _targets = . init ( wrappedValue : targets)
84
85
self . products = products
85
86
self . targetSearchPath = targetSearchPath
86
87
self . testTargetSearchPath = testTargetSearchPath
Original file line number Diff line number Diff line change 9
9
*/
10
10
11
11
import TSCBasic
12
+ import TSCUtility
12
13
13
14
/// The type of product.
14
15
public enum ProductType : CustomStringConvertible , Equatable {
@@ -66,7 +67,8 @@ public class Product: Codable {
66
67
///
67
68
/// This is never empty, and is only the targets which are required to be in
68
69
/// the product, but not necessarily their transitive dependencies.
69
- public let targets : [ Target ]
70
+ @PolymorphicCodableArray
71
+ public var targets : [ Target ]
70
72
71
73
/// The path to linux main file.
72
74
public let linuxMain : AbsolutePath ?
@@ -85,7 +87,7 @@ public class Product: Codable {
85
87
}
86
88
self . name = name
87
89
self . type = type
88
- self . targets = targets
90
+ self . _targets = . init ( wrappedValue : targets)
89
91
self . linuxMain = linuxMain
90
92
}
91
93
}
Original file line number Diff line number Diff line change 9
9
*/
10
10
11
11
import TSCBasic
12
+ import TSCUtility
13
+
14
+ public class Target : ObjectIdentifierProtocol , PolymorphicCodableProtocol {
15
+ public static var implementations : [ PolymorphicCodableProtocol . Type ] = [
16
+ SwiftTarget . self,
17
+ ClangTarget . self,
18
+ SystemLibraryTarget . self,
19
+ BinaryTarget . self,
20
+ ]
12
21
13
- public class Target : ObjectIdentifierProtocol , Codable {
14
22
/// The target kind.
15
23
public enum Kind : String , Codable {
16
24
case executable
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ add_library(TSCUtility
25
25
OSLog.swift
26
26
PkgConfig.swift
27
27
Platform.swift
28
+ PolymorphicCodable.swift
28
29
ProgressAnimation.swift
29
30
SimplePersistence.swift
30
31
StringExtensions.swift
You can’t perform that action at this time.
0 commit comments