How would you convert this snippet to `kts` ? ```...
# gradle
t
How would you convert this snippet to
kts
?
Copy code
allprojects {
  if (plugins.hasPlugin("org.jetbrains.kotlin.jvm")) {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
  }

  plugins.withId("com.android.library") {
    extensions.getByName("android").compileOptions {
      sourceCompatibility JavaVersion.VERSION_1_8
      targetCompatibility JavaVersion.VERSION_1_8
    }
  }
}
d
Hmm,
sourceCompatibility = JavaVersion.VERSION_1_8
(and similar) should be all you need.
t
I tried it but it does not work 😕 It’s in a root build.gradle with no applied plugin
d
Hmm, add this to you root build.gradle.kts
Copy code
plugins {
    id("android?") version ("can only be specified once in root") apply false
}
Then you'll be able to do something like
extensions.configure<AndroidLibraryExtension> { compileOptions { ... } }
.
t
Thanks I’ll give it a try