m

    Mohamed Ibrahim

    2 years ago
    should I use
    buildSrc
    or convert all
    .gradle
    files to Kotlin dsl, preparing to refactor app to Modules?
    j

    Joost Klitsie

    2 years ago
    what do you wish to achieve?
    m

    Mohamed Ibrahim

    2 years ago
    preparing to refactor app to Modules?
    v

    Vincent Williams

    2 years ago
    Im not sure either of your suggestions relate to modules. You dont need kotlin dsl or buildSrc for multi-module
    m

    Mohamed Ibrahim

    2 years ago
    the idea is to organize dependencies and versions across all modules
    j

    Joost Klitsie

    2 years ago
    Okay so buildSrc is a place to put scripts which have access to the gradle API and can be referenced from build.gradle scripts.
    you can put in JVM languages, such as Java, Groovy or Kotlin in the buildSrc
    So if you have many different modules, using the buildSrc is a good way to go, as you can put that in the root project and then reference it from your modules' build.gradle files
    if you do not have a whole lot of modules, then I would advise to use Kotlin everywhere
    as I read here a topic by a guy that had 140 modules and noticed that script initialization is a bit slow for build.gradle.kts scipts (like 1s, but times 140 it is a lot)
    so you can use the kotlin-dsl plugin in the buildSrc to write kotlin files
    There is also people saying you shouldn't use buildSrc as it makes initial builds slower https://proandroiddev.com/stop-using-gradle-buildsrc-use-composite-builds-instead-3c38ac7a2ab3
    but in my experience the ease of buildSrc makes it a good choice
    m

    Mohamed Ibrahim

    2 years ago
    Thank you, I’ll go with
    buildSrc
    for now