https://kotlinlang.org logo
Title
e

Egor Okhterov

12/24/2019, 3:13 PM
When you create default project there is the following in
build.gradle
:
jvmJar {
    dependsOn(jsBrowserWebpack)
    from(new File(jsBrowserWebpack.entry.name, jsBrowserWebpack.outputPath))
}
How do you express that in
build.gradle.kts
? Probably, I've got a part of this right, but I'm not sure about the last expression
tasks.named("jvmJar") {
    dependsOn("jsBrowserWebpack")
}
d

diesieben07

12/24/2019, 3:20 PM
val jsBrowserWebpack by tasks.getting(JsBrowserWebpack::class) // not sure if this is the correct class name

tasks.named("jvmJar", Jar::class) {
    dependsOn(jsBrowserWebpack)
    from(File(jsBrowserWebpack.entry.name, jsBrowserWebpack.outputPath))
}
You need the correct task types
e

Egor Okhterov

12/24/2019, 3:21 PM
d

diesieben07

12/24/2019, 3:21 PM
Read the comment in my code...
e

Egor Okhterov

12/24/2019, 3:22 PM
That is the part of the
build.gradle
from default project created via IntelliJ IDEA
d

diesieben07

12/24/2019, 3:22 PM
Not sure what you are trying to say.
e

Egor Okhterov

12/24/2019, 3:23 PM
Just adding information
I cannot find JsBrowserWebpack in the source of Kotlin neither
d

diesieben07

12/24/2019, 3:24 PM
Yes, like I said I don't know what the class name is. But you need to use the actual task class for that task
Looks like its
org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpack
e

Egor Okhterov

12/24/2019, 3:26 PM
How did you find it?
d

diesieben07

12/24/2019, 3:26 PM
val jsBrowserWebpack by tasks.getting

project.afterEvaluate {
    println(jsBrowserWebpack::class)
}
e

Egor Okhterov

12/24/2019, 3:27 PM
oh, thank you!