Template
mirror of
https://github.com/MorpheApp/morphe-patches-template.git
synced 2026-11-30 23:09:34 +00:00
chore: Miscellaneous fixes/improvements (#78)
This commit is contained in:
1 parent
120f628830
commit
26704bea2b
4 files changed
+33
-10
No files matched your search
@@ -95,13 +95,13 @@ for patch in data["patches"]:
|
||||
def anchor(name):
|
||||
"""Convert a heading to a GitHub-compatible anchor slug (github-slugger rules).
|
||||
|
||||
Spaces become hyphens, then all non-word characters (dots, parens, slashes,
|
||||
etc.) are removed, so `## 1.1.1.1 (com.foo.bar)` anchors as `#1111-comfoobar`.
|
||||
All characters except word characters, hyphens and spaces (dots, parens,
|
||||
slashes, etc.) are removed, then each space becomes a hyphen, so
|
||||
`## 1.1.1.1 (com.foo.bar)` anchors as `#1111-comfoobar`. Like GitHub, runs of
|
||||
hyphens are kept and nothing is trimmed: `## Foo - Bar` anchors as `#foo---bar`.
|
||||
"""
|
||||
slug = re.sub(r"\s+", "-", name.lower())
|
||||
slug = re.sub(r"[^\w\-]+", "", slug)
|
||||
slug = re.sub(r"-+", "-", slug)
|
||||
return slug.strip("-")
|
||||
slug = re.sub(r"[^\w\- ]", "", name.lower())
|
||||
return slug.replace(" ", "-")
|
||||
|
||||
|
||||
def play_store_link(package_name):
|
||||
@@ -200,8 +200,9 @@ def resolve_icons(package_names, existing):
|
||||
|
||||
|
||||
def app_anchor(app_name, package_name):
|
||||
"""Unique anchor for an app section heading: `## Name (package)`."""
|
||||
return anchor(f"{app_name} ({package_name})")
|
||||
"""Unique anchor for an app section heading: `## Name (package)`, or `## Name`
|
||||
for the universal patches, which have no package."""
|
||||
return anchor(f"{app_name} ({package_name})" if package_name else app_name)
|
||||
|
||||
|
||||
def version_labels(targets):
|
||||
@@ -390,9 +391,11 @@ if not marker_match or END_MARKER not in readme:
|
||||
actual_start = marker_match.group(0)
|
||||
|
||||
generated = build_readme_section()
|
||||
# A function replacement inserts the section as is: a string replacement would treat
|
||||
# backslashes in it (e.g. in an app name) as regex escapes.
|
||||
new_readme = re.sub(
|
||||
rf"{START_PATTERN}.*?{re.escape(END_MARKER)}",
|
||||
f"{actual_start}\n{generated}\n{END_MARKER}",
|
||||
lambda _: f"{actual_start}\n{generated}\n{END_MARKER}",
|
||||
readme,
|
||||
flags=re.DOTALL,
|
||||
)
|
||||
|
||||
+2
-1
@@ -60,7 +60,8 @@
|
||||
"gradle.properties",
|
||||
"patches-bundle.json",
|
||||
"patches-list.json",
|
||||
"README.md"
|
||||
"README.md",
|
||||
"PATCHES.md"
|
||||
],
|
||||
"message": "chore: Release v${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
|
||||
}
|
||||
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
# R8 rules shared by all extensions (applied in settings.gradle.kts).
|
||||
|
||||
-dontobfuscate
|
||||
-dontoptimize
|
||||
-keepattributes *
|
||||
|
||||
# Extension classes are only called by bytecode that patches add, so R8 sees no uses of them.
|
||||
# Keep everything except the Kotlin standard library, which R8 then trims to what extension code
|
||||
# uses. Listing only your extension packages here would also shrink other libraries, but a package
|
||||
# missing from that list is removed without any build error.
|
||||
-keep class !kotlin.**,!kotlinx.**,** {
|
||||
*;
|
||||
}
|
||||
@@ -19,3 +19,9 @@ pluginManagement {
|
||||
plugins {
|
||||
id("app.morphe.patches") version "2.1.2"
|
||||
}
|
||||
|
||||
configure<app.morphe.patches.gradle.SettingsExtension> {
|
||||
extensions {
|
||||
proguardFiles(rootProject.projectDir.resolve("extensions/proguard-rules.pro").toString())
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user