mirror of
https://github.com/revanced/revanced-cli.git
synced 2025-04-30 06:34:29 +02:00
fix: Only set options for filtered patches
This prevents errors when settings required options from patches that are not accepted to `null`.
This commit is contained in:
parent
e3c55507cf
commit
64d9127291
@ -196,13 +196,6 @@ internal object PatchCommand : Runnable {
|
|||||||
logger.warning("Unknown input of patches:\n${unknownPatches.joinToString("\n")}")
|
logger.warning("Unknown input of patches:\n${unknownPatches.joinToString("\n")}")
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info("Setting patch options")
|
|
||||||
|
|
||||||
optionsFile.let {
|
|
||||||
if (it.exists()) patches.setOptions(it)
|
|
||||||
else Options.serialize(patches, prettyPrint = true).let(it::writeText)
|
|
||||||
}
|
|
||||||
|
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
Patcher(
|
Patcher(
|
||||||
@ -213,11 +206,18 @@ internal object PatchCommand : Runnable {
|
|||||||
resourceCachePath.absolutePath,
|
resourceCachePath.absolutePath,
|
||||||
)
|
)
|
||||||
).use { patcher ->
|
).use { patcher ->
|
||||||
|
val filteredPatches = patcher.filterPatchSelection(patches).also { patches ->
|
||||||
|
logger.info("Setting patch options")
|
||||||
|
|
||||||
|
if (optionsFile.exists()) patches.setOptions(optionsFile)
|
||||||
|
else Options.serialize(patches, prettyPrint = true).let(optionsFile::writeText)
|
||||||
|
}
|
||||||
|
|
||||||
// region Patch
|
// region Patch
|
||||||
|
|
||||||
val patcherResult = patcher.apply {
|
val patcherResult = patcher.apply {
|
||||||
acceptIntegrations(integrations)
|
acceptIntegrations(integrations)
|
||||||
acceptPatches(filterPatchSelection(patches))
|
acceptPatches(filteredPatches.toList())
|
||||||
|
|
||||||
// Execute patches.
|
// Execute patches.
|
||||||
runBlocking {
|
runBlocking {
|
||||||
@ -277,7 +277,7 @@ internal object PatchCommand : Runnable {
|
|||||||
* @param patches The patches to filter.
|
* @param patches The patches to filter.
|
||||||
* @return The filtered patches.
|
* @return The filtered patches.
|
||||||
*/
|
*/
|
||||||
private fun Patcher.filterPatchSelection(patches: PatchSet) = buildList {
|
private fun Patcher.filterPatchSelection(patches: PatchSet): PatchSet = buildSet {
|
||||||
val packageName = context.packageMetadata.packageName
|
val packageName = context.packageMetadata.packageName
|
||||||
val packageVersion = context.packageMetadata.packageVersion
|
val packageVersion = context.packageMetadata.packageVersion
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user