https://kotlinlang.org logo
Title
p

Paul Woitaschek

05/01/2017, 6:48 PM
How can I import other scripts in my script?
p

Paul Woitaschek

05/02/2017, 7:44 AM
That does not resolve the file
It says unresolved reference for everything I want to access from the applied function
b

bamboo

05/02/2017, 12:27 PM
You can’t. You can apply scripts from other scripts but any data must be shared via types available in the
buildSrc
classpath.
You can easily share code using
buildSrc
though.
If you prefer organizing build logic around scripts only, you can share data among them by using
extra
properties. In the applied script:
extra["data"] = listOf("my", "data")
In the main script:
val data: List<String> by extra
...
p

Paul Woitaschek

05/02/2017, 1:51 PM
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
?
p

Paul Woitaschek

05/03/2017, 7:55 AM
Is there any documentation? Or is it all through samples?
b

bamboo

05/03/2017, 12:46 PM
@Paul Woitaschek https://docs.gradle.org/current/userguide/organizing_build_logic.html - it doesn’t include Kotlin specific documentation just yet though