From 40707ac350490ed154cc96834bbfb765fa158d69 Mon Sep 17 00:00:00 2001 From: Johannes Link Date: Sat, 22 Jun 2024 10:59:45 +0200 Subject: [PATCH] Update documentation for Kotlin 2 compiler --- .gitignore | 1 + TODO.md | 7 ------ documentation/build.gradle | 24 +++++++++++++------ .../src/docs/include/kotlin-module.md | 10 ++++---- 4 files changed, 24 insertions(+), 18 deletions(-) diff --git a/.gitignore b/.gitignore index 024faf341..6f8f986cb 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,7 @@ out/ # Misc *.log *.graphml +*.salive # Mac .DS_Store diff --git a/TODO.md b/TODO.md index 37e7d7ff2..138fef6de 100644 --- a/TODO.md +++ b/TODO.md @@ -1,12 +1,5 @@ # 1.9.0 - - Fix nullability annotation problem https://github.com/jqwik-team/jqwik/issues/575 - Maybe with PR https://github.com/jqwik-team/jqwik/issues/575 - - - Upgrade to Kotlin 2.0 - - Fix type problems from K2 compiler - - Document differences between K1 and K2 in user guide - # 1.9.x diff --git a/documentation/build.gradle b/documentation/build.gradle index fb487c849..f4edb5984 100644 --- a/documentation/build.gradle +++ b/documentation/build.gradle @@ -1,3 +1,7 @@ +import org.jetbrains.kotlin.gradle.dsl.JvmTarget +import org.jetbrains.kotlin.gradle.dsl.KotlinVersion +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + plugins { id 'jqwik.common-configuration' } @@ -129,16 +133,22 @@ test { testLogging.showStandardStreams = true } -tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { - kotlinOptions.freeCompilerArgs = [ - "-Xemit-jvm-type-annotations" // Required for annotations on type variables - ] - kotlinOptions.jvmTarget = "${javaTargetVersion}" - kotlinOptions.javaParameters = true +tasks.withType(KotlinCompile).configureEach { + compilerOptions { + freeCompilerArgs = [ + "-Xemit-jvm-type-annotations" // Required for annotations on type variables + ] + apiVersion = KotlinVersion.KOTLIN_1_9 + languageVersion = KotlinVersion.KOTLIN_1_9 + javaParameters = true // Required to get correct parameter names in reporting + jvmTarget = JvmTarget.fromTarget("${javaTargetVersion}") + } } compileTestKotlin { - kotlinOptions.suppressWarnings = true + compilerOptions { + suppressWarnings = true + } } dependencies { diff --git a/documentation/src/docs/include/kotlin-module.md b/documentation/src/docs/include/kotlin-module.md index 11fc8cb20..35de963c1 100644 --- a/documentation/src/docs/include/kotlin-module.md +++ b/documentation/src/docs/include/kotlin-module.md @@ -52,12 +52,14 @@ tasks.withType().configureEach { } tasks.withType { - kotlinOptions { + compilerOptions { freeCompilerArgs = listOf( - "-Xemit-jvm-type-annotations" // Required for annotations on type variables + "-Xnullability-annotations=@org.jspecify.annotations:strict", + "-Xemit-jvm-type-annotations" // Enable annotations on type variables ) - jvmTarget = "11" // 1.8 or above - javaParameters = true // Required to get correct parameter names in reporting + apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0 + languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0 + javaParameters = true // Get correct parameter names in jqwik reporting } } ```