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

Slow Gradle Build #702

Open
nizam-betterapp opened this issue Nov 21, 2024 · 2 comments
Open

Slow Gradle Build #702

nizam-betterapp opened this issue Nov 21, 2024 · 2 comments

Comments

@nizam-betterapp
Copy link

nizam-betterapp commented Nov 21, 2024

Everytime we make a code change (eg: add a log line), kspDebugKotlin step takes 13 seconds and causes issues. Is this expected due to annotation library (or) is it supposed to be compiling incrementally?
below is our gradle.properties
Can you please help here how to enable ksp incremental build

org.gradle.jvmargs=-Xmx8g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseParallelGC -Dkotlin.daemon.jvm.options=-Xmx8g -XX:+HeapDumpOnOutOfMemoryError

org.gradle.jvmargs=-Xmx8g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseParallelGC -Dkotlin.daemon.jvm.options=-Xmx8g -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true
kotlin.code.style=official
android.nonTransitiveRClass=true
android.nonFinalResIds=false
android.enableJetifier=false
org.gradle.parallel=true
org.gradle.caching=true
org.gradle.configureondemand=true
org.gradle.daemon=true
org.gradle.configuration-cache=true
org.gradle.configuration-cache.problems=warn
ksp.incremental=true
ksp.incremental.log=true

@nizam-betterapp
Copy link
Author

I did the following and tried to figure out which library is not working with ksp incremental

Added these flags to track the dirty files

ksp.incremental=true
ksp.incremental.log=true

I commented compose destinations ksp line in build.gradle and ran the gradlew command

// ksp "io.github.raamcosta.compose-destinations:ksp:$raamcostaVersion"

./gradlew :app:kspDebugKotlin --scan

Dirty flag was perfect as below:

Dirty / All: 0.05%

Disappeared Outputs
Affected By CP
Affected By new syms
  src/main/java/ai/blox100/feature_zen_mode/presentation/bottom_sheet_end_session/ZenEndSessionViewModel.kt
  build/generated/ksp/debug/java/byRounds/1/ai/blox100/feature_zen_mode/presentation/bottom_sheet_end_session/ZenEndSessionViewModel_HiltModules.java
Affected By sealed
CP changes
Dirty:
  src/main/java/ai/blox100/feature_zen_mode/presentation/bottom_sheet_end_session/ZenEndSessionViewModel.kt

Dirty / All: 0.05%

When i uncommented the ksp of compose destinations it shows 100% dirty

Dirty / All: 100.00%

This makes every line change in the code taking 13 seconds extra for building. I have been stuck with this issue for 2 days. Any help would be deeply appreciated.

Simple steps to reproduce

  1. Add these to gradle.properties so that we can see the kspDirtySet.log
ksp.incremental=true
ksp.incremental.log=true
  1. run ./gradlew :app:kspDebugKotlin --scan
    ignore the first build run since this will be 100% dirty
  2. run ./gradlew :app:kspDebugKotlin --scan again
    this time it will be fully from cache
  3. just add a Log.d("abc", "xyz") line in any of your code and then
    run ./gradlew :app:kspDebugKotlin --scan again
    this time again it will be 100% dirty

My main question, is this what it is expected due to the library (or) Am I misisng something?

@nizam-betterapp
Copy link
Author

It looks like you have fixed this issue in v2. Is my understanding correct?

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

1 participant