@@ -30,8 +30,8 @@ import enum SwiftBuild.ProjectModel
30
30
/// incrementally updated by clients when something changes.
31
31
public enum PIF {
32
32
/// This is used as part of the signature for the high-level PIF objects, to ensure that changes to the PIF schema
33
- /// are represented by the objects which do not use a content-based signature scheme (workspaces and projects,
34
- /// currently).
33
+ /// are represented by the objects which do not use a content-based signature scheme
34
+ /// (workspaces and projects, currently).
35
35
static let schemaVersion = 11
36
36
37
37
/// The type used for identifying PIF objects.
@@ -103,13 +103,13 @@ public enum PIF {
103
103
}
104
104
105
105
public func encode( to encoder: Encoder ) throws {
106
- var container = encoder. container ( keyedBy: CodingKeys . self)
107
- try container . encode ( type, forKey: . type)
106
+ var superContainer = encoder. container ( keyedBy: CodingKeys . self)
107
+ try superContainer . encode ( type, forKey: . type)
108
108
}
109
109
110
110
required public init ( from decoder: Decoder ) throws {
111
- let container = try decoder. container ( keyedBy: CodingKeys . self)
112
- self . type = try container . decode ( String . self, forKey: . type)
111
+ let superContainer = try decoder. container ( keyedBy: CodingKeys . self)
112
+ self . type = try superContainer . decode ( String . self, forKey: . type)
113
113
114
114
guard self . type == Self . type else {
115
115
throw InternalError ( " Expected same type for high-level object: \( self . type) " )
@@ -148,7 +148,7 @@ public enum PIF {
148
148
var superContainer = encoder. container ( keyedBy: HighLevelObject . CodingKeys. self)
149
149
var contents = superContainer. nestedContainer ( keyedBy: CodingKeys . self, forKey: . contents)
150
150
151
- try contents. encode ( " \( guid) @ \( schemaVersion ) " , forKey: . guid)
151
+ try contents. encode ( " \( guid) " , forKey: . guid)
152
152
try contents. encode ( name, forKey: . name)
153
153
try contents. encode ( path, forKey: . path)
154
154
try contents. encode ( projects. map ( \. signature) , forKey: . projects)
@@ -165,8 +165,7 @@ public enum PIF {
165
165
let superContainer = try decoder. container ( keyedBy: HighLevelObject . CodingKeys. self)
166
166
let contents = try superContainer. nestedContainer ( keyedBy: CodingKeys . self, forKey: . contents)
167
167
168
- let guidString = try contents. decode ( GUID . self, forKey: . guid)
169
- self . guid = String ( guidString. dropLast ( " \( schemaVersion) " . count + 1 ) )
168
+ self . guid = try contents. decode ( GUID . self, forKey: . guid)
170
169
self . name = try contents. decode ( String . self, forKey: . name)
171
170
self . path = try contents. decode ( AbsolutePath . self, forKey: . path)
172
171
self . projects = try contents. decode ( [ Project ] . self, forKey: . projects)
@@ -247,6 +246,7 @@ public enum PIF {
247
246
}
248
247
249
248
public required init ( from decoder: Decoder ) throws {
249
+ // FIXME: Remove all support for decoding PIF objects in SwiftBuildSupport? rdar://149003797
250
250
fatalError ( " Decoding not implemented " )
251
251
/*
252
252
let superContainer = try decoder.container(keyedBy: HighLevelObject.CodingKeys.self)
0 commit comments