forked from istonikula/realworld-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
169 lines (142 loc) · 4.13 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
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
import org.flywaydb.gradle.FlywayExtension
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jlleitschuh.gradle.ktlint.KtlintExtension
plugins {
id("com.github.ben-manes.versions") version Version.versionsPlugin
id("org.flywaydb.flyway") version Version.flyway apply false
id("org.jetbrains.kotlin.jvm") version Version.kotlin apply false
id("org.jetbrains.kotlin.plugin.spring") version Version.kotlin apply false
id("org.jlleitschuh.gradle.ktlint") version Version.ktlintPlugin apply false
id("org.springframework.boot") version Version.springBoot apply false
}
configure(subprojects.apply {
remove(project(":realworld-app"))
remove(project(":realworld-infra"))
}) {
apply(plugin = "io.spring.dependency-management")
apply(plugin = "org.jetbrains.kotlin.jvm")
apply(plugin = "org.jetbrains.kotlin.plugin.spring")
apply(plugin = "org.jlleitschuh.gradle.ktlint")
version = "0.0.1-SNAPSHOT"
repositories {
jcenter()
mavenCentral()
}
configurations {
all {
resolutionStrategy.eachDependency {
if (requested.group == "org.jetbrains.kotlin") {
useVersion(Version.kotlin)
because("use single kotlin version")
}
}
}
}
tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = Version.java
freeCompilerArgs = listOf(
"-Xjsr305=strict",
"-Xinline-classes"
)
}
}
tasks.withType<Test> {
useJUnitPlatform()
outputs.upToDateWhen { false }
testLogging {
events("passed", "failed", "skipped")
exceptionFormat = TestExceptionFormat.FULL
}
}
configure<KtlintExtension> {
version.set(Version.ktlint)
}
dependencies {
// override spring-boot platform versions
project.extra.set("groovy.version", Version.groovy) // keep in sync with rest-assured https://raw.githubusercontent.com/rest-assured/rest-assured/master/changelog.txt
project.extra.set("rest-assured.version", Version.restAssured)
implementation.let {
it(platform("org.springframework.boot:spring-boot-dependencies:${Version.springBoot}"))
it(Libs.arrowFx)
it(Libs.arrowMtl)
it(Libs.arrowSyntax)
}
runtime(Libs.jaxb)
testImplementation.let {
it(Starters.test) {
exclude(group = "org.junit.vintage", module = "junit-vintage-engine")
}
it(Libs.junitJupiter)
}
}
}
project("realworld-app:web") {
apply(plugin = "org.springframework.boot")
apply(plugin = "org.flywaydb.flyway")
configure<FlywayExtension> {
url = "jdbc:postgresql://localhost:5432/realworld"
user = "postgres"
password = "secret"
placeholders = mapOf(
"application_user" to "realworld"
)
}
dependencies {
implementation.let {
it(project(":realworld-domain"))
it(project(":realworld-infra:persistence"))
it(Starters.actuator)
it(Starters.jdbc)
it(Starters.validation)
it(Starters.web) {
exclude(
group = "org.springframework.boot",
module = "spring-boot-starter-tomcat"
)
}
it(Starters.undertow)
it(Libs.jacksonKotlin)
}
runtime(Libs.postgresql)
testImplementation.let {
it(Libs.jsonSchemaValidator)
it(Libs.restassured)
}
}
}
project("realworld-domain") {
dependencies {
implementation.let {
it(Libs.jasypt)
it(Libs.jjwt)
it(Libs.slugify)
}
}
}
project("realworld-infra:persistence") {
dependencies {
implementation.let {
it(project(":realworld-domain"))
it(Starters.jdbc)
it(Libs.postgresql)
}
}
}
tasks.named<DependencyUpdatesTask>("dependencyUpdates") {
resolutionStrategy {
componentSelection {
all {
val rejected = listOf("alpha", "b", "beta", "build-snapshot", "rc", "cr", "m", "preview")
.map { qualifier -> Regex("(?i).*[.-]$qualifier[.\\d-]*") }
.any { it.matches(candidate.version) }
if (rejected) {
reject("Release candidate")
}
}
}
}
checkForGradleUpdate = true
}