Skip to content

Commit e876796

Browse files
chore: Merge branch dev to main (#59)
2 parents eaf4915 + 60e0580 commit e876796

13 files changed

Lines changed: 268 additions & 45 deletions

File tree

.github/workflows/build_pull_request.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,13 @@ on:
77
- dev
88

99
jobs:
10-
release:
11-
name: Build
12-
runs-on: ubuntu-latest
10+
build:
11+
name: Build (${{ matrix.os }})
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
os: [ubuntu-latest, windows-latest, macos-latest]
1317
steps:
1418
- name: Checkout
1519
uses: actions/checkout@v4
@@ -20,13 +24,15 @@ jobs:
2024
uses: burrunan/gradle-cache-action@v1
2125

2226
- name: Build
27+
shell: bash
2328
env:
2429
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2530
run: ./gradlew build --no-daemon
2631

2732
- name: Upload artifacts
28-
uses: actions/upload-artifact@v6
33+
if: matrix.os == 'ubuntu-latest'
34+
uses: actions/upload-artifact@v7
2935
with:
30-
name: morphe-patches
36+
archive: false
3137
path: build/libs/morphe-cli-*-all.jar
3238

.releaserc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
{
3333
"assets": [
3434
{
35-
"path": "build/libs/*-all*"
35+
"path": "build/libs/morphe-cli*-all.jar"
3636
}
3737
],
3838
successComment: false

CHANGELOG.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,80 @@
1+
# [1.5.0-dev.11](https://github.com/MorpheApp/morphe-cli/compare/v1.5.0-dev.10...v1.5.0-dev.11) (2026-03-05)
2+
3+
4+
### Bug Fixes
5+
6+
* Use latest patcher dev release ([ea6e231](https://github.com/MorpheApp/morphe-cli/commit/ea6e2313268a8111c8a21faf425bda1eda534f35))
7+
8+
# [1.5.0-dev.10](https://github.com/MorpheApp/morphe-cli/compare/v1.5.0-dev.9...v1.5.0-dev.10) (2026-03-05)
9+
10+
11+
### Bug Fixes
12+
13+
* Use latest patcher dev release ([2b33a6c](https://github.com/MorpheApp/morphe-cli/commit/2b33a6cc0523be29cb7dcd86990de7e0e08c0c87))
14+
15+
# [1.5.0-dev.9](https://github.com/MorpheApp/morphe-cli/compare/v1.5.0-dev.8...v1.5.0-dev.9) (2026-03-02)
16+
17+
18+
### Bug Fixes
19+
20+
* Use latest patcher dev release ([baf34de](https://github.com/MorpheApp/morphe-cli/commit/baf34de0857f1c94b044aedbac33485b51ab3f2c))
21+
22+
# [1.5.0-dev.8](https://github.com/MorpheApp/morphe-cli/compare/v1.5.0-dev.7...v1.5.0-dev.8) (2026-03-02)
23+
24+
25+
### Bug Fixes
26+
27+
* Use latest patcher dev release ([9cf07f9](https://github.com/MorpheApp/morphe-cli/commit/9cf07f922fb5129aeeee2de0a3e990fecadae4fb))
28+
29+
# [1.5.0-dev.7](https://github.com/MorpheApp/morphe-cli/compare/v1.5.0-dev.6...v1.5.0-dev.7) (2026-02-28)
30+
31+
32+
### Bug Fixes
33+
34+
* Use latest patcher and library dev release ([2f21880](https://github.com/MorpheApp/morphe-cli/commit/2f21880c49705b3e5153b7e636f01cf578d7b1c0))
35+
36+
# [1.5.0-dev.6](https://github.com/MorpheApp/morphe-cli/compare/v1.5.0-dev.5...v1.5.0-dev.6) (2026-02-27)
37+
38+
39+
### Bug Fixes
40+
41+
* Use latest library dev release ([b60ea86](https://github.com/MorpheApp/morphe-cli/commit/b60ea86c72b8a62e2220b3a76dba01d47c494750))
42+
43+
# [1.5.0-dev.5](https://github.com/MorpheApp/morphe-cli/compare/v1.5.0-dev.4...v1.5.0-dev.5) (2026-02-26)
44+
45+
46+
### Features
47+
48+
* Add `--out` and `--patches` arguments to `list-patches` command ([#60](https://github.com/MorpheApp/morphe-cli/issues/60)) ([ef9fc48](https://github.com/MorpheApp/morphe-cli/commit/ef9fc482fcc6de2e51741b23ce12729991d6b36d))
49+
50+
# [1.5.0-dev.4](https://github.com/MorpheApp/morphe-cli/compare/v1.5.0-dev.3...v1.5.0-dev.4) (2026-02-26)
51+
52+
53+
### Bug Fixes
54+
55+
* Use latest patcher dev release ([791257c](https://github.com/MorpheApp/morphe-cli/commit/791257c48983c1a006eca87abd458331141252f1))
56+
57+
# [1.5.0-dev.3](https://github.com/MorpheApp/morphe-cli/compare/v1.5.0-dev.2...v1.5.0-dev.3) (2026-02-25)
58+
59+
60+
### Bug Fixes
61+
62+
* Use latest patcher dev release ([7cc195a](https://github.com/MorpheApp/morphe-cli/commit/7cc195a59d37521751fcbe5f15d267b3efbeeb0a))
63+
64+
# [1.5.0-dev.2](https://github.com/MorpheApp/morphe-cli/compare/v1.5.0-dev.1...v1.5.0-dev.2) (2026-02-24)
65+
66+
67+
### Bug Fixes
68+
69+
* Use latest patcher dev release ([f8bd235](https://github.com/MorpheApp/morphe-cli/commit/f8bd2354438dd3a1e969610d43dca224e9d3ef63))
70+
71+
# [1.5.0-dev.1](https://github.com/MorpheApp/morphe-cli/compare/v1.4.0...v1.5.0-dev.1) (2026-02-21)
72+
73+
74+
### Features
75+
76+
* Add ARSCLib support ([#55](https://github.com/MorpheApp/morphe-cli/issues/55)) ([07c3f7e](https://github.com/MorpheApp/morphe-cli/commit/07c3f7ec50d52739ee2695f52c3c7182f2287ecf))
77+
178
# [1.4.0](https://github.com/MorpheApp/morphe-cli/compare/v1.3.0...v1.4.0) (2026-02-21)
279

380

build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ val strippedApkEditorLib by tasks.registering(org.gradle.jvm.tasks.Jar::class) {
5252
}
5353

5454
dependencies {
55-
implementation(libs.morphe.patcher)
55+
api(libs.morphe.patcher)
5656
implementation(libs.morphe.library)
5757
implementation(libs.kotlinx.coroutines.core)
5858
implementation(libs.kotlinx.serialization.json)
@@ -61,6 +61,7 @@ dependencies {
6161
implementation(files(strippedApkEditorLib))
6262

6363
testImplementation(libs.kotlin.test)
64+
testImplementation(libs.junit.params)
6465
}
6566

6667
kotlin {

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
org.gradle.parallel = true
22
org.gradle.caching = true
33
kotlin.code.style = official
4-
version = 1.4.0
4+
version = 1.5.0-dev.11

gradle/libs.versions.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
[versions]
22
shadow = "8.3.9"
3+
junit = "5.11.0"
34
kotlin = "2.3.0"
45
kotlinx = "1.9.0"
56
picocli = "4.7.7"
6-
morphe-patcher = "1.1.1"
7-
morphe-library = "1.2.0"
7+
morphe-patcher = "1.2.0"
8+
morphe-library = "1.3.0"
89

910
[libraries]
11+
junit-params = { module = "org.junit.jupiter:junit-jupiter-params", version.ref = "junit" }
1012
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
1113
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx" }
1214
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx" }

settings.gradle.kts

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
11
rootProject.name = "morphe-cli"
22

33
// Include morphe-patcher and morphe-library as composite builds if they exist locally
4-
val morphePatcherDir = file("../morphe-patcher")
5-
if (morphePatcherDir.exists()) {
6-
includeBuild(morphePatcherDir) {
7-
dependencySubstitution {
8-
substitute(module("app.morphe:morphe-patcher")).using(project(":"))
9-
}
10-
}
11-
}
12-
13-
val morpheLibraryDir = file("../morphe-library")
14-
if (morpheLibraryDir.exists()) {
15-
includeBuild(morpheLibraryDir) {
16-
dependencySubstitution {
17-
substitute(module("app.morphe:morphe-library")).using(project(":"))
4+
mapOf(
5+
"morphe-patcher" to "app.morphe:morphe-patcher",
6+
"morphe-library" to "app.morphe:morphe-library",
7+
).forEach { (libraryPath, libraryName) ->
8+
val libDir = file("../$libraryPath")
9+
if (libDir.exists()) {
10+
includeBuild(libDir) {
11+
dependencySubstitution {
12+
substitute(module(libraryName)).using(project(":"))
13+
}
1814
}
1915
}
2016
}

src/main/kotlin/app/morphe/cli/command/ListCompatibleVersions.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package app.morphe.cli.command
22

3-
import app.morphe.library.PackageName
4-
import app.morphe.library.VersionMap
5-
import app.morphe.library.mostCommonCompatibleVersions
3+
import app.morphe.patcher.patch.PackageName
4+
import app.morphe.patcher.patch.VersionMap
65
import app.morphe.patcher.patch.loadPatchesFromJar
6+
import app.morphe.patcher.patch.mostCommonCompatibleVersions
77
import picocli.CommandLine
88
import java.io.File
99
import java.util.logging.Logger

src/main/kotlin/app/morphe/cli/command/ListPatchesCommand.kt

Lines changed: 48 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1+
/*
2+
* Copyright 2026 Morphe.
3+
* https://github.com/MorpheApp/morphe-cli
4+
*
5+
* Original hard forked code:
6+
* https://github.com/revanced/revanced-cli
7+
*/
8+
19
package app.morphe.cli.command
210

311
import app.morphe.patcher.patch.Package
412
import app.morphe.patcher.patch.Patch
513
import app.morphe.patcher.patch.loadPatchesFromJar
6-
import picocli.CommandLine.*
14+
import picocli.CommandLine.Command
15+
import picocli.CommandLine.Option
716
import picocli.CommandLine.Help.Visibility.ALWAYS
817
import java.io.File
918
import java.util.logging.Logger
@@ -16,11 +25,20 @@ import app.morphe.patcher.patch.Option as PatchOption
1625
internal object ListPatchesCommand : Runnable {
1726
private val logger = Logger.getLogger(this::class.java.name)
1827

19-
@Parameters(
20-
description = ["Paths to MPP files."],
28+
// Patches is now flag based rather than position based
29+
@Option(
30+
names = ["--patches"],
31+
description = ["One or more paths to MPP files."],
2132
arity = "1..*",
33+
required = true
34+
)
35+
private lateinit var patchFiles: Set<File>
36+
37+
@Option(
38+
names = ["--out"],
39+
description = ["Path to the output text file. Writes patch list to this file instead of stdout."],
2240
)
23-
private lateinit var patchesFiles: Set<File>
41+
private var outputFile: File? = null
2442

2543
@Option(
2644
names = ["-d", "--with-descriptions"],
@@ -135,14 +153,33 @@ internal object ListPatchesCommand : Runnable {
135153
}
136154

137155
fun Patch<*>.filterCompatiblePackages(name: String) =
138-
compatiblePackages?.any { (compatiblePackageName, _) -> compatiblePackageName == name }
139-
?: withUniversalPatches
156+
compatiblePackages?.any { (compatiblePackageName, _) ->
157+
compatiblePackageName == name
158+
} ?: withUniversalPatches
140159

141-
val patches = loadPatchesFromJar(patchesFiles).withIndex().toList()
160+
val patches = loadPatchesFromJar(patchFiles).withIndex().toList()
142161

143-
val filtered =
144-
packageName?.let { patches.filter { (_, patch) -> patch.filterCompatiblePackages(it) } } ?: patches
145-
146-
if (filtered.isNotEmpty()) logger.info(filtered.joinToString("\n\n") { it.buildString() })
162+
val filtered = packageName?.let {
163+
patches.filter { (_, patch) ->
164+
patch.filterCompatiblePackages(
165+
it
166+
)
167+
}
168+
} ?: patches
169+
170+
// Extracted the final output that we get into this variable. Now we just call this based
171+
// on what the user wants. In the console or as an external text file.
172+
val finalOutput = filtered.joinToString("\n\n") {it.buildString()}
173+
174+
if (filtered.isEmpty()) {
175+
logger.warning("No compatible patches found in: $patchFiles")
176+
} else {
177+
if (outputFile == null) {
178+
logger.info(finalOutput)
179+
} else {
180+
logger.info("Created new output file at ${outputFile!!.path}")
181+
outputFile!!.writeText(finalOutput)
182+
}
183+
}
147184
}
148185
}

src/main/kotlin/app/morphe/cli/command/MainCommand.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package app.morphe.cli.command
22

33
import app.morphe.cli.command.utility.UtilityCommand
44
import app.morphe.library.logging.Logger
5+
import org.jetbrains.annotations.VisibleForTesting
56
import picocli.CommandLine
67
import picocli.CommandLine.Command
78
import picocli.CommandLine.IVersionProvider
@@ -42,4 +43,5 @@ private object CLIVersionProvider : IVersionProvider {
4243
UtilityCommand::class,
4344
]
4445
)
45-
private object MainCommand
46+
@VisibleForTesting
47+
internal object MainCommand

0 commit comments

Comments
 (0)