THRIFT-5775 Kotlin build failed for broken toolchain in docker (#3043)
* THRIFT-5775 Kotlin build failed for broken toolchain in docker
This PR adds JDK 8 to both docker containers to support the kotlin
build.
Kotlin requires toolchain 8 and cant build this without the JDK for that
language level being present.
Also correct readme since docker desktop on Mac also fixes the
permissions with volume sharing automatically.
* Remove gradle toolchains from kotlin and set source/target to java 8
* Manually set the release target for kotlin, remove overwrites from cross-test-client/server
* Set toolchain to 17 on the kotlin lib module
diff --git a/lib/kotlin/build.gradle.kts b/lib/kotlin/build.gradle.kts
index df4a2c1..16d745b 100644
--- a/lib/kotlin/build.gradle.kts
+++ b/lib/kotlin/build.gradle.kts
@@ -16,6 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
+import org.jetbrains.kotlin.gradle.dsl.JvmTarget
+import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm")
@@ -36,13 +38,19 @@
kotlin {
jvmToolchain {
- (this as JavaToolchainSpec).languageVersion.set(JavaLanguageVersion.of(8))
+ languageVersion.set(JavaLanguageVersion.of(17))
}
}
-tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
+java {
+ sourceCompatibility = JavaVersion.VERSION_1_8
+ targetCompatibility = JavaVersion.VERSION_1_8
+}
+
+tasks.withType<KotlinCompile> {
compilerOptions {
- jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8
+ jvmTarget = JvmTarget.JVM_1_8
+ freeCompilerArgs = listOf("-Xjdk-release=1.8")
}
}