From 6a70dfb657d84ae8921c9e9fcaa6e66f5f5657c7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 30 Mar 2024 14:54:04 +0900 Subject: [PATCH 01/19] Bump com.google.guava:guava from 33.0.0-jre to 33.1.0-jre (#31) Bumps [com.google.guava:guava](https://github.com/google/guava) from 33.0.0-jre to 33.1.0-jre. - [Release notes](https://github.com/google/guava/releases) - [Commits](https://github.com/google/guava/commits) --- updated-dependencies: - dependency-name: com.google.guava:guava dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 57025b1..059f6ce 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -43,7 +43,7 @@ dependencies { implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") implementation("ch.qos.logback:logback-classic:1.5.3") - implementation("com.google.guava:guava:33.0.0-jre") + implementation("com.google.guava:guava:33.1.0-jre") // https://mvnrepository.com/artifact/org.xerial/sqlite-jdbc implementation("org.xerial:sqlite-jdbc:3.45.1.0") implementation("org.projectlombok:lombok:${lombokVersion}") From 95c38b8bd2601a1105b035d90ed71ec5fe20b791 Mon Sep 17 00:00:00 2001 From: hizumiaoba <56146205+hizumiaoba@users.noreply.github.com> Date: Sat, 30 Mar 2024 19:21:13 +0900 Subject: [PATCH 02/19] Update gradle.yml (#32) Delete uploading artifacts logic for limiting quota --- .github/workflows/gradle.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index f64b7d0..754f5b6 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -41,11 +41,6 @@ jobs: jpackageImage -i --scan - - name: Upload built artifacts - uses: actions/upload-artifact@v2 - with: - name: ${{ matrix.os }}-jpackageImage - path: build/jpackage/MinecraftTimeMachine # NOTE: The Gradle Wrapper is the default and recommended way to run Gradle (https://docs.gradle.org/current/userguide/gradle_wrapper.html). # If your project does not have the Gradle Wrapper configured, you can use the following configuration to run Gradle with a specified version. From 4f4c2413b9b4e4c145e6f3714a63d3f62d7876e8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 30 Mar 2024 10:34:27 +0000 Subject: [PATCH 03/19] Bump org.xerial:sqlite-jdbc from 3.45.1.0 to 3.45.2.0 (#30) --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 059f6ce..848a1c2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -45,7 +45,7 @@ dependencies { implementation("ch.qos.logback:logback-classic:1.5.3") implementation("com.google.guava:guava:33.1.0-jre") // https://mvnrepository.com/artifact/org.xerial/sqlite-jdbc - implementation("org.xerial:sqlite-jdbc:3.45.1.0") + implementation("org.xerial:sqlite-jdbc:3.45.2.0") implementation("org.projectlombok:lombok:${lombokVersion}") // https://mvnrepository.com/artifact/jakarta.annotation/jakarta.annotation-api implementation("jakarta.annotation:jakarta.annotation-api:${jakartaVersion}") From 045742a8e6452b521518f88646009fc4152b2b1d Mon Sep 17 00:00:00 2001 From: hizumiaoba <56146205+hizumiaoba@users.noreply.github.com> Date: Sun, 14 Apr 2024 14:29:38 +0900 Subject: [PATCH 04/19] fix: improve file selecting logic (#33) * extract logic for opening file dialog * fix platform issue * fix typo * delete error popup logic for aborting the operation --- .../mctimemachine/MainController.java | 62 ++++++++++--------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/src/main/java/io/github/hizumiaoba/mctimemachine/MainController.java b/src/main/java/io/github/hizumiaoba/mctimemachine/MainController.java index cc7994b..87ed001 100644 --- a/src/main/java/io/github/hizumiaoba/mctimemachine/MainController.java +++ b/src/main/java/io/github/hizumiaoba/mctimemachine/MainController.java @@ -30,7 +30,6 @@ import javafx.scene.control.SpinnerValueFactory.IntegerSpinnerValueFactory; import javafx.scene.control.TabPane; import javafx.scene.control.TextField; -import javafx.stage.DirectoryChooser; import javafx.stage.FileChooser; import lombok.Getter; import lombok.RequiredArgsConstructor; @@ -301,47 +300,50 @@ void onOpenSavesFolderBtnClick() { @FXML void onSelectBackupSavingFolderBtnClick() { - DirectoryChooser dc = new DirectoryChooser(); - dc.setTitle("バックアップを保存するフォルダを選択してください。"); - dc.setInitialDirectory(new File(System.getProperty("user.home"))); - log.debug("awaiting for the user to select the backup saving folder."); - File f = dc.showDialog(null); + File f = openFileChooser("バックアップを保存するフォルダを選択してください。", + new File(System.getProperty("user.home"))); if (f == null) { - log.debug("Got nothing."); return; } - log.debug("Got the folder: {}", f.getAbsolutePath()); - backupSavingFolderPathField.setText(f.getAbsolutePath()); + assignPath(backupSavingFolderPathField, f); } @FXML - void onSelectLauncherExeBtnClick() { - FileChooser fc = new FileChooser(); - fc.setTitle("ランチャーの実行ファイルを選択してください。"); - fc.setInitialDirectory(new File(System.getProperty("user.home"))); - log.debug("awaiting for the user to select the executable file."); - File f = fc.showOpenDialog(null); + void onSelectSavesFolderBtnClick() { + File f = openFileChooser("\".minecraft/saves\"フォルダを選択してください。", + new File(System.getProperty("user.home"))); if (f == null) { - log.debug("Got nothing."); return; } - log.debug("Got the file: {}", f.getAbsolutePath()); - launcherExePathField.setText(f.getAbsolutePath()); + assignPath(savesFolderPathField, f); } @FXML - void onSelectSavesFolderBtnClick() { - DirectoryChooser dc = new DirectoryChooser(); - dc.setTitle("\".minecraft/saves\"フォルダを選択してください。"); - dc.setInitialDirectory(new File(System.getProperty("user.home"))); - log.debug("awaiting for the user to select the saves folder."); - File f = dc.showDialog(null); - if (f == null) { - log.debug("Got nothing."); - return; - } - log.debug("Got the folder: {}", f.getAbsolutePath()); - savesFolderPathField.setText(f.getAbsolutePath()); + void onSelectLauncherExeBtnClick() { + File f = openFileChooser("ランチャーの実行ファイルを選択してください。", + new File(System.getProperty("user.home"))); + if (f == null) { + return; + } + assignPath(launcherExePathField, f); + } + + private File openFileChooser(String title, File initialDir) { + FileChooser fc = new FileChooser(); + fc.setTitle(title); + fc.setInitialDirectory(initialDir); + log.debug("awaiting for the user to select the file."); + File f = fc.showOpenDialog(null); + if (f == null) { + log.debug("Got nothing."); + return null; + } + return f; + } + + private void assignPath(TextField injected, File target) { + log.debug("injecting the path: {}", target.getAbsolutePath()); + injected.setText(target.getAbsolutePath()); } @FXML From 1eb355e3180837aef4aa23227bf3d41e47f2a33f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 19 Apr 2024 08:04:32 +0000 Subject: [PATCH 05/19] Bump ch.qos.logback:logback-classic from 1.5.3 to 1.5.5 (#34) --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 848a1c2..aa86c50 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -42,7 +42,7 @@ javafx { dependencies { implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") - implementation("ch.qos.logback:logback-classic:1.5.3") + implementation("ch.qos.logback:logback-classic:1.5.5") implementation("com.google.guava:guava:33.1.0-jre") // https://mvnrepository.com/artifact/org.xerial/sqlite-jdbc implementation("org.xerial:sqlite-jdbc:3.45.2.0") From 3fac82742af761cfe16f471d17e2759a9f4da1c9 Mon Sep 17 00:00:00 2001 From: hizumiaoba <56146205+hizumiaoba@users.noreply.github.com> Date: Fri, 19 Apr 2024 18:32:58 +0900 Subject: [PATCH 06/19] Use version catalog (#36) * add catalog toml file * change declaration for matching catalog definition * fix dependabot configuration for pointing new toml file --- .github/dependabot.yml | 2 +- build.gradle.kts | 32 +++++++++++++++----------------- gradle/libs.versions.toml | 28 ++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 18 deletions(-) create mode 100644 gradle/libs.versions.toml diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 3e4a382..a7357c0 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -6,6 +6,6 @@ version: 2 updates: - package-ecosystem: "gradle" # See documentation for possible values - directory: "/" # Location of package manifests + directory: "/gradle/" # Location of package manifests schedule: interval: "weekly" diff --git a/build.gradle.kts b/build.gradle.kts index aa86c50..5f5f4b9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,11 +1,11 @@ plugins { java application - id("org.beryx.jlink") version "3.0.1" - id("org.openjfx.javafxplugin") version "0.1.0" - id("org.javamodularity.moduleplugin") version "1.8.15" + alias(libs.plugins.jlink) + alias(libs.plugins.moduleplugin) + alias(libs.plugins.shadow) + alias(libs.plugins.javafxpugin) id("org.jetbrains.kotlin.jvm") - id("com.github.johnrengelman.shadow") version "8.1.1" } group = "io.github.hizumiaoba" @@ -40,28 +40,26 @@ javafx { } dependencies { - implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") + implementation(libs.kotlin.stdlib) - implementation("ch.qos.logback:logback-classic:1.5.5") - implementation("com.google.guava:guava:33.1.0-jre") + implementation(libs.logback) + implementation(libs.guava) // https://mvnrepository.com/artifact/org.xerial/sqlite-jdbc - implementation("org.xerial:sqlite-jdbc:3.45.2.0") - implementation("org.projectlombok:lombok:${lombokVersion}") + implementation(libs.sqlite.jdbc) + implementation(libs.lombok) // https://mvnrepository.com/artifact/jakarta.annotation/jakarta.annotation-api - implementation("jakarta.annotation:jakarta.annotation-api:${jakartaVersion}") + implementation(libs.jakarta.annotation) // https://mvnrepository.com/artifact/com.melloware/jintellitype - implementation("com.melloware:jintellitype:1.4.1") + implementation(libs.jintelitype) // test dependencies - testImplementation("org.junit.jupiter:junit-jupiter-api:${junitVersion}") - testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${junitVersion}") - testImplementation("com.google.truth:truth:1.4.2") + testImplementation(libs.bundles.testlibs) + testRuntimeOnly(libs.jupiter.engine) // annotation processor - annotationProcessor("org.projectlombok:lombok:${lombokVersion}") - testAnnotationProcessor("org.projectlombok:lombok:${lombokVersion}") - annotationProcessor("jakarta.annotation:jakarta.annotation-api:${jakartaVersion}") + annotationProcessor(libs.bundles.annotationProcess) + testAnnotationProcessor(libs.lombok) } tasks.shadowJar { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..9f885d4 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,28 @@ +[versions] +junit = "5.10.1" +lombok = "1.18.30" +jakarta = "2.1.1" + +[libraries] +logback = { group = "ch.qos.logback", name = "logback-classic", version = "1.5.5" } +guava = { group = "com.google.guava", name = "guava", version = "33.1.0-jre" } +sqlite-jdbc = { group = "org.xerial", name = "sqlite-jdbc", version = "3.45.2.0" } +lombok = { group = "org.projectlombok", name = "lombok", version.ref = "lombok" } +jakarta-annotation = { group = "jakarta.annotation", name = "jakarta.annotation-api", version.ref = "jakarta" } +jintelitype = { group = "com.melloware", name = "jintellitype", version = "1.4.1" } +jupiter-api = { group = "org.junit.jupiter", name = "junit-jupiter-api", version.ref = "junit" } +jupiter-engine = { group = "org.junit.jupiter", name = "junit-jupiter-engine", version.ref = "junit" } +truth = { group = "com.google.truth", name = "truth", version = "1.4.2" } +kotlin-stdlib = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-jdk8", version = "1.8.22" } + +[bundles] +# except for engine dependency, which is only needed for running tests +testlibs = ["jupiter-api", "truth"] +# convenience bundle for annotationProcessor +annotationProcess = ["lombok", "jakarta-annotation"] + +[plugins] +jlink = { id = "org.beryx.jlink", version = "3.0.1" } +javafxpugin = { id = "org.openjfx.javafxplugin", version = "0.1.0" } +moduleplugin = { id = "org.javamodularity.moduleplugin", version = "1.8.15" } +shadow = { id = "com.github.johnrengelman.shadow", version = "8.1.1" } From 77079c57fa13e4faa9b7d3499a4ff5b2c1e1b226 Mon Sep 17 00:00:00 2001 From: hizumiaoba <56146205+hizumiaoba@users.noreply.github.com> Date: Fri, 19 Apr 2024 18:37:34 +0900 Subject: [PATCH 07/19] fix depednabot.yml (#37) --- .github/dependabot.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index a7357c0..3e4a382 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -6,6 +6,6 @@ version: 2 updates: - package-ecosystem: "gradle" # See documentation for possible values - directory: "/gradle/" # Location of package manifests + directory: "/" # Location of package manifests schedule: interval: "weekly" From 43e25ec0c169b738d5de91d04b4f7d4ca5fb1be1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 19 Apr 2024 18:42:17 +0900 Subject: [PATCH 08/19] Bump junit from 5.10.1 to 5.10.2 (#40) Bumps `junit` from 5.10.1 to 5.10.2. Updates `org.junit.jupiter:junit-jupiter-api` from 5.10.1 to 5.10.2 - [Release notes](https://github.com/junit-team/junit5/releases) - [Commits](https://github.com/junit-team/junit5/compare/r5.10.1...r5.10.2) Updates `org.junit.jupiter:junit-jupiter-engine` from 5.10.1 to 5.10.2 - [Release notes](https://github.com/junit-team/junit5/releases) - [Commits](https://github.com/junit-team/junit5/compare/r5.10.1...r5.10.2) --- updated-dependencies: - dependency-name: org.junit.jupiter:junit-jupiter-api dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.junit.jupiter:junit-jupiter-engine dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 9f885d4..e5c92d4 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -junit = "5.10.1" +junit = "5.10.2" lombok = "1.18.30" jakarta = "2.1.1" From 1ac63a87b44a48457a69b4abc140a04d5d0949e7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 19 Apr 2024 09:45:04 +0000 Subject: [PATCH 09/19] Bump ch.qos.logback:logback-classic from 1.5.5 to 1.5.6 (#38) Bumps [ch.qos.logback:logback-classic](https://github.com/qos-ch/logback) from 1.5.5 to 1.5.6. - [Commits](https://github.com/qos-ch/logback/compare/v_1.5.5...v_1.5.6) --- updated-dependencies: - dependency-name: ch.qos.logback:logback-classic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: hizumiaoba <56146205+hizumiaoba@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e5c92d4..28587df 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -4,7 +4,7 @@ lombok = "1.18.30" jakarta = "2.1.1" [libraries] -logback = { group = "ch.qos.logback", name = "logback-classic", version = "1.5.5" } +logback = { group = "ch.qos.logback", name = "logback-classic", version = "1.5.6" } guava = { group = "com.google.guava", name = "guava", version = "33.1.0-jre" } sqlite-jdbc = { group = "org.xerial", name = "sqlite-jdbc", version = "3.45.2.0" } lombok = { group = "org.projectlombok", name = "lombok", version.ref = "lombok" } From c33197d4584f2df4224a0d6b9aa763b716431fe7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 19 Apr 2024 09:48:33 +0000 Subject: [PATCH 10/19] Bump org.projectlombok:lombok from 1.18.30 to 1.18.32 (#39) Bumps [org.projectlombok:lombok](https://github.com/projectlombok/lombok) from 1.18.30 to 1.18.32. - [Changelog](https://github.com/projectlombok/lombok/blob/master/doc/changelog.markdown) - [Commits](https://github.com/projectlombok/lombok/compare/v1.18.30...v1.18.32) --- updated-dependencies: - dependency-name: org.projectlombok:lombok dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 28587df..fdbd7fe 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] junit = "5.10.2" -lombok = "1.18.30" +lombok = "1.18.32" jakarta = "2.1.1" [libraries] From 684fa0e81a9250b5d68dabae07f08b200eb67bc6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 19 Apr 2024 09:51:34 +0000 Subject: [PATCH 11/19] Bump org.xerial:sqlite-jdbc from 3.45.2.0 to 3.45.3.0 (#41) Bumps [org.xerial:sqlite-jdbc](https://github.com/xerial/sqlite-jdbc) from 3.45.2.0 to 3.45.3.0. - [Release notes](https://github.com/xerial/sqlite-jdbc/releases) - [Changelog](https://github.com/xerial/sqlite-jdbc/blob/master/CHANGELOG) - [Commits](https://github.com/xerial/sqlite-jdbc/compare/3.45.2.0...3.45.3.0) --- updated-dependencies: - dependency-name: org.xerial:sqlite-jdbc dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index fdbd7fe..0f5ac19 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -6,7 +6,7 @@ jakarta = "2.1.1" [libraries] logback = { group = "ch.qos.logback", name = "logback-classic", version = "1.5.6" } guava = { group = "com.google.guava", name = "guava", version = "33.1.0-jre" } -sqlite-jdbc = { group = "org.xerial", name = "sqlite-jdbc", version = "3.45.2.0" } +sqlite-jdbc = { group = "org.xerial", name = "sqlite-jdbc", version = "3.45.3.0" } lombok = { group = "org.projectlombok", name = "lombok", version.ref = "lombok" } jakarta-annotation = { group = "jakarta.annotation", name = "jakarta.annotation-api", version.ref = "jakarta" } jintelitype = { group = "com.melloware", name = "jintellitype", version = "1.4.1" } From c5557f71efd199a26f02f6cbe9b96f2a03a5a478 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 19 Apr 2024 10:02:52 +0000 Subject: [PATCH 12/19] Bump jakarta.annotation:jakarta.annotation-api from 2.1.1 to 3.0.0 (#42) Bumps [jakarta.annotation:jakarta.annotation-api](https://github.com/jakartaee/common-annotations-api) from 2.1.1 to 3.0.0. - [Commits](https://github.com/jakartaee/common-annotations-api/compare/2.1.1...3.0.0) --- updated-dependencies: - dependency-name: jakarta.annotation:jakarta.annotation-api dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 0f5ac19..105068b 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,7 +1,7 @@ [versions] junit = "5.10.2" lombok = "1.18.32" -jakarta = "2.1.1" +jakarta = "3.0.0" [libraries] logback = { group = "ch.qos.logback", name = "logback-classic", version = "1.5.6" } From 57fc1ee8eb0cc81affe5e0480983c3f44cc5a05d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 23 Apr 2024 11:32:28 +0900 Subject: [PATCH 13/19] Bump org.jetbrains.kotlin:kotlin-stdlib-jdk8 from 1.8.22 to 1.9.23 (#51) Bumps [org.jetbrains.kotlin:kotlin-stdlib-jdk8](https://github.com/JetBrains/kotlin) from 1.8.22 to 1.9.23. - [Release notes](https://github.com/JetBrains/kotlin/releases) - [Changelog](https://github.com/JetBrains/kotlin/blob/v1.9.23/ChangeLog.md) - [Commits](https://github.com/JetBrains/kotlin/compare/v1.8.22...v1.9.23) --- updated-dependencies: - dependency-name: org.jetbrains.kotlin:kotlin-stdlib-jdk8 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 105068b..48ad8ae 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -13,7 +13,7 @@ jintelitype = { group = "com.melloware", name = "jintellitype", version = "1.4.1 jupiter-api = { group = "org.junit.jupiter", name = "junit-jupiter-api", version.ref = "junit" } jupiter-engine = { group = "org.junit.jupiter", name = "junit-jupiter-engine", version.ref = "junit" } truth = { group = "com.google.truth", name = "truth", version = "1.4.2" } -kotlin-stdlib = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-jdk8", version = "1.8.22" } +kotlin-stdlib = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-jdk8", version = "1.9.23" } [bundles] # except for engine dependency, which is only needed for running tests From 6aeeecb8bf5c983504f45deadaa1a4886307927f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 7 May 2024 01:57:17 +0000 Subject: [PATCH 14/19] Bump com.google.guava:guava from 33.1.0-jre to 33.2.0-jre (#55) --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 48ad8ae..d4db8f4 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,7 +5,7 @@ jakarta = "3.0.0" [libraries] logback = { group = "ch.qos.logback", name = "logback-classic", version = "1.5.6" } -guava = { group = "com.google.guava", name = "guava", version = "33.1.0-jre" } +guava = { group = "com.google.guava", name = "guava", version = "33.2.0-jre" } sqlite-jdbc = { group = "org.xerial", name = "sqlite-jdbc", version = "3.45.3.0" } lombok = { group = "org.projectlombok", name = "lombok", version.ref = "lombok" } jakarta-annotation = { group = "jakarta.annotation", name = "jakarta.annotation-api", version.ref = "jakarta" } From 2d648d3a04f971393205b3aa4ad61734e0dceda0 Mon Sep 17 00:00:00 2001 From: hizumiaoba <56146205+hizumiaoba@users.noreply.github.com> Date: Thu, 16 May 2024 19:25:57 +0900 Subject: [PATCH 15/19] feat: Add version check feature (#54) * Add Version annotation interface * Add Retention policy Version annotation interface * Add Version annotation * Add helper method for suffix * Add VersionHelper * Refactor VersionObj class * Delete `EXPERIMENTAL` Suffix * add suffix checking logic * add test code for checking Suffix checking * fix tests * fix array index validation * roll back build script * fix status checking method * fix status checking method * add test for status checking * change accessor for `fromAnnotation` method * add `okhttp` and `jackson` deps * add check method * add modules for new deps * add some implementation for fetching online content * complete implementation for HttpRequest classes * build: add github-client dep * Revert "build: add github-client dep" This reverts commit a7eabc4b5e2ff782d3ab7d9269d1d39da36600aa. * dependency update * add logic for fetch remote versions * delete redundant test * fix for an issue where version string can be started with `v` * add checking matches completely * Update NOTICE add License notice for `GitHub API for Java` * refactor * Breaking changes for version check logic (#56) * Bump com.google.guava:guava from 33.1.0-jre to 33.2.0-jre (#55) * add experimental logic for checking update * add tests * add getter for specific version data --------- Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * delete unused deps * add ability to fetch remote version * add log statement for tracing * add some annotation * add logic for both prerelease and not. * add UI component and event handling for Version Update Checking * update version String conversion process * add GUI for user-friendly version check dialog --------- Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- NOTICE | 414 ++++++++++++++++++ build.gradle.kts | 1 + gradle/libs.versions.toml | 3 + .../mctimemachine/MainController.java | 17 + .../MineCraftTimeMachineApplication.java | 3 + .../mctimemachine/UpdateDialogController.java | 87 ++++ .../hizumiaoba/mctimemachine/api/Suffix.java | 25 ++ .../hizumiaoba/mctimemachine/api/Version.java | 16 + .../internal/version/VersionHelper.java | 79 ++++ .../internal/version/VersionObj.java | 44 ++ src/main/java/module-info.java | 3 + .../github/hizumiaoba/mctimemachine/main.fxml | 5 +- .../hizumiaoba/mctimemachine/update.fxml | 79 ++++ .../mctimemachine/FetchRemoteVersionTest.java | 24 + .../mctimemachine/VersionCheckTest.java | 99 +++++ 15 files changed, 898 insertions(+), 1 deletion(-) create mode 100644 src/main/java/io/github/hizumiaoba/mctimemachine/UpdateDialogController.java create mode 100644 src/main/java/io/github/hizumiaoba/mctimemachine/api/Suffix.java create mode 100644 src/main/java/io/github/hizumiaoba/mctimemachine/api/Version.java create mode 100644 src/main/java/io/github/hizumiaoba/mctimemachine/internal/version/VersionHelper.java create mode 100644 src/main/java/io/github/hizumiaoba/mctimemachine/internal/version/VersionObj.java create mode 100644 src/main/resources/io/github/hizumiaoba/mctimemachine/update.fxml create mode 100644 src/test/java/io/github/hizumiaoba/mctimemachine/FetchRemoteVersionTest.java create mode 100644 src/test/java/io/github/hizumiaoba/mctimemachine/VersionCheckTest.java diff --git a/NOTICE b/NOTICE index ad1b5e7..99b37a2 100644 --- a/NOTICE +++ b/NOTICE @@ -1373,3 +1373,417 @@ JDBC Driver for SQLite WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +okhttp3 + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +jackson + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +GitHub API for Java + +The MIT License + +Details are available at https://github-api.kohsuke.org/licenses.html diff --git a/build.gradle.kts b/build.gradle.kts index 5f5f4b9..6e15afd 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -51,6 +51,7 @@ dependencies { implementation(libs.jakarta.annotation) // https://mvnrepository.com/artifact/com.melloware/jintellitype implementation(libs.jintelitype) + implementation(libs.gh.api) // test dependencies diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d4db8f4..52419ef 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,6 +2,7 @@ junit = "5.10.2" lombok = "1.18.32" jakarta = "3.0.0" +jackson = "2.17.0" [libraries] logback = { group = "ch.qos.logback", name = "logback-classic", version = "1.5.6" } @@ -14,12 +15,14 @@ jupiter-api = { group = "org.junit.jupiter", name = "junit-jupiter-api", version jupiter-engine = { group = "org.junit.jupiter", name = "junit-jupiter-engine", version.ref = "junit" } truth = { group = "com.google.truth", name = "truth", version = "1.4.2" } kotlin-stdlib = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-jdk8", version = "1.9.23" } +gh-api = { group = "org.kohsuke", name = "github-api", version = "1.321" } [bundles] # except for engine dependency, which is only needed for running tests testlibs = ["jupiter-api", "truth"] # convenience bundle for annotationProcessor annotationProcess = ["lombok", "jakarta-annotation"] +# convenience bundle for jackson libraries [plugins] jlink = { id = "org.beryx.jlink", version = "3.0.1" } diff --git a/src/main/java/io/github/hizumiaoba/mctimemachine/MainController.java b/src/main/java/io/github/hizumiaoba/mctimemachine/MainController.java index 87ed001..efceeb9 100644 --- a/src/main/java/io/github/hizumiaoba/mctimemachine/MainController.java +++ b/src/main/java/io/github/hizumiaoba/mctimemachine/MainController.java @@ -24,6 +24,8 @@ import java.util.concurrent.TimeUnit; import javafx.application.Platform; import javafx.fxml.FXML; +import javafx.fxml.FXMLLoader; +import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.CheckBox; import javafx.scene.control.Spinner; @@ -31,6 +33,7 @@ import javafx.scene.control.TabPane; import javafx.scene.control.TextField; import javafx.stage.FileChooser; +import javafx.stage.Stage; import lombok.Getter; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -393,6 +396,20 @@ void onSpecialBackupNowBtnClick() { }); } + @FXML + private Button checkVersionUpdateBtn; + + @FXML + void onCheckVersionUpdateBtnClick() throws IOException { + log.trace("Checking the latest version..."); + // open new dialog with `update.fxml` + FXMLLoader loader = new FXMLLoader( + MineCraftTimeMachineApplication.class.getResource("update.fxml")); + Stage updateDialogStage = new Stage(); + updateDialogStage.setScene(new Scene(loader.load())); + updateDialogStage.showAndWait(); + } + private void runConcurrentTask(ExecutorService service, Runnable task) { service.execute(task); } diff --git a/src/main/java/io/github/hizumiaoba/mctimemachine/MineCraftTimeMachineApplication.java b/src/main/java/io/github/hizumiaoba/mctimemachine/MineCraftTimeMachineApplication.java index 4fe639d..6e45e8f 100644 --- a/src/main/java/io/github/hizumiaoba/mctimemachine/MineCraftTimeMachineApplication.java +++ b/src/main/java/io/github/hizumiaoba/mctimemachine/MineCraftTimeMachineApplication.java @@ -1,6 +1,8 @@ package io.github.hizumiaoba.mctimemachine; import com.melloware.jintellitype.JIntellitype; +import io.github.hizumiaoba.mctimemachine.api.Suffix; +import io.github.hizumiaoba.mctimemachine.api.Version; import java.io.IOException; import javafx.application.Application; import javafx.fxml.FXMLLoader; @@ -10,6 +12,7 @@ import lombok.extern.slf4j.Slf4j; @Slf4j +@Version(major = 0, minor = 2, patch = 0, suffix = Suffix.ALPHA) public class MineCraftTimeMachineApplication extends Application { @Override diff --git a/src/main/java/io/github/hizumiaoba/mctimemachine/UpdateDialogController.java b/src/main/java/io/github/hizumiaoba/mctimemachine/UpdateDialogController.java new file mode 100644 index 0000000..23e6a3b --- /dev/null +++ b/src/main/java/io/github/hizumiaoba/mctimemachine/UpdateDialogController.java @@ -0,0 +1,87 @@ +package io.github.hizumiaoba.mctimemachine; + +import io.github.hizumiaoba.mctimemachine.api.ExceptionPopup; +import io.github.hizumiaoba.mctimemachine.api.Version; +import io.github.hizumiaoba.mctimemachine.internal.version.VersionHelper; +import io.github.hizumiaoba.mctimemachine.internal.version.VersionObj; +import java.awt.Desktop; +import java.io.IOException; +import java.net.URI; +import javafx.event.ActionEvent; +import javafx.fxml.FXML; +import javafx.scene.control.CheckBox; +import javafx.scene.control.Label; +import javafx.scene.control.ProgressBar; +import javafx.stage.Stage; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class UpdateDialogController { + + @FXML + private CheckBox chkIncludePrerelease; + + @FXML + private ProgressBar updateProgressBar; + + @FXML + private Label labelUpdateMessage; + + private VersionObj remoteLatest; + + @FXML + void onCheckUpdateBtnClick() { + log.info("Check update button clicked."); + chkIncludePrerelease.setDisable(true); + updateProgressBar.setProgress(0.0); + log.trace("Fetching remote latest version..."); + VersionObj clientVersion = VersionObj.parse(MineCraftTimeMachineApplication.class.getAnnotation( + Version.class)); + updateProgressBar.setProgress(0.15); + VersionHelper helper = new VersionHelper(clientVersion); + try { + this.remoteLatest = VersionHelper.getLatestRemoteVersion(chkIncludePrerelease.isSelected()); + updateProgressBar.setProgress(0.33); + log.info("Remote latest version: {}", remoteLatest.asStringNotation()); + log.trace("Client version: {}", clientVersion.asStringNotation()); + updateProgressBar.setProgress(0.67); + if (helper.checkLatest(remoteLatest, false)) { + log.info("Client is up-to-date."); + } else { + log.info("Client is outdated."); + } + } catch (IOException e) { + ExceptionPopup p = new ExceptionPopup(e, "最新バージョンを取得できませんでした。", + "UpdateDialogController#onCheckUpdateBtnClick"); + p.pop(); + } finally { + chkIncludePrerelease.setDisable(false); + updateProgressBar.setProgress(1.0); + labelUpdateMessage.setText(helper.constructUpdateMessage(remoteLatest, false)); + } + } + + @FXML + void onOpenReleasePageBtnClick() { + log.info("Open release page button clicked."); + try { + // construct GitHub release page URL with remoteLatest + URI uri = URI.create( + String.format("https://github.com/hizumiaoba/MineCraftTimeMachine/releases/tag/v%s", + remoteLatest.asStringNotation())); + log.info("Opening release page: {}", uri); + Desktop.getDesktop().browse(uri); + } catch (IOException e) { + ExceptionPopup p = new ExceptionPopup(e, "リリースページを開けませんでした。", + "UpdateDialogController#onOpenReleasePageBtnClick"); + p.pop(); + } + } + + @FXML + void onCloseBtnClick(ActionEvent e) { + log.info("Close button clicked."); + Stage stage = (Stage) updateProgressBar.getScene().getWindow(); + stage.close(); + } +} diff --git a/src/main/java/io/github/hizumiaoba/mctimemachine/api/Suffix.java b/src/main/java/io/github/hizumiaoba/mctimemachine/api/Suffix.java new file mode 100644 index 0000000..cd3a697 --- /dev/null +++ b/src/main/java/io/github/hizumiaoba/mctimemachine/api/Suffix.java @@ -0,0 +1,25 @@ +package io.github.hizumiaoba.mctimemachine.api; + +import lombok.Getter; + +@Getter +public enum Suffix { + NONE(""), + ALPHA("alpha"), + BETA("beta"); + + private final String suffix; + + Suffix(String suffix) { + this.suffix = suffix; + } + + public static Suffix parse(String suffix) { + for (Suffix s : values()) { + if (s.suffix.equals(suffix)) { + return s; + } + } + return NONE; + } +} diff --git a/src/main/java/io/github/hizumiaoba/mctimemachine/api/Version.java b/src/main/java/io/github/hizumiaoba/mctimemachine/api/Version.java new file mode 100644 index 0000000..7a56a06 --- /dev/null +++ b/src/main/java/io/github/hizumiaoba/mctimemachine/api/Version.java @@ -0,0 +1,16 @@ +package io.github.hizumiaoba.mctimemachine.api; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +@Retention(RetentionPolicy.RUNTIME) +public @interface Version { + + int major(); + + int minor(); + + int patch(); + + Suffix suffix() default Suffix.NONE; +} diff --git a/src/main/java/io/github/hizumiaoba/mctimemachine/internal/version/VersionHelper.java b/src/main/java/io/github/hizumiaoba/mctimemachine/internal/version/VersionHelper.java new file mode 100644 index 0000000..0c77b64 --- /dev/null +++ b/src/main/java/io/github/hizumiaoba/mctimemachine/internal/version/VersionHelper.java @@ -0,0 +1,79 @@ +package io.github.hizumiaoba.mctimemachine.internal.version; + +import io.github.hizumiaoba.mctimemachine.MineCraftTimeMachineApplication; +import io.github.hizumiaoba.mctimemachine.api.Version; +import java.io.IOException; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.kohsuke.github.GHRelease; +import org.kohsuke.github.GitHub; + +@RequiredArgsConstructor +@Slf4j +public class VersionHelper { + + private final VersionObj clientVersion; + + public boolean checkLatest(VersionObj remoteVersion, boolean ignoreSuffix) { + return getUpdateType(remoteVersion, ignoreSuffix).equals("latest"); + } + + private String getUpdateType(VersionObj remoteVersion, boolean ignoreSuffix) { + final boolean isMajorSame = clientVersion.getMajor() == remoteVersion.getMajor(); + final boolean isMinorSame = clientVersion.getMinor() == remoteVersion.getMinor(); + final boolean isPatchSame = clientVersion.getPatch() == remoteVersion.getPatch(); + final boolean isSuffixSame = + ignoreSuffix || clientVersion.getSuffix().equals(remoteVersion.getSuffix()); + if (isMajorSame && isMinorSame && isPatchSame && isSuffixSame) { + return "latest"; + } else if (isMajorSame && isMinorSame && isPatchSame) { + return "suffix"; + } else if (isMajorSame && isMinorSame) { + return "patch"; + } else if (isMajorSame) { + return "minor"; + } else { + return "major"; + } + } + + public static VersionObj getLatestRemoteVersion(boolean includePrerelease) throws IOException { + GitHub gh = GitHub.connectAnonymously(); + List releases = gh.getRepository("hizumiaoba/MineCraftTimeMachine") + .listReleases() + .toList() + .parallelStream().filter(r -> includePrerelease || !r.isPrerelease()) + .toList(); + if (releases.isEmpty()) { + // fall back client version so that no update prompt will be shown + log.warn( + "No available releases found with required precondition. Fallback to client version."); + return VersionObj.parse(MineCraftTimeMachineApplication.class.getAnnotation(Version.class)); + } + log.debug("Found {} releases", releases.size()); + log.trace("Latest release: {}", releases.get(0).getTagName()); + return VersionObj.parse(releases.get(0).getTagName()); + } + + public String constructUpdateMessage(VersionObj remoteVersion, boolean ignoreSuffix) { + final String updateType = getUpdateType(remoteVersion, ignoreSuffix); + final String remoteVersionString = remoteVersion.asStringNotation(); + final String clientVersionString = clientVersion.asStringNotation(); + final String clientVersionNotice = "現在のバージョンは" + clientVersionString + "です。"; + return switch (updateType) { + case "latest" -> "現在最新バージョンのソフトウェアを使用中です!最新こそ正義!"; + case "suffix" -> "新しい試験運用版のソフトウェアが利用可能です!未知への冒険へ、出発です! \n最新バージョン: " + + remoteVersionString + "。 " + clientVersionNotice; + case "patch" -> "新しいパッチリリースのソフトウェアが利用可能です!バグ修正などが含まれています! \n最新バージョン: " + + remoteVersionString + "。 " + clientVersionNotice; + case "minor" -> "新しいマイナーリリースのソフトウェアが利用可能です!新機能や小規模な機能の挙動改善が含まれています! \n最新バージョン: " + + remoteVersionString + "。 " + clientVersionNotice; + case "major" -> + "新しいメジャーリリースのソフトウェアが利用可能です!大規模な機能追加や大幅な仕様変更が含まれています!更新の際には互換性にご注意ください! \n最新バージョン: " + + remoteVersionString + "。 " + clientVersionNotice; + default -> + "更新の種類を特定できません。直接アップデートを確認してください。" + clientVersionNotice; + }; + } +} diff --git a/src/main/java/io/github/hizumiaoba/mctimemachine/internal/version/VersionObj.java b/src/main/java/io/github/hizumiaoba/mctimemachine/internal/version/VersionObj.java new file mode 100644 index 0000000..81d1ac8 --- /dev/null +++ b/src/main/java/io/github/hizumiaoba/mctimemachine/internal/version/VersionObj.java @@ -0,0 +1,44 @@ +package io.github.hizumiaoba.mctimemachine.internal.version; + +import io.github.hizumiaoba.mctimemachine.api.Suffix; +import io.github.hizumiaoba.mctimemachine.api.Version; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor(access = AccessLevel.PRIVATE) +@AllArgsConstructor(access = AccessLevel.PRIVATE) +@Getter +public class VersionObj { + + private final int major; + private final int minor; + private final int patch; + private Suffix suffix; + + public static VersionObj parse(String versionNotation) { + // versionNotation should be "major.minor.patch" or "major.minor.patch-suffix" + // and may contain "v" prefix + String[] versionParts = versionNotation.replace("v", "").split("-"); + String[] versionNumbers = versionParts[0].split("\\."); + int major = Integer.parseInt(versionNumbers[0]); + int minor = Integer.parseInt(versionNumbers[1]); + int patch = Integer.parseInt(versionNumbers[2]); + Suffix suffix = versionParts.length > 1 ? Suffix.parse(versionParts[1]) : Suffix.NONE; + return new VersionObj(major, minor, patch, suffix); + } + + public static VersionObj parse(Version versionAnnotation) { + int major = versionAnnotation.major(); + int minor = versionAnnotation.minor(); + int patch = versionAnnotation.patch(); + Suffix suffix = versionAnnotation.suffix(); + return new VersionObj(major, minor, patch, suffix); + } + + public String asStringNotation() { + return String.format("%d.%d.%d%s", major, minor, patch, + Suffix.NONE.equals(suffix) ? "" : "-" + suffix.getSuffix()); + } +} diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index 5f15def..7f8f889 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -10,6 +10,9 @@ requires lombok; requires annotations; requires jintellitype; + requires org.kohsuke.github.api; + requires com.fasterxml.jackson.core; + requires com.fasterxml.jackson.databind; opens io.github.hizumiaoba.mctimemachine to javafx.fxml; exports io.github.hizumiaoba.mctimemachine; diff --git a/src/main/resources/io/github/hizumiaoba/mctimemachine/main.fxml b/src/main/resources/io/github/hizumiaoba/mctimemachine/main.fxml index 441427b..c2c651a 100644 --- a/src/main/resources/io/github/hizumiaoba/mctimemachine/main.fxml +++ b/src/main/resources/io/github/hizumiaoba/mctimemachine/main.fxml @@ -46,7 +46,7 @@ @@ -113,6 +113,9 @@ mnemonicParsing="false" onAction="#onOpenRelatedFolderBtnClick" prefHeight="40.0" prefWidth="170.0" text="各種フォルダを開く" fx:id="openRelatedFolderBtn"/> +