Compare commits

..
6 Commits
5 changed files with 47 additions and 54 deletions

No files matched your search

+5 -3
View File
@@ -120,7 +120,7 @@ def play_store_link(package_name):
return f"https://play.google.com/store/apps/details?id={package_name}"
def app_icon(package_name, size):
def app_icon(package_name, size, *, inline=False):
"""Icon of the app, the "universal" override for the universal patches (no package
name), or an empty string if icons are off or there is no icon.
@@ -131,7 +131,9 @@ def app_icon(package_name, size):
src = icons.get(package_name) if package_name else ICON_OVERRIDES.get("universal")
if not src:
return ""
return f'<img src="{escape(src)}" width="{size}" height="{size}" alt="">'
# GitHub preserves this attribute when rendering inline images.
alignment = ' align="absmiddle"' if inline else ""
return f'<img src="{escape(src)}" width="{size}" height="{size}"{alignment} alt="">'
class _NoRedirectHandler(urllib.request.HTTPRedirectHandler):
@@ -293,7 +295,7 @@ def versions_line(targets):
def index_row(index, app_name, package_name, count, labels):
"""One row of the compact README index table."""
app_cell = f"[**{markdown_cell(app_name)}**](PATCHES.md#{app_anchor(app_name, package_name)})"
icon = app_icon(package_name, 24)
icon = app_icon(package_name, 24, inline=True)
if icon:
app_cell = f"{icon} {app_cell}"
version_cell = ", ".join(f"`{escape(label)}`" for label in labels) if labels else "—"
+28 -27
View File
@@ -61,6 +61,34 @@ To start using this template, follow these steps:
🎉 You are now ready to start creating patches!
## 🧑‍💻 Dev usage
To develop and release your Patches using this template:
- **Make all changes to the `dev` branch.**
- For local development work build your patches using the gradle task `./gradlew buildAndroid` to generate the mpp file found in `patches/build/libs/patches-*.mpp`. Apply your patches locally using Morphe Desktop tool like any other patch bundle.
- Always use [Semantic commit](https://kapeli.com/cheat_sheets/Semantic_Commits.docset/Contents/Resources/Documents/index) messages for commits. To keep it simple use only 3 commit message types:
- `feat: Added a new feature`
- `fix: Some problem now fixed`
- `chore: Random change you do not want in the user facing changelog`
- Commits of `fix:` and `feat:` will automatically generate new pre-releases and `chore:` will not create a new release.
- Users can apply your dev branch releases by enabling `pre-release` in Morphe Manager patch sources.
- When your dev branch is ready, and you want a stable release, merge dev branch to main (do not squash, and only merge).
- **Always use semantic release (release.yml)**. Do not manually upload or create releases by hand
because many files must be updated and release.yml handles everything.
## 🤓 Tips
- See the [patcher documentation](https://github.com/MorpheApp/morphe-patcher/blob/main/docs/1_patcher_intro.md) for more examples of creating patches and fingerprints.
- Do not use AI to create new release scripts. The `release.yml` here already handles everything.
If you need something custom with your releases then modify the existing `release.yml`
and `.releaserc` instead of writing everything new from scratch.
- Do not manually edit or manually commit any generated files such as: `patches-list.json`,
`patches-bundle.json`, `PATCHES.md`, `CHANGELOG.md`. These files will be automatically updated by `release.yml`.
- Do not force push any semantic release commits as that will break all future releases.
If you need to fix a broken release, it's always easiest to create a new release instead of
fixing an existing release.
## 🤖 AI issue triage
The [Issue triage](.github/workflows/issue_triage.yml) GitHub Action uses a free [OpenRouter](https://openrouter.ai)
@@ -103,33 +131,6 @@ To triage an issue again, such as after a failed run, use Actions > Issue triage
for training. Your OpenRouter [privacy settings](https://openrouter.ai/settings/privacy) must allow the
providers of the free models.
## 🧑‍💻 Dev usage
To develop and release your Patches using this template:
- **Make all changes to the `dev` branch.**
- For local development work build your patches using the gradle task `./gradlew buildAndroid` to generate the mpp file found in `patches/build/libs/patches-*.mpp`. Apply your patches locally using Morphe Desktop tool like any other patch bundle.
- Always use [Semantic commit](https://kapeli.com/cheat_sheets/Semantic_Commits.docset/Contents/Resources/Documents/index) messages for commits. To keep it simple use only 3 commit message types:
- `feat: Added a new feature`
- `fix: Some problem now fixed`
- `chore: Random change you do not want in the user facing changelog`
- Commits of `fix:` and `feat:` will automatically generate new pre-releases and `chore:` will not create a new release.
- Users can apply your dev branch releases by enabling `pre-release` in Morphe Manager patch sources.
- When your dev branch is ready, and you want a stable release, merge dev branch to main (do not squash, and only merge).
- **Always use semantic release (release.yml)**. Do not manually upload or create releases by hand
because many files must be updated and release.yml handles everything.
## 🤓 Tips
- See the [patcher documentation](https://github.com/MorpheApp/morphe-patcher/blob/main/docs/1_patcher_intro.md) for more examples of creating patches and fingerprints.
- Do not use AI to create new release scripts. The `release.yml` here already handles everything.
If you need something custom with your releases then modify the existing `release.yml`
and `.releaserc` instead of writing everything new from scratch.
- Do not manually edit or manually commit any generated files such as: `patches-list.json`,
`patches-bundle.json`, `PATCHES.md`, `CHANGELOG.md`. These files will be automatically updated by `release.yml`.
- Do not force push any semantic release commits as that will break all future releases.
If you need to fix a broken release, it's always easiest to create a new release instead of
fixing an existing release.
<!-- The patches end tag is intentionally placed here so the first release will clean up
this readme of all developer instructions above. -->
+1 -1
View File
@@ -1,5 +1,5 @@
[versions]
morphe-patcher = "2.6.0"
morphe-patcher = "2.7.0"
#noinspection GradleDependency
smali = "5a5249e22f"
gson = "2.15.0"
+5 -1
View File
@@ -44,6 +44,8 @@ animalsniffer {
}
tasks {
val patchesFile = jar.flatMap { it.archiveFile }
register<JavaExec>("generatePatchesList") {
description = "Build patch with patch list"
@@ -51,13 +53,15 @@ tasks {
classpath = sourceSets["main"].runtimeClasspath + patchListGeneratorClasspath
mainClass.set("util.PatchListGeneratorKt")
argumentProviders.add(CommandLineArgumentProvider {
listOf(patchesFile.get().asFile.absolutePath)
})
}
// Runs D8 on every class in the patches file (the patches and all bundled dependencies)
// but outputs class files instead of dex, so the check sees the code as it runs on Android,
// after D8 has replaced methods it backports such as List.of() and Optional.isEmpty().
val desugarPatchesClasses = register("desugarPatchesClasses") {
val patchesFile = jar.flatMap { it.archiveFile }
val classpath = sourceSets["main"].compileClasspath
val output = layout.buildDirectory.file("animalsniffer/patches-desugared.jar")
@@ -10,30 +10,16 @@ import app.morphe.patcher.patch.loadPatchesFromJar
import com.google.gson.GsonBuilder
import com.google.gson.JsonObject
import java.io.File
import java.net.URLClassLoader
import java.util.jar.Manifest
import java.util.jar.JarFile
fun main() {
val patchFiles = setOf(
File("build/libs/").listFiles { file ->
val fileName = file.name
!fileName.contains("javadoc") &&
!fileName.contains("sources") &&
fileName.endsWith(".mpp")
}!!.first()
)
val loadedPatches = loadPatchesFromJar(patchFiles)
val patchClassLoader = URLClassLoader(patchFiles.map { it.toURI().toURL() }.toTypedArray())
val manifest = patchClassLoader.getResources("META-INF/MANIFEST.MF")
fun main(args: Array<String>) {
require(args.size == 1) { "Expected a patch bundle path." }
val patchBundle = File(args[0])
val version = JarFile(patchBundle).use {
it.manifest?.mainAttributes?.getValue("Version")
} ?: error("Patch bundle has no Version in its manifest: $patchBundle")
while (manifest.hasMoreElements()) {
Manifest(manifest.nextElement().openStream())
.mainAttributes
.getValue("Version")
?.let {
generatePatchList(it, loadedPatches)
}
}
generatePatchList(version, loadPatchesFromJar(setOf(patchBundle)))
}
@Suppress("DEPRECATION")