gradle / gradle-profiler

A tool for gathering profiling and benchmarking information for Gradle builds
Apache License 2.0
1.4k stars 155 forks source link

Last build of a "just_rebuild" scenario rebuilds during the --scan build anyway #396

Open NinoDLC opened 2 years ago

NinoDLC commented 2 years ago

Command gradle-profiler --profile buildscan -scenario-file performance.scenarios

performance.scenarios

default-scenarios = [
  "clean_build",
  "just_rebuild"
]

clean_build {
  tasks = ["clean", "assembleDebug"]
}

just_rebuild {
  tasks = ["assembleDebug"]
}

Profile.log

* Running scenario just_rebuild using Gradle 7.3 (scenario 2/2)

* Stopping daemons
Running command C:\Work\foo\gradle-user-home\wrapper\dists\gradle-7.3-bin\ddwl0k7mt9g6ak16i1m905vyv\gradle-7.3\bin\gradle.bat --stop --gradle-user-home C:\Work\foo\gradle-user-home
No Gradle daemons are running.

* Build details
Gradle version: Gradle 7.3
Java home: C:\Program Files\Java\jdk-11.0.12
OS: windows 10 amd64 10.0
JVM args:
  --add-opens
  java.base/java.util=ALL-UNNAMED
  --add-opens
  java.base/java.lang=ALL-UNNAMED
  --add-opens
  java.base/java.lang.invoke=ALL-UNNAMED
  --add-opens
  java.base/java.util=ALL-UNNAMED
  --add-opens
  java.prefs/java.util.prefs=ALL-UNNAMED
  --add-opens
  java.prefs/java.util.prefs=ALL-UNNAMED
  --add-opens
  java.base/java.nio.charset=ALL-UNNAMED
  --add-opens
  java.base/java.net=ALL-UNNAMED
  --add-opens
  java.base/java.util.concurrent.atomic=ALL-UNNAMED
  -Xmx4608M
  -Dfile.encoding=windows-1252
  -Duser.country=FR
  -Duser.language=fr
  -Duser.variant
  -Dorg.gradle.profiler.scenario=just_rebuild
Gradle args:
  --gradle-user-home
  C:\Work\foo\gradle-user-home
  -I
  C:\Users\bar\AppData\Local\Temp\gradleProfiler1665138600507168692.gradle
  -I
  C:\Users\bar\AppData\Local\Temp\gradleProfilerGradleEnterpriseInitScript8348735058986481232.gradle

* Running warm-up build #1
(...)
BUILD SUCCESSFUL in 4m 24s
254 actionable tasks: 254 executed
Used daemon with pid 10892
Execution time 264521 ms

* Running warm-up build #2
(...)
BUILD SUCCESSFUL in 4s
254 actionable tasks: 1 executed, 253 up-to-date
Used daemon with pid 10892
Execution time 4175 ms
Using build scan plugin 3.5.2

* Using args for instrumented builds:
Gradle args:
  --gradle-user-home
  C:\Work\foo\gradle-user-home
  -I
  C:\Users\bar\AppData\Local\Temp\gradleProfiler1665138600507168692.gradle
  -I
  C:\Users\bar\AppData\Local\Temp\gradleProfilerGradleEnterpriseInitScript8348735058986481232.gradle
  --scan

* Running measured build #1
(...)
BUILD SUCCESSFUL in 3m 39s
254 actionable tasks: 254 executed

Publishing build scan...
https://gradle.com/s/baz

Used daemon with pid 10892
Execution time 220569 ms

* Stopping daemons
Running command C:\Work\foo\gradle-user-home\wrapper\dists\gradle-7.3-bin\ddwl0k7mt9g6ak16i1m905vyv\gradle-7.3\bin\gradle.bat --stop --gradle-user-home C:\Work\foo\gradle-user-home
Stopping Daemon(s)
1 Daemon stopped

My gradle build has issues with incremental build (for the matter, since I added viewbinding to my Android project, a single line change on any kotlin file will trigger a full 5 min build).

But this tool doesn't seem to work with incremental build since it retrigger a full build even for a "just_rebuild" scenario.

Am I missing something here ?

asodja commented 2 years ago

It should work incrementally since it just calls the gradle. Note that gradle-user-home is changed so this might affect it. You can set it to default gradle-user-home with --gradle-user-home parameter.

You might want to enable info or debug logs for gradle and see the reason for gradle not acting incrementally.