From 5f54f67f707fa96bbe261dcd57b989a0f27dcda5 Mon Sep 17 00:00:00 2001 From: Alexey Tsvetkov Date: Fri, 2 Nov 2018 05:08:48 +0300 Subject: [PATCH] Stop using `-Xbuild-file` in Gradle Plugin #KT-27640 fixed #KT-27778 fixed #KT-27638 fixed --- .../kotlin/codegen/state/GenerationState.kt | 8 +++- .../arguments/K2JVMCompilerArguments.kt | 14 ++++++ .../jetbrains/kotlin/cli/jvm/K2JVMCompiler.kt | 18 +++++-- .../compiler/KotlinToJVMBytecodeCompiler.kt | 8 ++-- .../daemon/common/CompilationOptions.kt | 16 +++++-- .../kotlin/daemon/CompileServiceImpl.kt | 47 ++++++------------- .../IncrementalJvmCompilerRunner.kt | 30 +++--------- .../GradleCompilerEnvironment.kt | 3 +- .../GradleKotlinCompilerRunner.kt | 25 ++++------ .../GradleKotlinCompilerWork.kt | 22 ++++----- .../internal/CompilerArgumentsGradleInput.kt | 1 + .../jetbrains/kotlin/gradle/tasks/Tasks.kt | 3 +- 12 files changed, 94 insertions(+), 101 deletions(-) diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/GenerationState.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/GenerationState.kt index 5eba2ff1576..82d0778c6e7 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/GenerationState.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/GenerationState.kt @@ -149,8 +149,12 @@ class GenerationState private constructor( init { val icComponents = configuration.get(JVMConfigurationKeys.INCREMENTAL_COMPILATION_COMPONENTS) if (icComponents != null) { - incrementalCacheForThisTarget = - icComponents.getIncrementalCache(targetId ?: error("Target ID should be specified for incremental compilation")) + val targetId = targetId + ?: moduleName?.let { + // hack for Gradle IC, Gradle does not use build.xml file, so there is no way to pass target id + TargetId(it, "java-production") + } ?: error("Target ID should be specified for incremental compilation") + incrementalCacheForThisTarget = icComponents.getIncrementalCache(targetId) packagesWithObsoleteParts = incrementalCacheForThisTarget.getObsoletePackageParts().map { JvmClassName.byInternalName(it).packageFqName }.toSet() diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt index 7f8ca8dca2e..3a07369effd 100644 --- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt +++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt @@ -191,6 +191,20 @@ class K2JVMCompilerArguments : CommonCompilerArguments() { ) var javacArguments: Array? by FreezableVar(null) + + @Argument( + value = "-Xjava-source-roots", + valueDescription = "", + description = "Paths to output directories for friend modules (whose internals should be visible)" + ) + var javaSourceRoots: Array? by FreezableVar(null) + + @Argument( + value = "-Xjava-package-prefix", + description = "Package prefix for Java files" + ) + var javaPackagePrefix: String? by FreezableVar(null) + @Argument( value = "-Xjsr305", deprecatedName = "-Xjsr305-annotations", diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/K2JVMCompiler.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/K2JVMCompiler.kt index 1c665e80c0e..77249547739 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/K2JVMCompiler.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/K2JVMCompiler.kt @@ -85,6 +85,10 @@ class K2JVMCompiler : CLICompiler() { } } } + + for (path in arguments.javaSourceRoots ?: emptyArray()) { + configuration.addJavaSourceRoot(File(path), arguments.javaPackagePrefix) + } } configuration.put(CommonConfigurationKeys.MODULE_NAME, arguments.moduleName ?: JvmAbi.DEFAULT_MODULE_NAME) @@ -108,11 +112,17 @@ class K2JVMCompiler : CLICompiler() { val destination = arguments.destination if (arguments.buildFile != null) { + fun strongWarning(message: String) { + messageCollector.report(STRONG_WARNING, message) + } if (destination != null) { - messageCollector.report( - STRONG_WARNING, - "The '-d' option with a directory destination is ignored because '-Xbuild-file' is specified" - ) + strongWarning("The '-d' option with a directory destination is ignored because '-Xbuild-file' is specified") + } + if (arguments.javaSourceRoots != null) { + strongWarning("The '-Xjava-source-roots' option is ignored because '-Xbuild-file' is specified") + } + if (arguments.javaPackagePrefix != null) { + strongWarning("The '-Xjava-package-prefix' option is ignored because '-Xbuild-file' is specified") } val sanitizedCollector = FilteringMessageCollector(messageCollector, VERBOSE::contains) diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt index 4ae5a5ac6bd..3bd15ca78bb 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt @@ -420,9 +420,11 @@ object KotlinToJVMBytecodeCompiler { private fun GenerationState.Builder.withModule(module: Module?) = apply { - targetId(module?.let { TargetId(it) }) - moduleName(module?.getModuleName()) - outDirectory(module?.let { File(it.getOutputDirectory()) }) + if (module != null) { + targetId(TargetId(module)) + moduleName(module.getModuleName()) + outDirectory(File(module.getOutputDirectory())) + } } private fun generate( diff --git a/compiler/daemon/daemon-common/src/org/jetbrains/kotlin/daemon/common/CompilationOptions.kt b/compiler/daemon/daemon-common/src/org/jetbrains/kotlin/daemon/common/CompilationOptions.kt index 66419a67145..38505dbf5bc 100644 --- a/compiler/daemon/daemon-common/src/org/jetbrains/kotlin/daemon/common/CompilationOptions.kt +++ b/compiler/daemon/daemon-common/src/org/jetbrains/kotlin/daemon/common/CompilationOptions.kt @@ -28,7 +28,8 @@ open class CompilationOptions( /** @See [ReportSeverity] */ val reportSeverity: Int, /** @See [CompilationResultCategory]] */ - val requestedCompilationResults: Array + val requestedCompilationResults: Array, + val kotlinScriptExtensions: Array? = null ) : Serializable { companion object { const val serialVersionUID: Long = 0 @@ -41,6 +42,7 @@ open class CompilationOptions( "reportCategories=${Arrays.toString(reportCategories)}, " + "reportSeverity=$reportSeverity, " + "requestedCompilationResults=${Arrays.toString(requestedCompilationResults)}" + + "kotlinScriptExtensions=${Arrays.toString(kotlinScriptExtensions)}" + ")" } } @@ -65,8 +67,16 @@ class IncrementalCompilationOptions( val outputFiles: List, val multiModuleICSettings: MultiModuleICSettings, val modulesInfo: IncrementalModuleInfo, - val classpathFqNamesHistory: File? = null -) : CompilationOptions(compilerMode, targetPlatform, reportCategories, reportSeverity, requestedCompilationResults) { + val classpathFqNamesHistory: File? = null, + kotlinScriptExtensions: Array? = null +) : CompilationOptions( + compilerMode, + targetPlatform, + reportCategories, + reportSeverity, + requestedCompilationResults, + kotlinScriptExtensions +) { companion object { const val serialVersionUID: Long = 0 } diff --git a/compiler/daemon/src/org/jetbrains/kotlin/daemon/CompileServiceImpl.kt b/compiler/daemon/src/org/jetbrains/kotlin/daemon/CompileServiceImpl.kt index 2fc8211ed0d..7b0e8b089a7 100644 --- a/compiler/daemon/src/org/jetbrains/kotlin/daemon/CompileServiceImpl.kt +++ b/compiler/daemon/src/org/jetbrains/kotlin/daemon/CompileServiceImpl.kt @@ -454,7 +454,7 @@ class CompileServiceImpl( doCompile(sessionId, daemonReporter, tracer = null) { _, _ -> execIncrementalCompiler( k2jvmArgs, gradleIncrementalArgs, gradleIncrementalServicesFacade, compilationResults!!, - messageCollector, daemonReporter + messageCollector ) } } @@ -525,44 +525,28 @@ class CompileServiceImpl( } } + // todo: non-IC non-KTS scripts? private fun execIncrementalCompiler( k2jvmArgs: K2JVMCompilerArguments, incrementalCompilationOptions: IncrementalCompilationOptions, servicesFacade: IncrementalCompilerServicesFacade, compilationResults: CompilationResults, - compilerMessageCollector: MessageCollector, - daemonMessageReporter: DaemonMessageReporter + compilerMessageCollector: MessageCollector ): ExitCode { - val moduleFile = k2jvmArgs.buildFile?.let(::File) - assert(moduleFile?.exists() ?: false) { "Module does not exist ${k2jvmArgs.buildFile}" } - - // todo: pass javaSourceRoots and allKotlinFiles using IncrementalCompilationOptions - val parsedModule = run { - val bytesOut = ByteArrayOutputStream() - val printStream = PrintStream(bytesOut) - val mc = PrintingMessageCollector(printStream, MessageRenderer.PLAIN_FULL_PATHS, false) - val parsedModule = ModuleXmlParser.parseModuleScript(k2jvmArgs.buildFile!!, mc) - if (mc.hasErrors()) { - daemonMessageReporter.report(ReportSeverity.ERROR, bytesOut.toString("UTF8")) + val allKotlinExtensions = (DEFAULT_KOTLIN_SOURCE_FILES_EXTENSIONS + + (incrementalCompilationOptions.kotlinScriptExtensions ?: emptyArray())).distinct() + val dotExtensions = allKotlinExtensions.map { ".$it" } + val freeArgs = arrayListOf() + val allKotlinFiles = arrayListOf() + for (arg in k2jvmArgs.freeArgs) { + val file = File(arg) + if (file.isFile && dotExtensions.any { ext -> file.path.endsWith(ext, ignoreCase = true) }) { + allKotlinFiles.add(file) + } else { + freeArgs.add(arg) } - parsedModule } - - val javaSourceRoots = parsedModule.modules.flatMapTo(HashSet()) { - it.getJavaSourceRoots().map { JvmSourceRoot(File(it.path), it.packagePrefix) } - } - - k2jvmArgs.commonSources = parsedModule.modules.flatMap { it.getCommonSourceFiles() }.toTypedArray().takeUnless { it.isEmpty() } - - val allKotlinFiles = parsedModule.modules.flatMap { it.getSourceFiles().map(::File) } - val allKotlinExtensions = ( - DEFAULT_KOTLIN_SOURCE_FILES_EXTENSIONS + - allKotlinFiles.asSequence() - .map { it.extension } - .filter { !it.equals("java", ignoreCase = true) } - .asIterable() - ).distinct() - k2jvmArgs.friendPaths = parsedModule.modules.flatMap(Module::getFriendPaths).toTypedArray() + k2jvmArgs.freeArgs = freeArgs val changedFiles = if (incrementalCompilationOptions.areFileChangesKnown) { ChangedFiles.Known(incrementalCompilationOptions.modifiedFiles!!, incrementalCompilationOptions.deletedFiles!!) @@ -588,7 +572,6 @@ class CompileServiceImpl( val compiler = IncrementalJvmCompilerRunner( workingDir, - javaSourceRoots, reporter, buildHistoryFile = incrementalCompilationOptions.multiModuleICSettings.buildHistoryFile, outputFiles = outputFiles, diff --git a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalJvmCompilerRunner.kt b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalJvmCompilerRunner.kt index e60f8a7a7a1..02de4dab98b 100644 --- a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalJvmCompilerRunner.kt +++ b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalJvmCompilerRunner.kt @@ -62,11 +62,11 @@ fun makeIncrementally( val files = rootsWalk.filter(File::isFile) val sourceFiles = files.filter { it.extension.toLowerCase() in allExtensions }.toList() val buildHistoryFile = File(cachesDir, "build-history.bin") + args.javaSourceRoots = sourceRoots.map { it.absolutePath }.toTypedArray() withIC { val compiler = IncrementalJvmCompilerRunner( cachesDir, - sourceRoots.map { JvmSourceRoot(it, null) }.toSet(), reporter, // Use precise setting in case of non-Gradle build usePreciseJavaTracking = true, @@ -104,7 +104,6 @@ inline fun withIC(enabled: Boolean = true, fn: ()->R): R { class IncrementalJvmCompilerRunner( workingDir: File, - private val javaSourceRoots: Set, reporter: ICReporter, private val usePreciseJavaTracking: Boolean, buildHistoryFile: File, @@ -367,28 +366,11 @@ class IncrementalJvmCompilerRunner( messageCollector: MessageCollector ): ExitCode { val compiler = K2JVMCompiler() - val outputDir = args.destinationAsFile - val classpath = args.classpathAsList - val moduleFile = makeModuleFile( - args.moduleName!!, - isTest = false, - outputDir = outputDir, - sourcesToCompile = sourcesToCompile, - commonSources = args.commonSources?.map(::File).orEmpty(), - javaSourceRoots = javaSourceRoots, - classpath = classpath, - friendDirs = listOf() - ) - val destination = args.destination - args.destination = null - args.buildFile = moduleFile.absolutePath - - return try { - compiler.exec(messageCollector, services, args) - } finally { - args.destination = destination - moduleFile.delete() - } + val freeArgsBackup = args.freeArgs.toList() + args.freeArgs += sourcesToCompile.map { it.absolutePath } + val exitCode = compiler.exec(messageCollector, services, args) + args.freeArgs = freeArgsBackup + return exitCode } } diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/compilerRunner/GradleCompilerEnvironment.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/compilerRunner/GradleCompilerEnvironment.kt index 4748585691b..1cecf5c7fdf 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/compilerRunner/GradleCompilerEnvironment.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/compilerRunner/GradleCompilerEnvironment.kt @@ -18,7 +18,8 @@ internal class GradleCompilerEnvironment( outputItemsCollector: OutputItemsCollector, val outputFiles: FileCollection, val buildReportMode: BuildReportMode?, - val incrementalCompilationEnvironment: IncrementalCompilationEnvironment? = null + val incrementalCompilationEnvironment: IncrementalCompilationEnvironment? = null, + val kotlinScriptExtensions: Array = emptyArray() ) : CompilerEnvironment(Services.EMPTY, messageCollector, outputItemsCollector) { val toolsJar: File? by lazy { findToolsJar() } diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/compilerRunner/GradleKotlinCompilerRunner.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/compilerRunner/GradleKotlinCompilerRunner.kt index f78378c24ba..b8d4af8ff77 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/compilerRunner/GradleKotlinCompilerRunner.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/compilerRunner/GradleKotlinCompilerRunner.kt @@ -22,7 +22,6 @@ import org.gradle.api.invocation.Gradle import org.gradle.api.plugins.JavaPluginConvention import org.gradle.api.tasks.bundling.AbstractArchiveTask import org.gradle.jvm.tasks.Jar -import org.jetbrains.kotlin.build.JvmSourceRoot import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments @@ -73,23 +72,16 @@ internal open class GradleCompilerRunner(protected val task: Task) { args: K2JVMCompilerArguments, environment: GradleCompilerEnvironment ) { - val buildFile = makeModuleFile( - args.moduleName!!, - isTest = false, - outputDir = args.destinationAsFile, - sourcesToCompile = sourcesToCompile, - commonSources = commonSources, - javaSourceRoots = javaSourceRoots.map { JvmSourceRoot(it, javaPackagePrefix) }, - classpath = args.classpathAsList, - friendDirs = args.friendPaths?.map(::File).orEmpty() - ) - args.buildFile = buildFile.absolutePath + args.freeArgs += sourcesToCompile.map { it.absolutePath } + args.commonSources = commonSources.map { it.absolutePath }.toTypedArray() + args.javaSourceRoots = javaSourceRoots.map { it.absolutePath }.toTypedArray() + args.javaPackagePrefix = javaPackagePrefix if (environment.incrementalCompilationEnvironment == null || kotlinCompilerExecutionStrategy() != DAEMON_EXECUTION_STRATEGY) { args.destination = null } - runCompilerAsync(KotlinCompilerClass.JVM, args, environment, buildFile = buildFile) + runCompilerAsync(KotlinCompilerClass.JVM, args, environment) } /** @@ -123,8 +115,7 @@ internal open class GradleCompilerRunner(protected val task: Task) { private fun runCompilerAsync( compilerClassName: String, compilerArgs: CommonCompilerArguments, - environment: GradleCompilerEnvironment, - buildFile: File? = null + environment: GradleCompilerEnvironment ) { if (compilerArgs.version) { task.logger.lifecycle( @@ -144,10 +135,10 @@ internal open class GradleCompilerRunner(protected val task: Task) { isVerbose = compilerArgs.verbose, incrementalCompilationEnvironment = incrementalCompilationEnvironment, incrementalModuleInfo = modulesInfo, - buildFile = buildFile, outputFiles = environment.outputFiles.toList(), taskPath = task.path, - buildReportMode = environment.buildReportMode + buildReportMode = environment.buildReportMode, + kotlinScriptExtensions = environment.kotlinScriptExtensions ) TaskLoggers.put(task.path, task.logger) runCompilerAsync(workArgs) diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/compilerRunner/GradleKotlinCompilerWork.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/compilerRunner/GradleKotlinCompilerWork.kt index 40f94e20455..faa377bc950 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/compilerRunner/GradleKotlinCompilerWork.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/compilerRunner/GradleKotlinCompilerWork.kt @@ -19,7 +19,6 @@ import org.jetbrains.kotlin.gradle.tasks.clearLocalState import org.jetbrains.kotlin.gradle.tasks.throwGradleExceptionIfError import org.jetbrains.kotlin.gradle.utils.stackTraceAsString import org.jetbrains.kotlin.incremental.ChangedFiles -import org.jetbrains.kotlin.incremental.DELETE_MODULE_FILE_PROPERTY import org.slf4j.LoggerFactory import java.io.* import java.net.URLClassLoader @@ -53,10 +52,10 @@ internal class GradleKotlinCompilerWorkArguments( val isVerbose: Boolean, val incrementalCompilationEnvironment: IncrementalCompilationEnvironment?, val incrementalModuleInfo: IncrementalModuleInfo?, - val buildFile: File?, val outputFiles: List, val taskPath: String, - val buildReportMode: BuildReportMode? + val buildReportMode: BuildReportMode?, + val kotlinScriptExtensions: Array ) : Serializable { companion object { const val serialVersionUID: Long = 0 @@ -91,10 +90,10 @@ internal class GradleKotlinCompilerWork @Inject constructor( private val isVerbose = config.isVerbose private val incrementalCompilationEnvironment = config.incrementalCompilationEnvironment private val incrementalModuleInfo = config.incrementalModuleInfo - private val buildFile = config.buildFile private val outputFiles = config.outputFiles private val taskPath = config.taskPath private val buildReportMode = config.buildReportMode + private val kotlinScriptExtensions = config.kotlinScriptExtensions private val log: KotlinLogger = TaskLoggers.get(taskPath)?.let { GradleKotlinLogger(it).apply { debug("Using '$taskPath' logger") } } @@ -114,14 +113,7 @@ internal class GradleKotlinCompilerWork @Inject constructor( override fun run() { val messageCollector = GradlePrintingMessageCollector(log) - val exitCode = try { - compileWithDaemonOrFallbackImpl(messageCollector) - } finally { - if (buildFile != null && System.getProperty(DELETE_MODULE_FILE_PROPERTY) != "false") { - buildFile.delete() - } - } - + val exitCode = compileWithDaemonOrFallbackImpl(messageCollector) if (incrementalCompilationEnvironment?.disableMultiModuleIC == true) { incrementalCompilationEnvironment.multiModuleICSettings.buildHistoryFile.delete() } @@ -230,7 +222,8 @@ internal class GradleKotlinCompilerWork @Inject constructor( targetPlatform = targetPlatform, reportCategories = reportCategories(isVerbose), reportSeverity = reportSeverity(isVerbose), - requestedCompilationResults = emptyArray() + requestedCompilationResults = emptyArray(), + kotlinScriptExtensions = kotlinScriptExtensions ) val servicesFacade = GradleCompilerServicesFacadeImpl(log, bufferingMessageCollector) return try { @@ -275,7 +268,8 @@ internal class GradleKotlinCompilerWork @Inject constructor( outputFiles = outputFiles, multiModuleICSettings = icEnv.multiModuleICSettings, modulesInfo = incrementalModuleInfo!!, - classpathFqNamesHistory = icEnv.classpathFqNamesHistory + classpathFqNamesHistory = icEnv.classpathFqNamesHistory, + kotlinScriptExtensions = kotlinScriptExtensions ) log.info("Options for KOTLIN DAEMON: $compilationOptions") diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/internal/CompilerArgumentsGradleInput.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/internal/CompilerArgumentsGradleInput.kt index e113e5d0c85..8e354fbed73 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/internal/CompilerArgumentsGradleInput.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/internal/CompilerArgumentsGradleInput.kt @@ -55,6 +55,7 @@ internal object CompilerArgumentsGradleInput { K2JVMCompilerArguments::buildFile, // in Gradle build, these XMLs are transient and provide no useful info K2JVMCompilerArguments::pluginOptions, // handled specially in the task K2JVMCompilerArguments::pluginClasspaths, // handled in the task as classpath + K2JVMCompilerArguments::javaSourceRoots, // handled in inputs K2JSCompilerArguments::outputFile, // already handled by Gradle task property K2JSCompilerArguments::libraries, // defined by by classpath and friendDependency of the Gradle task 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 c24532809fa..d95db0b3f8b 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 @@ -439,7 +439,8 @@ open class KotlinCompile : AbstractKotlinCompile(), Kotl computedCompilerClasspath, messageCollector, outputItemCollector, outputFiles = allOutputFiles(), buildReportMode = buildReportMode, - incrementalCompilationEnvironment = icEnv + incrementalCompilationEnvironment = icEnv, + kotlinScriptExtensions = sourceFilesExtensions.toTypedArray() ) compilerRunner.runJvmCompilerAsync( sourceRoots.kotlinSourceFiles,