Report code the app can never reach
Checklist
- I have used the search function for OPEN issues to see if someone else has already submitted the same feature request.
- I have also used the search function for CLOSED issues to see if the feature was already implemented and is just waiting to be released, or if the feature was rejected.
- I will describe the problem with as much detail as possible.
- This request contains only one single feature, not a list of multiple (related) features.
App version
develop (541d8cc2e)
Feature or improvement you want
A ./gradlew :app:r8Usage task that lists code the app can never reach, and fails when something new turns up.
It shrinks the play release build with the blanket de.danoeh.antennapod** keep rules taken out of proguard.cfg, and with optimisation and obfuscation turned off, then reads R8's own usage.txt. R8 still lists things that are only unreachable because of BuildConfig flags (the old playback service behind USE_MEDIA3_PLAYBACK_SERVICE, for example), so the task only keeps entries that no other non-test source file mentions by name. What's left is checked against app/r8-usage-baseline.txt.
Why should this be added?
On #8778 you said unused code should be removed, not tested. Android Lint and IntelliJ only report unused private members, so there's currently nothing that finds an unused public method. On develop this finds 25 entries. #8796 removes most of the ones nothing uses at all, and nearly all the rest are only used by tests.
It isn't wired into CI. It needs a release build, and I wasn't sure you'd want that on every PR.
Screenshots / Drawings / Technical details
I checked it with a throwaway unused public method in Chapter, and the task failed and named it. Entries that stop being unused are logged so they can come out of the baseline. This issue was AI generated.
Source: AntennaPod/AntennaPod