Fix jvmTarget was not set on reusing configuration cache.

When project has toolchain configured and on reusing configuration
cache, 'filteredMapArguments' input was calculated without actual
value of `jvmTarget` provided by toolchain leading to non-UP-TO-DATE
KotlinCompile task state.

^KT-51937 Fixed
This commit is contained in:
Yahor Berdnikau
2022-04-11 15:06:39 +02:00
committed by Space
parent 1dae506198
commit 85689f4eb3
3 changed files with 4 additions and 9 deletions
@@ -578,7 +578,9 @@ class KotlinJavaToolchainTest : KGPBaseTest() {
)
build("assemble")
build("assemble")
build("assemble") {
assertTasksUpToDate(":compileKotlin")
}
}
}
@@ -129,10 +129,6 @@ internal abstract class DefaultKotlinJavaToolchain @Inject constructor(
task: KotlinCompile,
args: K2JVMCompilerArguments
) {
check(task.state.executing) {
"\"updateJvmTarget()\" method should be called only on task execution!"
}
if (providedJvmExplicitlySet) {
val jdkVersion = javaVersion.get()
@@ -852,10 +852,7 @@ abstract class KotlinCompile @Inject constructor(
)
)
// This method could be called on configuration phase to calculate `filteredArgumentsMap` property
if (state.executing) {
defaultKotlinJavaToolchain.get().updateJvmTarget(this, args)
}
defaultKotlinJavaToolchain.get().updateJvmTarget(this, args)
if (reportingSettings().buildReportMode == BuildReportMode.VERBOSE) {
args.reportPerf = true