https://kotlinlang.org logo
#compiler
Title
# compiler
t

Travis Griggs

02/13/2023, 9:41 PM
What is the current idiomatic method to apply
@kotlin.ExperimentalUnsignedTypes
globally to a whole project, so I don't have to annotate 500+ sites? I had this with gradle compiler options once upon a time, but I think that's evolved and the names may have changed since then (sorry if this belongs in another channel, please direct if so?)
although I’d probably do this instead
Copy code
tasks.withType<KotlinCompile>().configureEach {
  kotlinOptions {
    freeCompilerArgs += listOf(
      "-opt-in=kotlin.ExperimentalUnsignedTypes"
    )
  }
}
because
configureEach {}
is usually better https://melix.github.io/blog/2022/05/gradle-laziness.html
t

Travis Griggs

02/13/2023, 10:13 PM
Where do I put that at? in the android block of the module gradle file?
b

Big Chungus

02/13/2023, 10:15 PM
Copy code
kotlin.sourceSets.all {
  languageSettings.optIn("annotation.package.ClassName")
}
Shove it inside gradle buildfile for each module or inside
allprojects {}
at the root module buildscript
t

Travis Griggs

02/13/2023, 11:47 PM
Thanks. That worked.
5 Views