Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift Type check and functions build times not generated #190

Open
stherold opened this issue Oct 24, 2023 · 10 comments
Open

Swift Type check and functions build times not generated #190

stherold opened this issue Oct 24, 2023 · 10 comments

Comments

@stherold
Copy link

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
Copy link

Same here 🙋‍♂️

@Bobbyphtr
Copy link
Contributor

Same here

@BalestraPatrick
Copy link
Collaborator

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
Copy link

@stherold What is the xcodebuild command you was using?

@stherold
Copy link
Author

stherold commented Mar 12, 2024

@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 #203):

Error: The line *{"stime":68549,"utim doesn't seem like a valid SLF line

@hoangatuan
Copy link

hoangatuan commented Mar 12, 2024

@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
Copy link

hoangatuan commented Mar 12, 2024

@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
Copy link

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

@hoangatuan
Copy link

@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
Copy link

hbanzon commented Mar 18, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants