Skip to content

Commit 650b633

Browse files
committed
Update to modern java
1 parent c5b7535 commit 650b633

7 files changed

Lines changed: 99 additions & 50 deletions

File tree

build.gradle.kts

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,41 @@
11
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
2+
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
23
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
34

45
plugins {
5-
java
6-
kotlin("jvm") version "1.3.11"
7-
id("com.github.johnrengelman.shadow") version "4.0.1"
6+
application
7+
kotlin("jvm") version "1.4.31"
8+
id("com.github.johnrengelman.shadow") version "6.1.0"
89
}
910

1011
group = "ladysnake"
11-
version = "2.0.0"
12+
version = "2.1.0"
13+
14+
// https://stackoverflow.com/questions/63997525/task-run-causes-org-joor-reflectexception-java-lang-nosuchfieldexception-ja
15+
val currentOS = DefaultNativePlatform.getCurrentOperatingSystem()
16+
val platform = when {
17+
currentOS.isWindows() -> "win"
18+
currentOS.isLinux() -> "linux"
19+
currentOS.isMacOsX() -> "mac"
20+
else -> throw IllegalStateException()
21+
}
1222

1323
repositories {
1424
mavenCentral()
1525
}
1626

1727
dependencies {
18-
compile(kotlin("stdlib-jdk8"))
19-
testCompile("junit", "junit", "4.12")
20-
compile("no.tornado:tornadofx:1.7.16")
28+
testImplementation("junit", "junit", "4.12")
29+
implementation("org.openjfx:javafx-base:15.0.1:${platform}")
30+
implementation("org.openjfx:javafx-controls:15.0.1:${platform}")
31+
implementation("org.openjfx:javafx-graphics:15.0.1:${platform}")
32+
implementation("org.openjfx:javafx-fxml:15.0.1:${platform}")
33+
implementation("no.tornado:tornadofx:1.7.20")
34+
}
35+
36+
application {
37+
mainModule.set("ladysnake.translationhelper.app")
38+
mainClass.set("ladysnake.translationhelper.TranslationHelperKt")
2139
}
2240

2341
tasks.withType<ShadowJar> {
@@ -27,8 +45,13 @@ tasks.withType<ShadowJar> {
2745
}
2846

2947
configure<JavaPluginConvention> {
30-
sourceCompatibility = JavaVersion.VERSION_1_8
48+
sourceCompatibility = JavaVersion.VERSION_11
49+
targetCompatibility = JavaVersion.VERSION_11
3150
}
51+
3252
tasks.withType<KotlinCompile> {
33-
kotlinOptions.jvmTarget = "1.8"
53+
kotlinOptions {
54+
jvmTarget = "1.8"
55+
useIR = true
56+
}
3457
}

gradle/wrapper/gradle-wrapper.jar

2.96 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

gradlew

Lines changed: 33 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gradlew.bat

Lines changed: 24 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/kotlin/ladysnake/translationhelper/TranslationHelper.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ class TranslationHelper: App(TranslatorView::class, AppStyle::class) {
1515
init {
1616
TranslationLoader.registerAdapter(PlainLanguageMapAdapter())
1717
TranslationLoader.registerAdapter(JsonLanguageMapAdapter())
18-
1918
}
2019

2120
override fun start(stage: Stage) {

src/main/kotlin/module-info.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module ladysnake.translationhelper.app {
2+
requires javafx.base;
3+
requires javafx.controls;
4+
requires javafx.graphics;
5+
requires kotlin.stdlib;
6+
requires tornadofx;
7+
requires java.prefs;
8+
requires java.desktop;
9+
}

0 commit comments

Comments
 (0)