Compare commits

...
2 Commits
Author SHA1 Message Date
LisoUseInAIKyrios 1d5c5702cc chore: Update patcher dependency 2026-11-21 09:28:20 +00:00
LisoUseInAIKyrios ca3ebed38b chore: Fail the build if patches use APIs not available on Android
Patches run inside Manager on Android, so check the compiled patch
classes against the Android API 26 signature with Animal Sniffer.
This catches desktop-only JDK classes such as AWT and newer JDK
methods such as InputStream.readAllBytes() or List.of().
2026-11-21 09:05:10 +00:00
2 changed files with 25 additions and 1 deletions

No files matched your search

+7 -1
View File
@@ -1,11 +1,17 @@
[versions]
morphe-patcher = "2.4.0"
morphe-patcher = "2.5.0"
#noinspection GradleDependency
smali = "5eaff5a2c9"
gson = "2.15.0"
animalsniffer = "2.0.1"
android-api-signature = "8.0.0_r2"
[libraries]
gson = { module = "com.google.code.gson:gson", version.ref = "gson" }
android-api-signature = { module = "net.sf.androidscents.signature:android-api-level-26", version.ref = "android-api-signature" }
# Gradle plugins adds the dependency during build, this declaration is here only for dependabot to provide updates.
#noinspection UnusedVersionCatalogEntry
morphe-patcher = { module = "app.morphe:morphe-patcher", version.ref = "morphe-patcher" }
[plugins]
animalsniffer = { id = "ru.vyarus.animalsniffer", version.ref = "animalsniffer" }
+18
View File
@@ -1,3 +1,8 @@
plugins {
// Fails the build if patch code uses JDK APIs that do not exist on Android.
alias(libs.plugins.animalsniffer)
}
group = "app.template"
patches {
@@ -20,6 +25,14 @@ val patchListGeneratorClasspath = configurations.create("patchListGeneratorClass
dependencies {
compileOnly(libs.gson)
patchListGeneratorClasspath(libs.gson)
// Android API level 26 is the minimum API the patches are compiled for (see buildAndroid).
signature(libs.android.api.signature) { artifact { type = "signature" } }
}
animalsniffer {
// Only the main source set ships in the patches file.
sourceSets = listOf(project.sourceSets["main"])
}
tasks {
@@ -32,6 +45,11 @@ tasks {
mainClass.set("util.PatchListGeneratorKt")
}
// The check task already runs it, but buildAndroid does not depend on check.
named("buildAndroid") {
dependsOn("animalsnifferMain")
}
// Used by gradle-semantic-release-plugin.
publish {
dependsOn("generatePatchesList")