mirror of
https://github.com/ReVanced/revanced-cli.git
synced 2026-01-11 13:56:18 +00:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
61d3b99313 | ||
|
|
5b8537e6b7 | ||
|
|
7d8a61c3ba | ||
|
|
1dcdbc9fe9 | ||
|
|
4cc2f5269f | ||
|
|
46056956fe | ||
|
|
8e3d147690 | ||
|
|
87ffaa4bdb | ||
|
|
8a49dcc110 | ||
|
|
4a23cb69bc | ||
|
|
8c325af0f9 | ||
|
|
a26ab2a2c3 | ||
|
|
d335846202 |
33
CHANGELOG.md
33
CHANGELOG.md
@@ -1,3 +1,36 @@
|
||||
## [1.10.2](https://github.com/revanced/revanced-cli/compare/v1.10.1...v1.10.2) (2022-06-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* keystore file not found exception ([#57](https://github.com/revanced/revanced-cli/issues/57)) ([5b8537e](https://github.com/revanced/revanced-cli/commit/5b8537e6b7922f1b44058c3a4fc2f56cb4e15e89))
|
||||
|
||||
## [1.10.1](https://github.com/revanced/revanced-cli/compare/v1.10.0...v1.10.1) (2022-06-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* show actual version in CLI ([1dcdbc9](https://github.com/revanced/revanced-cli/commit/1dcdbc9fe9e3ad2fe232ad3baa76d186817532a4))
|
||||
|
||||
# [1.10.0](https://github.com/revanced/revanced-cli/compare/v1.9.3...v1.10.0) (2022-06-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add callback for addFiles ([87ffaa4](https://github.com/revanced/revanced-cli/commit/87ffaa4bdb25cb85c6ba7195f5d3b13b09a5f912))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add logging back ([4a23cb6](https://github.com/revanced/revanced-cli/commit/4a23cb69bc385158d47b6ea8d3da54b0566a242c))
|
||||
|
||||
## [1.9.3](https://github.com/revanced/revanced-cli/compare/v1.9.2...v1.9.3) (2022-06-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* use absolute file path for key store ([d335846](https://github.com/revanced/revanced-cli/commit/d335846202b991e130882e9ce0ab268deb2e27ab))
|
||||
|
||||
## [1.9.2](https://github.com/revanced/revanced-cli/compare/v1.9.1...v1.9.2) (2022-06-22)
|
||||
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ dependencies {
|
||||
implementation(kotlin("stdlib"))
|
||||
implementation(kotlin("reflect"))
|
||||
|
||||
implementation("app.revanced:revanced-patcher:1.7.1")
|
||||
implementation("app.revanced:revanced-patcher:1.7.2")
|
||||
implementation("info.picocli:picocli:4.6.3")
|
||||
implementation("com.android.tools.build:apksig:7.2.1")
|
||||
implementation("com.github.revanced:jadb:master-SNAPSHOT") // updated fork
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
kotlin.code.style = official
|
||||
version = 1.9.2
|
||||
version = 1.10.2
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package app.revanced.cli.command
|
||||
|
||||
import app.revanced.cli.patcher.Patcher
|
||||
import app.revanced.cli.patcher.PatcherLogger
|
||||
import app.revanced.cli.signing.Signing
|
||||
import app.revanced.cli.signing.SigningOptions
|
||||
import app.revanced.patcher.PatcherOptions
|
||||
@@ -12,8 +13,16 @@ import picocli.CommandLine.*
|
||||
import java.io.File
|
||||
import java.nio.file.Files
|
||||
|
||||
private class CLIVersionProvider : IVersionProvider {
|
||||
override fun getVersion() = arrayOf(
|
||||
MainCommand::class.java.`package`.implementationVersion ?: "unknown"
|
||||
)
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "ReVanced-CLI", version = ["1.0.0"], mixinStandardHelpOptions = true
|
||||
name = "ReVanced-CLI",
|
||||
mixinStandardHelpOptions = true,
|
||||
versionProvider = CLIVersionProvider::class
|
||||
)
|
||||
internal object MainCommand : Runnable {
|
||||
@ArgGroup(exclusive = false, multiplicity = "1")
|
||||
@@ -91,7 +100,10 @@ internal object MainCommand : Runnable {
|
||||
|
||||
val patcher = app.revanced.patcher.Patcher(
|
||||
PatcherOptions(
|
||||
args.inputFile, args.cacheDirectory, !args.disableResourcePatching
|
||||
args.inputFile,
|
||||
args.cacheDirectory,
|
||||
!args.disableResourcePatching,
|
||||
logger = PatcherLogger
|
||||
)
|
||||
)
|
||||
|
||||
@@ -113,7 +125,7 @@ internal object MainCommand : Runnable {
|
||||
SigningOptions(
|
||||
args.cn,
|
||||
args.password,
|
||||
args.keystorePath ?: outputFile.parentFile
|
||||
args.keystorePath ?: outputFile.absoluteFile.parentFile
|
||||
.resolve("${outputFile.nameWithoutExtension}.keystore")
|
||||
.name
|
||||
)
|
||||
|
||||
23
src/main/kotlin/app/revanced/cli/patcher/PatcherLogger.kt
Normal file
23
src/main/kotlin/app/revanced/cli/patcher/PatcherLogger.kt
Normal file
@@ -0,0 +1,23 @@
|
||||
package app.revanced.cli.patcher
|
||||
|
||||
import app.revanced.patcher.PatchLogger
|
||||
|
||||
object PatcherLogger : PatchLogger {
|
||||
private const val prefix = "[patcher]"
|
||||
|
||||
override fun error(msg: String) {
|
||||
println("error: $prefix: $msg")
|
||||
}
|
||||
|
||||
override fun info(msg: String) {
|
||||
println("info: $prefix: $msg")
|
||||
}
|
||||
|
||||
override fun trace(msg: String) {
|
||||
println("trace: $prefix: $msg")
|
||||
}
|
||||
|
||||
override fun warn(msg: String) {
|
||||
println("warn: $prefix: $msg")
|
||||
}
|
||||
}
|
||||
@@ -18,10 +18,9 @@ object Signing {
|
||||
// the reason is, in case the signer fails
|
||||
// it does not damage the output file
|
||||
println("[signing]")
|
||||
val keyStore = Signer(signingOptions).signApk(alignedOutput, signedOutput)
|
||||
Signer(signingOptions).signApk(alignedOutput, signedOutput)
|
||||
|
||||
// afterwards copy over the file and the keystore to the output
|
||||
// afterwards copy over the file to the output
|
||||
signedOutput.copyTo(outputFile, true)
|
||||
keyStore.copyTo(outputFile.resolveSibling(keyStore.name), true)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,5 +66,7 @@ fun Patcher.applyPatchesVerbose() {
|
||||
}
|
||||
|
||||
fun Patcher.mergeFiles() {
|
||||
this.addFiles(args.pArgs!!.mergeFiles)
|
||||
this.addFiles(args.pArgs!!.mergeFiles) {
|
||||
println("[merged] ${it.name}")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,13 +49,13 @@ internal class Signer(
|
||||
return JcaX509CertificateConverter().getCertificate(builder.build(signer)) to pair.private
|
||||
}
|
||||
|
||||
fun signApk(input: File, output: File): File {
|
||||
fun signApk(input: File, output: File) {
|
||||
Security.addProvider(BouncyCastleProvider())
|
||||
|
||||
// TODO: keystore should be saved securely
|
||||
val ks = File(signingOptions.keyStoreFilePath)
|
||||
if (!ks.exists()) newKeystore(ks) else {
|
||||
println("found existing keystore: ${ks.nameWithoutExtension}")
|
||||
println("[found] existing keystore: ${ks.nameWithoutExtension}")
|
||||
}
|
||||
|
||||
val keyStore = KeyStore.getInstance("BKS", "BC")
|
||||
@@ -74,7 +74,5 @@ internal class Signer(
|
||||
signer.setOutputApk(output)
|
||||
|
||||
signer.build().sign()
|
||||
|
||||
return ks
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user