I'm getting started with converting all our module...
# gradle
r
I'm getting started with converting all our modules build from groovy to kts. Learning this as I go. I'm trying to figure out something that I think should be simple? With groovy I could do this: //
$rootDir/gradle/root.gradle
Copy code
ext.foo = "something"
//
$rootDir/gradle/root/git_util.gradle
Copy code
ext.complex_value = someValue.with {
  return doSomeHardWork(rootDir) + foo
}
//
build.gradle
Copy code
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
)
o