Compare commits

...

13 Commits

Author SHA1 Message Date
semantic-release-bot
61d3b99313 chore(release): 1.10.2 [skip ci]
## [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](5b8537e6b7))
2022-06-22 17:23:50 +00:00
Itroublve
5b8537e6b7 fix: keystore file not found exception (#57)
* fix: keystore file not found exception

* the fix

* fix oopsies
2022-06-22 19:22:19 +02:00
semantic-release-bot
7d8a61c3ba chore(release): 1.10.1 [skip ci]
## [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](1dcdbc9fe9))
2022-06-22 14:52:53 +00:00
Lucaskyy
1dcdbc9fe9 fix: show actual version in CLI 2022-06-22 16:51:29 +02:00
Lucaskyy
4cc2f5269f Merge remote-tracking branch 'origin/main' into main 2022-06-22 16:44:17 +02:00
Lucaskyy
46056956fe refactor: fix consistency in logging 2022-06-22 16:44:07 +02:00
semantic-release-bot
8e3d147690 chore(release): 1.10.0 [skip ci]
# [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](87ffaa4bdb))

### Features

* add logging back ([4a23cb6](4a23cb69bc))
2022-06-22 14:43:38 +00:00
Lucaskyy
87ffaa4bdb fix: add callback for addFiles 2022-06-22 16:42:02 +02:00
Lucaskyy
8a49dcc110 Merge remote-tracking branch 'origin/main' into main
# Conflicts:
#	build.gradle.kts
2022-06-22 16:25:53 +02:00
Lucaskyy
4a23cb69bc feat: add logging back 2022-06-22 16:25:04 +02:00
Lucaskyy
8c325af0f9 build: update patcher version 2022-06-22 16:24:35 +02:00
semantic-release-bot
a26ab2a2c3 chore(release): 1.9.3 [skip ci]
## [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](d335846202))
2022-06-22 13:59:04 +00:00
oSumAtrIX
d335846202 fix: use absolute file path for key store 2022-06-22 15:57:15 +02:00
8 changed files with 80 additions and 13 deletions

View File

@@ -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)

View File

@@ -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

View File

@@ -1,2 +1,2 @@
kotlin.code.style = official
version = 1.9.2
version = 1.10.2

View File

@@ -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
)

View 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")
}
}

View File

@@ -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)
}
}

View File

@@ -66,5 +66,7 @@ fun Patcher.applyPatchesVerbose() {
}
fun Patcher.mergeFiles() {
this.addFiles(args.pArgs!!.mergeFiles)
this.addFiles(args.pArgs!!.mergeFiles) {
println("[merged] ${it.name}")
}
}

View File

@@ -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
}
}