Skip to content

Commit d1e519f

Browse files
authored
Merge pull request #2542 from hartbit/workspace-migration-fix
[SR-12101] Support migration of old dependencies-state.json
2 parents e1d3918 + dee0a42 commit d1e519f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Sources/Workspace/WorkspaceState.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,15 @@ public final class WorkspaceState: SimplePersistanceProtocol {
259259
}
260260

261261
public func restore(from json: JSON) throws {
262+
try restore(from: json, supportedSchemaVersion: WorkspaceState.schemaVersion)
263+
}
264+
265+
public func restore(from json: JSON, supportedSchemaVersion: Int) throws {
262266
dependencies = try ManagedDependencies(json: json.get("dependencies"))
263-
artifacts = try ManagedArtifacts(json: json.get("artifacts"))
267+
268+
if supportedSchemaVersion >= 4 {
269+
artifacts = try ManagedArtifacts(json: json.get("artifacts"))
270+
}
264271
}
265272

266273
public func toJSON() -> JSON {

0 commit comments

Comments
 (0)