Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -71,21 +71,20 @@ application {
}

// include JS artifacts in any JAR we generate
tasks.getByName<Jar>("jvmJar") {
tasks.named<Jar>("jvmJar").configure {
val taskName = if (project.hasProperty("isProduction")
|| project.gradle.startParameter.taskNames.contains("installDist")
) {
"jsBrowserProductionWebpack"
} else {
"jsBrowserDevelopmentWebpack"
}
val webpackTask = tasks.getByName<KotlinWebpack>(taskName)
dependsOn(webpackTask) // make sure JS gets compiled first
from(File(webpackTask.destinationDirectory, webpackTask.outputFileName)) // bring output file along into the JAR
val webpackTask = tasks.named<KotlinWebpack>(taskName)
from(webpackTask.map { File(it.destinationDirectory, it.outputFileName) }) // bring output file along into the JAR
}

tasks {
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = "1.8"
}
Expand All @@ -104,10 +103,10 @@ distributions {
}

// Alias "installDist" as "stage" (for cloud providers)
tasks.create("stage") {
dependsOn(tasks.getByName("installDist"))
tasks.register("stage") {
dependsOn(tasks.named("installDist"))
}

tasks.getByName<JavaExec>("run") {
classpath(tasks.getByName<Jar>("jvmJar")) // so that the JS artifacts generated by `jvmJar` can be found and served
tasks.named<JavaExec>("run").configure {
classpath(tasks.named<Jar>("jvmJar")) // so that the JS artifacts generated by `jvmJar` can be found and served
}
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pluginManagement {
repositories {
mavenCentral()
maven { setUrl("https://plugins.gradle.org/m2/") }
gradlePluginPortal()
}
}
rootProject.name = "shoppinglist"
Expand Down