Fix JS DCE classpath duplicated in two input properties
* Do not add the classpath elements to source to avoid them being treated as task inputs without proper classpath normalization * Move resolution of the classpath configuration to execution time
This commit is contained in:
+3
-4
@@ -52,13 +52,12 @@ class KotlinJsDcePlugin : Plugin<Project> {
|
||||
val outputDir = File(File(project.buildDir, DEFAULT_OUT_DIR), sourceSet.name)
|
||||
|
||||
val configuration = project.configurations.findByName(sourceSet.compileConfigurationName)!!
|
||||
val dceInputTrees = listOf(project.fileTree(kotlinTask.outputFile)) + configuration.map { project.fileTree(it) }
|
||||
val dceInputFiles = dceInputTrees.reduce { acc: FileTree, tree -> acc + tree }
|
||||
val dceInputTree = project.fileTree(kotlinTask.outputFile)
|
||||
|
||||
with (dceTask) {
|
||||
classpath = sourceSet.compileClasspath
|
||||
classpath = configuration
|
||||
destinationDir = dceTask.dceOptions.outputDirectory?.let { File(it) } ?: outputDir
|
||||
source(dceInputFiles)
|
||||
source(dceInputTree)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-2
@@ -17,13 +17,13 @@
|
||||
package org.jetbrains.kotlin.gradle.tasks
|
||||
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.file.FileTree
|
||||
import org.gradle.api.tasks.CacheableTask
|
||||
import org.gradle.api.tasks.Input
|
||||
import org.gradle.api.tasks.Internal
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JSDceArguments
|
||||
import org.jetbrains.kotlin.cli.js.dce.K2JSDce
|
||||
import org.jetbrains.kotlin.compilerRunner.ArgumentUtils
|
||||
import org.jetbrains.kotlin.compilerRunner.GradleKotlinLogger
|
||||
import org.jetbrains.kotlin.compilerRunner.createLoggingMessageCollector
|
||||
import org.jetbrains.kotlin.compilerRunner.runToolInSeparateProcess
|
||||
@@ -61,7 +61,9 @@ open class KotlinJsDce : AbstractKotlinCompileTool<K2JSDceArguments>(), KotlinJs
|
||||
|
||||
@TaskAction
|
||||
fun performDce() {
|
||||
val inputFiles = getSource().files.map { it.path }
|
||||
val inputFiles = (listOf(getSource()) + classpath.map { project.fileTree(it) })
|
||||
.reduce(FileTree::plus)
|
||||
.files.map { it.path }
|
||||
|
||||
val outputDirArgs = arrayOf("-output-dir", destinationDir.path)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user