feat: Add option to warn about patches not being found in supplied patch bundles

This commit is contained in:
oSumAtrIX 2023-09-22 02:56:23 +02:00
parent 80a8d88406
commit e46d855643
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4

View File

@ -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"
)
@ -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 {