-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.gradle
95 lines (80 loc) · 1.96 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
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
plugins {
id 'java-library'
id 'scala'
id "com.palantir.git-version" version "0.14.0"
}
def name = 'fungraphics' // <- Will change the .jar name
def main = 'hevs.graphics.FunGraphics' // <- Main class name
java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
}
test {
useJUnitPlatform()
//jvmArgs["-Djava.awt.headless=true"]
//environment.remove("DISPLAY")
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.scala-lang:scala-library:2.13.9'
testImplementation 'org.scalatest:scalatest_2.13:3.2.0'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
testImplementation 'org.assertj:assertj-core:3.9.2'
testImplementation 'org.assertj:assertj-swing-junit:3.9.2'
}
def genDir = "$buildDir/gen/"
task versionGen {
def versionFile = "$genDir/version.txt"
outputs.upToDateWhen { false }
outputs.file(versionFile)
doLast {
new File(versionFile).text = """${gitVersion()}
"""
}
}
tasks.named('jar') {
dependsOn versionGen
dependsOn test
dependsOn scaladoc
manifest {
attributes('Implementation-Title': name,
'Implementation-Version': rootProject.version,
'Main-Class': main)
}
archiveBaseName.set(rootProject.name)
archiveVersion.set(rootProject.version)
from('src/main/scala') {
include '**/*.scala'
include '**/*.java'
}
from(scaladoc.outputs.files) {
include '**'
exclude 'hevs/utils/ScalaDocSetup.html'
exclude 'index.html'
}
from("$genDir") {
rename {
String filename -> "res/generated/" + filename
}
}
}
version = gitVersion()
task runJar(type: JavaExec) {
dependsOn jar
mainClass = "-jar";
args jar.archiveFile.get()
}
task copyJar(type: Copy) {
from jar // copies output of file produced from jar task
into "$buildDir"
rename '.*', "$rootProject.name-dev.jar"
}
javadoc {
// without the -quiet option, the build fails
options.addStringOption('Xdoclint:none', '-quiet')
}
build.finalizedBy copyJar