Skip to content

Commit

Permalink
perf: --rip-lib and --unsigned
Browse files Browse the repository at this point in the history
  • Loading branch information
E85Addict committed Nov 10, 2024
1 parent 63b6350 commit 3984c8a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
9 changes: 9 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ repositories {
password = project.findProperty("gpr.key") as String? ?: System.getenv("GITHUB_TOKEN")
}
}
maven {
// A repository must be speficied for some reason. "registry" is a dummy.
url = uri("https://maven.pkg.github.com/E85Addict/registry")
credentials {
username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_ACTOR")
password = project.findProperty("gpr.key") as String? ?: System.getenv("GITHUB_TOKEN")
}
}
}

dependencies {
Expand Down Expand Up @@ -63,6 +71,7 @@ tasks {
exclude(dependency("org.jetbrains.kotlin:.*"))
exclude(dependency("org.bouncycastle:.*"))
exclude(dependency("app.revanced:.*"))
exclude(dependency("e85.app.revanced:.*"))
}
}

Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotl
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx" }
picocli = { module = "info.picocli:picocli", version.ref = "picocli" }
revanced-patcher = { module = "app.revanced:revanced-patcher", version.ref = "revanced-patcher" }
revanced-library = { module = "app.revanced:revanced-library-jvm", version.ref = "revanced-library" }
revanced-library = { module = "e85.app.revanced:revanced-library-jvm", version.ref = "revanced-library" }

[plugins]
shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" }
Expand Down
15 changes: 13 additions & 2 deletions src/main/kotlin/app/revanced/cli/command/PatchCommand.kt
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,17 @@ internal object PatchCommand : Runnable {

private var aaptBinaryPath: File? = null

@CommandLine.Option(
names = ["--unsigned"],
description = ["Disable signing of the final apk."],
)
private var unsigned: Boolean = false
@CommandLine.Option(
names = ["--rip-lib"],
description = ["Rip native libs from APK (x86_64 etc.)"],
)
private var ripLibs = arrayOf<String>()

@CommandLine.Option(
names = ["--purge"],
description = ["Purge temporary files directory after patching."],
Expand Down Expand Up @@ -330,9 +341,9 @@ internal object PatchCommand : Runnable {
// region Save.

apk.copyTo(temporaryFilesPath.resolve(apk.name), overwrite = true).apply {
patcherResult.applyTo(this)
patcherResult.applyTo(this, ripLibs)
}.let { patchedApkFile ->
if (!mount) {
if (!mount && !unsigned) {
ApkUtils.signApk(
patchedApkFile,
outputFilePath,
Expand Down

0 comments on commit 3984c8a

Please sign in to comment.