Skip to content

Reverted back to the "good" jdk 8 wherever possible #1101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,6 @@ so do familiarize yourself with the following guidelines.
* Note, any version above 21 should work in theory, but JDK 21 is the only version we test with,
so it is the recommended version.

* JDK == 11 referred to by the `JDK_11_0` environment variable or `gradle.properties`/`local.properties`.
* This is used for testing our compiler plugins.

* We recommend using [IntelliJ IDEA](https://www.jetbrains.com/idea/download/) as the IDE. This
has the best support for Kotlin, compiler plugins, Gradle, and [Kotlin Notebook](https://kotlinlang.org/docs/kotlin-notebook-overview.html) of course.

Expand Down
46 changes: 35 additions & 11 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -136,22 +136,46 @@ tasks.named<DependencyUpdatesTask>("dependencyUpdates").configure {
kotlin {
jvmToolchain(21)
compilerOptions {
jvmTarget = JvmTarget.JVM_11
jvmTarget = JvmTarget.JVM_1_8
}
}

// DataFrame targets Java 8 for maximum compatibility.
// This is, however, not always possible thanks to external dependencies.
// In those cases, we default to Java 11.
val modulesUsingJava11 = with(projects) {
setOf(
dataframeJupyter,
dataframeGeo,
examples.ideaExamples.titanic,
)
}.map { it.path }

allprojects {
tasks.withType<KotlinCompile> {
compilerOptions {
jvmTarget = JvmTarget.JVM_11
freeCompilerArgs.add("-Xjdk-release=11")
if (path in modulesUsingJava11) {
tasks.withType<KotlinCompile> {
compilerOptions {
jvmTarget = JvmTarget.JVM_11
freeCompilerArgs.add("-Xjdk-release=11")
}
}
tasks.withType<JavaCompile> {
sourceCompatibility = JavaVersion.VERSION_11.toString()
targetCompatibility = JavaVersion.VERSION_11.toString()
options.release.set(11)
}
} else {
tasks.withType<KotlinCompile> {
compilerOptions {
jvmTarget = JvmTarget.JVM_1_8
freeCompilerArgs.add("-Xjdk-release=8")
}
}
tasks.withType<JavaCompile> {
sourceCompatibility = JavaVersion.VERSION_1_8.toString()
targetCompatibility = JavaVersion.VERSION_1_8.toString()
options.release.set(8)
}
}

tasks.withType<JavaCompile> {
sourceCompatibility = JavaVersion.VERSION_11.toString()
targetCompatibility = JavaVersion.VERSION_11.toString()
options.release.set(11)
}

// Attempts to configure ktlint for each sub-project that uses the plugin
Expand Down
2 changes: 2 additions & 0 deletions dataframe-geo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ This module, published as `dataframe-geo`, contains all logic and tests for Data
with geographical data.

Experimental.

This module targets java 11 because of the restriction from `org.jetbrains.kotlin.jupyter`.
1 change: 1 addition & 0 deletions dataframe-jupyter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ This module is a friend module of [`:core`](../core) to be able to access intern
See [Get started with Kotlin DataFrame on Jupyter Notebook](https://kotlin.github.io/dataframe/gettingstartedjupyternotebook.html),
and [Usage with Kotlin Notebook Plugin](https://kotlin.github.io/dataframe/usage-with-kotlin-notebook-plugin.html).

This module targets java 11 because of the restriction from `org.jetbrains.kotlin.jupyter`.
17 changes: 16 additions & 1 deletion dataframe-openapi-generator/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
with(libs.plugins) {
alias(kotlin.jvm)
alias(publisher)
alias(serialization)
alias(kover)
alias(ktlint)
alias(jupyter.api)
alias(binary.compatibility.validator)
}
}
Expand Down Expand Up @@ -39,6 +40,7 @@ dependencies {
testImplementation(libs.kotestAssertions) {
exclude("org.jetbrains.kotlin", "kotlin-stdlib-jdk8")
}
testImplementation(libs.kotlin.jupyter.test.kit)
}

kotlinPublications {
Expand All @@ -53,3 +55,16 @@ kotlinPublications {
kotlin {
explicitApi()
}

// uses jupyter for testing, so requires java 11 for that
tasks.compileTestKotlin {
compilerOptions {
jvmTarget = JvmTarget.JVM_11
freeCompilerArgs.add("-Xjdk-release=11")
}
}
tasks.compileTestJava {
sourceCompatibility = JavaVersion.VERSION_11.toString()
targetCompatibility = JavaVersion.VERSION_11.toString()
options.release.set(11)
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.jetbrains.kotlinx.dataframe.io

import org.jetbrains.kotlinx.dataframe.annotations.DataSchema
import org.jetbrains.kotlinx.dataframe.codeGen.Code
import org.jetbrains.kotlinx.dataframe.codeGen.DefaultReadDfMethod
import org.jetbrains.kotlinx.jupyter.api.Code
import java.io.File
import java.io.InputStream

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import org.jetbrains.kotlinx.dataframe.DataFrame
import org.jetbrains.kotlinx.dataframe.DataRow
import org.jetbrains.kotlinx.dataframe.annotations.DataSchema
import org.jetbrains.kotlinx.dataframe.api.JsonPath
import org.jetbrains.kotlinx.dataframe.codeGen.Code
import org.jetbrains.kotlinx.dataframe.codeGen.CodeGenerator
import org.jetbrains.kotlinx.dataframe.codeGen.FieldType
import org.jetbrains.kotlinx.dataframe.codeGen.GeneratedField
Expand All @@ -23,7 +24,6 @@ import org.jetbrains.kotlinx.dataframe.codeGen.isNullable
import org.jetbrains.kotlinx.dataframe.codeGen.name
import org.jetbrains.kotlinx.dataframe.codeGen.toNotNullable
import org.jetbrains.kotlinx.dataframe.codeGen.toNullable
import org.jetbrains.kotlinx.jupyter.api.Code
import kotlin.reflect.typeOf

/** Parse and read OpenApi specification to [DataSchema] interfaces. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import org.intellij.lang.annotations.Language
import org.jetbrains.kotlinx.dataframe.AnyFrame
import org.jetbrains.kotlinx.dataframe.api.isNotEmpty
import org.jetbrains.kotlinx.dataframe.api.schema
import org.jetbrains.kotlinx.dataframe.codeGen.Code
import org.jetbrains.kotlinx.dataframe.codeGen.ValidFieldName
import org.jetbrains.kotlinx.dataframe.io.OpenApi
import org.jetbrains.kotlinx.jupyter.api.Code
import org.jetbrains.kotlinx.jupyter.testkit.JupyterReplTestCase
import org.junit.Test
import java.io.File
Expand Down
2 changes: 1 addition & 1 deletion examples/idea-examples/json/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dependencies {
}

tasks.withType<KotlinCompile> {
compilerOptions.jvmTarget = JvmTarget.JVM_11
compilerOptions.jvmTarget = JvmTarget.JVM_1_8
}

dataframes {
Expand Down
2 changes: 1 addition & 1 deletion examples/idea-examples/movies/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ dependencies {
}

tasks.withType<KotlinCompile> {
compilerOptions.jvmTarget = JvmTarget.JVM_11
compilerOptions.jvmTarget = JvmTarget.JVM_1_8
}
2 changes: 2 additions & 0 deletions examples/idea-examples/titanic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ application.mainClass = "org.jetbrains.kotlinx.dataframe.examples.titanic.ml.Tit
dependencies {
// implementation("org.jetbrains.kotlinx:dataframe:X.Y.Z")
implementation(project(":"))

// note: needs to target java 11 for these dependencies
implementation("org.jetbrains.kotlinx:kotlin-deeplearning-api:0.5.2")
implementation("org.jetbrains.kotlinx:kotlin-deeplearning-impl:0.5.2")
implementation("org.jetbrains.kotlinx:kotlin-deeplearning-tensorflow:0.5.2")
Expand Down
2 changes: 1 addition & 1 deletion examples/idea-examples/youtube/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ dependencies {
}

tasks.withType<KotlinCompile> {
compilerOptions.jvmTarget = JvmTarget.JVM_11
compilerOptions.jvmTarget = JvmTarget.JVM_1_8
}

11 changes: 0 additions & 11 deletions plugins/dataframe-gradle-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
`kotlin-dsl`
`java-gradle-plugin`
Expand Down Expand Up @@ -90,15 +88,6 @@ gradlePlugin {
}
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
compilerOptions.jvmTarget = JvmTarget.JVM_11
}

tasks.withType<JavaCompile>().all {
sourceCompatibility = JavaVersion.VERSION_11.toString()
targetCompatibility = JavaVersion.VERSION_11.toString()
}

sourceSets {
val main by getting
val test by getting
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ConvenienceSchemaGeneratorPlugin : Plugin<Project> {
// regardless whether we add KSP or the user adds it, when it's added,
// configure it to depend on symbol-processor-all
target.plugins.whenPluginAdded {
if ("com.google.devtools.ksp" in this.javaClass.packageName) {
if (this::class.qualifiedName?.contains("com.google.devtools.ksp") == true) {
val isMultiplatform by lazy {
when {
target.plugins.hasPlugin("org.jetbrains.kotlin.jvm") -> false
Expand Down
5 changes: 0 additions & 5 deletions plugins/expressions-converter/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ dependencies {

tasks.test {
useJUnitPlatform()
// gets the path to JDK 11 either from gradle.properties or from the system property, defaulting to java.home
environment(
"JDK_11_0",
project.properties["JDK_11_0"] ?: System.getProperty("JDK_11_0", System.getProperty("java.home")),
)
doFirst {
setLibraryProperty("org.jetbrains.kotlin.test.kotlin-stdlib", "kotlin-stdlib")
setLibraryProperty("org.jetbrains.kotlin.test.kotlin-reflect", "kotlin-reflect")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ open class AbstractExplainerBlackBoxCodegenTest : BaseTestRunner() {
override fun TestConfigurationBuilder.configuration() {
globalDefaults {
frontend = FrontendKinds.ClassicAndFIR
targetPlatform = JvmPlatforms.jvm11
targetPlatform = JvmPlatforms.jvm8
dependencyKind = DependencyKind.Binary
targetBackend = TargetBackend.JVM_IR
}
defaultDirectives {
JvmEnvironmentConfigurationDirectives.JDK_KIND with TestJdkKind.FULL_JDK_11
JvmEnvironmentConfigurationDirectives.JVM_TARGET with JvmTarget.JVM_11
JvmEnvironmentConfigurationDirectives.JDK_KIND with TestJdkKind.FULL_JDK
JvmEnvironmentConfigurationDirectives.JVM_TARGET with JvmTarget.JVM_1_8
+JvmEnvironmentConfigurationDirectives.WITH_REFLECT
}
facadeStep(::ClassicFrontendFacade)
Expand Down
10 changes: 5 additions & 5 deletions plugins/keywords-generator/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ dependencies {
kotlin {
jvmToolchain(21)
compilerOptions {
jvmTarget = JvmTarget.JVM_11
freeCompilerArgs.add("-Xjdk-release=11")
jvmTarget = JvmTarget.JVM_1_8
freeCompilerArgs.add("-Xjdk-release=8")
}
}

tasks.withType<JavaCompile> {
sourceCompatibility = JavaVersion.VERSION_11.toString()
targetCompatibility = JavaVersion.VERSION_11.toString()
options.release.set(11)
sourceCompatibility = JavaVersion.VERSION_1_8.toString()
targetCompatibility = JavaVersion.VERSION_1_8.toString()
options.release.set(8)
}

gradlePlugin {
Expand Down
14 changes: 4 additions & 10 deletions plugins/kotlin-dataframe/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,6 @@ tasks.test {
useJUnitPlatform()
jvmArgs("-Xmx2G")
environment("TEST_RESOURCES", project.layout.projectDirectory)

// gets the path to JDK 11 either from gradle.properties or from the system property, defaulting to java.home
environment(
"JDK_11_0",
project.properties["JDK_11_0"] ?: System.getProperty("JDK_11_0", System.getProperty("java.home")),
)
doFirst {
setLibraryProperty("org.jetbrains.kotlin.test.kotlin-stdlib", "kotlin-stdlib")
setLibraryProperty("org.jetbrains.kotlin.test.kotlin-reflect", "kotlin-reflect")
Expand All @@ -86,21 +80,21 @@ tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach
}

tasks.withType<JavaCompile> {
sourceCompatibility = JavaVersion.VERSION_11.toString()
targetCompatibility = JavaVersion.VERSION_11.toString()
sourceCompatibility = JavaVersion.VERSION_1_8.toString()
targetCompatibility = JavaVersion.VERSION_1_8.toString()
}

tasks.compileKotlin {
compilerOptions {
languageVersion = KotlinVersion.KOTLIN_2_0
jvmTarget = JvmTarget.JVM_11
jvmTarget = JvmTarget.JVM_1_8
}
}

tasks.compileTestKotlin {
compilerOptions {
languageVersion = KotlinVersion.KOTLIN_2_0
jvmTarget = JvmTarget.JVM_11
jvmTarget = JvmTarget.JVM_1_8
}
}

Expand Down
4 changes: 0 additions & 4 deletions plugins/kotlin-dataframe/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
kotlin.code.style=official
kotlinVersion=2.0.20

# Optionally, you can set this property to point to your JDK 11 installation.
# This version is used to run the box/diagnostics tests.
# JDK_11_0=/path/to/jdk_11
Loading