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 Aug 14, 2024
1 parent 1496e82 commit e8fe824
Show file tree
Hide file tree
Showing 3 changed files with 24 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 @@ -26,6 +26,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 @@ -64,6 +72,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-coroutines-core" }
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", version.ref = "revanced-library" }
revanced-library = { module = "e85.app.revanced:revanced-library", version.ref = "revanced-library" }

[plugins]
shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" }
Expand Down
16 changes: 14 additions & 2 deletions src/main/kotlin/app/revanced/cli/command/PatchCommand.kt
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,18 @@ 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 = ["-p", "--purge"],
description = ["Purge the temporary resource cache directory after patching."],
Expand Down Expand Up @@ -315,9 +327,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 e8fe824

Please sign in to comment.