Skip to content

Commit

Permalink
Update to Kotlin 2.1.0 and migrate to KotlinBaseExtension
Browse files Browse the repository at this point in the history
  • Loading branch information
romainbsl committed Dec 14, 2024
1 parent b4628c5 commit a60217b
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 16 deletions.
7 changes: 2 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import okhttp3.OkHttpClient
import okhttp3.Request
import org.jetbrains.kotlin.builtins.StandardNames.FqNames.target

@Suppress("DSL_SCOPE_VIOLATION")
plugins {
Expand All @@ -22,7 +21,7 @@ buildscript {

allprojects {
group = "org.kodein.internal.gradle"
version = "8.9.0"
version = "8.10.0"
}

repositories {
Expand Down Expand Up @@ -50,9 +49,7 @@ dependencies {
kotlin {
explicitApi()

target.compilations.all {
kotlinOptions.jvmTarget = "17"
}
jvmToolchain(17)

sourceSets.all {
languageSettings.progressiveMode = true
Expand Down
2 changes: 1 addition & 1 deletion gradle/globals.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
kotlin = "2.0.21"
kotlin = "2.1.0"
dokka = "1.9.20"
android-gradle-plugin = "8.5.2"
android-ndk = "25.2.9519653"
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ git-publish = "4.2.2"
gradle-develocityPlugin = "3.19"
gradle-publishPlugin = "1.3.0"
# https://docs.gradle.org/current/userguide/compatibility.html#kotlin
kotlin = "1.9.22"
kotlin = "2.0.20"
okhttp = "4.12.0"

[plugins]
Expand Down
4 changes: 1 addition & 3 deletions kodein-internal-gradle-settings/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ dependencies {

kotlin {
explicitApi()
target.compilations.all {
kotlinOptions.jvmTarget = "17"
}
jvmToolchain(17)
}

buildConfig {
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/org/kodein/internal/gradle/KodeinJvmPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.getByName
import org.gradle.kotlin.dsl.getByType
import org.gradle.kotlin.dsl.withType
import org.jetbrains.kotlin.gradle.dsl.KotlinBaseExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinTopLevelExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

public class KodeinJvmPlugin : KtPlugin<Project> {

internal companion object {

fun configureJvmTarget(project: Project, kotlin: KotlinTopLevelExtension) = with(project) {
fun configureJvmTarget(project: Project, kotlin: KotlinBaseExtension) = with(project) {
kotlin.jvmToolchain(jvmTarget(project))
tasks.withType<KotlinCompile>().configureEach {
if (KodeinLocalPropertiesPlugin.on(project).isNotTrue("allowWarnings")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import org.gradle.api.NamedDomainObjectProvider
import org.gradle.api.Project
import org.gradle.internal.os.OperatingSystem
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
import org.jetbrains.kotlin.gradle.dsl.KotlinBaseExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinTopLevelExtension
import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation
import org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
Expand Down Expand Up @@ -125,7 +125,7 @@ public open class KodeinMppExtension(
): Target<T, C, Sources> = Target(name, kotlinAccess, ::Sources, nativeBuildOn, defaultConfig)

public fun <C : KotlinCompilation<*>> TargetBuilder<*, C, out Sources>.commonJvmConfig(
kotlin: KotlinTopLevelExtension,
kotlin: KotlinBaseExtension,
) {
kotlin.jvmToolchain(KodeinJvmPlugin.jvmTarget(project))

Expand Down Expand Up @@ -161,13 +161,13 @@ public open class KodeinMppExtension(
// TODO: Try again with Kotlin 2.0.0
// Because Chrome 11* on CI is not compatible
// https://youtrack.jetbrains.com/issue/KT-63014
testTask { enabled = false }
testTask { enabled = true }
}
if (jsEnvNodejs) target.nodejs {
// TODO: Try again with Kotlin 2.0.0
// Because Chrome 11* on CI is not compatible
// https://youtrack.jetbrains.com/issue/KT-63014
testTask { enabled = false }
testTask { enabled = true }
}
if (jsEnvD8) target.d8()
}
Expand Down

0 comments on commit a60217b

Please sign in to comment.