Skip to content

Commit 33729ee

Browse files
authored
Prep for Kotlin 2.1.0 (#288)
1 parent e01f833 commit 33729ee

File tree

10 files changed

+42
-21
lines changed

10 files changed

+42
-21
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
uses: actions/setup-java@v4
3333
with:
3434
distribution: 'zulu'
35-
java-version: '21'
35+
java-version: '22'
3636

3737
- name: Check
3838
run: ./gradlew check

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
Changelog
22
=========
33

4+
**Unreleased**
5+
--------------
6+
7+
- Remove `irOnly` option from `KotlinJsCompilation`.
8+
- Default to the current language/api version if one isn't specified in KSP2 invocations.
9+
- Update to Kotlin `2.1.0`.
10+
- Update to KSP `2.1.0-1.0.29`.
11+
412
0.6.0
513
-----
614

build.gradle.kts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
11
import com.vanniktech.maven.publish.MavenPublishBaseExtension
2+
import org.jetbrains.dokka.gradle.DokkaExtension
23
import org.jetbrains.dokka.gradle.DokkaTask
34
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
45
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
56

67
plugins {
78
alias(libs.plugins.kotlin.jvm) apply false
8-
alias(libs.plugins.dokka) apply false
9+
alias(libs.plugins.dokka)
910
alias(libs.plugins.mavenPublish) apply false
1011
}
1112

13+
dokka {
14+
dokkaPublications.html {
15+
outputDirectory.set(rootDir.resolve("docs/api/0.x"))
16+
includes.from(project.layout.projectDirectory.file("README.md"))
17+
}
18+
}
19+
1220
subprojects {
1321
pluginManager.withPlugin("java") {
14-
configure<JavaPluginExtension> { toolchain { languageVersion.set(JavaLanguageVersion.of(21)) } }
22+
configure<JavaPluginExtension> { toolchain { languageVersion.set(JavaLanguageVersion.of(22)) } }
1523

1624
tasks.withType<JavaCompile>().configureEach { options.release.set(8) }
1725
}
@@ -45,8 +53,8 @@ subprojects {
4553
pluginManager.withPlugin("com.vanniktech.maven.publish") {
4654
apply(plugin = "org.jetbrains.dokka")
4755

48-
tasks.withType<DokkaTask>().configureEach {
49-
outputDirectory.set(rootDir.resolve("../docs/0.x"))
56+
configure<DokkaExtension> {
57+
dokkaPublicationDirectory.set(layout.buildDirectory.dir("dokkaDir"))
5058
dokkaSourceSets.configureEach {
5159
skipDeprecated.set(true)
5260
}
@@ -58,3 +66,8 @@ subprojects {
5866
}
5967
}
6068
}
69+
70+
dependencies {
71+
dokka(projects.core)
72+
dokka(projects.ksp)
73+
}

core/build.gradle.kts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ dependencies {
4646
tasks.withType<KotlinCompile>().configureEach {
4747
val isTest = name.contains("test", ignoreCase = true)
4848
compilerOptions {
49-
freeCompilerArgs.add(
50-
// https://github.com/tschuchortdev/kotlin-compile-testing/pull/63
51-
"-Xno-optimized-callable-references"
52-
)
5349
if (isTest) {
5450
optIn.add("org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi")
5551
}

core/src/main/kotlin/com/tschuchort/compiletesting/KotlinJsCompilation.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ class KotlinJsCompilation : AbstractKotlinCompilation<K2JSCompilerArguments>() {
3030
/** Print declarations' reachability info to stdout during performing DCE */
3131
var irDcePrintReachabilityInfo: Boolean = false
3232

33-
/** Disables pre-IR backend */
34-
var irOnly: Boolean = true
35-
3633
/** Specify a compilation module name for IR backend */
3734
var irModuleName: String? = null
3835

@@ -77,7 +74,6 @@ class KotlinJsCompilation : AbstractKotlinCompilation<K2JSCompilerArguments>() {
7774
args.irProduceJs = irProduceJs
7875
args.irDce = irDce
7976
args.irDcePrintReachabilityInfo = irDcePrintReachabilityInfo
80-
args.irOnly = irOnly
8177
args.moduleName = moduleName
8278
args.irModuleName = irModuleName
8379
args.generateDts = generateDts

gradle.properties

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@ kapt.include.compile.classpath=false
44

55
systemProp.kct.test.useKsp2=true
66

7+
# Dokka flags
8+
org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
9+
org.jetbrains.dokka.experimental.gradle.pluginMode.noWarn=true
10+
711
GROUP=dev.zacsweers.kctfork
8-
VERSION_NAME=1.0.0-SNAPSHOT
12+
VERSION_NAME=0.7.0-SNAPSHOT
913
POM_DESCRIPTION=A library that enables testing of Kotlin annotation processors, compiler plugins and code generation.
1014
POM_INCEPTION_YEAR=2019
1115
POM_URL=https\://github.com/zacsweers/kotlin-compile-testing

gradle/libs.versions.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
[versions]
22
idea = "242.8057" # (see https://plugins.jetbrains.com/docs/intellij/android-studio-releases-list.html)
3-
kotlin = "2.0.21"
3+
kotlin = "2.1.0"
44
kotlinpoet = "2.0.0"
5-
ksp = "2.0.21-1.0.28"
5+
ksp = "2.1.0-1.0.29"
66

77
[plugins]
88
buildconfig = { id = "com.github.gmazzo.buildconfig", version = "3.1.0" }
99
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
10-
dokka = { id = "org.jetbrains.dokka", version = "1.9.20" }
10+
dokka = { id = "org.jetbrains.dokka", version = "2.0.0-Beta" }
1111
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
1212
mavenPublish = { id = "com.vanniktech.maven.publish", version = "0.30.0" }
1313

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

ksp/src/main/kotlin/com/tschuchort/compiletesting/Ksp2.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ class Ksp2PrecursorTool : PrecursorTool, KspTool {
5050

5151
jvmTarget = compilation.jvmTarget
5252
jdkHome = compilation.jdkHome
53-
languageVersion = compilation.languageVersion ?: "2.0"
54-
apiVersion = compilation.apiVersion ?: "2.0"
53+
languageVersion = compilation.languageVersion ?: KotlinVersion.CURRENT.languageVersion()
54+
apiVersion = compilation.apiVersion ?: KotlinVersion.CURRENT.languageVersion()
5555

5656
// TODO adopt new roots model
5757
moduleName = compilation.moduleName ?: "main"
@@ -118,6 +118,10 @@ class Ksp2PrecursorTool : PrecursorTool, KspTool {
118118
}
119119
}
120120

121+
private fun KotlinVersion.languageVersion(): String {
122+
return "$major.$minor"
123+
}
124+
121125
/** Enables KSP2. */
122126
@OptIn(ExperimentalCompilerApi::class)
123127
fun KotlinCompilation.useKsp2() {

release.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ git commit -am "Prepare for release $NEW_VERSION."
1919
git tag -a "$NEW_VERSION" -m "Version $NEW_VERSION"
2020

2121
# Publish
22-
./gradlew publish -x dokkaHtml
22+
./gradlew publish --no-configuration-cache
2323

2424
# Prepare next snapshot
2525
echo "Restoring snapshot version $SNAPSHOT_VERSION"

0 commit comments

Comments
 (0)