From d9b279e675269cdbc65eba219bc7f52795faa253 Mon Sep 17 00:00:00 2001 From: Alexander Likhachev Date: Tue, 18 Jan 2022 16:44:20 +0300 Subject: [PATCH] Revert "[Gradle, JVM] Validate JVM targets even if compiler isn't called" This reverts commit aa52a60f --- .../org/jetbrains/kotlin/gradle/tasks/Tasks.kt | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) 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 66fcb06e6c6..ff4110a4382 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 @@ -410,9 +410,6 @@ abstract class AbstractKotlinCompile : AbstractKotl logger.kotlinDebug { "All kotlin sources: ${allKotlinSources.pathsAsStringRelativeTo(projectDir)}" } - val args = prepareCompilerArguments() - validateCompilerArguments(args) - if (!inputChanges.isIncremental && skipCondition()) { // Skip running only if non-incremental run. Otherwise, we may need to do some cleanup. logger.kotlinDebug { "No Kotlin files found, skipping Kotlin compiler task" } @@ -420,6 +417,7 @@ abstract class AbstractKotlinCompile : AbstractKotl } sourceRoots.log(this.name, logger) + val args = prepareCompilerArguments() taskBuildDirectory.get().asFile.mkdirs() callCompilerAsync( args, @@ -454,8 +452,6 @@ abstract class AbstractKotlinCompile : AbstractKotl @Internal internal abstract fun getSourceRoots(): SourceRoots - protected open fun validateCompilerArguments(args: T) = Unit - /** * Compiler might be executed asynchronously. Do not do anything requiring end of compilation after this function is called. * @see [GradleKotlinCompilerWork] @@ -735,10 +731,6 @@ abstract class KotlinCompile @Inject constructor( override fun getSourceRoots(): SourceRoots.ForJvm = jvmSourceRoots - override fun validateCompilerArguments(args: K2JVMCompilerArguments) { - validateKotlinAndJavaHasSameTargetCompatibility(args) - } - override fun callCompilerAsync( args: K2JVMCompilerArguments, sourceRoots: SourceRoots, @@ -747,6 +739,8 @@ abstract class KotlinCompile @Inject constructor( ) { sourceRoots as SourceRoots.ForJvm + validateKotlinAndJavaHasSameTargetCompatibility(args) + val messageCollector = GradlePrintingMessageCollector(logger, args.allWarningsAsErrors) val outputItemCollector = OutputItemsCollectorImpl() val compilerRunner = compilerRunner.get()