Skip to content

Commit

Permalink
Merge pull request #139 from jjelliott/gradle-and-exe-build
Browse files Browse the repository at this point in the history
Gradle Conversion + EXE Build
  • Loading branch information
SpiritQuaddicted committed Jul 10, 2021
2 parents 8cb4dbf + 9347d84 commit b18b214
Show file tree
Hide file tree
Showing 99 changed files with 499 additions and 1,420 deletions.
8 changes: 0 additions & 8 deletions .classpath

This file was deleted.

6 changes: 6 additions & 0 deletions .gitattributes
@@ -0,0 +1,6 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# These are explicitly windows files and should use crlf
*.bat text eol=crlf

22 changes: 21 additions & 1 deletion .gitignore
@@ -1,4 +1,24 @@
bin
dist
release
BuildCommit.java
build-info.properties

# Ignore Gradle project-specific cache directory
.gradle
# Ignore Gradle build output directory
build


database.xml
installedMaps.xml
config.properties
jre/

# ide files
# These can be regenerated with `gradlew eclipse` so they no longer need to be committed
.classpath
.project
.settings/

*.iml
.idea/
17 changes: 0 additions & 17 deletions .project

This file was deleted.

35 changes: 34 additions & 1 deletion README.md
Expand Up @@ -42,8 +42,41 @@ This works well in combination with a filter. For example you could look at all
### Bugs and feedback
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!

### Running from source
To run the application for development, run the following command in the root directory.

On Windows:
```
gradlew.bat run
```
On Unix:
```
./gradlew run
```

### Building
To build a jar, grab the source and run `ant release` in the root directory.
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.

On Windows:
```
gradlew.bat assemble
```
On Unix:
```bash
./gradlew assemble
```

### Building a Windows EXE
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.

On Windows:
```
gradlew.bat winDist
```
On Unix:
```bash
./gradlew winDist
```

## Credits
- Hauke 'megaman' Rehfeld (initial programming)
Expand Down
8 changes: 0 additions & 8 deletions ant-helpers/osname.xml

This file was deleted.

107 changes: 107 additions & 0 deletions build.gradle
@@ -0,0 +1,107 @@
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'
}

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
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/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}}
}

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("jre")) {
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()
}

0 comments on commit b18b214

Please sign in to comment.