Gradle: provide descriptions for JS tasks
#KT-31560 Fixed
This commit is contained in:
+1
@@ -35,6 +35,7 @@ class KotlinJsTarget(project: Project, platformType: KotlinPlatformType) :
|
|||||||
val runTaskName get() = lowerCamelCaseName(disambiguationClassifier, runTaskNameSuffix)
|
val runTaskName get() = lowerCamelCaseName(disambiguationClassifier, runTaskNameSuffix)
|
||||||
val runTask
|
val runTask
|
||||||
get() = project.tasks.maybeCreate(runTaskName).also {
|
get() = project.tasks.maybeCreate(runTaskName).also {
|
||||||
|
it.description = "Run js on all configured platforms"
|
||||||
if (runTaskName != runTaskNameSuffix) {
|
if (runTaskName != runTaskNameSuffix) {
|
||||||
project.whenEvaluated {
|
project.whenEvaluated {
|
||||||
project.tasks.maybeCreate(runTaskNameSuffix).dependsOn(it)
|
project.tasks.maybeCreate(runTaskNameSuffix).dependsOn(it)
|
||||||
|
|||||||
+1
-1
@@ -90,7 +90,7 @@ class NpmSimpleLinker(val rootProject: Project) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (result.exitValue != 0) {
|
if (result.exitValue != 0) {
|
||||||
error("Cannot create window junctions: nodejs exited with ${result.exitValue}")
|
error("Cannot create windows junctions: nodejs exited with ${result.exitValue}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
@@ -19,6 +19,9 @@ class KotlinBrowserJs(target: KotlinJsTarget) :
|
|||||||
KotlinJsSubTarget(target, "browser"),
|
KotlinJsSubTarget(target, "browser"),
|
||||||
KotlinJsBrowserDsl {
|
KotlinJsBrowserDsl {
|
||||||
|
|
||||||
|
override val testTaskDescription: String
|
||||||
|
get() = "Run all ${target.name} tests inside browser using karma and webpack"
|
||||||
|
|
||||||
private val webpackTaskName = disambiguateCamelCased("webpack")
|
private val webpackTaskName = disambiguateCamelCased("webpack")
|
||||||
|
|
||||||
override fun configureDefaultTestFramework(it: KotlinJsTest) {
|
override fun configureDefaultTestFramework(it: KotlinJsTest) {
|
||||||
@@ -43,6 +46,7 @@ class KotlinBrowserJs(target: KotlinJsTarget) :
|
|||||||
it.dependsOn(target.project.nodeJs.root.npmResolveTask, compileKotlinTask)
|
it.dependsOn(target.project.nodeJs.root.npmResolveTask, compileKotlinTask)
|
||||||
|
|
||||||
it.compilation = compilation
|
it.compilation = compilation
|
||||||
|
it.description = "build webpack bundle"
|
||||||
|
|
||||||
project.tasks.getByName(LifecycleBasePlugin.ASSEMBLE_TASK_NAME).dependsOn(it)
|
project.tasks.getByName(LifecycleBasePlugin.ASSEMBLE_TASK_NAME).dependsOn(it)
|
||||||
}
|
}
|
||||||
@@ -57,6 +61,7 @@ class KotlinBrowserJs(target: KotlinJsTarget) :
|
|||||||
|
|
||||||
it.bin = "webpack-dev-server"
|
it.bin = "webpack-dev-server"
|
||||||
it.compilation = compilation
|
it.compilation = compilation
|
||||||
|
it.description = "start webpack dev server"
|
||||||
|
|
||||||
it.devServer = KotlinWebpackConfigWriter.DevServer(
|
it.devServer = KotlinWebpackConfigWriter.DevServer(
|
||||||
open = true,
|
open = true,
|
||||||
|
|||||||
+3
@@ -62,6 +62,8 @@ abstract class KotlinJsSubTarget(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
abstract val testTaskDescription: String
|
||||||
|
|
||||||
private fun configureTests(compilation: KotlinJsCompilation) {
|
private fun configureTests(compilation: KotlinJsCompilation) {
|
||||||
// apply plugin (cannot be done at task instantiation time)
|
// apply plugin (cannot be done at task instantiation time)
|
||||||
val nodeJs = NodeJsPlugin.apply(target.project).root
|
val nodeJs = NodeJsPlugin.apply(target.project).root
|
||||||
@@ -70,6 +72,7 @@ abstract class KotlinJsSubTarget(
|
|||||||
val compileTask = compilation.compileKotlinTask
|
val compileTask = compilation.compileKotlinTask
|
||||||
|
|
||||||
testJs.group = LifecycleBasePlugin.VERIFICATION_GROUP
|
testJs.group = LifecycleBasePlugin.VERIFICATION_GROUP
|
||||||
|
testJs.description = testTaskDescription
|
||||||
|
|
||||||
testJs.dependsOn(target.project.nodeJs.root.npmResolveTask, compileTask, nodeJs.nodeJsSetupTask)
|
testJs.dependsOn(target.project.nodeJs.root.npmResolveTask, compileTask, nodeJs.nodeJsSetupTask)
|
||||||
|
|
||||||
|
|||||||
+7
@@ -19,6 +19,9 @@ class KotlinNodeJs(target: KotlinJsTarget) :
|
|||||||
KotlinJsSubTarget(target, "node"),
|
KotlinJsSubTarget(target, "node"),
|
||||||
KotlinJsNodeDsl {
|
KotlinJsNodeDsl {
|
||||||
|
|
||||||
|
override val testTaskDescription: String
|
||||||
|
get() = "Run all ${target.name} tests inside nodejs using the builtin test framework"
|
||||||
|
|
||||||
override fun runTask(body: NodeJsExec.() -> Unit) {
|
override fun runTask(body: NodeJsExec.() -> Unit) {
|
||||||
(project.tasks.getByName(runTaskName) as NodeJsExec).body()
|
(project.tasks.getByName(runTaskName) as NodeJsExec).body()
|
||||||
}
|
}
|
||||||
@@ -30,7 +33,11 @@ class KotlinNodeJs(target: KotlinJsTarget) :
|
|||||||
override fun configureRun(compilation: KotlinJsCompilation) {
|
override fun configureRun(compilation: KotlinJsCompilation) {
|
||||||
val project = target.project
|
val project = target.project
|
||||||
|
|
||||||
|
"true".toBoolean()
|
||||||
|
|
||||||
val runTaskHolder = project.createOrRegisterTask<NodeJsExec>(disambiguateCamelCased("run")) { runTask ->
|
val runTaskHolder = project.createOrRegisterTask<NodeJsExec>(disambiguateCamelCased("run")) { runTask ->
|
||||||
|
runTask.description = "run compiled js in nodejs"
|
||||||
|
|
||||||
val compileKotlinTask = compilation.compileKotlinTask
|
val compileKotlinTask = compilation.compileKotlinTask
|
||||||
runTask.dependsOn(target.project.nodeJs.root.npmResolveTask, compileKotlinTask)
|
runTask.dependsOn(target.project.nodeJs.root.npmResolveTask, compileKotlinTask)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user