Hello! I am working on an Android project with mul...
# gradle
o
Hello! I am working on an Android project with multiple modules. To reduce boilerplate Gradle configuration, I have created a custom plugin that I apply to all modules. I have put it in the buildSrc directory. Also, we keep our dependencies in the .kt file under the buildSrc directory. To access classes from the plugin, I have to move the plugin dependency from classpath declaration inside root build.gradle.kts file to implementation section in buildSrc/build.gradle.kts file. The problem is that I want to have versions for build plugins and runtime dependencies in the same place. I cannot access my Dependencies.kt file from buildSrc/build.gradle.kt file. I have tried to move plugin implementation to a separate module but had no success. Also, I tried to define the version in extra or project properties, but I can’t access them from the .kt file.
Basically I would like to keep my dependencies as following
Copy code
private const val hiltVersion = "2.40"


object BuildPlugins {

    const val hilt ="com.google.dagger:hilt-android-gradle-plugin:$hiltVersion"
}

object Dependencies {

	object Hilt {
        const val hilt = "com.google.dagger:hilt-android:$hiltVersion"
        const val hiltCompiler = "com.google.dagger:hilt-compiler:$hiltVersion"
    }
}
but then this doesn’t work in buildSrc/build.gradle.kts:
Copy code
dependencies {
    compileOnly(gradleApi())

    implementation(BuildPlugins.hilt)
}
v
o
I will Thanks a lot