@@ -76,21 +76,20 @@ application {
7676}
7777
7878// include JS artifacts in any JAR we generate
79- tasks.getByName <Jar >(" jvmJar" ) {
79+ tasks.named <Jar >(" jvmJar" ).configure {
8080 val taskName = if (project.hasProperty(" isProduction" )
8181 || project.gradle.startParameter.taskNames.contains(" installDist" )
8282 ) {
8383 " jsBrowserProductionWebpack"
8484 } else {
8585 " jsBrowserDevelopmentWebpack"
8686 }
87- val webpackTask = tasks.getByName<KotlinWebpack >(taskName)
88- dependsOn(webpackTask) // make sure JS gets compiled first
89- from(File (webpackTask.destinationDirectory, webpackTask.outputFileName)) // bring output file along into the JAR
87+ val webpackTask = tasks.named<KotlinWebpack >(taskName)
88+ from(webpackTask.map { File (it.destinationDirectory, it.outputFileName) }) // bring output file along into the JAR
9089}
9190
9291tasks {
93- withType< org.jetbrains.kotlin.gradle.tasks.KotlinCompile > {
92+ withType< org.jetbrains.kotlin.gradle.tasks.KotlinCompile > ().configureEach {
9493 kotlinOptions {
9594 jvmTarget = " 1.8"
9695 }
@@ -109,10 +108,10 @@ distributions {
109108}
110109
111110// Alias "installDist" as "stage" (for cloud providers)
112- tasks.create (" stage" ) {
113- dependsOn(tasks.getByName (" installDist" ))
111+ tasks.register (" stage" ) {
112+ dependsOn(tasks.named (" installDist" ))
114113}
115114
116- tasks.getByName <JavaExec >(" run" ) {
117- classpath(tasks.getByName <Jar >(" jvmJar" )) // so that the JS artifacts generated by `jvmJar` can be found and served
115+ tasks.named <JavaExec >(" run" ).configure {
116+ classpath(tasks.named <Jar >(" jvmJar" )) // so that the JS artifacts generated by `jvmJar` can be found and served
118117}
0 commit comments