Skip to content

New -checkdiscard Proguard rules cause minification to fail when using Keeper #1624

@alexvanyo

Description

@alexvanyo

Description

When using Keeper to run tests with minification enabled, the inferred keep rules from Keeper results in keeping classes like ***MetroContributionToAppScope, which then causes minification to fail at build time due to the bundled -checkdiscard rules from #1582

Self-contained Reproducer

alexvanyo/composelife#3145 updates Metro to 0.9.3 and removes the manual keeping of some metro internals, which were previously needed for the minified tests to run without crashing at runtime.

Metro version

0.9.3

Context

It's also possible that this is an issue on the Keeper side, but I am reporting here since it has worked with 0.9.2 and previous versions.

Output of ./gradlew :app:minifyStagingWithR8:

> Task :app:minifyStagingWithR8 FAILED
ERROR: R8: Discard checks failed.
The following items were not discarded
Item com.alexvanyo.composelife.data.CellStateCleanup$MetroContributionToAppScope was not discarded.
com.alexvanyo.composelife.data.CellStateCleanup$MetroContributionToAppScope
|- is referenced in keep rule:
|  /home/xela/StudioProjects/composelife/app/build/intermediates/keeper/StagingAndroidTest/inferredKeepRules.pro:871:1

Item com.alexvanyo.composelife.data.CellStateCleanupWorker$Factory$MetroContributionToAppScope was not discarded.
com.alexvanyo.composelife.data.CellStateCleanupWorker$Factory$MetroContributionToAppScope
|- is referenced in keep rule:
|  /home/xela/StudioProjects/composelife/app/build/intermediates/keeper/StagingAndroidTest/inferredKeepRules.pro:887:1

Item com.alexvanyo.composelife.data.PatternCollectionSync$MetroContributionToAppScope was not discarded.
com.alexvanyo.composelife.data.PatternCollectionSync$MetroContributionToAppScope
|- is referenced in keep rule:
|  /home/xela/StudioProjects/composelife/app/build/intermediates/keeper/StagingAndroidTest/inferredKeepRules.pro:914:1

Item com.alexvanyo.composelife.data.PatternCollectionSyncWorker$Factory$MetroContributionToAppScope was not discarded.
com.alexvanyo.composelife.data.PatternCollectionSyncWorker$Factory$MetroContributionToAppScope
|- is referenced in keep rule:
|  /home/xela/StudioProjects/composelife/app/build/intermediates/keeper/StagingAndroidTest/inferredKeepRules.pro:930:1

Item com.alexvanyo.composelife.donotkeepprocess.DoNotKeepProcess$MetroContributionToAppScope was not discarded.
com.alexvanyo.composelife.donotkeepprocess.DoNotKeepProcess$MetroContributionToAppScope
|- is referenced in keep rule:
|  /home/xela/StudioProjects/composelife/app/build/intermediates/keeper/StagingAndroidTest/inferredKeepRules.pro:1021:1

Item com.alexvanyo.composelife.preferences.OkioDiskPreferencesDataStore$MetroContributionToAppScope was not discarded.
com.alexvanyo.composelife.preferences.OkioDiskPreferencesDataStore$MetroContributionToAppScope
|- is referenced in keep rule:
|  /home/xela/StudioProjects/composelife/app/build/intermediates/keeper/StagingAndroidTest/inferredKeepRules.pro:1119:1

Item com.alexvanyo.composelife.ui.util.AndroidFullscreenModeManager$MetroContributionToUiScope was not discarded.
com.alexvanyo.composelife.ui.util.AndroidFullscreenModeManager$MetroContributionToUiScope
|- is referenced in keep rule:
|  /home/xela/StudioProjects/composelife/app/build/intermediates/keeper/StagingAndroidTest/inferredKeepRules.pro:1358:1

Item com.alexvanyo.composelife.ui.util.AndroidTimeZoneHolder$MetroContributionToAppScope was not discarded.
com.alexvanyo.composelife.ui.util.AndroidTimeZoneHolder$MetroContributionToAppScope
|- is referenced in keep rule:
|  /home/xela/StudioProjects/composelife/app/build/intermediates/keeper/StagingAndroidTest/inferredKeepRules.pro:1366:1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions