From 9fe5a0b6d93304f630436ed0e954723d9a27b0f6 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Mon, 28 Aug 2023 18:37:02 +0200 Subject: [PATCH] fix: check for package compatibility at first --- .../app/revanced/cli/command/PatchCommand.kt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/kotlin/app/revanced/cli/command/PatchCommand.kt b/src/main/kotlin/app/revanced/cli/command/PatchCommand.kt index 585ce58..9e2fc5c 100644 --- a/src/main/kotlin/app/revanced/cli/command/PatchCommand.kt +++ b/src/main/kotlin/app/revanced/cli/command/PatchCommand.kt @@ -241,15 +241,7 @@ internal object PatchCommand : Runnable { val explicitlyExcluded = excludedPatches.contains(formattedPatchName) if (explicitlyExcluded) return@patch logger.info("Excluding ${patch.patchName}") - // If the patch is implicitly included, it will be only included if [exclusive] is false. - val implicitlyIncluded = !exclusive && patch.include - // If the patch is explicitly included, it will be included even if [exclusive] is false. - val explicitlyIncluded = includedPatches.contains(formattedPatchName) - - val included = implicitlyIncluded || explicitlyIncluded - if (!included) return@patch logger.info("${patch.patchName} excluded by default") // Case 1. - - // At last make sure the patch is compatible with the supplied APK files package name and version. + // Make sure the patch is compatible with the supplied APK files package name and version. patch.compatiblePackages?.let { packages -> packages.singleOrNull { it.name == packageName }?.let { `package` -> val matchesVersion = force || `package`.versions.let { @@ -269,6 +261,14 @@ internal object PatchCommand : Runnable { return@let } ?: logger.fine("$formattedPatchName: No constraint on packages.") + // If the patch is implicitly included, it will be only included if [exclusive] is false. + val implicitlyIncluded = !exclusive && patch.include + // If the patch is explicitly included, it will be included even if [exclusive] is false. + val explicitlyIncluded = includedPatches.contains(formattedPatchName) + + val included = implicitlyIncluded || explicitlyIncluded + if (!included) return@patch logger.info("${patch.patchName} excluded by default") // Case 1. + logger.fine("Adding $formattedPatchName") add(patch)