Revert "[Gradle, JVM] Validate JVM targets even if compiler isn't called"

This reverts commit aa52a60f
This commit is contained in:
Alexander Likhachev
2022-01-18 16:44:20 +03:00
committed by Space
parent c76e7bc9d8
commit d9b279e675
@@ -410,9 +410,6 @@ abstract class AbstractKotlinCompile<T : CommonCompilerArguments> : 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<T : CommonCompilerArguments> : AbstractKotl
}
sourceRoots.log(this.name, logger)
val args = prepareCompilerArguments()
taskBuildDirectory.get().asFile.mkdirs()
callCompilerAsync(
args,
@@ -454,8 +452,6 @@ abstract class AbstractKotlinCompile<T : CommonCompilerArguments> : 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()