[Gradle, JS] Not error, but warning with test fix
This commit is contained in:
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
plugins {
|
plugins {
|
||||||
kotlin("js").version("<pluginMarkerVersion>")
|
kotlin("js").version("<pluginMarkerVersion>").apply(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "com.example"
|
group = "com.example"
|
||||||
|
|||||||
+16
-13
@@ -15,6 +15,7 @@ import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation.Companion.TEST_COMPI
|
|||||||
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider
|
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider
|
||||||
import org.jetbrains.kotlin.gradle.plugin.configureDefaultVersionsResolutionStrategy
|
import org.jetbrains.kotlin.gradle.plugin.configureDefaultVersionsResolutionStrategy
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinJsSingleTargetPreset
|
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinJsSingleTargetPreset
|
||||||
|
import org.jetbrains.kotlin.gradle.plugin.whenEvaluated
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsIrSingleTargetPreset
|
import org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsIrSingleTargetPreset
|
||||||
import org.jetbrains.kotlin.gradle.utils.*
|
import org.jetbrains.kotlin.gradle.utils.*
|
||||||
|
|
||||||
@@ -39,20 +40,22 @@ open class KotlinJsPlugin(
|
|||||||
defaultJsCompilerType = PropertiesProvider(project).jsCompiler
|
defaultJsCompilerType = PropertiesProvider(project).jsCompiler
|
||||||
}
|
}
|
||||||
|
|
||||||
project.afterEvaluate {
|
project.whenEvaluated {
|
||||||
checkNotNull(kotlinExtension._target) {
|
if (kotlinExtension._target == null) {
|
||||||
"""
|
project.logger.warn(
|
||||||
Need to initialize js target.
|
"""
|
||||||
Use
|
Need to initialize js target.
|
||||||
kotlin {
|
Use
|
||||||
js {
|
kotlin {
|
||||||
// Choose sub target (or both), for which js is necessary
|
js {
|
||||||
// Affect in which tests are executed and final dist (in browser is only one bundle file)
|
// Choose sub target (or both), for which js is necessary
|
||||||
browser()
|
// Affect in which tests are executed and final dist (in browser is only one bundle file)
|
||||||
nodejs()
|
browser()
|
||||||
|
nodejs()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
""".trimIndent()
|
||||||
""".trimIndent()
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user