In my `buildSrc` I got something like this, for ap...
# gradle
d
In my
buildSrc
I got something like this, for apply my tests dependencies:
Copy code
fun DependencyHandler.applyTests() = Libs.run {
    listOf( test, test_junit, mockk )
            .forEach { add("testImplementation", it ) }
}

fun DependencyHandler.applyAndroidTests() = Libs.Android.run {
    listOf( espresso, test_runner )
            .forEach { add( "androidTestImplementation", it ) }
}
I would also like to create something for apply my
android config
through my Android modules, instead of duplicate every time, but
com.android.build.gradle.internal.dsl.BaseAppModuleExtension
is part of the android gardle plugin, so it can’t be resolved in my
buildSrc
. Is there any way to achieve that?
✔️ 1
e
Yes, move the classpath dependency on the android plugin from your root project to a dependency in the
buildSrc
project. For example if you had:
Copy code
// build.gradle(.kts)
buildscript {
    dependencies {
        classpath("com.android.tools.build:gradle:3.3.0")
    }
}
You can move it to:
Copy code
// buildSrc/build.gradle(.kts)
dependencies {
    compile("com.android.tools.build:gradle:3.3.0")
}
d
Thanks, that won’t be a problem for my non-android modules?
e
It should not. The android plugin will be available in their build script classpath, but the plugin won’t be applied.
d
Thanks, I’ll try ASAP
That worked 😄
👍 1