Ran Magen
01/23/2020, 4:16 AM$rootDir/gradle/root.gradle
ext.foo = "something"
// $rootDir/gradle/root/git_util.gradle
ext.complex_value = someValue.with {
return doSomeHardWork(rootDir) + foo
}
// build.gradle
apply {
from "$rootDir/gradle/root/git_util.gradle"
}
def someMap = [
key: complex_value
]
I can't figure out how to get an equivalent going in Kotlin such that I could define `val`s that are globally available but are computed once and have access to the Project
(e.g. using rootDir
)
(I know I can make extension functions on Project
in buildSrc
but those are all functions that will get invoked on every call. Groovy has .memoize()
but I don't think there's an equivalent in .kts
)octylFractal
01/23/2020, 4:40 AM