Skip to content

Commit b18b214

Browse files
Merge pull request #139 from jjelliott/gradle-and-exe-build
Gradle Conversion + EXE Build
2 parents 8cb4dbf + 9347d84 commit b18b214

File tree

99 files changed

+499
-1420
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+499
-1420
lines changed

.classpath

Lines changed: 0 additions & 8 deletions
This file was deleted.

.gitattributes

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#
2+
# https://help.github.com/articles/dealing-with-line-endings/
3+
#
4+
# These are explicitly windows files and should use crlf
5+
*.bat text eol=crlf
6+

.gitignore

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,24 @@
11
bin
22
dist
33
release
4-
BuildCommit.java
4+
build-info.properties
5+
6+
# Ignore Gradle project-specific cache directory
7+
.gradle
8+
# Ignore Gradle build output directory
9+
build
10+
11+
12+
database.xml
13+
installedMaps.xml
14+
config.properties
15+
jre/
16+
17+
# ide files
18+
# These can be regenerated with `gradlew eclipse` so they no longer need to be committed
19+
.classpath
20+
.project
21+
.settings/
22+
23+
*.iml
24+
.idea/

.project

Lines changed: 0 additions & 17 deletions
This file was deleted.

README.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,41 @@ This works well in combination with a filter. For example you could look at all
4242
### Bugs and feedback
4343
If anything that feels weird occurs to you, or you find a definite bug, please [report it as an issue](https://github.com/hrehfeld/QuakeInjector/issues). Likewise, give us a shout if you want to help with development. Pull requests are welcome!
4444

45+
### Running from source
46+
To run the application for development, run the following command in the root directory.
47+
48+
On Windows:
49+
```
50+
gradlew.bat run
51+
```
52+
On Unix:
53+
```
54+
./gradlew run
55+
```
56+
4557
### Building
46-
To build a jar, grab the source and run `ant release` in the root directory.
58+
To build a jar, grab the source and run the following command in the root directory. The jar will be in the `build/libs` directory.
59+
60+
On Windows:
61+
```
62+
gradlew.bat assemble
63+
```
64+
On Unix:
65+
```bash
66+
./gradlew assemble
67+
```
68+
69+
### Building a Windows EXE
70+
To build an EXE for Windows, grab the source and run the following command in the root directory. It will create a zip in the `build/distributions` directory.
71+
72+
On Windows:
73+
```
74+
gradlew.bat winDist
75+
```
76+
On Unix:
77+
```bash
78+
./gradlew winDist
79+
```
4780

4881
## Credits
4982
- Hauke 'megaman' Rehfeld (initial programming)

ant-helpers/osname.xml

Lines changed: 0 additions & 8 deletions
This file was deleted.

build.gradle

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
plugins {
2+
id 'java'
3+
id 'eclipse'
4+
id 'application'
5+
// id 'com.palantir.graal' version '0.9.0'
6+
id "com.github.spotbugs" version "4.7.1"
7+
id 'edu.sc.seis.launch4j' version '2.5.0'
8+
}
9+
10+
sourceCompatibility = JavaVersion.VERSION_1_8
11+
targetCompatibility = JavaVersion.VERSION_1_8
12+
version = "git describe --tags".execute().text.trim()
13+
repositories {
14+
mavenCentral()
15+
}
16+
17+
dependencies {
18+
implementation 'edu.stanford.ejalbert:BrowserLauncher2:1.3'
19+
}
20+
21+
application {
22+
mainClass.set('de.haukerehfeld.quakeinjector.QuakeInjector')
23+
}
24+
25+
jar {
26+
manifest {
27+
attributes["Main-Class"] = application.mainClass.get()
28+
}
29+
}
30+
31+
//graal {
32+
// javaVersion "11"
33+
// graalVersion "21.1.0"
34+
// outputName "quake-injector"
35+
// mainClass application.mainClassName
36+
// option "--no-fallback"
37+
// option "--verbose"
38+
//}
39+
40+
task readCommit(type: WriteProperties) {
41+
outputFile = file("${buildDir}/build-info.properties")
42+
comment = "Revision name"
43+
property("quake-injector.build-commit", version)
44+
}
45+
46+
launch4j {
47+
mainClassName = application.mainClass.get()
48+
icon = "${projectDir}/src/main/resources/Inject2.ico"
49+
bundledJrePath "./runtime"
50+
bundledJre64Bit false
51+
}
52+
53+
processResources {
54+
from(readCommit)
55+
}
56+
57+
task downloadJre {
58+
def targetDir = "$buildDir/jre"
59+
def f = new File("$buildDir/jre.zip")
60+
f.parentFile.mkdir()
61+
if (!f.exists()) {
62+
new URL('https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u292-b10_openj9-0.26.0/OpenJDK8U-jre_x86-32_windows_openj9_8u292b10_openj9-0.26.0.zip').withInputStream {i -> f.withOutputStream {it << i}}
63+
}
64+
65+
copy {
66+
from zipTree("$buildDir/jre.zip")
67+
into(targetDir)
68+
fileMode 0777
69+
dirMode 0777
70+
}
71+
}
72+
73+
task setupWinDist(type: Copy) {
74+
dependsOn("createExe", "downloadJre")
75+
group "distribution"
76+
def targetDir = "$buildDir/winDist"
77+
mkdir(targetDir)
78+
File jreDir
79+
doLast {
80+
copy {
81+
file("$buildDir/jre").eachDir {
82+
if (it.name.contains("jre")) {
83+
jreDir = it
84+
}
85+
}
86+
if (jreDir) {
87+
from(jreDir)
88+
into("$targetDir/runtime")
89+
}
90+
}
91+
}
92+
from("$buildDir/launch4j")
93+
into(targetDir)
94+
}
95+
96+
task winDist(type: Zip) {
97+
dependsOn "setupWinDist"
98+
group "distribution"
99+
def distDir = "$buildDir/winDist"
100+
from "$distDir"
101+
archiveFileName = "QuakeInjector.exe-${project.version}.zip"
102+
exclude("*-jre")
103+
104+
}
105+
test {
106+
useJUnitPlatform()
107+
}

0 commit comments

Comments
 (0)