From cde041a126ade4bb7fee86b6e6c9510e5ecbcc3e Mon Sep 17 00:00:00 2001 From: WarningImHack3r <43064022+WarningImHack3r@users.noreply.github.com> Date: Sun, 16 Jun 2024 00:46:41 +0200 Subject: [PATCH] Release 2.3.3 - Mitigate crash due to OOBE in Semver by catching exceptions - Upgrade dependencies - Correctly install kotlinx.serialization --- CHANGELOG.md | 1 + build.gradle.kts | 1 + gradle.properties | 2 +- gradle/libs.versions.toml | 6 ++++-- gradle/wrapper/gradle-wrapper.properties | 2 +- .../backend/engine/PackageUpdateChecker.kt | 11 ++++++++--- 6 files changed, 16 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d2604d..1cf9d24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ ### Fixed - Fix plugin hanging forever when trying to find a dependency's registry (#110) +- Mitigate crashes when checking version for some dependencies (#109) ## [2.3.2] - 2024-05-17 diff --git a/build.gradle.kts b/build.gradle.kts index 3ebdc24..461864f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -31,6 +31,7 @@ kotlin { // Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog dependencies { implementation(libs.semver4j) + implementation(libs.serialization) } // Configure Gradle IntelliJ Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html diff --git a/gradle.properties b/gradle.properties index 14ec5e1..340b938 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,7 +19,7 @@ platformVersion = 2022.1 platformPlugins = # Gradle Releases -> https://github.com/gradle/gradle/releases -gradleVersion = 8.7 +gradleVersion = 8.8 # Opt-out flag for bundling Kotlin standard library -> https://jb.gg/intellij-platform-kotlin-stdlib kotlin.stdlib.default.dependency = false diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 284f7d3..d5ae37b 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -4,13 +4,15 @@ semver4j = "5.3.0" # plugins kotlin = "1.9.24" +serialization = "1.6.3" changelog = "2.2.0" -gradleIntelliJPlugin = "1.17.3" +gradleIntelliJPlugin = "1.17.4" qodana = "2024.1.5" -kover = "0.8.0" +kover = "0.8.1" [libraries] semver4j = { group = "org.semver4j", name = "semver4j", version.ref = "semver4j" } +serialization = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "serialization" } [plugins] changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b82aa23..a441313 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/src/main/kotlin/com/github/warningimhack3r/npmupdatedependencies/backend/engine/PackageUpdateChecker.kt b/src/main/kotlin/com/github/warningimhack3r/npmupdatedependencies/backend/engine/PackageUpdateChecker.kt index 0e7f4ad..c4b3e37 100644 --- a/src/main/kotlin/com/github/warningimhack3r/npmupdatedependencies/backend/engine/PackageUpdateChecker.kt +++ b/src/main/kotlin/com/github/warningimhack3r/npmupdatedependencies/backend/engine/PackageUpdateChecker.kt @@ -106,9 +106,14 @@ class PackageUpdateChecker(private val project: Project) { || !newestVersion.satisfies(comparator) ) { log.debug("Latest version $newestVersion is excluded, a beta, or does not satisfy the comparator") - val allVersions = npmjsClient.getAllVersions(packageName)?.mapNotNull { version -> - Semver.coerce(version) - }?.sortedDescending() ?: emptyList() + val allVersions = try { + npmjsClient.getAllVersions(packageName)?.mapNotNull { version -> + Semver.coerce(version) + }?.sortedDescending() ?: emptyList() + } catch (e: Exception) { + log.warn("Failed to get all versions for $packageName", e) + emptyList() + } // Downgrade the latest version if it's filtered out var latest: Semver? = null