mirror of
https://github.com/d4rken-org/capod.git
synced 2026-09-14 18:26:11 -04:00
chore(build): Enable R8 obfuscation for the Google Play flavor
Google Play scores the obfuscation share of uploaded bundles and flags
listings below its threshold ("App optimisation is below our threshold",
fix by Feb 2027). Minify and shrink were already on; the shared
-dontobfuscate was the only thing keeping the score at 0%.
-dontobfuscate moves to a FOSS-only rule file; the Play rule file keeps
SourceFile/LineNumberTable for retracing and pins names only where they
reach users or logs: AapSetting/AapCommand subclasses (session logs),
ViewModel1 subclasses (log tag), Throwables (error dialog label). All
reflective targets (BuildConfig, ArtMirror, NeverCall, InvokeStub,
AncModeActionCallback) already carry @Keep or explicit keeps and are
identity-mapped in the gplayRelease mapping. The release workflow
archives the mapping next to the Play upload.
This commit is contained in:
@@ -194,3 +194,14 @@ jobs:
|
||||
STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }}
|
||||
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
||||
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
|
||||
|
||||
# The Play flavor is obfuscated; the bundle embeds this mapping, but keep it reachable
|
||||
# for retracing user-submitted logs without going through Play Console.
|
||||
- name: Archive R8 mapping
|
||||
if: always() && !(github.event_name == 'workflow_dispatch' && inputs.dry_run)
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a #v7.0.1
|
||||
with:
|
||||
name: r8-mapping-${{ github.ref_name }}
|
||||
path: app/build/outputs/mapping/gplay*/mapping.txt
|
||||
if-no-files-found: warn
|
||||
overwrite: true
|
||||
|
||||
@@ -55,10 +55,12 @@ android {
|
||||
includeInApk = false
|
||||
includeInBundle = false
|
||||
}
|
||||
proguardFiles("proguard-rules-foss.pro")
|
||||
}
|
||||
create("gplay") {
|
||||
dimension = "version"
|
||||
signingConfig = signingConfigs["releaseGplay"]
|
||||
proguardFiles("proguard-rules-gplay.pro")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
# The FOSS build is open source and ships on GitHub/F-Droid; readable stack traces are worth more
|
||||
# than smaller identifiers there. Only the Google Play flavor obfuscates (proguard-rules-gplay.pro).
|
||||
-dontobfuscate
|
||||
@@ -0,0 +1,21 @@
|
||||
# Google Play scores the obfuscation share of every uploaded bundle and restricts listings that
|
||||
# stay below its threshold, so the Play flavor obfuscates. The FOSS flavor does not
|
||||
# (proguard-rules-foss.pro).
|
||||
|
||||
# Keep stack traces retraceable with the mapping file that the bundle embeds.
|
||||
-keepattributes SourceFile,LineNumberTable
|
||||
-renamesourcefileattribute SourceFile
|
||||
|
||||
# AAP session logs identify settings and commands by their simple class name
|
||||
# (AapSessionEngine, AapAncController, AapOutboundController). Names only; unused classes are
|
||||
# still removed.
|
||||
-keepnames class eu.darken.capod.pods.core.apple.aap.protocol.AapSetting
|
||||
-keepnames class * extends eu.darken.capod.pods.core.apple.aap.protocol.AapSetting
|
||||
-keepnames class eu.darken.capod.pods.core.apple.aap.protocol.AapCommand
|
||||
-keepnames class * extends eu.darken.capod.pods.core.apple.aap.protocol.AapCommand
|
||||
|
||||
# ViewModel1 derives its log tag from the subclass name (VM:OverviewViewModel).
|
||||
-keepnames class * extends eu.darken.capod.common.uix.ViewModel1
|
||||
|
||||
# Error dialogs and log summaries show exceptions by class name (LocalizedError, asLogSummary).
|
||||
-keepnames class * extends java.lang.Throwable
|
||||
Vendored
-1
@@ -1,5 +1,4 @@
|
||||
-keep class eu.darken.capod.BuildConfig { *; }
|
||||
-dontobfuscate
|
||||
|
||||
# work-runtime 2.7.1 (pulled by Glance) uses Class.newInstance() reflection throughout.
|
||||
# R8 full mode strips no-arg constructors not reachable by static analysis.
|
||||
|
||||
Reference in New Issue
Block a user