Hello guys, is it possible to put `implementation...
# gradle
s
Hello guys, is it possible to put
implementation(libs.foo.bar)
calls to a helper function and reuse it in individual modules? I'd like to be able to reuse declaration of testing dependencies like this:
Copy code
fun org.gradle.kotlin.dsl.DependencyHandlerScope.addTestDependencies() {
    // API for writing JUnit tests
    testImplementation(libs.junit.api)
    testImplementation(libs.junit.params)

    // IDE & Gradle integration:
    testImplementation(libs.junit.platform.runner)
    testImplementation(libs.kotlinx.coroutines.test)
    testImplementation(libs.mockk)
    testRuntimeOnly(libs.junit.engine)
    testRuntimeOnly(libs.junit.vintage.engine)
    testRuntimeOnly(libs.junit.launcher)
}

// JVM module build.gradle.kts

dependencies {
    addTestDependencies()
}
c
You don’t need to do any custom plugins or anything, this functionality is already available directly in the Version Catalogs with Dependency Bundles https://docs.gradle.org/current/userguide/platforms.html#sec:dependency-bundles
☝️ 1
s
Thanks! Didn't know about that 😱