mirror of
https://github.com/ReVanced/revanced-cli.git
synced 2026-01-11 13:56:18 +00:00
Compare commits
11 Commits
v3.0.2-dev
...
v3.1.2-dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
847e384d9e | ||
|
|
96c196dcb1 | ||
|
|
dfd535c201 | ||
|
|
2b6051e7f3 | ||
|
|
0304988733 | ||
|
|
ca809f0948 | ||
|
|
5d50d1a622 | ||
|
|
83c28d9f71 | ||
|
|
93cbcc28aa | ||
|
|
3b3f7c7a7a | ||
|
|
bbb1a63abd |
47
CHANGELOG.md
47
CHANGELOG.md
@@ -1,3 +1,50 @@
|
||||
## [3.1.2-dev.1](https://github.com/ReVanced/revanced-cli/compare/v3.1.1...v3.1.2-dev.1) (2023-09-12)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Log correct options command ([#262](https://github.com/ReVanced/revanced-cli/issues/262)) ([96c196d](https://github.com/ReVanced/revanced-cli/commit/96c196dcb14e37ad91b751af61ee8382547c1ca3))
|
||||
|
||||
## [3.1.1](https://github.com/ReVanced/revanced-cli/compare/v3.1.0...v3.1.1) (2023-09-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Create options if it does not exist when updating them ([ca809f0](https://github.com/ReVanced/revanced-cli/commit/ca809f0948379e3a825f24d7a49aba8b6b8767d1))
|
||||
|
||||
## [3.1.1-dev.1](https://github.com/ReVanced/revanced-cli/compare/v3.1.0...v3.1.1-dev.1) (2023-09-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Create options if it does not exist when updating them ([ca809f0](https://github.com/ReVanced/revanced-cli/commit/ca809f0948379e3a825f24d7a49aba8b6b8767d1))
|
||||
|
||||
# [3.1.0](https://github.com/ReVanced/revanced-cli/compare/v3.0.1...v3.1.0) (2023-08-31)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* check for package compatibility at first ([9fe5a0b](https://github.com/ReVanced/revanced-cli/commit/9fe5a0b6d93304f630436ed0e954723d9a27b0f6))
|
||||
* do not filter explicitly included patches ([a3d8f00](https://github.com/ReVanced/revanced-cli/commit/a3d8f004ec405f696d99d96c74ca41b573ecf425))
|
||||
* format patches input ([bbb1a63](https://github.com/ReVanced/revanced-cli/commit/bbb1a63abd80dcbecdcf362158c0429cf3e6318f))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Simplify command description ([3b3f7c7](https://github.com/ReVanced/revanced-cli/commit/3b3f7c7a7a7b2795e3d1fad776f6b457f2e68c7b))
|
||||
|
||||
# [3.1.0-dev.1](https://github.com/ReVanced/revanced-cli/compare/v3.0.2-dev.2...v3.1.0-dev.1) (2023-08-28)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* format patches input ([bbb1a63](https://github.com/ReVanced/revanced-cli/commit/bbb1a63abd80dcbecdcf362158c0429cf3e6318f))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Simplify command description ([3b3f7c7](https://github.com/ReVanced/revanced-cli/commit/3b3f7c7a7a7b2795e3d1fad776f6b457f2e68c7b))
|
||||
|
||||
## [3.0.2-dev.2](https://github.com/ReVanced/revanced-cli/compare/v3.0.2-dev.1...v3.0.2-dev.2) (2023-08-28)
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
org.gradle.parallel = true
|
||||
org.gradle.caching = true
|
||||
kotlin.code.style = official
|
||||
version = 3.0.2-dev.2
|
||||
version = 3.1.2-dev.1
|
||||
|
||||
@@ -23,7 +23,7 @@ internal object OptionsCommand : Runnable {
|
||||
@CommandLine.Option(
|
||||
names = ["-p", "--path"], description = ["Path to patch options JSON file"], showDefaultValue = ALWAYS
|
||||
)
|
||||
private var path: File = File("options.json")
|
||||
private var filePath: File = File("options.json")
|
||||
|
||||
@CommandLine.Option(
|
||||
names = ["-o", "--overwrite"], description = ["Overwrite existing options file"], showDefaultValue = ALWAYS
|
||||
@@ -37,10 +37,10 @@ internal object OptionsCommand : Runnable {
|
||||
)
|
||||
private var update: Boolean = false
|
||||
|
||||
override fun run() = if (!path.exists() || overwrite) with(PatchBundleLoader.Jar(*patchBundles)) {
|
||||
if (update) setOptions(path)
|
||||
override fun run() = if (!filePath.exists() || overwrite) with(PatchBundleLoader.Jar(*patchBundles)) {
|
||||
if (update && filePath.exists()) setOptions(filePath)
|
||||
|
||||
Options.serialize(this, prettyPrint = true).let(path::writeText)
|
||||
Options.serialize(this, prettyPrint = true).let(filePath::writeText)
|
||||
}
|
||||
else logger.severe("Options file already exists, use --override to override it")
|
||||
else logger.severe("Options file already exists, use --overwrite to override it")
|
||||
}
|
||||
@@ -25,7 +25,7 @@ import java.util.logging.Logger
|
||||
|
||||
|
||||
@CommandLine.Command(
|
||||
name = "patch", description = ["Patch the supplied APK file with the supplied patches and integrations"]
|
||||
name = "patch", description = ["Patch an APK file"]
|
||||
)
|
||||
internal object PatchCommand : Runnable {
|
||||
private val logger = Logger.getLogger(PatchCommand::class.java.name)
|
||||
@@ -232,13 +232,20 @@ internal object PatchCommand : Runnable {
|
||||
* @return The filtered patches.
|
||||
*/
|
||||
private fun Patcher.filterPatchSelection(patches: PatchList) = buildList {
|
||||
// TODO: Remove this eventually because
|
||||
// patches named "patch-name" and "patch name" will conflict.
|
||||
fun String.format() = lowercase().replace(" ", "-")
|
||||
|
||||
val formattedExcludedPatches = excludedPatches.map { it.format() }
|
||||
val formattedIncludedPatches = includedPatches.map { it.format() }
|
||||
|
||||
val packageName = context.packageMetadata.packageName
|
||||
val packageVersion = context.packageMetadata.packageVersion
|
||||
|
||||
patches.forEach patch@{ patch ->
|
||||
val formattedPatchName = patch.patchName.lowercase().replace(" ", "-")
|
||||
val formattedPatchName = patch.patchName.format()
|
||||
|
||||
val explicitlyExcluded = excludedPatches.contains(formattedPatchName)
|
||||
val explicitlyExcluded = formattedExcludedPatches.contains(formattedPatchName)
|
||||
if (explicitlyExcluded) return@patch logger.info("Excluding ${patch.patchName}")
|
||||
|
||||
// Make sure the patch is compatible with the supplied APK files package name and version.
|
||||
@@ -248,12 +255,13 @@ internal object PatchCommand : Runnable {
|
||||
it.isEmpty() || it.any { version -> version == packageVersion }
|
||||
}
|
||||
|
||||
if (!matchesVersion) return@patch logger.warning("${patch.patchName} is incompatible with version $packageVersion. " + "This patch is only compatible with version " + packages.joinToString(
|
||||
";"
|
||||
) { pkg ->
|
||||
"${pkg.name}: ${pkg.versions.joinToString(", ")}"
|
||||
})
|
||||
|
||||
if (!matchesVersion) return@patch logger.warning(
|
||||
"${patch.patchName} is incompatible with version $packageVersion. "
|
||||
+ "This patch is only compatible with version "
|
||||
+ packages.joinToString(";") { pkg ->
|
||||
"${pkg.name}: ${pkg.versions.joinToString(", ")}"
|
||||
}
|
||||
)
|
||||
} ?: return@patch logger.fine("${patch.patchName} is incompatible with $packageName. "
|
||||
+ "This patch is only compatible with "
|
||||
+ packages.joinToString(", ") { `package` -> `package`.name })
|
||||
@@ -264,7 +272,7 @@ internal object PatchCommand : Runnable {
|
||||
// If the patch is implicitly included, it will be only included if [exclusive] is false.
|
||||
val implicitlyIncluded = !exclusive && patch.include
|
||||
// If the patch is explicitly included, it will be included even if [exclusive] is false.
|
||||
val explicitlyIncluded = includedPatches.contains(formattedPatchName)
|
||||
val explicitlyIncluded = formattedIncludedPatches.contains(formattedPatchName)
|
||||
|
||||
val included = implicitlyIncluded || explicitlyIncluded
|
||||
if (!included) return@patch logger.info("${patch.patchName} excluded by default") // Case 1.
|
||||
|
||||
Reference in New Issue
Block a user