Skip to content

Commit

Permalink
Update the task that creates start.bat / start.sh scripts to take exp…
Browse files Browse the repository at this point in the history
…ort layout into account
  • Loading branch information
bitspittle committed Oct 3, 2024
1 parent 3b1a24e commit f89e3a2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ class KobwebApplicationPlugin @Inject constructor(

val kobwebUnpackServerJarTask = project.tasks.register<KobwebUnpackServerJarTask>("kobwebUnpackServerJar")
val kobwebCreateServerScriptsTask = project.tasks
.register<KobwebCreateServerScriptsTask>("kobwebCreateServerScripts")
.register<KobwebCreateServerScriptsTask>("kobwebCreateServerScripts", exportLayout)

val kobwebStartTask = run {
val reuseServer = project.findProperty("kobwebReuseServer")?.toString()?.toBoolean() ?: true
project.tasks.register<KobwebStartTask>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ import com.varabyte.kobweb.gradle.application.util.getServerJar
import com.varabyte.kobweb.gradle.core.tasks.KobwebTask
import com.varabyte.kobweb.server.api.ServerEnvironment
import com.varabyte.kobweb.server.api.SiteLayout
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.TaskAction
import javax.inject.Inject

/**
* A simple task for creating scripts which can be used to run the Kobweb server in production mode.
*/
abstract class KobwebCreateServerScriptsTask :
abstract class KobwebCreateServerScriptsTask @Inject constructor(@get:Input val siteLayout: SiteLayout) :
KobwebTask("Create scripts which can be used to start the Kobweb server in production mode") {
@OutputFile
fun getServerStartShellScript() =
Expand All @@ -25,7 +27,7 @@ abstract class KobwebCreateServerScriptsTask :
fun execute() {
val javaArgs = listOf(
ServerEnvironment.PROD.toSystemPropertyParam(),
SiteLayout.FULLSTACK.toSystemPropertyParam(),
siteLayout.toSystemPropertyParam(),
"-Dio.ktor.development=false",
"-jar",
kobwebApplication.kobwebFolder.getServerJar().absolutePath.let {
Expand Down

0 comments on commit f89e3a2

Please sign in to comment.