Skip to content

Commit 9fe5a0b

Browse files
committed
fix: check for package compatibility at first
1 parent 4f2d256 commit 9fe5a0b

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/main/kotlin/app/revanced/cli/command/PatchCommand.kt

+9-9
Original file line numberDiff line numberDiff line change
@@ -241,15 +241,7 @@ internal object PatchCommand : Runnable {
241241
val explicitlyExcluded = excludedPatches.contains(formattedPatchName)
242242
if (explicitlyExcluded) return@patch logger.info("Excluding ${patch.patchName}")
243243

244-
// If the patch is implicitly included, it will be only included if [exclusive] is false.
245-
val implicitlyIncluded = !exclusive && patch.include
246-
// If the patch is explicitly included, it will be included even if [exclusive] is false.
247-
val explicitlyIncluded = includedPatches.contains(formattedPatchName)
248-
249-
val included = implicitlyIncluded || explicitlyIncluded
250-
if (!included) return@patch logger.info("${patch.patchName} excluded by default") // Case 1.
251-
252-
// At last make sure the patch is compatible with the supplied APK files package name and version.
244+
// Make sure the patch is compatible with the supplied APK files package name and version.
253245
patch.compatiblePackages?.let { packages ->
254246
packages.singleOrNull { it.name == packageName }?.let { `package` ->
255247
val matchesVersion = force || `package`.versions.let {
@@ -269,6 +261,14 @@ internal object PatchCommand : Runnable {
269261
return@let
270262
} ?: logger.fine("$formattedPatchName: No constraint on packages.")
271263

264+
// If the patch is implicitly included, it will be only included if [exclusive] is false.
265+
val implicitlyIncluded = !exclusive && patch.include
266+
// If the patch is explicitly included, it will be included even if [exclusive] is false.
267+
val explicitlyIncluded = includedPatches.contains(formattedPatchName)
268+
269+
val included = implicitlyIncluded || explicitlyIncluded
270+
if (!included) return@patch logger.info("${patch.patchName} excluded by default") // Case 1.
271+
272272
logger.fine("Adding $formattedPatchName")
273273

274274
add(patch)

0 commit comments

Comments
 (0)