Skip to content

Commit cc5e9f7

Browse files
giginetclaude
andcommitted
fix: support Xcode 26.4 BuildOperationMetrics JSON format change
Xcode 26.4 changed the BuildOperationMetrics JSON format from `{"clangCacheHits":0,"clangCacheMisses":2,"swiftCacheHits":0,"swiftCacheMisses":8}` to `{"counters":{},"taskCounters":{"SwiftDriver":{...}}}`. Make existing cache fields optional and add new `counters` and `taskCounters` fields to support both old and new formats. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: giginet <giginet.net@gmail.com>
1 parent 5c5b5bd commit cc5e9f7

1 file changed

Lines changed: 17 additions & 8 deletions

File tree

Sources/XCLogParser/activityparser/IDEActivityModel.swift

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -774,21 +774,30 @@ public class IDEActivityLogSectionAttachment: Encodable {
774774
}
775775

776776
public struct BuildOperationMetrics: Codable {
777-
public let clangCacheHits: Int
778-
public let clangCacheMisses: Int
779-
public let swiftCacheHits: Int
780-
public let swiftCacheMisses: Int
777+
// Xcode 15.3 - Xcode 16.x format
778+
public let clangCacheHits: Int?
779+
public let clangCacheMisses: Int?
780+
public let swiftCacheHits: Int?
781+
public let swiftCacheMisses: Int?
782+
783+
// Xcode 26.4+ format
784+
public let counters: [String: Int]?
785+
public let taskCounters: [String: [String: Int]]?
781786

782787
public init(
783-
clangCacheHits: Int,
784-
clangCacheMisses: Int,
785-
swiftCacheHits: Int,
786-
swiftCacheMisses: Int
788+
clangCacheHits: Int? = nil,
789+
clangCacheMisses: Int? = nil,
790+
swiftCacheHits: Int? = nil,
791+
swiftCacheMisses: Int? = nil,
792+
counters: [String: Int]? = nil,
793+
taskCounters: [String: [String: Int]]? = nil
787794
) {
788795
self.clangCacheHits = clangCacheHits
789796
self.clangCacheMisses = clangCacheMisses
790797
self.swiftCacheHits = swiftCacheHits
791798
self.swiftCacheMisses = swiftCacheMisses
799+
self.counters = counters
800+
self.taskCounters = taskCounters
792801
}
793802
}
794803
}

0 commit comments

Comments
 (0)