Skip to content

Commit 615c316

Browse files
committed
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
1 parent 4325632 commit 615c316

File tree

1 file changed

+12
-13
lines changed
  • libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/tasks

1 file changed

+12
-13
lines changed

libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/tasks/Tasks.kt

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,18 @@ open class Kotlin2JsCompile() : AbstractKotlinCompile<K2JSCompilerArguments>(),
322322
override fun populateCompilerArguments(): K2JSCompilerArguments {
323323
val args = K2JSCompilerArguments().apply { fillDefaultValues() }
324324
args.outputFile = outputFile
325+
kotlinOptionsImpl.updateArguments(args)
326+
return args
327+
}
328+
329+
override fun getSourceRoots() = SourceRoots.KotlinOnly.create(getSource())
330+
331+
override fun callCompiler(args: K2JSCompilerArguments, sourceRoots: SourceRoots, changedFiles: ChangedFiles) {
332+
sourceRoots as SourceRoots.KotlinOnly
333+
334+
logger.debug("Calling compiler")
335+
destinationDir.mkdirs()
336+
args.freeArgs = args.freeArgs + sourceRoots.kotlinSourceFiles.map { it.absolutePath }
325337

326338
val friendDependency = friendTaskName
327339
?.let { project.getTasksByName(it, false).singleOrNull() as? Kotlin2JsCompile }
@@ -340,19 +352,6 @@ open class Kotlin2JsCompile() : AbstractKotlinCompile<K2JSCompilerArguments>(),
340352
null
341353
}
342354

343-
kotlinOptionsImpl.updateArguments(args)
344-
return args
345-
}
346-
347-
override fun getSourceRoots() = SourceRoots.KotlinOnly.create(getSource())
348-
349-
override fun callCompiler(args: K2JSCompilerArguments, sourceRoots: SourceRoots, changedFiles: ChangedFiles) {
350-
sourceRoots as SourceRoots.KotlinOnly
351-
352-
logger.debug("Calling compiler")
353-
destinationDir.mkdirs()
354-
args.freeArgs = args.freeArgs + sourceRoots.kotlinSourceFiles.map { it.absolutePath }
355-
356355
logger.kotlinDebug("compiling with args ${ArgumentUtils.convertArgumentsToStringList(args)}")
357356

358357
val messageCollector = GradleMessageCollector(logger)

0 commit comments

Comments
 (0)