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

Commit

Permalink
feat: Add option to warn about patches not being found in supplied pa…
Browse files Browse the repository at this point in the history
…tch bundles
  • Loading branch information
oSumAtrIX committed Sep 23, 2023
1 parent 80a8d88 commit e46d855
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,13 @@ internal object PatchCommand : Runnable {
)
private var purge: Boolean = false

@CommandLine.Option(
names = ["-w", "--warn"],
description = ["Warn if a patch can not be found in the supplied patch bundles"],
showDefaultValue = ALWAYS
)
private var warn: Boolean = false

@CommandLine.Parameters(
description = ["APK file to be patched"], arity = "1..1"
)
Expand Down Expand Up @@ -179,6 +186,16 @@ internal object PatchCommand : Runnable {

val patches = PatchBundleLoader.Jar(*patchBundles.toTypedArray())

// Warn if a patch can not be found in the supplied patch bundles.
if (warn) patches.map { it.name }.toHashSet().let { availableNames ->
arrayOf(*includedPatches, *excludedPatches).filter { name ->
!availableNames.contains(name)
}
}.let { unknownPatches ->
if (unknownPatches.isEmpty()) return@let
logger.warning("Unknown input of patches:\n${unknownPatches.joinToString("\n")}")
}

logger.info("Setting patch options")

optionsFile.let {
Expand Down

0 comments on commit e46d855

Please sign in to comment.