mirror of
https://github.com/revanced/revanced-cli.git
synced 2025-01-08 10:15:49 +01:00
feat: use install
mode by default
This commit is contained in:
parent
430de23856
commit
1a3db77c21
@ -41,11 +41,8 @@ internal object MainCommand : Runnable {
|
|||||||
@Option(names = ["-o", "--out"], description = ["Output file path"], required = true)
|
@Option(names = ["-o", "--out"], description = ["Output file path"], required = true)
|
||||||
lateinit var outputPath: String
|
lateinit var outputPath: String
|
||||||
|
|
||||||
@Option(
|
@Option(names = ["-e", "--exclude"], description = ["Explicitly exclude patches"])
|
||||||
names = ["-i", "--include"],
|
var excludedPatches = arrayOf<String>()
|
||||||
description = ["Which patches to include. If none is specified, all compatible default patches will be included"]
|
|
||||||
)
|
|
||||||
var includedPatches = arrayOf<String>()
|
|
||||||
|
|
||||||
@Option(names = ["-r", "--resource-patcher"], description = ["Disable patching resources"])
|
@Option(names = ["-r", "--resource-patcher"], description = ["Disable patching resources"])
|
||||||
var disableResourcePatching: Boolean = false
|
var disableResourcePatching: Boolean = false
|
||||||
@ -56,8 +53,8 @@ internal object MainCommand : Runnable {
|
|||||||
@Option(names = ["-m", "--merge"], description = ["One or more dex file containers to merge"])
|
@Option(names = ["-m", "--merge"], description = ["One or more dex file containers to merge"])
|
||||||
var mergeFiles = listOf<File>()
|
var mergeFiles = listOf<File>()
|
||||||
|
|
||||||
@Option(names = ["--install"], description = ["If specified, instead of mounting, install"])
|
@Option(names = ["--mount"], description = ["If specified, instead of installing, mount"])
|
||||||
var install: Boolean = false
|
var mount: Boolean = false
|
||||||
|
|
||||||
@Option(names = ["--cn"], description = ["Overwrite the default CN for the signed file"])
|
@Option(names = ["--cn"], description = ["Overwrite the default CN for the signed file"])
|
||||||
var cn = "ReVanced"
|
var cn = "ReVanced"
|
||||||
@ -86,7 +83,7 @@ internal object MainCommand : Runnable {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val args = args.pArgs?: return
|
val args = args.pArgs ?: return
|
||||||
|
|
||||||
val patcher = app.revanced.patcher.Patcher(
|
val patcher = app.revanced.patcher.Patcher(
|
||||||
PatcherOptions(
|
PatcherOptions(
|
||||||
@ -97,17 +94,17 @@ internal object MainCommand : Runnable {
|
|||||||
val outputFile = File(args.outputPath)
|
val outputFile = File(args.outputPath)
|
||||||
|
|
||||||
val adb: Adb? = args.deploy?.let {
|
val adb: Adb? = args.deploy?.let {
|
||||||
Adb(outputFile, patcher.data.packageMetadata.packageName, args.deploy!!, args.install)
|
Adb(outputFile, patcher.data.packageMetadata.packageName, args.deploy!!, !args.mount)
|
||||||
}
|
}
|
||||||
|
|
||||||
val patchedFile =
|
val patchedFile =
|
||||||
if (args.install) File(args.cacheDirectory).resolve("${outputFile.nameWithoutExtension}_raw.apk") else outputFile
|
if (args.mount) outputFile else File(args.cacheDirectory).resolve("${outputFile.nameWithoutExtension}_raw.apk")
|
||||||
|
|
||||||
Patcher.start(patcher, patchedFile)
|
Patcher.start(patcher, patchedFile)
|
||||||
|
|
||||||
println("[aligning & signing]")
|
println("[aligning & signing]")
|
||||||
|
|
||||||
if (args.install) {
|
if (args.mount) {
|
||||||
Signing.start(
|
Signing.start(
|
||||||
patchedFile,
|
patchedFile,
|
||||||
outputFile,
|
outputFile,
|
||||||
|
@ -15,7 +15,7 @@ internal object Patcher {
|
|||||||
// merge files like necessary integrations
|
// merge files like necessary integrations
|
||||||
patcher.mergeFiles()
|
patcher.mergeFiles()
|
||||||
// add patches, but filter incompatible or excluded patches
|
// add patches, but filter incompatible or excluded patches
|
||||||
patcher.addPatchesFiltered(includeFilter = args.includedPatches.isNotEmpty())
|
patcher.addPatchesFiltered(excludePatches = args.excludedPatches.isNotEmpty())
|
||||||
// apply patches
|
// apply patches
|
||||||
patcher.applyPatchesVerbose()
|
patcher.applyPatchesVerbose()
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ import app.revanced.patcher.patch.base.Patch
|
|||||||
import app.revanced.patcher.util.patch.implementation.JarPatchBundle
|
import app.revanced.patcher.util.patch.implementation.JarPatchBundle
|
||||||
|
|
||||||
fun Patcher.addPatchesFiltered(
|
fun Patcher.addPatchesFiltered(
|
||||||
includeFilter: Boolean = false
|
excludePatches: Boolean = false
|
||||||
) {
|
) {
|
||||||
val packageName = this.data.packageMetadata.packageName
|
val packageName = this.data.packageMetadata.packageName
|
||||||
val packageVersion = this.data.packageMetadata.packageVersion
|
val packageVersion = this.data.packageMetadata.packageVersion
|
||||||
@ -26,8 +26,8 @@ fun Patcher.addPatchesFiltered(
|
|||||||
|
|
||||||
val args = MainCommand.args.pArgs!!
|
val args = MainCommand.args.pArgs!!
|
||||||
|
|
||||||
if (includeFilter) {
|
if (excludePatches) {
|
||||||
if (!args.includedPatches.contains(patchName)) {
|
if (args.excludedPatches.contains(patchName)) {
|
||||||
println("$prefix: Explicitly excluded.")
|
println("$prefix: Explicitly excluded.")
|
||||||
return@patch
|
return@patch
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user