[Gradle, JS] Fix android tests
- Can't write npm project to task data because 2 reasons: -- May be not npm project (if not declared nodejs or browser) -- In Android there is clash of clean tasks on creating NPM project
This commit is contained in:
+3
-8
@@ -41,7 +41,6 @@ import org.jetbrains.kotlin.gradle.scripting.internal.ScriptingGradleSubplugin
|
||||
import org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsIrCompilation
|
||||
import org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsIrLink
|
||||
import org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsIrType
|
||||
import org.jetbrains.kotlin.gradle.targets.js.npm.npmProject
|
||||
import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget
|
||||
import org.jetbrains.kotlin.gradle.tasks.*
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
@@ -107,14 +106,11 @@ internal abstract class KotlinSourceSetProcessor<T : AbstractKotlinCompile<*>>(
|
||||
kotlinCompilation.output.addClassesDir { project.files(task.map { it.destinationDir }) }
|
||||
}
|
||||
|
||||
protected fun registerKotlinCompileTask(
|
||||
name: String = kotlinCompilation.compileKotlinTaskName,
|
||||
compileDestinationDir: File = defaultKotlinDestinationDir
|
||||
): TaskProvider<out T> {
|
||||
protected fun registerKotlinCompileTask(name: String = kotlinCompilation.compileKotlinTaskName): TaskProvider<out T> {
|
||||
logger.kotlinDebug("Creating kotlin compile task $name")
|
||||
|
||||
KotlinCompileTaskData.register(name, kotlinCompilation).apply {
|
||||
destinationDir.set(project.provider { compileDestinationDir })
|
||||
destinationDir.set(project.provider { defaultKotlinDestinationDir })
|
||||
}
|
||||
|
||||
return doRegisterTask(project, name) {
|
||||
@@ -378,8 +374,7 @@ internal class KotlinJsIrSourceSetProcessor(
|
||||
compilation.developmentLinkTaskName
|
||||
).onEach { taskName ->
|
||||
registerKotlinCompileTask(
|
||||
taskName,
|
||||
compilation.npmProject.dist
|
||||
taskName
|
||||
)
|
||||
}.forEach { taskName ->
|
||||
project.tasks.named(taskName).configure {
|
||||
|
||||
+8
@@ -41,6 +41,14 @@ open class KotlinJsIrLink : Kotlin2JsCompile() {
|
||||
return !inputs.isIncremental && !entryModule.exists()
|
||||
}
|
||||
|
||||
override fun getDestinationDir(): File {
|
||||
return if (kotlinOptions.outputFile == null) {
|
||||
super.getDestinationDir()
|
||||
} else {
|
||||
outputFile.parentFile
|
||||
}
|
||||
}
|
||||
|
||||
@OutputFile
|
||||
val outputFileProperty: RegularFileProperty = project.newFileProperty {
|
||||
outputFile
|
||||
|
||||
+2
-1
@@ -514,7 +514,8 @@ open class Kotlin2JsCompile : AbstractKotlinCompile<K2JSCompilerArguments>(), Ko
|
||||
override val kotlinOptions: KotlinJsOptions
|
||||
get() = kotlinOptionsImpl
|
||||
|
||||
private val defaultOutputFile: File
|
||||
@get:Internal
|
||||
protected val defaultOutputFile: File
|
||||
get() = File(destinationDir, "${taskData.compilation.ownModuleName}.js")
|
||||
|
||||
@Suppress("unused")
|
||||
|
||||
Reference in New Issue
Block a user