87 lines
1.9 KiB
Kotlin
87 lines
1.9 KiB
Kotlin
plugins {
|
|
kotlin("jvm")
|
|
alias(libs.plugins.ktor)
|
|
application
|
|
}
|
|
|
|
/*
|
|
* Files supplied by the web project.
|
|
*
|
|
* This configuration is resolvable by this project but isn't itself
|
|
* published for other projects to consume.
|
|
*/
|
|
val webFiles = configurations.create("webFiles")
|
|
/*
|
|
{
|
|
isCanBeResolved = true
|
|
isCanBeConsumed = false
|
|
}
|
|
*/
|
|
|
|
dependencies {
|
|
// Ktor
|
|
implementation(libs.ktor.server.core)
|
|
implementation(libs.ktor.server.netty)
|
|
|
|
// JSON
|
|
implementation(libs.ktor.serialization.kotlinx.json)
|
|
|
|
// Status Pages / Exception Handling
|
|
implementation(libs.ktor.server.status.pages)
|
|
|
|
// Logging
|
|
implementation(libs.ktor.server.logging)
|
|
implementation(libs.logback)
|
|
|
|
// Swagger/OpenAPI
|
|
implementation(libs.ktor.server.swagger)
|
|
implementation(libs.ktor.server.openapi)
|
|
implementation(libs.ktor.server.routing.openapi)
|
|
implementation(libs.ktor.server.content.negotiation)
|
|
|
|
// Testing
|
|
testImplementation(libs.ktor.server.test.host)
|
|
testImplementation(kotlin("test"))
|
|
|
|
// Websockets
|
|
implementation(libs.ktor.server.websockets)
|
|
|
|
// CORS
|
|
implementation(libs.ktor.server.cors)
|
|
|
|
// General Use
|
|
implementation(libs.kotlinx.datetime)
|
|
|
|
// Shared application code
|
|
implementation(project(":shared"))
|
|
|
|
/*
|
|
* Web application's generated files.
|
|
*
|
|
* This is a build-time dependency, not a runtime dependency.
|
|
* The web project exposes the files through its webDistribution
|
|
* outgoing configuration.
|
|
*/
|
|
webFiles(project(path = ":web", configuration = "webDistribution"))
|
|
}
|
|
|
|
application {
|
|
mainClass = "dev.geekback.dopewars.server.ServerKt"
|
|
}
|
|
|
|
/*
|
|
* Copy the web distribution into the server's resources.
|
|
*
|
|
* The files will end up at:
|
|
*
|
|
* server/build/resources/main/web/
|
|
*
|
|
* and therefore inside the server JAR at:
|
|
*
|
|
* web/
|
|
*/
|
|
tasks.processResources {
|
|
from(webFiles) {
|
|
into("web")
|
|
}
|
|
} |