-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
213 lines (185 loc) · 5.72 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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.gradle.api.tasks.testing.logging.TestLogEvent.*
import org.springframework.boot.gradle.tasks.bundling.BootJar
import org.springframework.boot.gradle.tasks.bundling.BootWar
plugins {
war
idea
base
java
kotlin("jvm") version "1.3.21"
kotlin("plugin.spring") version "1.3.21"
id("io.franzbecker.gradle-lombok") version "2.1"
id("io.spring.dependency-management") version "1.0.7.RELEASE"
id("org.springframework.boot") version "2.2.0.BUILD-SNAPSHOT"
id("com.avast.gradle.docker-compose").version("0.9.1")
id("com.github.ben-manes.versions") version "0.21.0"
id("com.moowork.node") version "1.3.1"
}
allprojects {
val projectGroup: String by project
val projectVersion: String by project
group = projectGroup
version = projectVersion
}
val kotlinVersion: String by project
val junitJupiterVersion: String by project
extra["kotlin.version"] = kotlinVersion
extra["junit-jupiter.version"] = junitJupiterVersion
tasks.withType<Wrapper>().configureEach {
val gradleWrapperVersion: String by project
gradleVersion = gradleWrapperVersion
distributionType = Wrapper.DistributionType.BIN
}
val javaVersion = JavaVersion.VERSION_1_8
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
freeCompilerArgs += "-Xjsr305=strict"
jvmTarget = "$javaVersion"
}
}
java {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
}
sourceSets {
main {
java.srcDir("src/main/kotlin")
}
test {
java.srcDir("src/test/kotlin")
}
}
lombok {
val lombokVersion: String by project
version = lombokVersion
}
/*
the<SourceSetContainer>()["main"].java.srcDir("src/main/kotlin")
the<SourceSetContainer>()["test"].java.srcDir("src/test/kotlin")
*/
repositories {
mavenCentral()
maven(url = "https://repo.spring.io/snapshot")
maven(url = "https://repo.spring.io/milestone")
}
dependencyManagement {
imports {
val springBootVersion: String by project
mavenBom("org.springframework.boot:spring-boot-dependencies:$springBootVersion")
}
}
dependencies {
implementation("org.springframework.boot:spring-boot-starter-hateoas")
implementation("org.springframework.boot:spring-boot-starter-webflux")
implementation("org.springframework.boot:spring-boot-starter-actuator")
//implementation("org.springframework.boot:spring-boot-starter-web") // tomcat
implementation("org.springframework.boot:spring-boot-starter")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation(kotlin("stdlib-jdk8"))
implementation(kotlin("reflect"))
annotationProcessor("org.projectlombok:lombok")
testAnnotationProcessor("org.projectlombok:lombok")
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor")
testAnnotationProcessor("org.springframework.boot:spring-boot-configuration-processor")
runtimeOnly("org.springframework.boot:spring-boot-devtools")
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("io.projectreactor:reactor-test")
testImplementation("junit:junit")
testImplementation(platform("org.junit:junit-bom:$junitJupiterVersion"))
testImplementation("org.junit.jupiter:junit-jupiter-api")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
testRuntimeOnly("org.junit.vintage:junit-vintage-engine")
testRuntime("org.junit.platform:junit-platform-launcher")
}
tasks.withType<BootJar>().configureEach {
launchScript()
}
tasks.withType<BootWar>().configureEach {
launchScript()
}
tasks.withType<Test> {
useJUnitPlatform()
testLogging {
showExceptions = true
showStandardStreams = true
events(PASSED, SKIPPED, FAILED)
}
}
defaultTasks("build")
node {
val targetNodeVersion: String by project
val targetNpmVersion: String by project
download = true
version = targetNodeVersion
npmVersion = targetNpmVersion
}
tasks.create("start")
tasks["start"].dependsOn("npm_start")
tasks["npm_start"].dependsOn("npm_i")
tasks["build"].dependsOn("npm_run_build")
tasks["npm_run_build"].dependsOn("npm_install")
val dockerPs: Task = tasks.create<Exec>("dockerPs") {
shouldRunAfter("clean", "assemble")
executable = "docker"
args("ps", "-a", "-f", "name=${project.name}")
}
tasks["composeUp"].dependsOn("assemble")
tasks["composeUp"].shouldRunAfter("clean", "assemble")
dockerCompose {
isRequiredBy(dockerPs)
}
// gradle dependencyUpdates -Drevision=release --parallel
tasks.named<DependencyUpdatesTask>("dependencyUpdates") {
resolutionStrategy {
componentSelection {
all {
val rejected = listOf("alpha", "beta", "rc", "cr", "m", "preview", "b", "ea", "SNAPSHOT")
.map { qualifier -> Regex("(?i).*[.-]$qualifier[.\\d-+]*") }
.any { it.matches(candidate.version) }
if (rejected) reject("Release candidate")
}
}
}
//// optionals:
// checkForGradleUpdate = true
// outputFormatter = "plain" // "json" // "xml"
// outputDir = "build/dependencyUpdates"
// reportfileName = "report"
}
tasks {
getByName("clean") {
doLast {
delete(
project.buildDir,
"${project.projectDir}/.vuepress/dist"
)
}
}
}
tasks.create<Zip>("sources") {
group = "Archive"
description = "Archives sources in a zip archive"
dependsOn("clean")
shouldRunAfter("clean")
from(".vuepress") {
into(".vuepress")
}
from("src") {
into("src")
}
from(
".gitignore",
".travis.yml",
"build.gradle.kts",
"docker-compose.yaml",
"gradle.properties",
"LICENSE",
"package.json",
"package-lock.json",
"README.md",
"settings.gradle.kts"
)
archiveFileName.set("${project.buildDir}/sources-${project.version}.zip")
}