1 year ago

#351244

test-img

htafoya

Gradle - Do adding the same dependency to different modules increase build time?

If I have moduleA and moduleB, which both implement dependencyA and dependencyB. Will declaring both dependencies increase load time for moduleB if moduleA was already compiled?

For more information, a project has the following problem and I want to know if I should refactor it for a decent build time gain:

The project uses several dependencies across several modules, in order to clean up code, the project added a Dependencies.kt file where all versions of dependencies are added, and we also added "groups", so that for example all the Firebase dependencies are under a single object that implements the required libs.

fun DependencyHandler.firebase() {
    implementation(Dependencies.Firebase.core)
    implementation(Dependencies.Firebase.cloudMessaging)
    implementation(Dependencies.Firebase.remoteConfig)
    implementation(Dependencies.Firebase.analytics)
    implementation(Dependencies.Firebase.crashlytics)
}

so the build.gradle.kts file would look something as:

dependencies {
    app()
    design()
    rx()
    network()
    firebase()
}

Now, not all modules require firebase cloud messaging, but they will still call the firebase() dependency in order to import the group and keep things clean.

I want to know if the module will increase considerably the configuration and build time by adding libs that are not really required to the module, if those libs were already loaded for another module.

gradle

android-gradle-plugin

build.gradle

gradle-kotlin-dsl

gradle-dependencies

0 Answers

Your Answer

Accepted video resources