Skip to content
This repository has been archived by the owner on Dec 12, 2020. It is now read-only.

Commit

Permalink
Update to Java 10
Browse files Browse the repository at this point in the history
  • Loading branch information
Xerus committed Jul 18, 2019
1 parent 38a2608 commit f56f31f
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 10 deletions.
1 change: 1 addition & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ To fetch the Catalog and Genres, you need to create the file `src/resources/shee
`run` | runs the project right from source
`shadowJar` | Creates an executable jar in the root directory of the project bundled with all libraries
`runShadow` | Creates a shadowJar and runs it
`dplink` | Creates a self-contained application in `build/app`
`build` | Builds & tests the whole project

Both run tasks can be run with the argument `-Dargs="--loglevel trace"`to change the log level or pass other arguments to the application.
Expand Down
37 changes: 35 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ import org.gradle.internal.os.OperatingSystem
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.io.IOException
import java.util.*
import org.jetbrains.kotlin.gradle.dsl.Coroutines
import java.io.ByteArrayOutputStream
import java.nio.file.*
import java.util.Scanner
import com.alkimiapps.gradle.plugin.dplink.DplinkTask

val isUnstable = properties["release"] == null
var commitNumber: String = ""
Expand All @@ -22,6 +27,7 @@ plugins {
application
id("com.github.johnrengelman.shadow") version "5.1.0"
id("com.github.breadmoirai.github-release") version "2.2.9"
id("com.alkimiapps.gradle-dplink-plugin") version "0.4"
id("com.github.ben-manes.versions") version "0.21.0"
}

Expand Down Expand Up @@ -49,10 +55,23 @@ repositories {
dependencies {
implementation(kotlin("reflect"))

val os = org.gradle.internal.os.OperatingSystem.current()
val classifier = when {
os.isLinux -> "linux"
os.isMacOsX -> "mac"
os.isWindows -> "win"
else -> throw Exception("Unable to determine javafx dependency classifier due to unfamiliar system=$os")
}
implementation("org.openjfx:javafx-base:$version:$classifier")
implementation("org.openjfx:javafx-controls:$version:$classifier")
implementation("org.openjfx:javafx-graphics:$version:$classifier")
implementation("org.openjfx:javafx-media:$version:$classifier")

implementation("com.github.Xerus2000.util", "javafx", "61043c3eb09a7f0a3d3b2227bf2dac463958d237")
implementation("org.controlsfx", "controlsfx", "8.40.+")
implementation("org.controlsfx", "controlsfx", "11.0.0")

implementation("ch.qos.logback", "logback-classic", "1.2.+")
api("org.slf4j", "slf4j-api", "1.8.0-beta4")
implementation("ch.qos.logback", "logback-classic", "1.3.+")
implementation("io.github.microutils", "kotlin-logging", "1.6.+")

implementation("be.bluexin", "drpc4k", "0.9")
Expand Down Expand Up @@ -139,6 +158,20 @@ tasks {
useJUnitPlatform()
}

withType<DplinkTask> {
scriptsLocation = "monsterutilities"
libs = files("build/libs", configurations.default)
mainClassName = application.mainClassName
executableJarName = jarFile
}

withType<Jar> {
manifest {
attributes["Main-Class"] = application.mainClassName
attributes["Class-Path"] = configurations.default.get().joinToString(" ") { it.name }
}
}

}

println("Java version: ${JavaVersion.current()}")
Expand Down
13 changes: 13 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
pluginManagement {
repositories {
gradlePluginPortal()
maven("https://jitpack.io")
}
resolutionStrategy {
eachPlugin {
if(requested.id.namespace == "com.alkimiapps" && requested.version == "0.4")
useModule("com.github.Xerus2000:gradle-dplink-plugin:kotlin-SNAPSHOT")
}
}
}

rootProject.name = "MonsterUtilities"
9 changes: 1 addition & 8 deletions src/main/xerus/monstercat/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@ import xerus.ktutil.SystemUtils
import xerus.ktutil.getResource
import xerus.ktutil.javafx.onFx
import xerus.ktutil.javafx.ui.App
import xerus.ktutil.ui.SimpleFrame
import java.io.File
import java.net.URL
import java.util.concurrent.ExecutorService
import java.util.concurrent.Executors
import java.util.concurrent.ThreadFactory
import java.util.concurrent.atomic.AtomicInteger
import javax.swing.JTextArea

val VERSION = getResource("version")!!.readText()
val isUnstable = VERSION.contains('-')
Expand All @@ -42,14 +40,9 @@ val jarLocation: URL = MonsterUtilities::class.java.protectionDomain.codeSource.
fun main(args: Array<String>) {
initLogging(args)
val logger = KotlinLogging.logger {}
logger.info("Version: $VERSION, Java version: ${SystemUtils.javaVersion}, ")
logger.debug("Commandline arguments: ${args.joinToString(", ", "[", "]")}")

if(!SystemUtils.javaVersion.startsWith("1.8")) {
SimpleFrame { add(JTextArea("Please install and use Java 8!\nThe current version is ${SystemUtils.javaVersion}").apply { isEditable = false }) }
return
}
logger.info("Version: $VERSION, Java version: ${SystemUtils.javaVersion}")

logger.info("Initializing Google Sheets API Service")
Sheets.initService("MonsterUtilities")

Expand Down
3 changes: 3 additions & 0 deletions src/resources/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module monsterutilities {

}

0 comments on commit f56f31f

Please sign in to comment.