MobileNativeFoundation / XCLogParser

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

Swift Type check and functions build times not generated #190

Open stherold opened 1 year ago

stherold commented 1 year ago

Hey there 👋

I don't get any compilation time statistics in teh HTML file. According to this post the Swift compiler flags the generated website suggests don't exist anymore:

Screenshot 2023-10-24 at 18 05 39

david-bandlab commented 1 year ago

Same here 🙋‍♂️

Bobbyphtr commented 1 year ago

Same here

BalestraPatrick commented 1 year ago

Have you tried the new flags suggested at the link to see if they work? If they do, then we welcome a contribution to change the wording and references to those now removed flags.

hoangatuan commented 8 months ago

@stherold What is the xcodebuild command you was using?

stherold commented 8 months ago

@hoangatuan that one:

xcodebuild -workspace <ws-name>.xcworkspace -scheme <scheme> -resultBundlePath "$(mktemp).xcresult" -destination "platform=iOS Simulator,name=iPhone 15 Pro,OS=latest"

and then:

xclogparser parse --workspace <ws-name>.xcworkspace --reporter html

But now with Xcode 15.3 I get yet another eror (probably related to https://github.com/MobileNativeFoundation/XCLogParser/issues/203):

Error: The line *{"stime":68549,"utim doesn't seem like a valid SLF line
hoangatuan commented 8 months ago

@stherold Make sure you add these flags to "Other Swift Flags" in your project build setting "-Xfrontend", "-warn-long-function-bodies=200", "-Xfrontend", "-warn-long-expression-type-checking=200"

If your workspace uses swift package manager, can insert this code to your Package.swift file

for target in package.targets {
   target.swiftSettings = target.swiftSettings ?? []
   target.swiftSettings?.append(
       .unsafeFlags([
           "-Xfrontend", "-warn-long-function-bodies=200", "-Xfrontend", "-warn-long-expression-type-checking=200",
        ])
    )
}
hoangatuan commented 8 months ago

@stherold For Xcode 15.3, seems like XCLogParse is breaking. While waiting for the bug to be fixed, for now you can use this script to get slow compile warnings

xcodebuild -workspace <ws-name>.xcworkspace -scheme <scheme> -destination "platform=iOS Simulator,name=iPhone 15 Pro,OS=latest" OTHER_SWIFT_FLAGS="-Xfrontend -warn-long-function-bodies=200 -Xfrontend -warn-long-expression-type-checking=200" clean build | grep .[0-9]ms | grep -v ^0.[0-9]ms | grep "^$ROOT_DIRECTORY" | sort -nr > log.txt

References from my project: https://github.com/hoangatuan/iOSDevEx/blob/main/Sources/ToolBoxCore/Commands/DetectSlowCompile/DetectSlowCompileHandler.swift#L91

Blackjacx commented 8 months ago

Yes that generates some output 👍 Does that mean that it would be part of the final report?

hoangatuan commented 8 months ago

@Blackjacx Sorry I dont understand your question "Does that mean that it would be part of the final report?".

This is just a simple script that extract Xcode build logs directly by using regex. It doesn't use XCLogParser, so it can't generate the html report

hbanzon commented 8 months ago

Getting this issue as well when updating to Xcode 15.3. Any ETA on the fix?