Skip to content

Commit 76dd759

Browse files
authored
Merge pull request #1101 from Kotlin/java-8
Reverted back to the "good" jdk 8 wherever possible
2 parents 9028567 + 3db7fde commit 76dd759

File tree

24 files changed

+130
-104
lines changed

24 files changed

+130
-104
lines changed

CONTRIBUTING.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,6 @@ so do familiarize yourself with the following guidelines.
9090
* Note, any version above 21 should work in theory, but JDK 21 is the only version we test with,
9191
so it is the recommended version.
9292

93-
* JDK == 11 referred to by the `JDK_11_0` environment variable or `gradle.properties`/`local.properties`.
94-
* This is used for testing our compiler plugins.
95-
9693
* We recommend using [IntelliJ IDEA](https://www.jetbrains.com/idea/download/) as the IDE. This
9794
has the best support for Kotlin, compiler plugins, Gradle, and [Kotlin Notebook](https://kotlinlang.org/docs/kotlin-notebook-overview.html) of course.
9895

build.gradle.kts

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -136,22 +136,46 @@ tasks.named<DependencyUpdatesTask>("dependencyUpdates").configure {
136136
kotlin {
137137
jvmToolchain(21)
138138
compilerOptions {
139-
jvmTarget = JvmTarget.JVM_11
139+
jvmTarget = JvmTarget.JVM_1_8
140140
}
141141
}
142142

143+
// DataFrame targets Java 8 for maximum compatibility.
144+
// This is, however, not always possible thanks to external dependencies.
145+
// In those cases, we default to Java 11.
146+
val modulesUsingJava11 = with(projects) {
147+
setOf(
148+
dataframeJupyter,
149+
dataframeGeo,
150+
examples.ideaExamples.titanic,
151+
)
152+
}.map { it.path }
153+
143154
allprojects {
144-
tasks.withType<KotlinCompile> {
145-
compilerOptions {
146-
jvmTarget = JvmTarget.JVM_11
147-
freeCompilerArgs.add("-Xjdk-release=11")
155+
if (path in modulesUsingJava11) {
156+
tasks.withType<KotlinCompile> {
157+
compilerOptions {
158+
jvmTarget = JvmTarget.JVM_11
159+
freeCompilerArgs.add("-Xjdk-release=11")
160+
}
161+
}
162+
tasks.withType<JavaCompile> {
163+
sourceCompatibility = JavaVersion.VERSION_11.toString()
164+
targetCompatibility = JavaVersion.VERSION_11.toString()
165+
options.release.set(11)
166+
}
167+
} else {
168+
tasks.withType<KotlinCompile> {
169+
compilerOptions {
170+
jvmTarget = JvmTarget.JVM_1_8
171+
freeCompilerArgs.add("-Xjdk-release=8")
172+
}
173+
}
174+
tasks.withType<JavaCompile> {
175+
sourceCompatibility = JavaVersion.VERSION_1_8.toString()
176+
targetCompatibility = JavaVersion.VERSION_1_8.toString()
177+
options.release.set(8)
148178
}
149-
}
150-
151-
tasks.withType<JavaCompile> {
152-
sourceCompatibility = JavaVersion.VERSION_11.toString()
153-
targetCompatibility = JavaVersion.VERSION_11.toString()
154-
options.release.set(11)
155179
}
156180

157181
// Attempts to configure ktlint for each sub-project that uses the plugin

dataframe-geo/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ This module, published as `dataframe-geo`, contains all logic and tests for Data
44
with geographical data.
55

66
Experimental.
7+
8+
This module targets java 11 because of the restriction from `org.jetbrains.kotlin.jupyter`.

dataframe-jupyter/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ This module is a friend module of [`:core`](../core) to be able to access intern
1313
See [Get started with Kotlin DataFrame on Jupyter Notebook](https://kotlin.github.io/dataframe/gettingstartedjupyternotebook.html),
1414
and [Usage with Kotlin Notebook Plugin](https://kotlin.github.io/dataframe/usage-with-kotlin-notebook-plugin.html).
1515

16+
This module targets java 11 because of the restriction from `org.jetbrains.kotlin.jupyter`.

dataframe-openapi-generator/build.gradle.kts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
2+
13
plugins {
24
with(libs.plugins) {
35
alias(kotlin.jvm)
46
alias(publisher)
57
alias(serialization)
68
alias(kover)
79
alias(ktlint)
8-
alias(jupyter.api)
910
alias(binary.compatibility.validator)
1011
}
1112
}
@@ -39,6 +40,7 @@ dependencies {
3940
testImplementation(libs.kotestAssertions) {
4041
exclude("org.jetbrains.kotlin", "kotlin-stdlib-jdk8")
4142
}
43+
testImplementation(libs.kotlin.jupyter.test.kit)
4244
}
4345

4446
kotlinPublications {
@@ -53,3 +55,16 @@ kotlinPublications {
5355
kotlin {
5456
explicitApi()
5557
}
58+
59+
// uses jupyter for testing, so requires java 11 for that
60+
tasks.compileTestKotlin {
61+
compilerOptions {
62+
jvmTarget = JvmTarget.JVM_11
63+
freeCompilerArgs.add("-Xjdk-release=11")
64+
}
65+
}
66+
tasks.compileTestJava {
67+
sourceCompatibility = JavaVersion.VERSION_11.toString()
68+
targetCompatibility = JavaVersion.VERSION_11.toString()
69+
options.release.set(11)
70+
}

dataframe-openapi-generator/src/main/kotlin/org/jetbrains/kotlinx/dataframe/io/OpenApi.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package org.jetbrains.kotlinx.dataframe.io
22

33
import org.jetbrains.kotlinx.dataframe.annotations.DataSchema
4+
import org.jetbrains.kotlinx.dataframe.codeGen.Code
45
import org.jetbrains.kotlinx.dataframe.codeGen.DefaultReadDfMethod
5-
import org.jetbrains.kotlinx.jupyter.api.Code
66
import java.io.File
77
import java.io.InputStream
88

dataframe-openapi-generator/src/main/kotlin/org/jetbrains/kotlinx/dataframe/io/readOpenapi.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import org.jetbrains.kotlinx.dataframe.DataFrame
1212
import org.jetbrains.kotlinx.dataframe.DataRow
1313
import org.jetbrains.kotlinx.dataframe.annotations.DataSchema
1414
import org.jetbrains.kotlinx.dataframe.api.JsonPath
15+
import org.jetbrains.kotlinx.dataframe.codeGen.Code
1516
import org.jetbrains.kotlinx.dataframe.codeGen.CodeGenerator
1617
import org.jetbrains.kotlinx.dataframe.codeGen.FieldType
1718
import org.jetbrains.kotlinx.dataframe.codeGen.GeneratedField
@@ -23,7 +24,6 @@ import org.jetbrains.kotlinx.dataframe.codeGen.isNullable
2324
import org.jetbrains.kotlinx.dataframe.codeGen.name
2425
import org.jetbrains.kotlinx.dataframe.codeGen.toNotNullable
2526
import org.jetbrains.kotlinx.dataframe.codeGen.toNullable
26-
import org.jetbrains.kotlinx.jupyter.api.Code
2727
import kotlin.reflect.typeOf
2828

2929
/** Parse and read OpenApi specification to [DataSchema] interfaces. */

dataframe-openapi-generator/src/test/kotlin/OpenApiTests.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import org.intellij.lang.annotations.Language
66
import org.jetbrains.kotlinx.dataframe.AnyFrame
77
import org.jetbrains.kotlinx.dataframe.api.isNotEmpty
88
import org.jetbrains.kotlinx.dataframe.api.schema
9+
import org.jetbrains.kotlinx.dataframe.codeGen.Code
910
import org.jetbrains.kotlinx.dataframe.codeGen.ValidFieldName
1011
import org.jetbrains.kotlinx.dataframe.io.OpenApi
11-
import org.jetbrains.kotlinx.jupyter.api.Code
1212
import org.jetbrains.kotlinx.jupyter.testkit.JupyterReplTestCase
1313
import org.junit.Test
1414
import java.io.File

examples/idea-examples/json/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ dependencies {
2323
}
2424

2525
tasks.withType<KotlinCompile> {
26-
compilerOptions.jvmTarget = JvmTarget.JVM_11
26+
compilerOptions.jvmTarget = JvmTarget.JVM_1_8
2727
}
2828

2929
dataframes {

examples/idea-examples/movies/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ dependencies {
2424
}
2525

2626
tasks.withType<KotlinCompile> {
27-
compilerOptions.jvmTarget = JvmTarget.JVM_11
27+
compilerOptions.jvmTarget = JvmTarget.JVM_1_8
2828
}

0 commit comments

Comments
 (0)