-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
160 lines (145 loc) · 6.12 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
import com.expediagroup.graphql.plugin.gradle.config.GraphQLSerializer
import com.expediagroup.graphql.plugin.gradle.tasks.GraphQLGenerateTestClientTask
import io.github.cdimascio.dotenv.dotenv
import org.flywaydb.gradle.task.AbstractFlywayTask
import org.flywaydb.gradle.task.FlywayCleanTask
import org.flywaydb.gradle.task.FlywayMigrateTask
plugins {
val kotlinVersion = "2.1.0"
kotlin("jvm") version kotlinVersion
application
id("org.flywaydb.flyway") version "11.2.0"
id("org.jetbrains.kotlin.plugin.serialization") version kotlinVersion
id("com.adarshr.test-logger") version "4.0.0"
id("com.expediagroup.graphql") version "8.3.0"
id("org.jetbrains.kotlinx.kover") version "0.9.1"
id("io.ktor.plugin") version "3.0.3"
}
group = "com.tumugin"
version = "1.0.0-SNAPSHOT"
repositories {
mavenCentral()
maven { url = uri("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev") }
}
val exposedVersion = "0.58.0"
val koinVersion = "4.0.1"
val ktorVersion = "3.0.3"
val logbackVersion = "1.5.16"
val coroutineVersion = "1.10.1"
val graphQLKotlinVersion = "8.3.0"
val flywayVersion = "11.2.0"
val sentryVersion = "7.20.0"
buildscript {
dependencies {
classpath("io.github.cdimascio:dotenv-kotlin:6.5.0")
classpath("org.flywaydb:flyway-database-postgresql:11.2.0")
}
}
application {
val dotEnvSetting = dotenv { ignoreIfMissing = true }
mainClass.set("com.tumugin.aisu.ApplicationKt")
val isDevelopment: Boolean = dotEnvSetting["APP_ENV"] != "production"
applicationDefaultJvmArgs = listOf("-Dio.ktor.development=$isDevelopment")
}
kotlin {
jvmToolchain(21)
// Enable K2 compiler
sourceSets.all {
languageSettings {
languageVersion = "2.0"
}
}
}
dependencies {
// ktor
implementation("io.ktor:ktor-server-core-jvm:$ktorVersion")
implementation("io.ktor:ktor-server-resources:$ktorVersion")
implementation("io.ktor:ktor-server-content-negotiation-jvm:$ktorVersion")
implementation("io.ktor:ktor-serialization-kotlinx-json-jvm:$ktorVersion")
implementation("io.ktor:ktor-server-default-headers-jvm:$ktorVersion")
implementation("io.ktor:ktor-server-cors-jvm:$ktorVersion")
implementation("io.ktor:ktor-server-sessions-jvm:$ktorVersion")
implementation("io.ktor:ktor-server-auth-jvm:$ktorVersion")
implementation("io.ktor:ktor-server-netty-jvm:$ktorVersion")
implementation("io.ktor:ktor-server-double-receive:$ktorVersion")
implementation("io.ktor:ktor-client-core:$ktorVersion")
implementation("io.ktor:ktor-client-cio:$ktorVersion")
implementation("io.ktor:ktor-client-content-negotiation:$ktorVersion")
implementation("io.ktor:ktor-server-forwarded-header:$ktorVersion")
implementation("ch.qos.logback:logback-classic:$logbackVersion")
// graphql
implementation("com.expediagroup:graphql-kotlin-server:$graphQLKotlinVersion")
implementation("com.expediagroup:graphql-kotlin-schema-generator:$graphQLKotlinVersion")
implementation("com.expediagroup:graphql-kotlin-ktor-client:$graphQLKotlinVersion")
implementation("com.expediagroup:graphql-kotlin-client-serialization:$graphQLKotlinVersion")
// libs
implementation("org.jetbrains.exposed:exposed-core:$exposedVersion")
implementation("org.jetbrains.exposed:exposed-dao:$exposedVersion")
implementation("org.jetbrains.exposed:exposed-jdbc:$exposedVersion")
implementation("org.jetbrains.exposed:exposed-kotlin-datetime:$exposedVersion")
implementation("mysql:mysql-connector-java:8.0.33")
implementation("org.postgresql:postgresql:42.7.5")
implementation("p6spy:p6spy:3.9.1")
implementation("com.zaxxer:HikariCP:6.2.1")
implementation("io.insert-koin:koin-core:$koinVersion")
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.6.1")
implementation("io.github.cdimascio:dotenv-kotlin:6.5.0")
implementation("de.svenkubiak:jBCrypt:0.4.3")
implementation("io.konform:konform:0.10.0")
implementation("io.lettuce:lettuce-core:6.5.2.RELEASE")
implementation("org.flywaydb:flyway-core:$flywayVersion")
implementation("org.flywaydb:flyway-mysql:$flywayVersion")
implementation("org.flywaydb:flyway-database-postgresql:$flywayVersion")
implementation("io.sentry:sentry:$sentryVersion")
implementation("io.sentry:sentry-kotlin-extensions:$sentryVersion")
implementation("io.sentry:sentry-logback:$sentryVersion")
implementation("io.sentry:sentry-jdbc:$sentryVersion")
// kotlin
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutineVersion")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutineVersion")
implementation(kotlin("stdlib-jdk8"))
// test(junit)
testImplementation("org.junit.jupiter:junit-jupiter-api:5.11.4")
testImplementation("org.junit.jupiter:junit-jupiter-params:5.11.4")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.11.4")
// test libs
testImplementation("io.mockk:mockk:1.13.16")
testImplementation("io.insert-koin:koin-test:4.0.1")
testImplementation("io.ktor:ktor-server-test-host:$ktorVersion")
testImplementation("com.h2database:h2:2.3.232")
testImplementation("io.ktor:ktor-client-mock:$ktorVersion")
}
val graphqlGenerateTestClient by tasks.getting(GraphQLGenerateTestClientTask::class) {
packageName.set("com.tumugin.aisu.testing.graphql.client")
schemaFile.set(file("${project.projectDir}/src/main/resources/aisuSchema.graphql"))
queryFileDirectory.set(file("${project.projectDir}/src/test/resources/graphql"))
serializer.set(GraphQLSerializer.KOTLINX)
}
flyway {
val dotEnvSetting = dotenv { ignoreIfMissing = true }
baselineVersion = "0"
url = dotEnvSetting["DB_JDBC_URL"]
user = dotEnvSetting["DB_USERNAME"]
password = dotEnvSetting["DB_PASSWORD"]
}
tasks.test {
useJUnitPlatform()
}
val flywayTestingDatabaseConfig: AbstractFlywayTask.() -> Unit = {
val dotEnvSetting = dotenv {
ignoreIfMissing = true
filename = ".env.testing"
}
baselineVersion = "0"
url = dotEnvSetting["DB_JDBC_URL"]
user = dotEnvSetting["DB_USERNAME"]
password = dotEnvSetting["DB_PASSWORD"]
cleanDisabled = false
}
task<FlywayMigrateTask>("migrateTestingDatabase", flywayTestingDatabaseConfig)
task<FlywayCleanTask>("cleanTestingDatabase", flywayTestingDatabaseConfig)
ktor {
docker {
jreVersion.set(JavaVersion.VERSION_19)
}
}