This repository has been archived by the owner on Jun 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
66 lines (54 loc) · 1.63 KB
/
build.gradle
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
plugins {
id 'java'
}
def peachMainClass = 'nl.windesheim.ictm2o.peach.Main'
group 'nl.windesheim.ictm2o'
version '1.0'
repositories {
mavenCentral()
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
compileJava {
sourceCompatibility = '17'
targetCompatibility = '17'
}
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
implementation 'org.jetbrains:annotations:16.0.2'
implementation 'org.json:json:20220320'
// https://mavenlibs.com/maven/dependency/com.miglayout/miglayout
implementation 'com.miglayout:miglayout:3.7.4'
}
test {
useJUnitPlatform()
}
task generateJava(type:Copy) {
def templateContext = [version: project.version]
inputs.properties templateContext // for gradle up-to-date check
from 'src/template/java'
into "$buildDir/generated/java"
expand templateContext
}
jar {
manifest {
attributes(
'Main-Class': "${peachMainClass}"
)
}
}
// Een 'fat' JAR is een JAR (Java Executable, soort van EXE) die alle libraries
// bevat die we in dit project gebruiken. Zo hoeven we dus maar een enkel bestand
// te shippen.
task fatJar(type: Jar) {
manifest.attributes['Main-Class'] = "${peachMainClass}"
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from {
configurations.runtimeClasspath.collect{ it.isDirectory() ? it : zipTree(it) }
}
with jar
}
sourceSets.main.java.srcDir "$buildDir/generated/java" // add the extra source dir
compileJava.dependsOn generateJava // wire the generateJava task into the DAG