Skip to content

Commit 5d3c4b0

Browse files
giginetclaude
andcommitted
docs: document Xcode 26.4 attachment and BuildOperationMetrics changes
Update Xcactivitylog Format doc with SLF version history table, IDEActivityLogSectionAttachment section, and BuildOperationMetrics format change in Xcode 26.4. Update JSON Format doc with Attachments section covering BuildOperationTaskMetrics, BuildOperationMetrics (both old and Xcode 26.4+ formats), and BuildOperationTaskBacktrace. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: giginet <giginet.net@gmail.com>
1 parent cb38a21 commit 5d3c4b0

File tree

2 files changed

+116
-1
lines changed

2 files changed

+116
-1
lines changed

docs/JSON Format.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,87 @@ Other fields:
7676
- `compilationEndTimestamp`: Timestamp in which the actual compilation finished. For a Target this could be before `endTimestamp` because in the new Xcode Build System linking can happen way after compilation.
7777
- `compilationDuration` Actual duration in seconds of just the compilation phase. In a Target this could be significant shorter than the `duration`.
7878

79+
## Attachments (Xcode 15.3+)
80+
81+
When using the `dump` command, each `IDEActivityLogSection` may include an `attachments` array. This was introduced in SLF version 11 (Xcode 15.3). Each attachment has an `identifier`, `majorVersion`, `minorVersion`, and one of the following typed payloads:
82+
83+
### BuildOperationTaskMetrics
84+
85+
Per-task execution metrics:
86+
87+
```json
88+
{
89+
"identifier": "com.apple.dt.ActivityLogSectionAttachment.TaskMetrics",
90+
"majorVersion": 1,
91+
"minorVersion": 0,
92+
"metrics": {
93+
"utime": 1834,
94+
"stime": 1723,
95+
"maxRSS": 3391488,
96+
"wcStartTime": 793866997013418,
97+
"wcDuration": 141479
98+
}
99+
}
100+
```
101+
102+
### BuildOperationMetrics
103+
104+
Aggregate build operation metrics. The JSON format differs by Xcode version:
105+
106+
**Xcode 15.3 - Xcode 16.x:**
107+
```json
108+
{
109+
"identifier": "com.apple.dt.ActivityLogSectionAttachment.BuildOperationMetrics",
110+
"majorVersion": 1,
111+
"minorVersion": 0,
112+
"buildOperationMetrics": {
113+
"clangCacheHits": 0,
114+
"clangCacheMisses": 2,
115+
"swiftCacheHits": 0,
116+
"swiftCacheMisses": 8
117+
}
118+
}
119+
```
120+
121+
**Xcode 26.4+:**
122+
```json
123+
{
124+
"identifier": "com.apple.dt.ActivityLogSectionAttachment.BuildOperationMetrics",
125+
"majorVersion": 1,
126+
"minorVersion": 0,
127+
"buildOperationMetrics": {
128+
"counters": {},
129+
"taskCounters": {
130+
"SwiftDriver": {
131+
"moduleDependenciesNotValidatedTasks": 1
132+
}
133+
}
134+
}
135+
}
136+
```
137+
138+
All fields in `buildOperationMetrics` are optional to support both formats.
139+
140+
### BuildOperationTaskBacktrace
141+
142+
Backtrace frames explaining why a build task was executed:
143+
144+
```json
145+
{
146+
"identifier": "com.apple.dt.ActivityLogSectionAttachment.TaskBacktrace",
147+
"majorVersion": 1,
148+
"minorVersion": 0,
149+
"backtrace": [
150+
{
151+
"description": "'Planning Swift module Foo' had never run",
152+
"category": { "ruleNeverBuilt": {} }
153+
}
154+
]
155+
}
156+
```
157+
158+
## Detail step types
159+
79160
When possible, the `signature` content of `detail` steps is parsed to determine its type. This makes it easier to aggregate the data.
80161

81162
Value | Description

docs/Xcactivitylog Format.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,15 @@ You can get these tokens:
136136
[type: "string", value: "Prepare build"],
137137
```
138138

139-
The first integer is the version of the `SLF` format used. In Xcode 10.x and 11 Beta, the version is 10. The values after the version are the actual content of the log.
139+
The first integer is the version of the `SLF` format used. The values after the version are the actual content of the log.
140+
141+
### SLF version history
142+
143+
Version | Xcode Version | Changes
144+
--- | --- | ---
145+
10 | Xcode 10.x - 14.x | Initial format
146+
11 | Xcode 15.3+ | Added `IDEFoundation.IDEActivityLogSectionAttachment` list to `IDEActivityLogSection`
147+
12 | Xcode 26.2+ | Added an unknown integer field before `subtitle` in `IDEActivityLogSection`
140148

141149
## Parsing an xcactivitylog
142150

@@ -156,3 +164,29 @@ Inside the logs you can find these classes:
156164
If you search for them, you will find that they belong to the IDEFoundation.framework. A private framework part of Xcode. You can class dump it to get the headers of those classes. Once you have the headers, you will have the name and type of the properties that belong to the class. Now, you can match them to the tokens you got from the log. Some of them are in the same order than in the headers, but for others it will be about trial and error.
157165

158166
In the project you can find those classes with their properties in the order in which they appear in the log in the file [IDEActivityModel.swift](../Sources/XCLogParser/activityparser/IDEActivityModel.swift).
167+
168+
## IDEActivityLogSectionAttachment (SLF version 11+)
169+
170+
Starting with SLF version 11 (Xcode 15.3), each `IDEActivityLogSection` includes an array of `IDEFoundation.IDEActivityLogSectionAttachment` entries after the `xcbuildSignature` field. Each attachment has an `identifier` string, a `majorVersion` integer, a `minorVersion` integer, and a JSON payload. The identifier determines the type of the JSON payload:
171+
172+
Identifier | JSON Type | Description
173+
--- | --- | ---
174+
`...TaskMetrics` | `BuildOperationTaskMetrics` | Per-task timing metrics (`utime`, `stime`, `maxRSS`, `wcStartTime`, `wcDuration`)
175+
`...TaskBacktrace` | `BuildOperationTaskBacktrace` | Backtrace frames explaining why a task was run
176+
`...BuildOperationMetrics` | `BuildOperationMetrics` | Aggregate build operation metrics (see below)
177+
178+
### BuildOperationMetrics format changes
179+
180+
In **Xcode 15.3 - Xcode 16.x**, the `BuildOperationMetrics` JSON contains compiler cache statistics:
181+
182+
```json
183+
{"clangCacheHits":0,"clangCacheMisses":2,"swiftCacheHits":0,"swiftCacheMisses":8}
184+
```
185+
186+
Starting with **Xcode 26.4**, the format changed to a dynamic counter-based structure:
187+
188+
```json
189+
{"counters":{},"taskCounters":{"SwiftDriver":{"moduleDependenciesNotValidatedTasks":1}}}
190+
```
191+
192+
XCLogParser supports both formats. All fields are optional to maintain backward compatibility.

0 commit comments

Comments
 (0)