Let's say you have a multi module project, where each module has some common build logic.
Is it better:
A. to extract that logic into a plugin
plugins { id("shared-build") }
)
B. or is it also okay apply it
apply(from: "shared-build.gradle.kts")
Does using apply from have any impact on build performance?
c
Chris Lee
10/30/2022, 1:59 AM
build-logic composite project is a good starting point.
v
Vampire
10/30/2022, 10:45 AM
"apply from" should not have significant impact on the build performance, but a major (negative) impact on your quality of life. Such legacy script plugins have many drawbacks and quirks like unintuitive class loader handling leading to hard to diagnose build bugs, the inability to use the
plugins { ... }
DSL, thus also no type-safe accessor for Kotlin DSL, ...
Using a convention plugin is the way better way to go as Chris indicated.
g
gildor
10/30/2022, 12:43 PM
Exactly what Björn said, script plugins are almost unusable with Kotlin DSL
p
Peter Mandeljc
10/30/2022, 1:51 PM
I see, thanks for answers!
e
Eivind
10/31/2022, 6:34 AM
On huge multimodule builds I use convention plugins and version catalogs to manage shared build logic