mirror of
https://github.com/revanced/revanced-cli.git
synced 2024-12-04 01:12:54 +01:00
fix: check for package compatibility at first
This commit is contained in:
parent
4f2d2568d3
commit
9fe5a0b6d9
@ -241,15 +241,7 @@ internal object PatchCommand : Runnable {
|
|||||||
val explicitlyExcluded = excludedPatches.contains(formattedPatchName)
|
val explicitlyExcluded = excludedPatches.contains(formattedPatchName)
|
||||||
if (explicitlyExcluded) return@patch logger.info("Excluding ${patch.patchName}")
|
if (explicitlyExcluded) return@patch logger.info("Excluding ${patch.patchName}")
|
||||||
|
|
||||||
// If the patch is implicitly included, it will be only included if [exclusive] is false.
|
// Make sure the patch is compatible with the supplied APK files package name and version.
|
||||||
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.
|
|
||||||
patch.compatiblePackages?.let { packages ->
|
patch.compatiblePackages?.let { packages ->
|
||||||
packages.singleOrNull { it.name == packageName }?.let { `package` ->
|
packages.singleOrNull { it.name == packageName }?.let { `package` ->
|
||||||
val matchesVersion = force || `package`.versions.let {
|
val matchesVersion = force || `package`.versions.let {
|
||||||
@ -269,6 +261,14 @@ internal object PatchCommand : Runnable {
|
|||||||
return@let
|
return@let
|
||||||
} ?: logger.fine("$formattedPatchName: No constraint on packages.")
|
} ?: 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")
|
logger.fine("Adding $formattedPatchName")
|
||||||
|
|
||||||
add(patch)
|
add(patch)
|
||||||
|
Loading…
Reference in New Issue
Block a user