egorand
11/15/2021, 10:57 PMcompileDebugKotlin
build performed by CI that populated the cache and a local build that consumed the cache print out different task class names, which seemingly results in a miss - CI says it ran KotlinCompileWithWorkers
and the dev machine says it ran KotlinCompile
(see the screenshot). Upon some investigation I landed on this code that seems to pick a different task based on whether build parallelization is enabled (controlled by kotlin.parallel.tasks.in.project
before 1.5.20 and IIUC by org.gradle.parallel
after that - please correct me if I’m wrong):
https://github.com/JetBrains/kotlin/blob/v1.5.31/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/tasks/TasksProvider.kt#L165-L166
I’m not sure if this is a red herring and our cache misses have a different cause, but I’m curious if it’s a known issue. I also noticed that the following commit removes the KotlinCompileWithWorkers
task, which seemingly will ship in 1.6.20:
https://github.com/JetBrains/kotlin/commit/904f9c72f2a8996511def90d76e054a2f9f98b0e
So far we’re planning to enable parallelization for our CI builds, but would love to know more about this issue.tapchicoma
11/16/2021, 8:06 AM--parallel
Gradle flag or same value for kotlin.parallel.tasks.in.project
.
1.6.20
removes kotlin.parallel.tasks.in.project
flag and fixes this issueegorand
11/16/2021, 1:02 PMtapchicoma
11/16/2021, 1:04 PMtapchicoma
11/16/2021, 1:06 PMkotlin.paralle.tasks.in.project
- after a build failure - next build will be non-incremental for the module where failure was. It was also fixed.egorand
11/16/2021, 1:13 PMorg.gradle.parallel
since kotlin.paralle.tasks.in.project
has been deprecated in 1.5.20?tapchicoma
11/16/2021, 1:37 PM<http://kotlin.parallel.tasks.in|kotlin.parallel.tasks.in>.project=false
and org.gradle.parallel=true
to mitigate remote cache/incremental compilation issues, but have "parallel" build.
Note that org.gradle.parallel
flag only affect whether Gradle will build different modules in the project in parallel. But Gradle could still execute tasks in parallel inside the module, which is controlled by org.gradle.workers.max
propertyegorand
11/16/2021, 7:06 PMkotlin.parallel.tasks.in.project
on either CI or dev machines, so curious why we’re seeing different tasks invoked - is that an effect of org.gradle.parallel
being set to different values? In that case, do we need to set <http://kotlin.parallel.tasks.in|kotlin.parallel.tasks.in>.project=false
, or just make sure we set org.gradle.parallel
to the same value in both setups?tapchicoma
11/16/2021, 8:07 PMis that an effect ofYes, alongside with deprecationbeing set to different values?org.gradle.parallel
kotlin.parallel.tasks.in.project
- default value (if value was not set explicetly) set to depend on --parallel
switch. I must admit that was a mistake and it actually should rather depend on org.gradle.workers.max
value.
So if you will set kotlin.parallel.tasks.in.project
explicitly - this default value should be overridden by explicit one.egorand
11/17/2021, 5:03 PM<http://kotlin.parallel.tasks.in|kotlin.parallel.tasks.in>.project=false
is that for some reason compileKotlin
tasks for different Gradle modules are executed sequentially on a single Gradle worker, while all the others stay IDLE. I’m going to try removing kotlin.parallel.tasks.in.project
override for both our local and CI setups to get the setting to just depend on org.gradle.parallel
- I believe that’s the behavior we want.tapchicoma
11/17/2021, 6:05 PMare executed sequentially on a single Gradle workerThere were 2 type of tasks - with compilation via worker (left) or with compilation via task action (removed,
<http://kotlin.parallel.tasks.in|kotlin.parallel.tasks.in>.project=false
). The second one, indeed, most probably will be executed sequentially