Goal
Verify that the same -assumevalues ProGuard rules generated by featured-gradle-plugin strip disabled-flag branches from a plain JVM/Desktop application processed by R8 or ProGuard — not only Android APKs.
Context
Today featured-shrinker-tests exercises R8 against synthetic bytecode shaped like an Android app. The Featured plugin also wires JVM and Desktop targets through core and featured-compose; consumers want the same DCE guarantee for desktop apps such as :sample:desktop.
The single existing JVM-shaped consumer of these rules is proguard-rules.pro aggregation, but no test proves the rules apply outside the AGP variant context.
Approach
- Build a small JVM jar that calls a generated
is*Enabled() extension and references both branches.
- Apply the generated
proguard-featured.pro via R8 library mode (or ProGuard CLI).
- Inspect the optimized jar and assert the disabled branch's class/method is absent.
- Cover Boolean and Int flags at minimum.
References
- Plugin generator:
build-logic/featured-gradle-plugin/src/main/kotlin/dev/androidbroadcast/featured/gradle/ProguardRulesGenerator.kt
- Extension generator (for the call site class name):
build-logic/featured-gradle-plugin/src/main/kotlin/dev/androidbroadcast/featured/gradle/ExtensionFunctionGenerator.kt
- Existing Android reference test:
featured-shrinker-tests/src/test/kotlin/dev/androidbroadcast/featured/shrinker/R8BooleanFlagEliminationTest.kt
Definition of Done
Related
Goal
Verify that the same
-assumevaluesProGuard rules generated byfeatured-gradle-pluginstrip disabled-flag branches from a plain JVM/Desktop application processed by R8 or ProGuard — not only Android APKs.Context
Today
featured-shrinker-testsexercises R8 against synthetic bytecode shaped like an Android app. The Featured plugin also wires JVM and Desktop targets throughcoreandfeatured-compose; consumers want the same DCE guarantee for desktop apps such as:sample:desktop.The single existing JVM-shaped consumer of these rules is
proguard-rules.proaggregation, but no test proves the rules apply outside the AGP variant context.Approach
is*Enabled()extension and references both branches.proguard-featured.provia R8 library mode (or ProGuard CLI).References
build-logic/featured-gradle-plugin/src/main/kotlin/dev/androidbroadcast/featured/gradle/ProguardRulesGenerator.ktbuild-logic/featured-gradle-plugin/src/main/kotlin/dev/androidbroadcast/featured/gradle/ExtensionFunctionGenerator.ktfeatured-shrinker-tests/src/test/kotlin/dev/androidbroadcast/featured/shrinker/R8BooleanFlagEliminationTest.ktDefinition of Done
featured-shrinker-testsexercise plain-JVM bytecode (no Android Manifest in the test fixture)Release Optimizationdocuments JVM/Desktop usage with a link to the testCHANGELOG.md[Unreleased]entryRelated