-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
156 lines (131 loc) · 4.12 KB
/
build.gradle
File metadata and controls
156 lines (131 loc) · 4.12 KB
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
plugins {
id "io.freefair.lombok" version "4.1.4"
id 'com.github.johnrengelman.shadow' version '5.2.0'
id "org.jetbrains.kotlin.jvm" version "1.3.60"
id "com.bmuschko.docker-java-application" version "5.3.0"
}
repositories {
mavenCentral()
gradlePluginPortal()
}
apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'eclipse'
apply plugin: 'idea'
sourceCompatibility = 1.11
targetCompatibility = 1.11
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
jvmTarget = "11"
}
}
/*
================================================================================
unit tests
================================================================================
*/
test {
useJUnitPlatform()
}
/*
================================================================================
integration tests
================================================================================
*/
sourceSets {
integrationTest {
java {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file('src/integration-test/java')
}
kotlin {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file('src/integration-test/kotlin')
}
resources.srcDir file('src/integration-test/resources')
}
}
configurations {
integrationTestImplementation.extendsFrom implementation
integrationTestRuntimeOnly.extendsFrom runtimeOnly
}
task integrationTest(type: Test) {
group = "verification"
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
useJUnitPlatform()
outputs.upToDateWhen { false }
}
/*
================================================================================
dependencies
================================================================================
*/
def versions = [
activation: "1.2.0",
freemarker: "2.3.29",
hamcrest: "2.2",
junit: "5.5.2",
kotlin: "1.3.60",
logback: "1.2.3",
slf4j: "1.7.26"
]
dependencies {
// web server
implementation("com.sun.activation:javax.activation:${versions.activation}")
implementation("org.freemarker:freemarker:${versions.freemarker}")
implementation("org.slf4j:slf4j-api:${versions.slf4j}")
runtimeOnly("ch.qos.logback:logback-classic:${versions.logback}")
// unit tests
testImplementation("org.junit.jupiter:junit-jupiter-api:${versions.junit}")
testImplementation("org.hamcrest:hamcrest:${versions.hamcrest}")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${versions.junit}")
// integration tests
integrationTestImplementation("org.jetbrains.kotlin:kotlin-stdlib:${versions.kotlin}")
integrationTestImplementation("org.junit.jupiter:junit-jupiter-api:${versions.junit}")
integrationTestImplementation("org.hamcrest:hamcrest:${versions.hamcrest}")
integrationTestRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${versions.junit}")
}
/*
================================================================================
artifact
================================================================================
*/
def mainClass = "org.giogt.web.server.Application"
application {
mainClassName = "${mainClass}"
}
jar {
manifest {
attributes(
'Main-Class': "${mainClass}"
)
}
from {
configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) }
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
}
/*
================================================================================
docker
================================================================================
*/
// copy artifacts under docker directory
task copyJar(type: Copy) {
from shadowJar
into 'docker/web-server/app'
}
build.dependsOn copyJar
// ensure copied artifacts are cleaned, when running the clean task
clean {
delete "docker/web-server/app"
}
import com.bmuschko.gradle.docker.tasks.image.DockerBuildImage
task buildDockerImage(type: DockerBuildImage) {
dependsOn build
inputDir = file('docker/web-server')
tags.add("giogt/web-server:latest")
}