Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export ProGuard specs from java_import. #14966

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Mar 5, 2022

  1. Export ProGuard specs from java_import.

    Background:
    JAR files can bundle ProGuard specs under `META-INF/proguard/`
    [See https://developer.android.com/studio/build/shrink-code]
    
    Problem:
    Bazel previously erroniously ignored these ProGuard specs, leading to failures with, for example, androidx.annotation.Keep. Bad times.
    
    There was previously a parallel issue with aar_import.
    [Fixed in bazelbuild#12749]
    
    Solution:
    This change causes the previously ignored, embedded proguards to be extracted, validated, and then bubbled up correctly via the ProguardSpecProvider.
    
    There's also a minor fix to aar_import, adding proguard validation and slightly simplifying the resulting code. For reasoning behind why library proguards should be validated, see the module docstring of proguard_whitelister.py
    
    Remaining issues:
    JAR files brought down from Maven via rules_jvm_external bypass java_import in favor of rolling their own jvm_import, since java_import apparently been broken for Kotlin for years. That'll need a subsequent fix, since this only fixes java_import. For context on the Kotlin breakage, see bazelbuild#4549. For the status on fixes in rules_jvm_external, see bazel-contrib/rules_jvm_external#672
    cpsauer committed Mar 5, 2022
    Configuration menu
    Copy the full SHA
    7a91124 View commit details
    Browse the repository at this point in the history