@@ -76,21 +76,20 @@ application {
76
76
}
77
77
78
78
// include JS artifacts in any JAR we generate
79
- tasks.getByName <Jar >(" jvmJar" ) {
79
+ tasks.named <Jar >(" jvmJar" ).configure {
80
80
val taskName = if (project.hasProperty(" isProduction" )
81
81
|| project.gradle.startParameter.taskNames.contains(" installDist" )
82
82
) {
83
83
" jsBrowserProductionWebpack"
84
84
} else {
85
85
" jsBrowserDevelopmentWebpack"
86
86
}
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
90
89
}
91
90
92
91
tasks {
93
- withType< org.jetbrains.kotlin.gradle.tasks.KotlinCompile > {
92
+ withType< org.jetbrains.kotlin.gradle.tasks.KotlinCompile > ().configureEach {
94
93
kotlinOptions {
95
94
jvmTarget = " 1.8"
96
95
}
@@ -109,10 +108,10 @@ distributions {
109
108
}
110
109
111
110
// 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" ))
114
113
}
115
114
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
118
117
}
0 commit comments