From 7d180b8bd7206ca62221dbdf5b41293cf353e4d1 Mon Sep 17 00:00:00 2001 From: Yahor Berdnikau Date: Thu, 10 Jun 2021 12:38:26 +0200 Subject: [PATCH] Treat toolchain as input only for JVM tasks. Kotlin compiler for non-JVM tasks does not care about current JDK version and should always produce same output disregard on which JDK it is running on. ^KT-45611 In Progress --- .../jetbrains/kotlin/gradle/tasks/KotlinCompileCommon.kt | 4 ++++ .../main/kotlin/org/jetbrains/kotlin/gradle/tasks/Tasks.kt | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/tasks/KotlinCompileCommon.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/tasks/KotlinCompileCommon.kt index 392d180b8c189..880632180aad8 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/tasks/KotlinCompileCommon.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/tasks/KotlinCompileCommon.kt @@ -118,6 +118,10 @@ abstract class KotlinCompileCommon @Inject constructor( @get:Internal internal val expectActualLinker = objects.property(Boolean::class.java) + @get:Internal + override val kotlinJavaToolchainProvider: Provider + get() = super.kotlinJavaToolchainProvider + override fun callCompilerAsync(args: K2MetadataCompilerArguments, sourceRoots: SourceRoots, changedFiles: ChangedFiles) { val messageCollector = GradlePrintingMessageCollector(logger, args.allWarningsAsErrors) val outputItemCollector = OutputItemsCollectorImpl() diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/tasks/Tasks.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/tasks/Tasks.kt index d61b8e0b5d87e..207b14247ed92 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/tasks/Tasks.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/tasks/Tasks.kt @@ -245,7 +245,7 @@ abstract class AbstractKotlinCompile : AbstractKotl private val kotlinLogger by lazy { GradleKotlinLogger(logger) } - final override val kotlinJavaToolchainProvider: Provider = + override val kotlinJavaToolchainProvider: Provider = objects.propertyWithNewInstance() @get:Internal @@ -716,6 +716,10 @@ abstract class Kotlin2JsCompile @Inject constructor( @get:Internal internal val absolutePathProvider = project.projectDir.absolutePath + @get:Internal + override val kotlinJavaToolchainProvider: Provider + get() = super.kotlinJavaToolchainProvider + override fun callCompilerAsync(args: K2JSCompilerArguments, sourceRoots: SourceRoots, changedFiles: ChangedFiles) { sourceRoots as SourceRoots.KotlinOnly