-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle.kts
141 lines (124 loc) · 4.67 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
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.jooq:jooq-codegen:3.14.1")
classpath("org.postgresql:postgresql:42.2.11")
}
}
plugins {
kotlin("jvm") version "1.5.0"
application
id("org.jlleitschuh.gradle.ktlint") version "9.4.1"
id("com.github.johnrengelman.shadow") version "6.1.0"
}
group = "com.davidonium"
version = "0.0.1-SNAPSHOT"
java.sourceCompatibility = JavaVersion.VERSION_11
val appMainClassName = "io.realworld.conduit.AppKt"
project.setProperty("mainClassName", appMainClassName)
application {
mainClass.set(appMainClassName)
}
repositories {
mavenCentral()
}
sourceSets {
main {
java.srcDir("src/main/generated/kotlin")
}
}
val auth0JwtVersion = "3.10.0"
val bcryptVersion = "0.9.0"
val hikaricpVersion = "3.4.1"
val jacksonVersion = "2.10.2"
val javalinVersion = "3.13.6"
val jooqVersion = "3.14.1"
val junitVersion = "5.5.1"
val koinVersion = "3.0.1"
val kotlinVersion = "1.5.0"
val logbackVersion = "1.2.3"
val mockkVersion = "1.10.3"
val postgresDriverVersion = "42.2.6"
val restAssuredVersion = "4.1.2"
val slugifyVersion = "2.4"
val springJdbcVersion = "5.2.4.RELEASE"
val testcontainersPostgresqlVersion = "1.15.1"
val reactiveStreamsVersion = "1.0.3"
val typesafeConfigVersion = "1.4.1"
dependencies {
implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion")
implementation("at.favre.lib:bcrypt:$bcryptVersion")
implementation("ch.qos.logback:logback-classic:$logbackVersion")
implementation("com.auth0:java-jwt:$auth0JwtVersion")
implementation("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jacksonVersion")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:$jacksonVersion")
implementation("com.zaxxer:HikariCP:$hikaricpVersion")
implementation("io.javalin:javalin:$javalinVersion")
implementation("org.jooq:jooq:$jooqVersion")
implementation("io.insert-koin:koin-core-jvm:$koinVersion")
implementation("org.postgresql:postgresql:$postgresDriverVersion")
implementation("com.github.slugify:slugify:$slugifyVersion")
implementation("org.springframework:spring-jdbc:$springJdbcVersion")
implementation("org.reactivestreams:reactive-streams:$reactiveStreamsVersion")
implementation("com.typesafe:config:$typesafeConfigVersion")
testImplementation("io.mockk:mockk:$mockkVersion")
testImplementation("io.rest-assured:rest-assured:$restAssuredVersion")
testImplementation("io.rest-assured:kotlin-extensions:$restAssuredVersion")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit5:$kotlinVersion")
testImplementation("org.testcontainers:postgresql:$testcontainersPostgresqlVersion")
testImplementation("org.junit.jupiter:junit-jupiter:$junitVersion")
}
tasks {
withType<Test> {
useJUnitPlatform()
}
register("jooq") {
group = "Jooq"
description = "Generate jooq classes from the xml schema generated from the jooqxml task"
inputs.file(file("src/main/resources/db/jooq/information_schema.xml"))
inputs.file(file("src/main/resources/db/jooq/jooq.xml"))
outputs.dir(file("src/main/generated/kotlin"))
doLast {
val config = file("src/main/resources/db/jooq/jooq.xml")
.readText()
.replace("%project_dir%", project.projectDir.toString())
org.jooq.codegen.GenerationTool.generate(config)
}
}
register("jooqxml") {
group = "Jooq"
description = "Generate jooq xml schema from database"
doLast {
val dbUrl = System.getenv("DB_URL") ?: "jdbc:postgresql://localhost:5555/realworld"
val dbUser = System.getenv("DB_USER") ?: "rw"
val dbPwd = System.getenv("DB_PASSWORD") ?: "rw"
val config = file("src/main/resources/db/jooq/jooq-meta.xml")
.readText()
.replace("%database_url%", dbUrl)
.replace("%database_user%", dbUser)
.replace("%database_password%", dbPwd)
.replace("%project_dir%", project.projectDir.toString())
org.jooq.codegen.GenerationTool.generate(config)
}
}
withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "11"
}
dependsOn(getByName("jooq"))
}
clean {
delete("src/main/generated")
}
}
ktlint {
filter {
exclude("**/generated/**")
}
}