Skip to content

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

build.gradle.kts

+8-9
Original file line numberDiff line numberDiff line change
@@ -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

9291
tasks {
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
}

settings.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
pluginManagement {
22
repositories {
33
mavenCentral()
4-
maven { setUrl("https://plugins.gradle.org/m2/") }
4+
gradlePluginPortal()
55
}
66
}
77
rootProject.name = "shoppinglist"

0 commit comments

Comments
 (0)