Skip to content
This repository has been archived by the owner on Apr 15, 2024. It is now read-only.

Commit

Permalink
fix: don't log when package is incompatible and exclusive option is…
Browse files Browse the repository at this point in the history
… used
  • Loading branch information
oSumAtrIX committed Dec 15, 2022
1 parent 8c2aeff commit ad81a1b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/main/kotlin/app/revanced/cli/command/MainCommand.kt
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ internal object MainCommand : Runnable {
names = ["--exclusive"],
description = ["Only installs the patches you include, not including any patch by default"]
)
var defaultExclude = false
var exclusive = false

@Option(names = ["-i", "--include"], description = ["Include patches"])
var includedPatches = arrayOf<String>()
Expand Down
19 changes: 9 additions & 10 deletions src/main/kotlin/app/revanced/utils/patcher/Patcher.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,9 @@ fun Patcher.addPatchesFiltered(allPatches: List<Class<out Patch<Context>>>) {
allPatches.forEach patchLoop@{ patch ->
val compatiblePackages = patch.compatiblePackages
val patchName = patch.patchName

val prefix = "Skipping $patchName"

val args = MainCommand.args.patchArgs?.patchingArgs!!

if (args.excludedPatches.contains(patchName)) {
logger.info("$prefix: Manually excluded")
return@patchLoop
} else if ((!patch.include || args.defaultExclude) && !args.includedPatches.contains(patchName)) {
logger.info("$prefix: Excluded by default")
return@patchLoop
}
val prefix = "Skipping $patchName"

if (compatiblePackages == null) logger.trace("$patchName: No constraint on packages.")
else {
Expand All @@ -51,6 +42,14 @@ fun Patcher.addPatchesFiltered(allPatches: List<Class<out Patch<Context>>>) {
}
}

if (args.excludedPatches.contains(patchName)) {
logger.info("$prefix: Manually excluded")
return@patchLoop
} else if ((!patch.include || args.exclusive) && !args.includedPatches.contains(patchName)) {
logger.info("$prefix: Excluded by default")
return@patchLoop
}

logger.trace("Adding $patchName")
includedPatches.add(patch)
}
Expand Down

0 comments on commit ad81a1b

Please sign in to comment.