forked from Apress/java-challenges
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
104 lines (76 loc) · 2.4 KB
/
build.gradle
File metadata and controls
104 lines (76 loc) · 2.4 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
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: "jacoco"
sourceCompatibility=17
targetCompatibility=17
repositories
{
jcenter();
}
dependencies
{
// JUnit 4 Support
testImplementation "junit:junit:4.13.2"
testRuntimeOnly("org.junit.vintage:junit-vintage-engine:5.8.2")
// JUnit 5
testRuntimeOnly "org.junit.platform:junit-platform-launcher:1.8.2"
testImplementation "org.junit.jupiter:junit-jupiter-engine:5.8.2"
// Asssert J
testImplementation group: 'org.assertj', name: 'assertj-core', version: '3.21.0'
// Parameterized tests
testImplementation("org.junit.jupiter:junit-jupiter-params:5.8.2")
// Migration Support to Enable Rules in JUnit 5
testImplementation "org.junit.jupiter:junit-jupiter-migrationsupport:5.8.2"
}
// JUnit 5 aktivieren
test {
useJUnitPlatform()
}
tasks.withType(JavaCompile) {
options.compilerArgs += ["--enable-preview"]
}
test {
// für die Beispiele wollen wir Fehler nicht als Build-Fehler werten, da die Beispiel
// bewusst ein paar Fehler integriert haben
ignoreFailures = true
// Aktivierung von Switch Expressions
jvmArgs '--enable-preview'
}
// Ausführbare Programme
apply from: "appTasks.txt"
// ---------------------------------- DISTRIBUTION / EXECUTABLES ------------------------------
jar {
archiveBaseName = "Java-Challenges"
manifest {
attributes(
"Created-By" : "Michael Inden",
"Specification-Title" : "Java-Challenges",
"Specification-Version" : "1",
"Specification-Vendor" : "Michael Inden",
"Implementation-Title" : "Java-Challenges",
"Implementation-Version" : "1",
"Implementation-Vendor" : "Michael Inden")
}
}
// Own Tasks
// ------------
def executeClass(final String mainName) {
javaexec {
main = mainName
classpath = files("${buildDir}/libs/Java-Challenges.jar") + files("${buildDir}/requiredLibs")
}
}
def executeClassPreviewEnabled(final String mainName) {
javaexec {
jvmArgs += ['--enable-preview']
main = mainName
classpath = files("${buildDir}/libs/Java-Challenges.jar") + files("${buildDir}/requiredLibs")
}
}
def executeClassWithAssertionsEnabled(final String mainName) {
javaexec {
jvmArgs += ['-ea']
main = mainName
classpath = files("${buildDir}/libs/Java-Challenges.jar") + files("${buildDir}/requiredLibs")
}
}