https://kotlinlang.org logo
Title
u

ursus

12/18/2018, 5:35 PM
One more: If I have multiple modules, are multithreaded builds enabled by default? I always thought so, because the tasks interleave during build. But now Ive tried org.gradle.parallel=true, and get 30% speedup, is this parallel a different thing?
g

gildor

12/18/2018, 5:37 PM
No, Gradle will not run builds of multiple modules in parallel by default, you have to specify org.gradle.parallel=true explicitly
u

ursus

12/18/2018, 5:39 PM
Thats weird, so Ive been modularized for few months for nothing? lol, However the build speed did improve even withouth the flag
c

cristiangm

12/18/2018, 5:42 PM
not being in parallel doesn't mean it doesn't have advantages compile avoidance ( if you don't use kotlin ) build cache ...
u

ursus

12/18/2018, 5:44 PM
true, but why would you not want parallel builds if you already have the separation
c

cristiangm

12/18/2018, 5:44 PM
because Gradle cannot assume your modules are independant
You should enable parallel, but they cannot do it by default
u

ursus

12/18/2018, 5:45 PM
how would they not be independant? they are modules = independant, no?
c

cristiangm

12/18/2018, 5:45 PM
even thought they could have made it a default on Gradle 5.0
u

ursus

12/18/2018, 5:46 PM
huhm compile avoidance doesnt work if I use kotlin?
c

cristiangm

12/18/2018, 5:46 PM
you can add sourceSets or resources from other modules ( which is kind of stupid )
u

ursus

12/18/2018, 5:46 PM
oh, yea thats silly
btw ive also seen
kotlin.incremental=true
, does that do anything?
c

cristiangm

12/18/2018, 5:47 PM
and no, compile avoidance doesn't work YET with Kotlin
u

ursus

12/18/2018, 5:47 PM
Im always strugging with gradle flags, as to what actuallydoes something
compile avoidance = not building a module you didnt touch, right?
c

cristiangm

12/18/2018, 5:48 PM
I would say kotlin.incremental is true be default, but I don't remember from which version
compile avoidance = not compiling a module, even if a module it depends changed
it needs to understand if the change would affect you or not
( so, for example, don't compile if only an implementation has changed, but compile if the interface has changed )
u

ursus

12/18/2018, 5:49 PM
okay so now in kotlin if I change something in base module, every other module that includes base will be recompiled?
c

cristiangm

12/18/2018, 5:49 PM
yes
u

ursus

12/18/2018, 5:50 PM
but, if I change feature1, then feature 2 (they are totally unrelated) doesnt get recompiled, right?
c

cristiangm

12/18/2018, 5:50 PM
in java if the change you made on base is only an implementation detail no other module would recompile
exactly, only if it depends on the other module
u

ursus

12/18/2018, 5:51 PM
okay so basically my
implementation
includes do nothing for now?
c

cristiangm

12/18/2018, 6:01 PM
¿?
u

ursus

12/18/2018, 6:10 PM
to get compilation avoidance I thought
implementation
including of modules is necessary
c

cristiangm

12/18/2018, 6:18 PM
implementation does not propagate the dependency, so it helps too
u

ursus

12/18/2018, 6:37 PM
what about that caching please?
g

gildor

12/19/2018, 12:40 AM
Implementation/api != compile avoidance
This is one more different thing. But it also helps avoid module recompilation, but only for transitive relationships between modules
g

ghedeon

01/02/2019, 2:12 AM
any good articles on this subject? Given: a few base modules plus feature modules on the top, all kotlin. How to speed this shit up? (I've checked the corresponding section on developer.android)
g

gildor

01/02/2019, 10:13 AM
not sure about feature/base module, because it’s one more level of dependencies on top usual Gradle modules. In general to speedup you should have more independent modules (maybe even not related on feature/base, just module with minimum dependencies, to make it recompilation recompile only modules that depend on it) But it’s pretty wide topic, I would recommend first check you build scan to understand what is slow. Also as starting point check this webinar from Gradle team https://gradle.com/blog/improving-android-and-java-build-performance/
👍 1
u

ursus

01/02/2019, 4:28 PM
@gildor what do you mean another level of modules, its the usual diamon :base -> :feature(s) -> :app
1
g

gildor

01/02/2019, 11:22 PM
I mean there are usual Gradle modules (projects) but when someone talks about base/feature modules in domain of Android it probably about instant app/app bundle dynamic modules which is additional feature where module dependencies are inverted (feature has base module in dependencies and base has list of dynamic features, and base module is your application for app bundle) And I just don't know how this works in terms of Gradle compilation
u

ursus

01/03/2019, 3:43 PM
oh, well I see people use base/core + features terminology as well in regular multimodule
g

gildor

01/04/2019, 12:40 AM
Yes, but it’s very confusing to use base/feature for usual gradle modules, because base and feature is even Gradle plugin name for app bundle/instan app modiles, that my point. Core is fine, at least it’s clear that core is root of other module and doesn’t have dependencies to other core modules