-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
176 lines (150 loc) · 5.14 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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
import org.apache.tools.ant.taskdefs.condition.Os
import org.gradle.api.tasks.testing.logging.TestLogEvent.*
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
buildscript {
dependencies {
classpath("org.postgresql:postgresql:${Globals.postgresVersion}")
}
}
plugins {
idea
java
kotlin("jvm") version Globals.kotlinVersion
kotlin("plugin.spring") version Globals.kotlinVersion
id("org.springframework.boot") version Globals.springBootVersion
id("org.flywaydb.flyway") version Globals.Gradle.Plugin.flywayVersion
id("io.franzbecker.gradle-lombok") version Globals.Gradle.Plugin.lombokVersion
id("io.spring.dependency-management") version Globals.Gradle.Plugin.dependencyManagementVersion
id("com.github.ben-manes.versions") version Globals.Gradle.Plugin.versionsVersion
// gradle dependencyUpdates -Drevision=release
}
group = Globals.Project.groupId
version = Globals.Project.version
extra["junit.version"] = Globals.junitVersion
extra["lombok.version"] = Globals.lombokVersion
extra["kotlin.version"] = Globals.kotlinVersion
extra["jackson.version"] = Globals.jacksonVersion
extra["junit-jupiter.version"] = Globals.junitJupiterVersion
//extra["flyway.user"] = "postgres"
//extra["flyway.password"] = "postgres"
//extra["flyway.url"] = "jdbc:postgresql://127.0.0.1:5432/postgres"
////extra["flyway.configFiles"] = "classpath:/flyway.properties"
////extra["flyway.schemas"] = "schema1,schema2,schema3,public"
////extra["flyway.placeholders.otherplaceholder"] = "value123"
////extra["flyway.placeholders.keyABC"] = "valueXYZ"
flyway {
user = "postgres"
password = "postgres"
url = "jdbc:postgresql://127.0.0.1:5432/postgres"
locations = arrayOf(
"classpath:db/migration" // -> src/main/resources/db/migration
)
}
java {
sourceCompatibility = Globals.javaVersion
targetCompatibility = Globals.javaVersion
}
repositories {
mavenCentral()
// maven { url = uri("https://repo.spring.io/snapshot/") }
maven { url = uri("https://repo.spring.io/milestone/") }
}
lombok {
version = Globals.lombokVersion
}
//// Comment this fucking shit! It doesn't work...
//sourceSets {
// main {
// java.srcDirs(
// "src/main/java",
// "src/main/kotlin"
// )
// }
// test {
// java.srcDirs(
// "src/test/java",
// "src/test/kotlin"
// )
// }
//}
val flywayMigration = configurations.create("flywayMigration")
dependencies {
flywayMigration("org.postgresql:postgresql:${Globals.postgresVersion}")
implementation(platform("org.jetbrains.kotlin:kotlin-bom:${Globals.kotlinVersion}"))
implementation(kotlin("stdlib"))
implementation(kotlin("reflect"))
testImplementation(kotlin("test-junit"))
testImplementation(kotlin("test-junit5"))
implementation(platform("org.springframework.boot:spring-boot-dependencies:${Globals.springBootVersion}"))
implementation("org.springframework.boot:spring-boot-starter-webflux")
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("io.projectreactor:reactor-test")
implementation(platform("org.springframework.boot.experimental:spring-boot-dependencies-r2dbc:${Globals.r2dbcSpringVersion}"))
implementation("org.springframework.boot.experimental:spring-boot-starter-data-r2dbc")
implementation("io.r2dbc:r2dbc-postgresql:${Globals.r2dbcPostgresVersion}")
implementation(platform("com.fasterxml.jackson:jackson-bom:${Globals.jacksonVersion}"))
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("io.vavr:vavr:${Globals.vavrVersion}")
annotationProcessor("org.projectlombok:lombok")
testImplementation(platform("org.junit:junit-bom:${Globals.junitJupiterVersion}"))
testRuntimeOnly("org.junit.vintage:junit-vintage-engine")
testImplementation("org.junit.jupiter:junit-jupiter")
}
tasks {
withType(Wrapper::class.java) {
gradleVersion = Globals.Gradle.wrapperVersion
distributionType = Wrapper.DistributionType.BIN
}
withType<KotlinCompile>().configureEach {
kotlinOptions {
freeCompilerArgs += "-Xjsr305=strict"
jvmTarget = "${Globals.javaVersion}"
}
}
withType<Test> {
useJUnitPlatform()
testLogging {
showExceptions = true
showStandardStreams = true
events(PASSED, SKIPPED, FAILED)
}
}
create<Zip>("sources") {
dependsOn("clean")
shouldRunAfter("clean", "assemble")
description = "Archives sources in a zip file"
group = "Archive"
from("buildSrc") {
into("buildSrc")
}
from("src") {
into("src")
}
from(".gitignore")
from(".java-version")
from(".travis.yml")
from("build.gradle.kts")
from("pom.xml")
from("README.md")
from("settings.gradle.kts")
archiveFileName.set("${project.buildDir}/sources-${project.version}.zip")
}
named("clean") {
doLast {
delete(
project.buildDir,
"${project.projectDir}/out"
)
}
}
register<Exec>("up") {
commandLine("docker", "run", "--rm", "-d", "--name", "pg", "-p", "5432:5432", "postgres:alpine")
}
register<Exec>("ps") {
commandLine("docker", "ps")
}
register<Exec>("rm") {
commandLine("docker", "rm", "-f", "-v", "pg")
}
}
defaultTasks("clean", "sources", "build")