Hi everyone! I want to migrate huge app to Kotlin-...
# gradle
s
Hi everyone! I want to migrate huge app to Kotlin-dsl step by step to do this I'm planing to extract pieces of code to
kts
files and use it from groovy. How could i achieve that.
apply from: "file.gradle.kts"
is not working in this case. Is there any other way?
g
What is exactly not working? Because simple apply from
kts
must work, maybe problem what is inside of your file.gradle.kts
s
@gildor so far it contains simple data class, getting
unable to resolve class
errors
g
@stepango You see this error on side of Groovy (when use it) or Kotlin?
s
Groovy
g
correct
Solution from from Alexander should work, also it make it easier to migrate dynamic scripts then reverse solution (extract kotlin code to scripts)
s
So there is no way to import
kts
in groovy?
g
You can import
problem with class itself
s
how?
g
your class is actually have name something like
File_gradle$Foo
👍 1
s
what i could import if no classes?
g
it’s just a way how Gradle works with kts script plugins
class is there, with mangled name
For things like data classes and so on better to use buildSrc or plugins
1
Script plugins just not intended to use like that
c
For me rule of thumb is, if you declare a class in a build file and want to use it in another build fire, move it to
buildSrc
.
👍 2
g
what i could import if no classes?
tasks, plugin application and extension configuration, it’s a way to extract part of you build.gradle config