How can I import other scripts in my script?
# gradle
p
How can I import other scripts in my script?
b
You can’t. You can apply scripts from other scripts but any data must be shared via types available in the
buildSrc
classpath.
If you prefer organizing build logic around scripts only, you can share data among them by using
extra
properties. In the applied script:
Copy code
extra["data"] = listOf("my", "data")
In the main script:
Copy code
val data: List<String> by extra
...
p
I don’t get it. Let’s say in downloader.gradle.kts I have a
fun download(uri : URI, dest : File)
. How can I execute it from
build.gradle.kts
?
b
@Paul Woitaschek https://docs.gradle.org/current/userguide/organizing_build_logic.html - it doesn’t include Kotlin specific documentation just yet though