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 Oct 21, 2018
1 parent 52f774e commit bcdb694
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 10 deletions.
1 change: 1 addition & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ and put an api key for Google Sheets into it.
`run` | runs the project right from source
`shadowJar` | Creates an executable jar with all libraries bundled in the root directory of the project
`runShadow` | Creates a shadowJar and runs it
`dplink` | Creates a self-contained application in `build/app`

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
23 changes: 21 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ 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
version = "dev" + Scanner(Runtime.getRuntime().exec("git rev-list --count HEAD").inputStream).next() +
Expand All @@ -17,6 +18,7 @@ plugins {
application
id("com.github.johnrengelman.shadow") version "2.0.4"
id("com.github.ben-manes.versions") version "0.20.0"
id("com.alkimiapps.gradle-dplink-plugin") version "0.4"
}

// source directories
Expand Down Expand Up @@ -51,9 +53,12 @@ dependencies {
implementation(kotlin("reflect"))

implementation("com.github.Xerus2000.util", "javafx", "-SNAPSHOT")
implementation("org.controlsfx", "controlsfx", "8.40.14")
implementation("org.controlsfx", "controlsfx", "9.0.0")

api("org.slf4j", "slf4j-api", "1.8.0-beta1")
implementation("ch.qos.logback", "logback-classic", "1.3.0-alpha4")
implementation("io.github.microutils", "kotlin-logging", "1.6.10")

implementation("ch.qos.logback", "logback-classic", "1.2.3")
implementation("com.github.Bluexin", "drpc4k", "-SNAPSHOT")
implementation("org.apache.httpcomponents", "httpmime", "4.5.+")
implementation("com.google.apis", "google-api-services-sheets", "v4-rev542-1.25.0")
Expand Down Expand Up @@ -120,6 +125,20 @@ tasks {
useJUnitPlatform()
}

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

withType<Jar> {
manifest {
attributes["Main-Class"] = application.mainClassName
attributes["Class-Path"] = configurations.default.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.applySkin
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 @@ -40,14 +38,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", GoogleCredential().createScoped(listOf(SheetsScopes.SPREADSHEETS_READONLY)))

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 bcdb694

Please sign in to comment.