Compare commits

...

3 Commits

Author SHA1 Message Date
semantic-release-bot
c7d72c4d1c chore(release): 1.5.1 [skip ci]
## [1.5.1](https://github.com/revanced/revanced-cli/compare/v1.5.0...v1.5.1) (2022-06-21)

### Bug Fixes

* update patcher version ([09b9027](09b9027e5e)), closes [#45](https://github.com/revanced/revanced-cli/issues/45)
2022-06-21 16:42:24 +00:00
Sculas
09b9027e5e fix: update patcher version
Fixes #45
2022-06-21 18:40:54 +02:00
oSumAtrIX
3cc98efaa6 refactor: apply formatting 2022-06-21 01:02:50 +02:00
4 changed files with 76 additions and 67 deletions

View File

@@ -1,3 +1,10 @@
## [1.5.1](https://github.com/revanced/revanced-cli/compare/v1.5.0...v1.5.1) (2022-06-21)
### Bug Fixes
* update patcher version ([09b9027](https://github.com/revanced/revanced-cli/commit/09b9027e5e28f0483e74b711cf65a7876267a339)), closes [#45](https://github.com/revanced/revanced-cli/issues/45)
# [1.5.0](https://github.com/revanced/revanced-cli/compare/v1.4.5...v1.5.0) (2022-06-20) # [1.5.0](https://github.com/revanced/revanced-cli/compare/v1.4.5...v1.5.0) (2022-06-20)

View File

@@ -31,7 +31,7 @@ repositories {
dependencies { dependencies {
implementation(kotlin("stdlib")) implementation(kotlin("stdlib"))
implementation(kotlin("reflect")) implementation(kotlin("reflect"))
implementation("app.revanced:revanced-patcher:1.3.0") implementation("app.revanced:revanced-patcher:1.3.1")
implementation("info.picocli:picocli:4.6.3") implementation("info.picocli:picocli:4.6.3")
implementation("com.android.tools.build:apksig:7.2.1") implementation("com.android.tools.build:apksig:7.2.1")
implementation("com.github.revanced:jadb:master-SNAPSHOT") // updated fork implementation("com.github.revanced:jadb:master-SNAPSHOT") // updated fork

View File

@@ -1,2 +1,2 @@
kotlin.code.style = official kotlin.code.style = official
version = 1.5.0 version = 1.5.1

View File

@@ -6,9 +6,7 @@ import app.revanced.patcher.PatcherOptions
import app.revanced.patcher.extensions.PatchExtensions.patchName import app.revanced.patcher.extensions.PatchExtensions.patchName
import app.revanced.patcher.util.patch.implementation.JarPatchBundle import app.revanced.patcher.util.patch.implementation.JarPatchBundle
import app.revanced.utils.adb.Adb import app.revanced.utils.adb.Adb
import picocli.CommandLine.Command import picocli.CommandLine.*
import picocli.CommandLine.Option
import picocli.CommandLine.ArgGroup
import java.io.File import java.io.File
import java.nio.file.Files import java.nio.file.Files
@@ -20,8 +18,7 @@ internal object MainCommand : Runnable {
@ArgGroup(exclusive = false, multiplicity = "1") @ArgGroup(exclusive = false, multiplicity = "1")
lateinit var args: Args lateinit var args: Args
class Args class Args {
{
@Option(names = ["-b", "--bundles"], description = ["One or more bundles of patches"], required = true) @Option(names = ["-b", "--bundles"], description = ["One or more bundles of patches"], required = true)
var patchBundles = arrayOf<String>() var patchBundles = arrayOf<String>()
@@ -34,7 +31,7 @@ internal object MainCommand : Runnable {
class ListingArgs { class ListingArgs {
@Option(names = ["-l", "--list"], description = ["List patches only"], required = true) @Option(names = ["-l", "--list"], description = ["List patches only"], required = true)
public var listOnly: Boolean = false var listOnly: Boolean = false
} }
class PatchingArgs { class PatchingArgs {
@@ -82,19 +79,23 @@ internal object MainCommand : Runnable {
} }
override fun run() { override fun run() {
try try {
{
if (args.lArgs.listOnly) { if (args.lArgs.listOnly) {
for (patchBundlePath in args.patchBundles) for (patch in JarPatchBundle(patchBundlePath).loadPatches()) { for (patchBundlePath in args.patchBundles) for (patch in JarPatchBundle(patchBundlePath).loadPatches()) {
println("[available] ${patch.patchName}") println("[available] ${patch.patchName}")
} }
return return
} }
} catch (e: UninitializedPropertyAccessException) {} } catch (_: UninitializedPropertyAccessException) {
}
val args = args.pArgs; val args = args.pArgs
val patcher = app.revanced.patcher.Patcher(PatcherOptions(args.inputFile, args.cacheDirectory, !args.disableResourcePatching)) val patcher = app.revanced.patcher.Patcher(
PatcherOptions(
args.inputFile, args.cacheDirectory, !args.disableResourcePatching
)
)
val outputFile = File(args.outputPath) val outputFile = File(args.outputPath)
@@ -102,7 +103,8 @@ internal object MainCommand : Runnable {
Adb(outputFile, patcher.data.packageMetadata.packageName, args.deploy!!, args.install) Adb(outputFile, patcher.data.packageMetadata.packageName, args.deploy!!, args.install)
} }
val patchedFile = if (args.install) File(args.cacheDirectory).resolve("${outputFile.nameWithoutExtension}_raw.apk") else outputFile val patchedFile =
if (args.install) File(args.cacheDirectory).resolve("${outputFile.nameWithoutExtension}_raw.apk") else outputFile
Patcher.start(patcher, patchedFile) Patcher.start(patcher, patchedFile)