-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle
82 lines (66 loc) · 2.19 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
import java.nio.charset.StandardCharsets
import java.nio.file.Files
import java.nio.file.StandardOpenOption
plugins {
id 'java'
id 'application'
id 'antlr'
}
group = 'net.shrimpworks'
version = "1.2"
mainClassName = 'net.shrimpworks.unreal.scriptbrowser.App'
repositories {
mavenCentral()
}
dependencies {
antlr 'org.antlr:antlr4:4.13.1'
implementation 'org.freemarker:freemarker:2.3.33'
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.2'
}
jar {
manifest {
attributes(
'Implementation-Title': project.name,
'Implementation-Version': project.version,
'Main-Class': mainClassName,
)
}
}
task execJar(type: Jar) {
// exclude jar signatures - else it invalidates our fat jar
exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA'
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
archiveClassifier = "exec"
archiveFileName = "${archiveBaseName.get()}-${archiveClassifier.get()}.${archiveExtension.get()}"
from sourceSets.main.output
dependsOn configurations.runtimeClasspath
manifest {
attributes(
'Implementation-Title': project.name,
'Implementation-Version': project.version,
'Main-Class': mainClassName,
'Class-Path': configurations.runtimeClasspath.files.collect { it.getName() }.join(' ')
)
}
// build the fat executable jar file
from {
configurations.runtimeClasspath.findAll { it.name.endsWith('jar') }.collect { zipTree(it) }
}
}
/**
* Create list of static files, used for later extraction from the jar to disk.
*/
processResources.doLast {
def wwwStaticDir = projectDir.toPath().resolve('src/main/resources/net/shrimpworks/unreal/scriptbrowser/www/static')
def destFile = buildDir.toPath().resolve('resources/main/net/shrimpworks/unreal/scriptbrowser/www/static.list')
def staticList = new StringBuilder()
files { fileTree(wwwStaticDir).matching { exclude('**/*.xcf') } }.each {
staticList.append(wwwStaticDir.getParent().relativize(it.toPath())).append("\t").append(it.lastModified()).append("\n")
}
Files.write(destFile, staticList.toString().replaceAll("\\\\", "/").getBytes(StandardCharsets.UTF_8),
StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING)
}
test {
// Use JUnit Jupiter test framework
useJUnitPlatform()
}