diff --git a/build-conventions/src/main/kotlin/zcash.kotlin-multiplatform-build-conventions.gradle.kts b/build-conventions/src/main/kotlin/zcash.kotlin-multiplatform-build-conventions.gradle.kts index daca12a4..1cf140ab 100644 --- a/build-conventions/src/main/kotlin/zcash.kotlin-multiplatform-build-conventions.gradle.kts +++ b/build-conventions/src/main/kotlin/zcash.kotlin-multiplatform-build-conventions.gradle.kts @@ -3,11 +3,23 @@ import org.gradle.jvm.toolchain.JavaToolchainSpec pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") { extensions.findByType()?.apply { jvmToolchain { - val javaVersion = JavaVersion.toVersion(project.property("ANDROID_JVM_TARGET").toString()) + val javaVersion = JavaVersion.toVersion(project.property("JVM_TOOLCHAIN").toString()) val javaLanguageVersion = JavaLanguageVersion.of(javaVersion.majorVersion) (this as JavaToolchainSpec).languageVersion.set(javaLanguageVersion) } + targets.matching { it.platformType.name == "jvm" }.all { + (this as org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget).apply { + val javaTargetVersion = project.property("ANDROID_JVM_TARGET").toString() + + compilations.all { + kotlinOptions { + jvmTarget = javaTargetVersion + } + } + } + } + targets.all { compilations.all { kotlinOptions { diff --git a/gradle.properties b/gradle.properties index 298cf149..c77fc1eb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -72,5 +72,10 @@ KOTLINX_COROUTINES_VERSION=1.5.2 KOTLIN_VERSION=1.5.31 ZCASH_SDK_VERSION=1.3.0-beta18 +# Toolchain is the Java version used to build the application, which is separate from the +# Java version used to run the application. Android requires a minimum of 11. Apple Silicon +# requires a newer toolchain. Kotlin won't support Java 17 until Kotlin 1.6 +JVM_TOOLCHAIN=16 + # This shouldn't be changed, as Android doesn't support targets beyond Java 8 ANDROID_JVM_TARGET=1.8 \ No newline at end of file