Kotlin Gradle Plugin: Postpone friend dependency collection until the actual compilation as it may cause an error during Gradle-IDEA project synchronization

#KT-16174 Fixed
This commit is contained in:
Alexey Sedunov
2017-02-03 16:49:24 +03:00
parent 4325632b3e
commit 615c316262
@@ -322,6 +322,18 @@ open class Kotlin2JsCompile() : AbstractKotlinCompile<K2JSCompilerArguments>(),
override fun populateCompilerArguments(): K2JSCompilerArguments {
val args = K2JSCompilerArguments().apply { fillDefaultValues() }
args.outputFile = outputFile
kotlinOptionsImpl.updateArguments(args)
return args
}
override fun getSourceRoots() = SourceRoots.KotlinOnly.create(getSource())
override fun callCompiler(args: K2JSCompilerArguments, sourceRoots: SourceRoots, changedFiles: ChangedFiles) {
sourceRoots as SourceRoots.KotlinOnly
logger.debug("Calling compiler")
destinationDir.mkdirs()
args.freeArgs = args.freeArgs + sourceRoots.kotlinSourceFiles.map { it.absolutePath }
val friendDependency = friendTaskName
?.let { project.getTasksByName(it, false).singleOrNull() as? Kotlin2JsCompile }
@@ -340,19 +352,6 @@ open class Kotlin2JsCompile() : AbstractKotlinCompile<K2JSCompilerArguments>(),
null
}
kotlinOptionsImpl.updateArguments(args)
return args
}
override fun getSourceRoots() = SourceRoots.KotlinOnly.create(getSource())
override fun callCompiler(args: K2JSCompilerArguments, sourceRoots: SourceRoots, changedFiles: ChangedFiles) {
sourceRoots as SourceRoots.KotlinOnly
logger.debug("Calling compiler")
destinationDir.mkdirs()
args.freeArgs = args.freeArgs + sourceRoots.kotlinSourceFiles.map { it.absolutePath }
logger.kotlinDebug("compiling with args ${ArgumentUtils.convertArgumentsToStringList(args)}")
val messageCollector = GradleMessageCollector(logger)