-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
96 lines (77 loc) · 2.65 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
val ktorVersion: String by project
val kotlinVersion: String by project
val logbackVersion: String by project
fun ktor(module: String, version: String? = this@Build_gradle.ktorVersion): Any =
"io.ktor:ktor-$module:$version"
plugins {
application
kotlin("jvm")
id("com.bmuschko.docker-java-application")
/** Required to build fat jar. */
id("com.github.johnrengelman.shadow") version "7.0.0"
// add if use Kotlin serialization
// id("org.jetbrains.kotlin.plugin.serialization")
}
application {
mainClass.set("io.ktor.server.netty.EngineMain")
}
docker {
javaApplication {
mainClassName.set(application.mainClass.get())
baseImage.set("adoptopenjdk/openjdk11:alpine-jre")
ports.set(listOf(8080))
val imageName = project.name
images.set(
listOf(
"$imageName:${project.version}",
"$imageName:latest"
)
)
jvmArgs.set(listOf("-Xms256m", "-Xmx512m"))
}
}
/**
* Build fat jar, and put it in build/libs folder.
*/
tasks {
shadowJar {
manifest {
attributes(Pair("Main-Class", "com.example.ApplicationKt"))
}
}
build {
dependsOn(":frontend:build")
dependsOn(":frontend:copyVueToKtor")
}
}
dependencies {
// Ktor core components
implementation(ktor("server-core"))
// Netty engine
implementation(ktor("server-netty"))
// support sessions
implementation(ktor("server-sessions"))
implementation(ktor("client-jackson"))
implementation(ktor("jackson"))
// Ktor own serialization
//implementation(ktor("serialization"))
implementation(ktor("freemarker"))
// main HTTP client functionality
implementation(ktor("client-core"))
// dependency for the CIO network engine
implementation(ktor("client-cio"))
implementation(ktor("auth"))
implementation(ktor("auth-jwt"))
// An slf4j implementation, we will use our own logback wrapper from the :backend:logging module
//implementation("ch.qos.logback:logback-classic:$logbackVersion")
implementation(project(":backend:models"))
implementation(project(":backend:services"))
implementation(project(":backend:transport:openapi"))
implementation(project(":backend:transport:mapping"))
implementation(project(":backend:transport:log"))
implementation(project(":backend:logging"))
// Allows to test parts of Ktor application without having to use the whole HTTP stack in the process
testImplementation(ktor("server-test-host"))
testImplementation(kotlin("test-junit"))
// testImplementation("org.jetbrains.kotlin:kotlin-test:$kotlinVersion")
}