diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 5ec28b7..468bd26 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,6 +2,7 @@ apiguardian = "1.1.2" junit-jupiter = "5.11.3" assertJ = '3.26.3' +kotlin = '2.0.21' #opentest4j = '1.3.0' #archunit = '1.3.0' #mockito = '5.14.2' @@ -9,4 +10,6 @@ assertJ = '3.26.3' [libraries] apiguardian = { module = "org.apiguardian:apiguardian-api", version.ref = "apiguardian" } junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-jupiter" } -assertj-core = { module = "org.assertj:assertj-core", version.ref = "assertJ" } \ No newline at end of file +assertj-core = { module = "org.assertj:assertj-core", version.ref = "assertJ" } +kotlin-gradlePlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } +kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" } diff --git a/gradle/plugins/build.gradle.kts b/gradle/plugins/build.gradle.kts index cc02e63..86ba80a 100644 --- a/gradle/plugins/build.gradle.kts +++ b/gradle/plugins/build.gradle.kts @@ -5,3 +5,7 @@ plugins { repositories { gradlePluginPortal() } + +dependencies { + implementation(libs.kotlin.gradlePlugin) +} \ No newline at end of file diff --git a/gradle/plugins/src/main/kotlin/buildlogic.kotlin-library-conventions.gradle.kts b/gradle/plugins/src/main/kotlin/buildlogic.kotlin-library-conventions.gradle.kts index f719e33..5868f7b 100644 --- a/gradle/plugins/src/main/kotlin/buildlogic.kotlin-library-conventions.gradle.kts +++ b/gradle/plugins/src/main/kotlin/buildlogic.kotlin-library-conventions.gradle.kts @@ -1,7 +1,11 @@ +import org.jetbrains.kotlin.gradle.dsl.JvmTarget +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + plugins { java `java-library` id("buildlogic.publish-library") + id("kotlin") } repositories { @@ -31,3 +35,22 @@ tasks.named("test") { testLogging.showStandardStreams = true } + +val javaVersion: String = System.getProperty("matrix.version") ?: "21" + +val kotlinCompilerArgs = listOf( + "-Xnullability-annotations=@org.jspecify.annotations:strict", + "-Xemit-jvm-type-annotations" // Required for annotations on type variables +) + +tasks.withType { + compilerOptions { + freeCompilerArgs.set(kotlinCompilerArgs) + javaParameters = true // Required to get correct parameter names in reporting + jvmTarget = JvmTarget.fromTarget(javaVersion) + } +} + +kotlin { + jvmToolchain(21) +} diff --git a/kotlin-core/build.gradle.kts b/kotlin-core/build.gradle.kts index 6e5fb67..bc0cbaf 100644 --- a/kotlin-core/build.gradle.kts +++ b/kotlin-core/build.gradle.kts @@ -1,6 +1,5 @@ plugins { id("buildlogic.kotlin-library-conventions") - kotlin("jvm") version "2.0.21" } description = "Jqwik2 Kotlin core support" @@ -9,16 +8,13 @@ val artifactName = "jqwik2-kotlin-core" dependencies { api(libs.apiguardian) + implementation(libs.kotlin.stdlib) implementation(project(":core")) testImplementation(libs.junit.jupiter) testImplementation(libs.assertj.core) } -kotlin { - jvmToolchain(21) -} - tasks.jar { archiveBaseName.set(artifactName) archiveVersion.set("${rootProject.extra.get("jqwik2Version")}")