Hi . I am doing some experiments with gradle and t...
# gradle
a
Hi . I am doing some experiments with gradle and the
kotlin-dsl
gradle plugin for android. So far i really liked the concept of configuring dependencies via a single
buildSrc/src/main/Dependencies.kt
file. I want to take it a step further and have the whole app configuration configured from pure kotlin files. is that possible? something like the old
apply from("${project.rootDir}/commons.gradle")
, but for koltin , like if i add an android library, all i need to do is add a build.gradle.kts file in library root with some static function call, like
GradleConfigurations.librarySetup(this)
and there i could automatically setup project plugins, dependencies, the
android{}
block, etc? How to do that? So far i have been able to do this for the root level
build.gradle.kts
file, but
app/build.gradle.kts
seems to use internal/inaccessible extensions. so any other approach ?
v
You could use the same "apply from" tactic, but actually that's not idiomatic and has drawbacks like not getting accessors generated. The better way is to use precompiled script plugins in an included build or
buildSrc
that you then apply in your main build. Those are usually called convention plugins.
a
@Vampire i got the same suggestion in another slack group. will look into creating plugins . thanks!