Extract embedded proguard specs from JARs and AARs during R8#460
Extract embedded proguard specs from JARs and AARs during R8#460snazhmudinov wants to merge 1 commit intobazelbuild:mainfrom
Conversation
|
if the changes look good, I can squash them into one commit before merge. |
|
@ted-xie can you check the latest changes I pushed? |
|
I think some more context about how the PR import process works would be helpful here. The latest commits you pushed strayed a little far from the vision I had (I probably should have explained my reasoning better). Background informationThis repository is an export of the internal Starlark Android rules that Google uses in our monorepo. We use a tool called Copybara to 1) do a bunch of text-replace transformations; 2) copy translated files to Github. The text transformations are a mixed bag and can range from changing package import paths to changing the default values of attributes to even removing certain code paths entirely. There is a lot of stuff in the Google rules that is not applicable to OSS builds, and vice versa: there are some features that are OSS-specific that we don't want to enable internally. R8 compilation is one of those features that is specific to OSS builds; we have another code optimization tool for internal builds. To import a PR, we have to pull these changes in via a reverse Copybara transform, which is sometimes tricky, but mostly straightforward. There are certain things that make the import more complicated, since we have to change the Copybara configuration to deal with them. File name changes or deletions are one of the change types that can make this process complicated. The next step is always tricky and labor-intensive: we have to verify that newly-introduced code does not change how builds work for every single Android target in the entire monorepo. Not just binaries, but tests and libraries, too. This includes huge apps like Gmail, Maps, etc. The more logic that a PR touches, especially in intricate parts of the codebase such as resource processing or proguard spec mangling, the more likely it is that the PR will cause an app breakage. We have had to permanently revert community PRs before because they broke internal apps. Just setting up the monorepo-wide tests can take a day+, not to mention running the tests (takes a whole day), and triaging breakages. This PRYour proposed change has a lot of features that complicate the import considerably.
My suggestionsGiven the background information and my notes above, I think there are a few things we could do to still try and get this change imported.
|
f4b21c7 to
c22d36f
Compare
c22d36f to
7289309
Compare
Thanks for the clarification! I have pushed the changes based on the proposed requirements, please let me if this approach is better. |
|
If the changes are still not compatible with internal rules, maybe we can then just expose 2 entry points in the android toolchain - one for aar extractor and one for jar extractor, guard their usage with feature flags, and I can override those toolchain entries with my own tools. |
What has changed
Extract embedded proguard specs from JARs and AARs. Add support for extracting proguard specs embedded in META-INF/proguard/ and META-INF/com.android.tools/ — matching what AGP/R8 does by default.
What's new
Feature flags (both default False)
Both behaviors are opt-in to avoid breaking existing builds.