From 7cf8aa02ca12dae713a6928032284f35f365fa24 Mon Sep 17 00:00:00 2001 From: Syer10 Date: Tue, 14 Dec 2021 20:05:06 -0500 Subject: [PATCH] Depend on JDK 17, update Kotlin to 1.6.10, update dependencies --- .github/workflows/Build.yml | 4 +-- .github/workflows/Check.yml | 2 +- .github/workflows/Preview.yml | 4 +-- build.gradle.kts | 14 ++++---- buildSrc/src/main/kotlin/Config.kt | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- .../data/server/host/ServerHostPreference.kt | 6 ++-- .../main/components/DebugOverlayViewModel.kt | 2 +- .../ca/gosyer/ui/reader/ReaderSideMenu.kt | 2 +- .../ui/sources/settings/SourceSettingsMenu.kt | 1 - .../settings/model/SourceSettingsView.kt | 2 +- .../kotlin/ca/gosyer/util/lang/Duration.kt | 32 ------------------- 12 files changed, 20 insertions(+), 53 deletions(-) delete mode 100644 src/main/kotlin/ca/gosyer/util/lang/Duration.kt diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 156f207f..1563a214 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -55,7 +55,7 @@ jobs: - uses: actions/setup-java@v1 if: ${{ matrix.runtime != 'linux-centos-x64' }} with: - java-version: '15' + java-version: '17' architecture: ${{ matrix.arch }} - name: Setup Cl @@ -70,7 +70,7 @@ jobs: - name: Build rpm Package if: ${{ matrix.runtime == 'linux-centos-x64' }} - uses: Syer10/CentOS-Java15-Action@v1 + uses: Syer10/CentOS-Java17-Action@v1 with: command: ./gradlew ${{ matrix.build }} diff --git a/.github/workflows/Check.yml b/.github/workflows/Check.yml index 553f4791..2a789318 100644 --- a/.github/workflows/Check.yml +++ b/.github/workflows/Check.yml @@ -31,7 +31,7 @@ jobs: - uses: actions/setup-java@v1 with: - java-version: '15' + java-version: '17' architecture: x64 - name: Setup Cl diff --git a/.github/workflows/Preview.yml b/.github/workflows/Preview.yml index 9dd6849d..b3143e31 100644 --- a/.github/workflows/Preview.yml +++ b/.github/workflows/Preview.yml @@ -56,7 +56,7 @@ jobs: - uses: actions/setup-java@v1 if: ${{ matrix.runtime != 'linux-centos-x64' }} with: - java-version: '15' + java-version: '17' architecture: ${{ matrix.arch }} - name: Setup Cl @@ -71,7 +71,7 @@ jobs: - name: Build rpm Package if: ${{ matrix.runtime == 'linux-centos-x64' }} - uses: Syer10/CentOS-Java15-Action@v1 + uses: Syer10/CentOS-Java17-Action@v1 with: command: ./gradlew ${{ matrix.build }} --stacktrace diff --git a/build.gradle.kts b/build.gradle.kts index 801c9f86..1aeff6c8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,10 +9,10 @@ import org.jmailen.gradle.kotlinter.tasks.FormatTask import org.jmailen.gradle.kotlinter.tasks.LintTask plugins { - kotlin("jvm") version "1.5.31" - kotlin("kapt") version "1.5.31" - kotlin("plugin.serialization") version "1.5.31" - id("org.jetbrains.compose") version "1.0.0" + kotlin("jvm") version "1.6.10" + kotlin("kapt") version "1.6.10" + kotlin("plugin.serialization") version "1.6.10" + id("org.jetbrains.compose") version "1.0.1-rc2" id("com.github.gmazzo.buildconfig") version "3.0.3" id("org.jmailen.kotlinter") version "3.7.0" id("com.github.ben-manes.versions") version "0.39.0" @@ -60,7 +60,7 @@ dependencies { kapt("com.github.stephanenicolas.toothpick:toothpick-compiler:$toothpickVersion") // Http client - val ktorVersion = "1.6.5" + val ktorVersion = "1.6.7" implementation("io.ktor:ktor-client-core:$ktorVersion") implementation("io.ktor:ktor-client-okhttp:$ktorVersion") implementation("io.ktor:ktor-client-serialization:$ktorVersion") @@ -72,11 +72,11 @@ dependencies { val slf4jVersion = "1.7.32" implementation("org.slf4j:slf4j-api:$slf4jVersion") implementation("org.slf4j:jul-to-slf4j:$slf4jVersion") - val log4jVersion = "2.14.1" + val log4jVersion = "2.16.0" implementation("org.apache.logging.log4j:log4j-api:$log4jVersion") implementation("org.apache.logging.log4j:log4j-core:$log4jVersion") implementation("org.apache.logging.log4j:log4j-slf4j-impl:$log4jVersion") - implementation("io.github.microutils:kotlin-logging-jvm:2.1.0") + implementation("io.github.microutils:kotlin-logging-jvm:2.1.16") // User storage implementation("net.harawata:appdirs:1.2.1") diff --git a/buildSrc/src/main/kotlin/Config.kt b/buildSrc/src/main/kotlin/Config.kt index fbc0c861..fe85ea91 100644 --- a/buildSrc/src/main/kotlin/Config.kt +++ b/buildSrc/src/main/kotlin/Config.kt @@ -10,5 +10,5 @@ object Config { const val preview = true const val previewCommit = "63ea28a620cdf6a2fd376304ad4e54e850e4f981" - val jvmTarget = JavaVersion.VERSION_15 + val jvmTarget = JavaVersion.VERSION_17 } \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e750102e..84d1f85f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/kotlin/ca/gosyer/data/server/host/ServerHostPreference.kt b/src/main/kotlin/ca/gosyer/data/server/host/ServerHostPreference.kt index 8dfdad37..c6bf41ab 100644 --- a/src/main/kotlin/ca/gosyer/data/server/host/ServerHostPreference.kt +++ b/src/main/kotlin/ca/gosyer/data/server/host/ServerHostPreference.kt @@ -34,7 +34,7 @@ sealed class ServerHostPreference { const val argPrefix = "-Dsuwayomi.tachidesk.config.server." } - open class StringServerHostPreference( + sealed class StringServerHostPreference( override val preferenceStore: PreferenceStore, override val propertyName: String, override val defaultValue: String, @@ -44,7 +44,7 @@ sealed class ServerHostPreference { return preferenceStore.getString(propertyName, defaultValue) } } - open class IntServerHostPreference( + sealed class IntServerHostPreference( override val preferenceStore: PreferenceStore, override val propertyName: String, override val defaultValue: Int, @@ -54,7 +54,7 @@ sealed class ServerHostPreference { return preferenceStore.getInt(propertyName, defaultValue) } } - open class BooleanServerHostPreference( + sealed class BooleanServerHostPreference( override val preferenceStore: PreferenceStore, override val propertyName: String, override val defaultValue: Boolean, diff --git a/src/main/kotlin/ca/gosyer/ui/main/components/DebugOverlayViewModel.kt b/src/main/kotlin/ca/gosyer/ui/main/components/DebugOverlayViewModel.kt index b69336e2..2cc5245a 100644 --- a/src/main/kotlin/ca/gosyer/ui/main/components/DebugOverlayViewModel.kt +++ b/src/main/kotlin/ca/gosyer/ui/main/components/DebugOverlayViewModel.kt @@ -7,11 +7,11 @@ package ca.gosyer.ui.main.components import ca.gosyer.ui.base.vm.ViewModel -import ca.gosyer.util.lang.milliseconds import kotlinx.coroutines.delay import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.launch import javax.inject.Inject +import kotlin.time.Duration.Companion.milliseconds class DebugOverlayViewModel @Inject constructor() : ViewModel() { val runtime: Runtime = Runtime.getRuntime() diff --git a/src/main/kotlin/ca/gosyer/ui/reader/ReaderSideMenu.kt b/src/main/kotlin/ca/gosyer/ui/reader/ReaderSideMenu.kt index df883a3e..2017a1ae 100644 --- a/src/main/kotlin/ca/gosyer/ui/reader/ReaderSideMenu.kt +++ b/src/main/kotlin/ca/gosyer/ui/reader/ReaderSideMenu.kt @@ -46,9 +46,9 @@ import ca.gosyer.data.models.MangaMeta import ca.gosyer.ui.base.components.Spinner import ca.gosyer.ui.base.resources.stringResource import ca.gosyer.ui.reader.model.ReaderChapter -import ca.gosyer.util.lang.milliseconds import ca.gosyer.util.system.kLogger import kotlin.math.roundToInt +import kotlin.time.Duration.Companion.milliseconds private val logger = kLogger {} diff --git a/src/main/kotlin/ca/gosyer/ui/sources/settings/SourceSettingsMenu.kt b/src/main/kotlin/ca/gosyer/ui/sources/settings/SourceSettingsMenu.kt index a8734925..8238f701 100644 --- a/src/main/kotlin/ca/gosyer/ui/sources/settings/SourceSettingsMenu.kt +++ b/src/main/kotlin/ca/gosyer/ui/sources/settings/SourceSettingsMenu.kt @@ -76,7 +76,6 @@ fun SourceSettingsMenu(sourceId: Long, menuController: MenuController? = LocalMe is MultiSelect -> { MultiSelectPreference(it) } - else -> Unit } } } diff --git a/src/main/kotlin/ca/gosyer/ui/sources/settings/model/SourceSettingsView.kt b/src/main/kotlin/ca/gosyer/ui/sources/settings/model/SourceSettingsView.kt index 37ec4594..d9d44db0 100644 --- a/src/main/kotlin/ca/gosyer/ui/sources/settings/model/SourceSettingsView.kt +++ b/src/main/kotlin/ca/gosyer/ui/sources/settings/model/SourceSettingsView.kt @@ -31,7 +31,7 @@ sealed class SourceSettingsView { open val summary: String? get() = subtitle?.let { withFormat(it, state.value) } - abstract class TwoState( + sealed class TwoState( props: TwoStateProps, private val _state: MutableStateFlow = MutableStateFlow( props.currentValue diff --git a/src/main/kotlin/ca/gosyer/util/lang/Duration.kt b/src/main/kotlin/ca/gosyer/util/lang/Duration.kt deleted file mode 100644 index e6fe3ab0..00000000 --- a/src/main/kotlin/ca/gosyer/util/lang/Duration.kt +++ /dev/null @@ -1,32 +0,0 @@ -/* - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. - */ - -package ca.gosyer.util.lang - -import kotlin.time.DurationUnit -import kotlin.time.toDuration - -val Int.nanoseconds get() = toDuration(DurationUnit.NANOSECONDS) -val Long.nanoseconds get() = toDuration(DurationUnit.NANOSECONDS) -val Double.nanoseconds get() = toDuration(DurationUnit.NANOSECONDS) -val Int.microseconds get() = toDuration(DurationUnit.MICROSECONDS) -val Long.microseconds get() = toDuration(DurationUnit.MICROSECONDS) -val Double.microseconds get() = toDuration(DurationUnit.MICROSECONDS) -val Int.milliseconds get() = toDuration(DurationUnit.MILLISECONDS) -val Long.milliseconds get() = toDuration(DurationUnit.MILLISECONDS) -val Double.milliseconds get() = toDuration(DurationUnit.MILLISECONDS) -val Int.seconds get() = toDuration(DurationUnit.SECONDS) -val Long.seconds get() = toDuration(DurationUnit.SECONDS) -val Double.seconds get() = toDuration(DurationUnit.SECONDS) -val Int.minutes get() = toDuration(DurationUnit.MINUTES) -val Long.minutes get() = toDuration(DurationUnit.MINUTES) -val Double.minutes get() = toDuration(DurationUnit.MINUTES) -val Int.hours get() = toDuration(DurationUnit.HOURS) -val Long.hours get() = toDuration(DurationUnit.HOURS) -val Double.hours get() = toDuration(DurationUnit.HOURS) -val Int.days get() = toDuration(DurationUnit.DAYS) -val Long.days get() = toDuration(DurationUnit.DAYS) -val Double.days get() = toDuration(DurationUnit.DAYS)