From 206f2029d7498b6474c16a47cbe451c170fdd31f Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Fri, 27 May 2022 12:25:44 +0200 Subject: [PATCH] fix: invalid code flow when adding patches --- .github/workflows/release.yml | 1 + build.gradle.kts | 4 ++-- src/main/kotlin/app/revanced/cli/MainCommand.kt | 4 ++-- src/main/kotlin/app/revanced/utils/patcher/Patcher.kt | 9 +++++---- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 424c8e09..09de4c15 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,5 +1,6 @@ name: Release on: + workflow_dispatch: push: branches: - main diff --git a/build.gradle.kts b/build.gradle.kts index 9c6e96d9..9d097eba 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -24,7 +24,7 @@ repositories { dependencies { implementation("org.jetbrains.kotlin:kotlin-stdlib:1.6.21") - implementation("app.revanced:revanced-patcher:1.0.0-dev.16") + implementation("app.revanced:revanced-patcher:1.0.0-dev.17") implementation("app.revanced:revanced-patches:1.0.0-dev.11") implementation("info.picocli:picocli:4.6.3") @@ -68,4 +68,4 @@ publishing { from(components["java"]) } } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/cli/MainCommand.kt b/src/main/kotlin/app/revanced/cli/MainCommand.kt index c78072f0..c9971228 100644 --- a/src/main/kotlin/app/revanced/cli/MainCommand.kt +++ b/src/main/kotlin/app/revanced/cli/MainCommand.kt @@ -58,9 +58,9 @@ internal object MainCommand : Runnable { for (it in JarPatchBundle(patchBundlePath).loadPatches()) println( "[available] ${ - it.javaClass.findAnnotationRecursively( + it.findAnnotationRecursively( Name::class.java - )?.name ?: Name::class.java.name + )?.name ?: it::class.java.name }" ) return diff --git a/src/main/kotlin/app/revanced/utils/patcher/Patcher.kt b/src/main/kotlin/app/revanced/utils/patcher/Patcher.kt index 92c31647..e8aac78f 100644 --- a/src/main/kotlin/app/revanced/utils/patcher/Patcher.kt +++ b/src/main/kotlin/app/revanced/utils/patcher/Patcher.kt @@ -24,7 +24,7 @@ fun Patcher.addPatchesFiltered( val compatibilityAnnotation = patch.javaClass.findAnnotationRecursively(Compatibility::class.java) - val patchName = patch.javaClass.findAnnotationRecursively(Name::class.java)?.name ?: Name::class.java.name + val patchName = patch.javaClass.findAnnotationRecursively(Name::class.java)?.name ?: patch.javaClass.name val prefix = "[skipped] $patchName" @@ -47,9 +47,10 @@ fun Patcher.addPatchesFiltered( return@patch } - if (!packageVersionCompatibilityFilter || compatiblePackage.versions.any { it == packageVersion }) return@patch - println("$prefix: Unsupported version.") - return@patch + if (packageVersionCompatibilityFilter && !compatiblePackage.versions.any { it == packageVersion }) { + println("$prefix: Unsupported version.") + return@patch + } } }