Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Merge branch dev to main #318

Merged
merged 7 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
# [4.6.0-dev.1](https://github.com/ReVanced/revanced-cli/compare/v4.5.1-dev.1...v4.6.0-dev.1) (2024-03-14)


### Bug Fixes

* Use correct option description ([45a2ffa](https://github.com/ReVanced/revanced-cli/commit/45a2ffa2dd95ee8ac3c4d466463c9a5b869b8da1))


### Features

* Use more consistent option name ([223629c](https://github.com/ReVanced/revanced-cli/commit/223629c663dcd94d237110e09e4e152aa03867f9))

## [4.5.1-dev.1](https://github.com/ReVanced/revanced-cli/compare/v4.5.0...v4.5.1-dev.1) (2024-03-12)


### Bug Fixes

* Copy APK to output path when it is not being signed ([366f400](https://github.com/ReVanced/revanced-cli/commit/366f400c5a46491f3f262c7ff4b0df1ae3721f74))

# [4.5.0](https://github.com/ReVanced/revanced-cli/compare/v4.4.2...v4.5.0) (2024-03-11)


Expand Down
11 changes: 11 additions & 0 deletions docs/2_building.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,15 @@ To build ReVanced CLI, follow these steps:
./gradlew build
```

> [!NOTE]
> If the build fails due to authentication, you may need to authenticate to GitHub Packages.
> Create a PAT with the scope `read:packages` [here](https://github.com/settings/tokens/new?scopes=read:packages&description=ReVanced) and add your token to ~/.gradle/gradle.properties.
>
> Example `gradle.properties` file:
>
> ```properties
> gpr.user = user
> gpr.key = key
> ```
After the build succeeds, the built JAR file will be located at `build/libs/revanced-cli-<version>-all.jar`.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
org.gradle.parallel = true
org.gradle.caching = true
kotlin.code.style = official
version = 4.5.0
version = 4.6.0-dev.1
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kotlin = "1.9.22"
kotlinx-coroutines-core = "1.7.3"
picocli = "4.7.5"
revanced-patcher = "19.3.1"
revanced-library = "2.2.1"
revanced-library = "2.3.0"

[libraries]
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
Expand Down
35 changes: 23 additions & 12 deletions src/main/kotlin/app/revanced/cli/command/PatchCommand.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package app.revanced.cli.command

import app.revanced.library.ApkUtils
import app.revanced.library.ApkUtils.applyTo
import app.revanced.library.ApkUtils.sign
import app.revanced.library.Options
import app.revanced.library.Options.setOptions
import app.revanced.library.adb.AdbManager
Expand Down Expand Up @@ -86,6 +85,7 @@ internal object PatchCommand : Runnable {
names = ["-o", "--out"],
description = ["Path to save the patched APK file to. Defaults to the same directory as the supplied APK file."],
)
@Suppress("unused")
private fun setOutputFilePath(outputFilePath: File?) {
this.outputFilePath = outputFilePath?.absoluteFile
}
Expand Down Expand Up @@ -115,7 +115,6 @@ internal object PatchCommand : Runnable {
)
private var keystoreFilePath: File? = null

// key store password
@CommandLine.Option(
names = ["--keystore-password"],
description = ["The password of the keystore to sign the patched APK file with. Empty password by default."],
Expand All @@ -124,16 +123,26 @@ internal object PatchCommand : Runnable {

@CommandLine.Option(
names = ["--alias"],
description = ["The alias of the key from the keystore to sign the patched APK file with."],
description = ["The alias of the keystore entry to sign the patched APK file with."],
showDefaultValue = ALWAYS,
)
private var alias = "ReVanced Key"
private fun setKeyStoreEntryAlias(alias: String = "ReVanced Key") {
logger.warning("The --alias option is deprecated. Use --keystore-entry-alias instead.")
keyStoreEntryAlias = alias
}

@CommandLine.Option(
names = ["--keystore-entry-alias"],
description = ["The alias of the keystore entry to sign the patched APK file with."],
showDefaultValue = ALWAYS,
)
private var keyStoreEntryAlias = "ReVanced Key"

@CommandLine.Option(
names = ["--keystore-entry-password"],
description = ["The password of the entry from the keystore for the key to sign the patched APK file with."],
)
private var password = "" // Empty password by default
private var keyStoreEntryPassword = "" // Empty password by default

@CommandLine.Option(
names = ["--signer"],
Expand Down Expand Up @@ -307,19 +316,21 @@ internal object PatchCommand : Runnable {
// region Save
apk.copyTo(temporaryFilesPath.resolve(apk.name), overwrite = true).apply {
patcherResult.applyTo(this)
}.let {
}.let { patchedApkFile ->
if (!mount) {
sign(
it,
ApkUtils.signApk(
patchedApkFile,
outputFilePath,
ApkUtils.SigningOptions(
signer,
ApkUtils.KeyStoreDetails(
keystoreFilePath,
keyStorePassword,
alias,
password,
signer,
keyStoreEntryAlias,
keyStoreEntryPassword,
),
)
} else {
patchedApkFile.copyTo(outputFilePath, overwrite = true)
}
}

Expand Down
Loading