MobileNativeFoundation / XCLogParser

Tool to parse Xcode and xcodebuild logs stored in the xcactivitylog format
Apache License 2.0
1.73k stars 121 forks source link

HTML Report Fails to parse build errors #113

Closed danielroach350 closed 3 years ago

danielroach350 commented 3 years ago

Swift/Xcode Version

swift 5, Xcode 12.0

Problem

Hi, I discovered a possible issue when there are no SubSteps as part of the failure.

The scenario: attempting to archive a build where the provisioning profile is incorrect or not found. This generates a failure before build compilation of any build steps have been performed. The result is a failure in the root log activities. After doing some local testing I found that the activity logs parse the errors and are stored in the root/main document model. The issue presents its self when attempting to writeTargetFiles without any subSteps being performed yet.

an empty array of errors has been written to file but the error count has been updated in the UI so that's great but you cannot see any of the errors generated.

I added these lines here to correct it but feels off to me.

        if let buildErrors = build.errors, buildErrors.count > 0 {
           stepsWithErrors.append(build)
        }
        if let buildWarnings = build.warnings, buildWarnings.count > 0 {
            stepsWithWarnings.append(build)
        }

Report before:

Screen Shot 2020-12-03 at 2 06 30 PM

After:

Screen Shot 2020-12-03 at 2 09 39 PM

I have not done any extensive testing and would really like to get some input on this. Thanks!

ecamacho commented 3 years ago

@danielroach350 Thank you for reporting it. I modified your solution a bit to append the build with no substeps. For cases in which we have errors at the build root level and inside some substeps. Can you check it works for your case? https://github.com/spotify/XCLogParser/pull/115

danielroach350 commented 3 years ago

Thanks @ecamacho pushing it out to CI for testing.

danielroach350 commented 3 years ago

@ecamacho that looks to have done the trick! Thanks