G-Earth/G-Earth/build.gradle.kts

141 lines
4.1 KiB
Plaintext

import org.gradle.internal.os.OperatingSystem
plugins {
kotlin("jvm") version "1.6.10"
kotlin("plugin.serialization") version "1.6.10"
id("org.beryx.runtime") version "1.12.5"
id("org.openjfx.javafxplugin") version "0.0.11"
`java-library`
`maven-publish`
}
description = "G-Earth"
repositories {
mavenCentral()
}
/**
* TODO: move dependency version declarations to different gradle file
*/
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.43.v20210629")
implementation("org.eclipse.jetty.websocket:javax-websocket-server-impl:9.4.43.v20210629") {
exclude("javax.websocket", "javax.websocket-client-api")
}
implementation("org.eclipse.jetty:jetty-http:9.4.43.v20210629")
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")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.3")
}
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"
}
publishing {
publications {
create<MavenPublication>("maven") {
groupId = "dorving"
artifactId = "gearth"
version = "1.5.3"
from(components["java"])
}
}
}
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")
}
}
into("$buildDir/jpackage/$outPath/app")
}
}
}