Skip to content

Commit 2411386

Browse files
authored
Merge pull request #1286 from Kotlin/kotlin-2.2
Kotlin 2.2
2 parents 3302243 + e1fc6a4 commit 2411386

File tree

19 files changed

+235
-135
lines changed

19 files changed

+235
-135
lines changed

build.gradle.kts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@ plugins {
2222
alias(dokka)
2323
// alias(kover)
2424
alias(ktlint)
25-
alias(korro) apply false
26-
alias(kodex) apply false
25+
26+
// TODO cannot define korro and kodex here due to leaking them kotlin-compiler-embeddable into the build classpath
27+
// alias(korro) apply false
28+
// alias(kodex) apply false
29+
2730
alias(simpleGit) apply false
2831
alias(dependencyVersions)
2932
alias(buildconfig) apply false
@@ -155,6 +158,7 @@ val modulesUsingJava11 = with(projects) {
155158
dataframeGeo,
156159
examples.ideaExamples.titanic,
157160
tests,
161+
plugins.dataframeGradlePlugin,
158162
)
159163
}.map { it.path }
160164

@@ -204,6 +208,7 @@ allprojects {
204208
configure<BuildConfigExtension> {
205209
packageName = "org.jetbrains.kotlinx.dataframe"
206210
className = "BuildConfig"
211+
buildConfigField("KOTLIN_VERSION", libs.versions.kotlin.asProvider().get())
207212
buildConfigField("VERSION", "${project.version}")
208213
buildConfigField("DEBUG", findProperty("kotlin.dataframe.debug")?.toString()?.toBoolean() ?: false)
209214
}

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/groupBy.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,5 @@ public class ReducedGroupBy<T, G>(
115115
}
116116

117117
@PublishedApi
118-
internal fun <T, G> GroupBy<T, G>.reduce(reducer: Selector<DataFrame<G>, DataRow<G>?>) = ReducedGroupBy(this, reducer)
118+
internal fun <T, G> GroupBy<T, G>.reduce(reducer: Selector<DataFrame<G>, DataRow<G>?>): ReducedGroupBy<T, G> =
119+
ReducedGroupBy(this, reducer)

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/pivot.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,8 @@ public class ReducedPivot<T>(
268268
}
269269

270270
@PublishedApi
271-
internal fun <T> Pivot<T>.reduce(reducer: Selector<DataFrame<T>, DataRow<T>?>) = ReducedPivot(this, reducer)
271+
internal fun <T> Pivot<T>.reduce(reducer: Selector<DataFrame<T>, DataRow<T>?>): ReducedPivot<T> =
272+
ReducedPivot(this, reducer)
272273

273274
@PublishedApi
274275
internal inline fun <T> Pivot<T>.delegate(crossinline body: PivotGroupBy<T>.() -> DataFrame<T>): DataRow<T> =

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/io/html.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ public fun <T> DataFrame<T>.toHTML(
533533
configuration: DisplayConfiguration = DisplayConfiguration.DEFAULT,
534534
cellRenderer: CellRenderer = DefaultCellRenderer,
535535
getFooter: (DataFrame<T>) -> String? = { "DataFrame [${it.size}]" },
536-
) = toHtml(configuration, cellRenderer, getFooter)
536+
): DataFrameHtmlData = toHtml(configuration, cellRenderer, getFooter)
537537

538538
@Deprecated(TO_STANDALONE_HTML, ReplaceWith(TO_STANDALONE_HTML_REPLACE), DeprecationLevel.ERROR)
539539
public fun <T> DataFrame<T>.toStandaloneHTML(

dataframe-arrow/api/dataframe-arrow.api

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,15 @@ public abstract interface class org/jetbrains/kotlinx/dataframe/io/ArrowWriter :
5353
public abstract fun getMismatchSubscriber ()Lkotlin/jvm/functions/Function1;
5454
public abstract fun getMode ()Lorg/jetbrains/kotlinx/dataframe/io/ArrowWriter$Mode;
5555
public abstract fun getTargetSchema ()Lorg/apache/arrow/vector/types/pojo/Schema;
56-
public abstract fun saveArrowFeatherToByteArray ()[B
57-
public abstract fun saveArrowIPCToByteArray ()[B
58-
public abstract fun writeArrowFeather (Ljava/io/File;)V
59-
public abstract fun writeArrowFeather (Ljava/io/OutputStream;)V
60-
public abstract fun writeArrowFeather (Ljava/nio/channels/WritableByteChannel;)V
61-
public abstract fun writeArrowIPC (Ljava/io/File;Z)V
62-
public abstract fun writeArrowIPC (Ljava/io/OutputStream;)V
63-
public abstract fun writeArrowIPC (Ljava/nio/channels/WritableByteChannel;)V
56+
public fun saveArrowFeatherToByteArray ()[B
57+
public fun saveArrowIPCToByteArray ()[B
58+
public fun writeArrowFeather (Ljava/io/File;)V
59+
public fun writeArrowFeather (Ljava/io/OutputStream;)V
60+
public fun writeArrowFeather (Ljava/nio/channels/WritableByteChannel;)V
61+
public fun writeArrowIPC (Ljava/io/File;Z)V
62+
public fun writeArrowIPC (Ljava/io/OutputStream;)V
63+
public fun writeArrowIPC (Ljava/nio/channels/WritableByteChannel;)V
64+
public static synthetic fun writeArrowIPC$default (Lorg/jetbrains/kotlinx/dataframe/io/ArrowWriter;Ljava/io/File;ZILjava/lang/Object;)V
6465
}
6566

6667
public final class org/jetbrains/kotlinx/dataframe/io/ArrowWriter$Companion {

gradle.properties

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ version=1.0.0
33
jupyterApiTCRepo=
44
kotlin.jupyter.add.scanner=false
55
org.gradle.jvmargs=-Xmx4G -Duser.language=en -Duser.country=US -Dfile.encoding=UTF-8
6+
67
# build.number.detection=false
78
# build.number=0.8.0
89

@@ -12,6 +13,9 @@ org.gradle.jvmargs=-Xmx4G -Duser.language=en -Duser.country=US -Dfile.encoding=U
1213
# KSP plugin in the modules that use it.
1314
kotlin.dataframe.add.ksp=false
1415

16+
# We don't support ksp2
17+
ksp.useKSP2=false
18+
1519
# Enables debug mode for dataframe.
1620
# This can make certain tests and checks run that should not be run in production.
1721
# It can also be turned on from the command line with `-Pkotlin.dataframe.debug=true`

gradle/libs.versions.toml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
[versions]
2-
ksp = "2.0.20-1.0.24"
3-
kotlinJupyter = "0.12.0-383"
2+
ksp = "2.2.0-2.0.2"
3+
kotlinJupyter = "0.13.0-481-1"
44

55
ktlint = "12.3.0"
66

77
# make sure to sync both manually with :generator module
8-
kotlin = "2.0.20" # needs jupyter compatibility with Kotlin 2.1 to update
9-
kotlinpoet = "1.18.1"
8+
kotlin = "2.2.0" # needs jupyter compatibility with Kotlin 2.1 to update
9+
kotlinpoet = "2.2.0"
1010

11-
dokka = "1.9.20"
12-
libsPublisher = "1.9.23-dev-45"
11+
dokka = "2.0.0"
12+
libsPublisher = "2.2.0-rc3-dev-57"
1313

1414
# "Bootstrap" version of the dataframe, used in the build itself to generate @DataSchema APIs,
1515
# dogfood Gradle / KSP plugins in tests and idea-examples modules
@@ -48,14 +48,14 @@ jsoup = "1.18.3"
4848
arrow = "18.1.0"
4949
kodex = "0.4.4"
5050
simpleGit = "2.2.1"
51-
dependencyVersions = "0.51.0"
51+
dependencyVersions = "0.52.0"
5252
plugin-publish = "1.3.0"
5353
shadow = "8.3.5"
5454
android-gradle-api = "7.3.1" # need to revise our tests to update
5555
ktor = "3.0.1" # needs jupyter compatibility with Kotlin 2.1 to update
56-
kotlin-compile-testing = "1.6.0"
56+
kotlin-compile-testing = "0.7.1"
5757
duckdb = "1.1.3"
58-
buildconfig = "5.5.1"
58+
buildconfig = "5.6.7"
5959
benchmark = "0.4.12"
6060

6161
geotools = "32.1"
@@ -152,8 +152,8 @@ android-gradle = { group = "com.android.tools.build", name = "gradle", version.r
152152
kotlin-gradle-plugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin" }
153153
kotlin-gradle-plugin-api = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin-api" }
154154
ktor-server-netty = { group = "io.ktor", name = "ktor-server-netty", version.ref = "ktor" }
155-
kotlin-compile-testing = { group = "com.github.tschuchortdev", name = "kotlin-compile-testing", version.ref = "kotlin-compile-testing" }
156-
kotlin-compile-testing-ksp = { group = "com.github.tschuchortdev", name = "kotlin-compile-testing-ksp", version.ref = "kotlin-compile-testing" }
155+
kotlin-compile-testing = { group = "dev.zacsweers.kctfork", name = "core", version.ref = "kotlin-compile-testing" }
156+
kotlin-compile-testing-ksp = { group = "dev.zacsweers.kctfork", name = "ksp", version.ref = "kotlin-compile-testing" }
157157
kotlin-compiler = { group = "org.jetbrains.kotlin", name = "kotlin-compiler", version.ref = "kotlin" }
158158
kotlin-compiler-embeddable = { group = "org.jetbrains.kotlin", name = "kotlin-compiler-embeddable", version.ref = "kotlin" }
159159
kotlin-compiler-internal-test-framework = { group = "org.jetbrains.kotlin", name = "kotlin-compiler-internal-test-framework", version.ref = "kotlin" }

plugins/dataframe-gradle-plugin/build.gradle.kts

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
plugins {
22
`kotlin-dsl`
3-
`java-gradle-plugin`
43
`maven-publish`
5-
alias(libs.plugins.plugin.publish)
6-
alias(libs.plugins.ktlint)
4+
with(libs.plugins) {
5+
alias(buildconfig)
6+
alias(plugin.publish)
7+
alias(ktlint)
8+
}
79
}
810

911
repositories {
@@ -14,26 +16,34 @@ repositories {
1416

1517
group = "org.jetbrains.kotlinx.dataframe"
1618

19+
buildscript {
20+
dependencies {
21+
classpath(embeddedKotlin("gradle-plugin"))
22+
}
23+
}
24+
1725
dependencies {
1826
api(libs.kotlin.reflect)
1927
implementation(projects.dataframe)
2028
// experimental
2129
implementation(projects.dataframeOpenapiGenerator)
2230

31+
compileOnly(embeddedKotlin("gradle-plugin"))
2332
implementation(libs.kotlin.gradle.plugin.api)
24-
implementation(libs.kotlin.gradle.plugin)
2533
implementation(libs.serialization.core)
2634
implementation(libs.serialization.json)
2735
implementation(libs.ksp.gradle)
2836
implementation(libs.ksp.api)
2937

30-
testImplementation(libs.junit)
38+
testImplementation(gradleTestKit())
39+
testImplementation(embeddedKotlin("test"))
40+
testImplementation(embeddedKotlin("test-junit"))
3141
testImplementation(libs.kotestAssertions)
3242
testImplementation(libs.android.gradle.api)
3343
testImplementation(libs.android.gradle)
44+
testImplementation(embeddedKotlin("gradle-plugin"))
3445
testImplementation(libs.ktor.server.netty)
3546
testImplementation(libs.h2db)
36-
testImplementation(gradleApi())
3747
}
3848

3949
tasks.withType<ProcessResources> {
@@ -100,7 +110,11 @@ val integrationTestConfiguration by configurations.creating {
100110
extendsFrom(configurations.testImplementation.get())
101111
}
102112

103-
val integrationTestTask = task<Test>("integrationTest") {
113+
tasks.pluginUnderTestMetadata {
114+
pluginClasspath.from(integrationTestConfiguration)
115+
}
116+
117+
val integrationTestTask = tasks.register<Test>("integrationTest") {
104118
dependsOn(":plugins:symbol-processor:publishToMavenLocal")
105119
dependsOn(":dataframe-arrow:publishToMavenLocal")
106120
dependsOn(":dataframe-excel:publishToMavenLocal")
@@ -126,3 +140,14 @@ val integrationTestTask = task<Test>("integrationTest") {
126140
}
127141

128142
tasks.check { dependsOn(integrationTestTask) }
143+
144+
// fixing linter + buildConfig
145+
kotlin.sourceSets.create("buildConfigSources") {
146+
kotlin.srcDir("build/generated/sources/buildConfig/main")
147+
}
148+
tasks.generateBuildConfig {
149+
finalizedBy("runKtlintFormatOverBuildConfigSourcesSourceSet")
150+
}
151+
tasks.named("runKtlintCheckOverBuildConfigSourcesSourceSet") {
152+
dependsOn(tasks.generateBuildConfig, "runKtlintFormatOverBuildConfigSourcesSourceSet")
153+
}

plugins/dataframe-gradle-plugin/src/main/kotlin/org/jetbrains/dataframe/gradle/SchemaGeneratorPlugin.kt

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package org.jetbrains.dataframe.gradle
22

3+
import com.google.devtools.ksp.gradle.KspAATask
4+
import com.google.devtools.ksp.gradle.KspTask
35
import com.google.devtools.ksp.gradle.KspTaskJvm
46
import org.gradle.api.Plugin
57
import org.gradle.api.Project
@@ -8,13 +10,12 @@ import org.gradle.api.logging.LogLevel
810
import org.gradle.api.tasks.TaskProvider
911
import org.gradle.internal.logging.services.DefaultLoggingManager
1012
import org.gradle.kotlin.dsl.create
11-
import org.gradle.kotlin.dsl.withType
1213
import org.jetbrains.kotlin.gradle.dsl.ExplicitApiMode
1314
import org.jetbrains.kotlin.gradle.dsl.KotlinAndroidProjectExtension
1415
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
1516
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
1617
import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension
17-
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
18+
import org.jetbrains.kotlin.gradle.tasks.BaseKotlinCompile
1819
import java.io.File
1920
import java.net.URL
2021
import java.nio.file.Path
@@ -43,10 +44,16 @@ class SchemaGeneratorPlugin : Plugin<Project> {
4344
group = GROUP
4445
dependsOn(*generationTasks.toTypedArray())
4546
}
46-
tasks.withType(KspTaskJvm::class.java).configureEach {
47+
tasks.withType(KspTask::class.java).configureEach {
4748
dependsOn(generateAll)
49+
dependsOn(*generationTasks.toTypedArray())
50+
}
51+
tasks.withType(KspAATask::class.java).configureEach {
52+
error(
53+
"Detected KSP2. This is not supported by the DataFrame Gradle/Ksp plugin. Add 'ksp.useKSP2=false' to 'gradle.properties'.",
54+
)
4855
}
49-
tasks.withType<KotlinCompile> {
56+
tasks.withType(BaseKotlinCompile::class.java).configureEach {
5057
dependsOn(generateAll)
5158
}
5259
}

plugins/dataframe-gradle-plugin/src/test/kotlin/org/jetbrains/dataframe/gradle/GradleRunnerDsl.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ fun runGradleBuild(
1616
buildFile.writeText(build(buildDir))
1717
val settingsFile = File(buildDir, "settings.gradle.kts")
1818
settingsFile.writeText(settingsGradle(buildDir))
19+
val propertiesFile = File(buildDir, "gradle.properties")
20+
propertiesFile.writeText("ksp.useKSP2=false")
1921
return Build(buildDir, gradleRunner(buildDir, task).build())
2022
}
2123

0 commit comments

Comments
 (0)