Upgraded to java 17, switched to gradle, added new G-Mem for mac

- uses badass runtime plugin to create platform-specific images (https://badass-runtime-plugin.beryx.org/releases/latest/).
- uses kotlin based gradle build script.
- uses openjfx's plugin to obtain the required javafx modules
- added G-Wasm jar to repo for now, maven link is broken for me
- added g_mem_mac executable (https://github.com/dorving/g_mem_mac)
- added MacOS readable icon (.icns format)
- removed unused and broken imports from PortRequester.java and GEarth.java
- added GEarthLauncher.java (see docs for reason)
This commit is contained in:
Dorving 2022-05-03 06:27:46 +02:00
parent 8cd429cc23
commit 4e2415f671
8 changed files with 143 additions and 8 deletions

124
G-Earth/build.gradle.kts Normal file
View File

@ -0,0 +1,124 @@
import org.gradle.internal.os.OperatingSystem
plugins {
id("org.beryx.runtime") version "1.12.5"
id("org.openjfx.javafxplugin") version "0.0.11"
`java-library`
}
description = "G-Earth"
repositories {
mavenCentral()
}
dependencies {
implementation(files("libs/G-Wasm-Minimal-1.0.3.jar"))
implementation("at.favre.lib:bytes:1.5.0")
implementation("com.github.tulskiy:jkeymaster:1.3")
implementation("com.github.ganskef:littleproxy-mitm:1.1.0")
implementation("commons-io:commons-io:2.10.0")
implementation("javax.websocket:javax.websocket-api:1.1")
implementation("org.apache.maven:maven-artifact:3.6.3")
implementation("org.eclipse.jetty:jetty-server:9.4.41.v20210516")
implementation("org.eclipse.jetty.websocket:javax-websocket-server-impl:9.4.41.v20210516") {
exclude("javax.websocket", "javax.websocket-client-api")
}
implementation("org.eclipse.jetty:jetty-http:9.4.41.v20210516")
implementation("org.fxmisc.richtext:richtextfx:0.10.5")
implementation("org.json:json:20190722")
implementation("org.jsoup:jsoup:1.14.2")
implementation("org.slf4j:slf4j-jdk14:2.0.0-alpha0")
}
java {
sourceCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_17
}
javafx {
version = "17.0.2"
modules(
"javafx.base",
"javafx.controls",
"javafx.fxml",
"javafx.graphics",
"javafx.media",
"javafx.swing",
"javafx.web"
)
}
application {
mainClass.set("gearth.GEarthLauncher")
applicationName = "G-Earth"
}
runtime {
addModules(
"java.datatransfer", "java.desktop", "java.prefs",
"java.logging", "java.naming", "java.net.http",
"java.sql", "java.scripting", "java.xml",
"jdk.crypto.ec", "jdk.jfr", "jdk.jsobject",
"jdk.unsupported", "jdk.unsupported.desktop", "jdk.xml.dom"
)
launcher {
noConsole = true
}
jpackage {
val currentOs = OperatingSystem.current()
val imgType = when {
currentOs.isWindows -> "ico"
currentOs.isMacOsX -> "icns"
else -> "png"
}
// TODO: add support for dark-theme icon, maybe depending on OS theme.
imageOptions.addAll(arrayOf("--icon", "src/main/resources/gearth/ui/themes/G-Earth/logo.$imgType"))
if (currentOs.isWindows) {
installerOptions.addAll(
listOf(
"--win-per-user-install",
"--win-dir-chooser",
"--win-menu"
)
)
}
}
}
tasks.jpackageImage {
doLast {
val os = OperatingSystem.current()
val outPath = when {
os.isWindows -> project.name
os.isMacOsX -> "${project.name}.app/Contents"
else -> "${project.name}/lib"
}
copy {
val buildResourcesPath = "src/main/resources/build"
when {
os.isWindows -> {
/*
TODO: differentiate between 32bit and 64bit windows.
*/
from("$buildResourcesPath/windows/64bit")
include("G-Mem.exe")
}
os.isMacOsX -> {
from("$buildResourcesPath/mac")
/*
* The`g_mem_mac` executable is generated by a modified version of the G-Mem program.
*
* Which can be found here: https://github.com/dorving/g_mem_mac
*/
include("g_mem_mac")
}
}
into("$buildDir/jpackage/$outPath/app")
}
}
}

Binary file not shown.

View File

@ -3,10 +3,8 @@ package gearth;
import gearth.misc.AdminValidator;
import gearth.misc.Cacher;
import gearth.misc.UpdateChecker;
import gearth.misc.listenerpattern.Observable;
import gearth.misc.listenerpattern.ObservableObject;
import gearth.ui.GEarthController;
import gearth.ui.subforms.logger.loggerdisplays.PacketLogger;
import gearth.ui.themes.Theme;
import gearth.ui.themes.ThemeFactory;
import gearth.ui.titlebar.TitleBarConfig;
@ -19,9 +17,6 @@ import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import sun.misc.Cache;
import java.util.function.Consumer;
public class GEarth extends Application {

View File

@ -0,0 +1,11 @@
package gearth;
/**
* <a href="https://stackoverflow.com/questions/52578072/gradle-openjfx11-error-javafx-runtime-components-are-missing">https://stackoverflow.com/questions/52578072/gradle-openjfx11-error-javafx-runtime-components-are-missing</a>">
*/
public final class GEarthLauncher {
public static void main(String[] args) {
GEarth.main(args);
}
}

View File

@ -1,8 +1,5 @@
package gearth.protocol.connection.proxy.unity;
import javafx.beans.InvalidationListener;
import org.eclipse.jetty.websocket.jsr356.annotations.JsrParamIdText;
import javax.websocket.OnOpen;
import javax.websocket.Session;
import javax.websocket.server.ServerEndpoint;

Binary file not shown.

8
settings.gradle.kts Normal file
View File

@ -0,0 +1,8 @@
/*
* This file was generated by the Gradle 'init' task.
*
* This project uses @Incubating APIs which are subject to change.
*/
rootProject.name = "G-Earth-Parent"
include(":G-Earth")