Upgrade Gradle, Kotlin, and libraries

This commit is contained in:
Daniel Wolf 2019-07-06 23:24:09 +02:00
parent 460378bf50
commit b9a75662db
7 changed files with 22 additions and 33 deletions

View File

@ -1,3 +1,7 @@
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.3.41'
}
def getVersion() { def getVersion() {
// Dynamically read version from CMake file // Dynamically read version from CMake file
String text = new File('../../appInfo.cmake').getText('UTF-8') String text = new File('../../appInfo.cmake').getText('UTF-8')
@ -12,29 +16,16 @@ def getVersion() {
group 'com.rhubarb_lip_sync' group 'com.rhubarb_lip_sync'
version = getVersion() version = getVersion()
buildscript {
ext.kotlin_version = '1.1.60'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: 'kotlin'
repositories { repositories {
mavenCentral() mavenCentral()
jcenter() jcenter()
} }
dependencies { dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
compile 'com.beust:klaxon:0.30' implementation 'com.beust:klaxon:5.0.1'
compile 'org.apache.commons:commons-lang3:3.7' implementation 'org.apache.commons:commons-lang3:3.9'
compile 'no.tornado:tornadofx:1.7.12' implementation 'no.tornado:tornadofx:1.7.19'
} }
compileKotlin { compileKotlin {

View File

@ -1,5 +1,5 @@
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3-bin.zip
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStorePath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@ -6,6 +6,7 @@ import javafx.beans.property.SimpleListProperty
import javafx.beans.property.SimpleObjectProperty import javafx.beans.property.SimpleObjectProperty
import javafx.beans.property.SimpleStringProperty import javafx.beans.property.SimpleStringProperty
import javafx.collections.ObservableList import javafx.collections.ObservableList
import tornadofx.asObservable
import java.nio.file.Path import java.nio.file.Path
import tornadofx.getValue import tornadofx.getValue
import tornadofx.observable import tornadofx.observable
@ -61,7 +62,7 @@ class AnimationFileModel(val parentModel: MainModel, animationFilePath: Path, pr
audioFileModel = AudioFileModel(event, this, executor, reportResult) audioFileModel = AudioFileModel(event, this, executor, reportResult)
return@map audioFileModel return@map audioFileModel
} }
.observable() .asObservable()
) )
val audioFileModels: ObservableList<AudioFileModel> by audioFileModelsProperty val audioFileModels: ObservableList<AudioFileModel> by audioFileModelsProperty
@ -97,7 +98,7 @@ class AnimationFileModel(val parentModel: MainModel, animationFilePath: Path, pr
} }
init { init {
slots = spineJson.slots.observable() slots = spineJson.slots.asObservable()
mouthSlot = spineJson.guessMouthSlot() mouthSlot = spineJson.guessMouthSlot()
} }

View File

@ -115,13 +115,13 @@ class MainView : View() {
placeholder = Label("There are no events with associated audio files.") placeholder = Label("There are no events with associated audio files.")
columnResizePolicy = SmartResize.POLICY columnResizePolicy = SmartResize.POLICY
column("Event", AudioFileModel::eventNameProperty) column("Event", AudioFileModel::eventNameProperty)
.weigthedWidth(1.0) .weightedWidth(1.0)
column("Animation name", AudioFileModel::animationNameProperty) column("Animation name", AudioFileModel::animationNameProperty)
.weigthedWidth(1.0) .weightedWidth(1.0)
column("Audio file", AudioFileModel::displayFilePathProperty) column("Audio file", AudioFileModel::displayFilePathProperty)
.weigthedWidth(1.0) .weightedWidth(1.0)
column("Dialog", AudioFileModel::dialogProperty).apply { column("Dialog", AudioFileModel::dialogProperty).apply {
weigthedWidth(3.0) weightedWidth(3.0)
// Make dialog column wrap // Make dialog column wrap
setCellFactory { tableColumn -> setCellFactory { tableColumn ->
return@setCellFactory TableCell<AudioFileModel, String>().also { cell -> return@setCellFactory TableCell<AudioFileModel, String>().also { cell ->
@ -138,7 +138,7 @@ class MainView : View() {
} }
} }
column("Status", AudioFileModel::audioFileStateProperty).apply { column("Status", AudioFileModel::audioFileStateProperty).apply {
weigthedWidth(1.0) weightedWidth(1.0)
setCellFactory { setCellFactory {
return@setCellFactory object : TableCell<AudioFileModel, AudioFileState>() { return@setCellFactory object : TableCell<AudioFileModel, AudioFileState>() {
override fun updateItem(state: AudioFileState?, empty: Boolean) { override fun updateItem(state: AudioFileState?, empty: Boolean) {
@ -176,7 +176,7 @@ class MainView : View() {
} }
} }
column("", AudioFileModel::actionLabelProperty).apply { column("", AudioFileModel::actionLabelProperty).apply {
weigthedWidth(1.0) weightedWidth(1.0)
// Show button // Show button
setCellFactory { setCellFactory {
return@setCellFactory object : TableCell<AudioFileModel, String>() { return@setCellFactory object : TableCell<AudioFileModel, String>() {

View File

@ -1,9 +1,6 @@
package com.rhubarb_lip_sync.rhubarb_for_spine package com.rhubarb_lip_sync.rhubarb_for_spine
import com.beust.klaxon.JsonObject import com.beust.klaxon.JsonObject
import com.beust.klaxon.array
import com.beust.klaxon.double
import com.beust.klaxon.string
import com.beust.klaxon.Parser as JsonParser import com.beust.klaxon.Parser as JsonParser
import org.apache.commons.lang3.SystemUtils.IS_OS_WINDOWS import org.apache.commons.lang3.SystemUtils.IS_OS_WINDOWS
import java.io.* import java.io.*
@ -78,7 +75,7 @@ class RhubarbTask(
} }
} }
private val jsonParser = JsonParser() private val jsonParser = JsonParser.default()
private fun parseJsonObject(jsonString: String): JsonObject { private fun parseJsonObject(jsonString: String): JsonObject {
return jsonParser.parse(StringReader(jsonString)) as JsonObject return jsonParser.parse(StringReader(jsonString)) as JsonObject
} }

View File

@ -17,7 +17,7 @@ class SpineJson(private val filePath: Path) {
throw EndUserException("File '$filePath' does not exist.") throw EndUserException("File '$filePath' does not exist.")
} }
try { try {
json = Parser().parse(filePath.toString()) as JsonObject json = Parser.default().parse(filePath.toString()) as JsonObject
} catch (e: Exception) { } catch (e: Exception) {
throw EndUserException("Wrong file format. This is not a valid JSON file.") throw EndUserException("Wrong file format. This is not a valid JSON file.")
} }