[Gradle, JS] Fix test on DCE working with usual js files
This commit is contained in:
+2
@@ -190,6 +190,8 @@ open class KotlinBrowserJs @Inject constructor(target: KotlinJsTarget) :
|
||||
|
||||
it.dependsOn(kotlinTask)
|
||||
|
||||
it.kotlinFilesOnly = true
|
||||
|
||||
it.classpath = project.configurations.getByName(compilation.compileDependencyConfigurationName)
|
||||
it.destinationDir = it.dceOptions.outputDirectory?.let { File(it) }
|
||||
?: compilation.npmProject.dir.resolve(DCE_DIR)
|
||||
|
||||
+5
-1
@@ -50,6 +50,10 @@ open class KotlinJsDce : AbstractKotlinCompileTool<K2JSDceArguments>(), KotlinJs
|
||||
|
||||
private val dceOptionsImpl = KotlinJsDceOptionsImpl()
|
||||
|
||||
// DCE can be broken in case of non-kotlin js files or modules
|
||||
@Internal
|
||||
var kotlinFilesOnly: Boolean = false
|
||||
|
||||
@get:Internal
|
||||
override val dceOptions: KotlinJsDceOptions
|
||||
get() = dceOptionsImpl
|
||||
@@ -68,7 +72,7 @@ open class KotlinJsDce : AbstractKotlinCompileTool<K2JSDceArguments>(), KotlinJs
|
||||
@TaskAction
|
||||
fun performDce() {
|
||||
val inputFiles = (listOf(source) + classpath
|
||||
.filter { isDceCandidate(it) }
|
||||
.filter { !kotlinFilesOnly || isDceCandidate(it) }
|
||||
.map { project.fileTree(it) })
|
||||
.reduce(FileTree::plus)
|
||||
.files.map { it.path }
|
||||
|
||||
Reference in New Issue
Block a user