-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.gradle.kts
151 lines (125 loc) · 5.06 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
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("com.energizedwork.webdriver-binaries") version "1.4"
id("com.palantir.docker") version "0.25.0"
id("io.spring.dependency-management") version "1.0.10.RELEASE"
id("org.gradle.groovy")
id("org.springframework.boot") version "2.3.5.RELEASE"
kotlin("jvm") version "1.4.20-RC"
kotlin("plugin.spring") version "1.4.20-RC"
}
val appName = "app"
val appVer by lazy { gitRev() }
group = "io.tronalddump"
version = appVer
java.sourceCompatibility = JavaVersion.VERSION_1_8
// versions
val chromeDriverVersion = "2.36"
val geckoDriverVersion = "0.24.0"
val seleniumVersion = "3.141.59"
val spockVersion = "1.3-groovy-2.5"
val sourceSets = the<SourceSetContainer>()
sourceSets {
create("browserTest") {
java.srcDir(file("src/browserTest/groovy"))
resources.srcDir(file("src/browserTest/resources"))
compileClasspath += sourceSets["main"].output + configurations["testRuntimeClasspath"]
runtimeClasspath += output + compileClasspath
}
create("integTest") {
java.srcDir(file("src/integTest/groovy"))
resources.srcDir(file("src/integTest/resources"))
compileClasspath += sourceSets["main"].output + configurations["testRuntimeClasspath"]
runtimeClasspath += output + compileClasspath
}
}
repositories {
mavenCentral()
}
dependencies {
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("org.postgresql:postgresql:42.2.18")
implementation("org.springdoc:springdoc-openapi-core:1.1.49")
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.springframework.boot:spring-boot-starter-thymeleaf")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.hateoas:spring-hateoas:1.2.0")
runtimeOnly("com.h2database:h2")
runtimeOnly("org.springframework.boot:spring-boot-devtools")
testImplementation("org.gebish:geb-spock:3.2")
testImplementation("org.seleniumhq.selenium:selenium-chrome-driver:${seleniumVersion}")
testImplementation("org.seleniumhq.selenium:selenium-firefox-driver:${seleniumVersion}")
testImplementation("org.seleniumhq.selenium:selenium-java:${seleniumVersion}")
testImplementation("org.spockframework:spock-core:${spockVersion}") { exclude(group = "org.codehaus.groovy") }
testImplementation("org.spockframework:spock-spring:${spockVersion}")
testImplementation("org.springframework.boot:spring-boot-starter-test") { exclude(group = "org.junit.vintage", module = "junit-vintage-engine") }
}
webdriverBinaries {
chromedriver = chromeDriverVersion
geckodriver = geckoDriverVersion
}
springBoot {
buildInfo {
properties {
artifact = "$appName-$appVer.jar"
version = appVer
name = appName
}
}
}
tasks {
bootJar {
manifest {
attributes("Multi-Release" to true)
}
archiveBaseName.set(appName)
archiveVersion.set(appVer)
if (project.hasProperty("archiveName")) {
archiveFileName.set(project.properties["archiveName"] as String)
}
}
docker {
val bootJar = bootJar.get()
val imageName = "$group/$appName"
name = "$imageName:latest"
tag("current", "$imageName:$appVer")
tag("latest", "$imageName:latest")
tag("herokuProduction", "registry.heroku.com/tronalddump/web")
tag("herokuStaging", "registry.heroku.com/tronalddump-staging/web")
files(bootJar.archiveFile)
files(file("$projectDir/src/main/resources"))
setDockerfile(file("$projectDir/src/main/docker/Dockerfile"))
buildArgs(
mapOf("JAR_FILE" to bootJar.archiveFileName.get())
)
}
register<Test>("browserTest") {
description = "Runs the browser tests in headless mode."
group = "verification"
testClassesDirs = sourceSets["browserTest"].output.classesDirs
classpath = sourceSets["browserTest"].runtimeClasspath
outputs.upToDateWhen { false }
systemProperty("geb.build.reportsDir", reporting.file("geb/headless"))
systemProperty("geb.env", "headless")
}
register<Test>("integrationTest") {
description = "Runs the integration tests."
group = "verification"
testClassesDirs = sourceSets["integTest"].output.classesDirs
classpath = sourceSets["integTest"].runtimeClasspath
}
withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "1.8"
}
}
}
fun gitRev() = ProcessBuilder("git", "rev-parse", "HEAD").start().let { p ->
p.waitFor(100, TimeUnit.MILLISECONDS)
p.inputStream.bufferedReader().readLine() ?: "none"
}