-
Notifications
You must be signed in to change notification settings - Fork 15
/
build.gradle
105 lines (92 loc) · 2.38 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
96
97
98
99
100
101
102
103
104
105
plugins {
id 'java'
id 'eclipse'
id 'application'
// id 'com.palantir.graal' version '0.9.0'
id "com.github.spotbugs" version "4.7.1"
id 'edu.sc.seis.launch4j' version '2.5.0'
}
version = "git describe --tags".execute().text.trim()
repositories {
mavenCentral()
}
dependencies {
implementation 'edu.stanford.ejalbert:BrowserLauncher2:1.3'
}
application {
mainClass.set('de.haukerehfeld.quakeinjector.QuakeInjector')
}
jar {
manifest {
attributes["Main-Class"] = application.mainClass.get()
}
}
//graal {
// javaVersion "11"
// graalVersion "21.1.0"
// outputName "quake-injector"
// mainClass application.mainClassName
// option "--no-fallback"
// option "--verbose"
//}
task readCommit(type: WriteProperties) {
outputFile = file("${buildDir}/build-info.properties")
comment = "Revision name"
property("quake-injector.build-commit", version)
}
launch4j {
mainClassName = application.mainClass.get()
icon = "${projectDir}/src/main/resources/Inject2.ico"
bundledJrePath "./runtime"
bundledJre64Bit false
}
processResources {
from(readCommit)
}
task downloadJre {
def targetDir = "$buildDir/jre"
def f = new File("$buildDir/jre.zip")
f.parentFile.mkdir()
if (!f.exists()) {
new URL('https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.10%2B7/OpenJDK17U-jdk_x86-32_windows_hotspot_17.0.10_7.zip').withInputStream {i -> f.withOutputStream {it << i}}
}
copy {
from zipTree("$buildDir/jre.zip")
into(targetDir)
fileMode 0777
dirMode 0777
}
}
task setupWinDist(type: Copy) {
dependsOn("createExe", "downloadJre")
group "distribution"
def targetDir = "$buildDir/winDist"
mkdir(targetDir)
File jreDir
doLast {
copy {
file("$buildDir/jre").eachDir {
if (it.name.contains("jdk")) {
jreDir = it
}
}
if (jreDir) {
from(jreDir)
into("$targetDir/runtime")
}
}
}
from("$buildDir/launch4j")
into(targetDir)
}
task winDist(type: Zip) {
dependsOn "setupWinDist"
group "distribution"
def distDir = "$buildDir/winDist"
from "$distDir"
archiveFileName = "QuakeInjector.exe-${project.version}.zip"
exclude("*-jre")
}
test {
useJUnitPlatform()
}