https://kotlinlang.org logo
Title
e

Elizabeth Thomas

04/24/2023, 3:59 PM
Migrating a build.gradle for a Java project to build.gradle.kts for a Kotlin project. I see that a
byteBuddyJava
task exists for the Java project. Is there something specific I have to do to get an equivalent in Kotlin ie
byteBuddyKotlin
? The opentelemetry extension build.gradle is the one I am trying to convert. Any pointers?
c

Chris Lee

04/24/2023, 4:15 PM
Kotlin generates Java bytecode, which can then be instrumented. Perhaps this will work as is, unless OpenTelemetry has specific guidance for Kotlin.
e

Elizabeth Thomas

04/24/2023, 4:28 PM
@Chris Lee The reason I asked is - the log statement
System.out.println("Adding custom SPAN Processor")
I added in
configureSdkTraceProvider
method gets printed when I use the Java project jar with groovy build script with my sample app. But I dont get the log statement printed for my Kotlin project with kotlin gradle script
c

Chris Lee

04/24/2023, 4:30 PM
If the project is still compiling Java it should continue to work. Ensure the appropriate plugins are still applied and configured equilavently.
e

Elizabeth Thomas

04/24/2023, 4:42 PM
Is there a way to check if I am missing any equivalent kotlin plugins?
c

Chris Lee

04/24/2023, 4:42 PM
the same plugins from your groovy script should generally work straight across
e

Elizabeth Thomas

04/24/2023, 5:02 PM
I see 6 actionable tasks executed for my Java project sample with build.gradle script but only 5 actionable tasks executed for my Kotlin project sample with build.gradle.kts. Not sure what I am missing in my build.gradle.kts. Here is my attempt at converting the groovy build script to kotlin build script