My build scans are showing the start of the build has ~ 53 seconds where almost nothing is happening (in the “Initialization & configuration” section), and I haven’t been able to determine how to troubleshoot this further.
Build Scan® | Gradle Cloud Services is a recent buildscan that demonstrates this problem. The log for this build is fix: Set correct text direction for localised error messages · pachli/pachli-android@dcafed6 · GitHub (the “ktlint” step, from the settings at the top right turn on “Show timestamps”).
After ~ 31s the build-logic tasks run, and complete within ~ 0.2s.
After ~ 44s the markdown2resource plugin is built, and completes within ~ 0.1s
The execution doesn’t start until the ~ 53s mark.
The relevant log messages to this point:
Tue, 09 Apr 2024 11:04:53 GMT
Run ./gradlew clean ktlintCheck
Tue, 09 Apr 2024 11:04:53 GMT Downloading https://services.gradle.org/distributions/gradle-8.6-bin.zip
Tue, 09 Apr 2024 11:04:55 GMT ............10%.............20%............30%.............40%.............50%............60%.............70%.............80%............90%.............100%
Tue, 09 Apr 2024 11:04:56 GMT Starting a Gradle Daemon (subsequent builds will be faster)
Tue, 09 Apr 2024 11:04:59 GMT Calculating task graph as no cached configuration is available for tasks: clean ktlintCheck
Tue, 09 Apr 2024 11:05:21 GMT Type-safe project accessors is an incubating feature.
Tue, 09 Apr 2024 11:05:25 GMT > Task :build-logic:convention:checkKotlinGradlePluginConfigurationErrors
Tue, 09 Apr 2024 11:05:25 GMT > Task :build-logic:convention:compileKotlin FROM-CACHE
Tue, 09 Apr 2024 11:05:25 GMT > Task :build-logic:convention:compileJava NO-SOURCE
Tue, 09 Apr 2024 11:05:25 GMT > Task :build-logic:convention:pluginDescriptors
Tue, 09 Apr 2024 11:05:25 GMT > Task :build-logic:convention:processResources
Tue, 09 Apr 2024 11:05:25 GMT > Task :build-logic:convention:classes
Tue, 09 Apr 2024 11:05:25 GMT > Task :build-logic:convention:jar
Tue, 09 Apr 2024 11:05:37 GMT > Task :markdown2resource:checkKotlinGradlePluginConfigurationErrors
Tue, 09 Apr 2024 11:05:37 GMT > Task :markdown2resource:compileKotlin FROM-CACHE
Tue, 09 Apr 2024 11:05:37 GMT > Task :markdown2resource:compileJava NO-SOURCE
Tue, 09 Apr 2024 11:05:37 GMT > Task :markdown2resource:pluginDescriptors
Tue, 09 Apr 2024 11:05:37 GMT > Task :markdown2resource:processResources
Tue, 09 Apr 2024 11:05:37 GMT > Task :markdown2resource:classes
Tue, 09 Apr 2024 11:05:37 GMT > Task :markdown2resource:jar
Tue, 09 Apr 2024 11:05:46 GMT > Task :checks:clean UP-TO-DATE
That suggests a couple of seconds to download the gradle 8.6 distribution, and a couple more to start the daemon.
Is it reasonable for the “Calculating task graph” step to take ~ 22 seconds? Is that work expected not to be included in the buildscan?
The log shows the unexplained gap between the build-logic tasks completing (at 11:05:25, line 20) and the markdown2resource tasks starting (at 11:05:37, line 21), but there’s no other activity logged in the intervening 12 seconds.
The log shows the explained gap between the markdown2resource tasks completing (at 11:05:37, line 27) and the checks:clean task starting at (11:05:46, line 28), but there’s no other activity logged in the intervening 12 seconds.
The complete build is only 1m29s, so this unexplained ~ 53s is almost two thirds of the build time. Is there additional debugging I can do to figure out where this time is being spent with a view to speeding it up?