Template
mirror of
https://github.com/MorpheApp/morphe-patches-template.git
synced 2026-11-30 23:09:34 +00:00
Compare commits
5
Commits
104bfedfcb
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4c7b79f488 | ||
|
|
e7d8e8917f | ||
|
|
b4f8f1b091 | ||
|
|
cf10969e33 | ||
|
|
50f717d6f9 |
No files matched your search
@@ -120,7 +120,7 @@ def play_store_link(package_name):
|
|||||||
return f"https://play.google.com/store/apps/details?id={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
|
"""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.
|
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")
|
src = icons.get(package_name) if package_name else ICON_OVERRIDES.get("universal")
|
||||||
if not src:
|
if not src:
|
||||||
return ""
|
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):
|
class _NoRedirectHandler(urllib.request.HTTPRedirectHandler):
|
||||||
@@ -293,7 +295,7 @@ def versions_line(targets):
|
|||||||
def index_row(index, app_name, package_name, count, labels):
|
def index_row(index, app_name, package_name, count, labels):
|
||||||
"""One row of the compact README index table."""
|
"""One row of the compact README index table."""
|
||||||
app_cell = f"[**{markdown_cell(app_name)}**](PATCHES.md#{app_anchor(app_name, package_name)})"
|
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:
|
if icon:
|
||||||
app_cell = f"{icon} {app_cell}"
|
app_cell = f"{icon} {app_cell}"
|
||||||
version_cell = ", ".join(f"`{escape(label)}`" for label in labels) if labels else "—"
|
version_cell = ", ".join(f"`{escape(label)}`" for label in labels) if labels else "—"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
[versions]
|
[versions]
|
||||||
morphe-patcher = "2.6.0"
|
morphe-patcher = "2.7.0"
|
||||||
#noinspection GradleDependency
|
#noinspection GradleDependency
|
||||||
smali = "5a5249e22f"
|
smali = "5a5249e22f"
|
||||||
gson = "2.15.0"
|
gson = "2.15.0"
|
||||||
|
|||||||
@@ -44,6 +44,8 @@ animalsniffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
|
val patchesFile = jar.flatMap { it.archiveFile }
|
||||||
|
|
||||||
register<JavaExec>("generatePatchesList") {
|
register<JavaExec>("generatePatchesList") {
|
||||||
description = "Build patch with patch list"
|
description = "Build patch with patch list"
|
||||||
|
|
||||||
@@ -51,13 +53,15 @@ tasks {
|
|||||||
|
|
||||||
classpath = sourceSets["main"].runtimeClasspath + patchListGeneratorClasspath
|
classpath = sourceSets["main"].runtimeClasspath + patchListGeneratorClasspath
|
||||||
mainClass.set("util.PatchListGeneratorKt")
|
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)
|
// 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,
|
// 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().
|
// after D8 has replaced methods it backports such as List.of() and Optional.isEmpty().
|
||||||
val desugarPatchesClasses = register("desugarPatchesClasses") {
|
val desugarPatchesClasses = register("desugarPatchesClasses") {
|
||||||
val patchesFile = jar.flatMap { it.archiveFile }
|
|
||||||
val classpath = sourceSets["main"].compileClasspath
|
val classpath = sourceSets["main"].compileClasspath
|
||||||
val output = layout.buildDirectory.file("animalsniffer/patches-desugared.jar")
|
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.GsonBuilder
|
||||||
import com.google.gson.JsonObject
|
import com.google.gson.JsonObject
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.net.URLClassLoader
|
import java.util.jar.JarFile
|
||||||
import java.util.jar.Manifest
|
|
||||||
|
|
||||||
fun main() {
|
fun main(args: Array<String>) {
|
||||||
val patchFiles = setOf(
|
require(args.size == 1) { "Expected a patch bundle path." }
|
||||||
File("build/libs/").listFiles { file ->
|
val patchBundle = File(args[0])
|
||||||
val fileName = file.name
|
val version = JarFile(patchBundle).use {
|
||||||
!fileName.contains("javadoc") &&
|
it.manifest?.mainAttributes?.getValue("Version")
|
||||||
!fileName.contains("sources") &&
|
} ?: error("Patch bundle has no Version in its manifest: $patchBundle")
|
||||||
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")
|
|
||||||
|
|
||||||
while (manifest.hasMoreElements()) {
|
generatePatchList(version, loadPatchesFromJar(setOf(patchBundle)))
|
||||||
Manifest(manifest.nextElement().openStream())
|
|
||||||
.mainAttributes
|
|
||||||
.getValue("Version")
|
|
||||||
?.let {
|
|
||||||
generatePatchList(it, loadedPatches)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
|
|||||||
Reference in new issue
Block a user