@@ -43,6 +43,7 @@ static void XTSwizzleSelectorForFunction(Class cls, SEL sel, IMP newImp)
43
43
method_exchangeImplementations (originalMethod, newMethod);
44
44
}
45
45
46
+ // from IDEFoundation.framework
46
47
@interface IDEActivityLogSection : NSObject
47
48
48
49
// Will be 0 for success, 1 for failure.
@@ -70,6 +71,12 @@ @interface IDEActivityLogSection : NSObject
70
71
@property (readonly ) double timeStoppedRecording;
71
72
@property (readonly ) double timeStartedRecording;
72
73
74
+ // The number of times "warning:" appears in the output.
75
+ @property (readonly ) NSUInteger totalNumberOfWarnings;
76
+
77
+ // The number of times "error:" appears in the output.
78
+ @property (readonly ) NSUInteger totalNumberOfErrors;
79
+
73
80
@end
74
81
75
82
#define kDomainTypeBuildItem @" com.apple.dt.IDE.BuildLogSection"
@@ -170,12 +177,18 @@ static void AnnounceEndSection(IDEActivityLogSection *section)
170
177
PrintJSON (EventDictionaryWithNameAndContent (
171
178
kReporter_Events_EndBuildCommand , @{
172
179
kReporter_EndBuildCommand_TitleKey : section.title ,
173
- kReporter_EndBuildCommand_SucceededKey : (section.resultCode == 0 ) ? @YES : @NO ,
180
+ // Xcode will only consider something a success if resultCode == 0 AND
181
+ // there's no output that contains the string "error: ".
182
+ kReporter_EndBuildCommand_SucceededKey : ((section.resultCode == 0 ) &&
183
+ (section.totalNumberOfErrors == 0 )) ? @YES : @NO ,
174
184
// Sometimes things will fail and 'emittedOutputText' will be nil. We've seen this
175
185
// happen when Xcode's Copy command fails. In this case, just send an empty string
176
186
// so Reporters don't have to worry about this sometimes being [NSNull null].
177
187
kReporter_EndBuildCommand_EmittedOutputTextKey : section.emittedOutputText ?: @" " ,
178
188
kReporter_EndBuildCommand_DurationKey : @(section.timeStoppedRecording - section.timeStartedRecording ),
189
+ kReporter_EndBuildCommand_ResultCode : @(section.resultCode ),
190
+ kReporter_EndBuildCommand_TotalNumberOfWarnings : @(section.totalNumberOfWarnings ),
191
+ kReporter_EndBuildCommand_TotalNumberOfErrors : @(section.totalNumberOfErrors ),
179
192
}));
180
193
} else if ([sectionTypeString hasPrefix: kDomainTypeProductItemPrefix ]) {
181
194
NSString *project = nil ;
0 commit comments