-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
refactor: migrate tests to aapt2 + related fixes #3865
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
base: master
Are you sure you want to change the base?
Conversation
All tests have been migrated to aapt2, no tests left for aapt1, as we phase out support. Fixed shared library support using a custom option '-l' or '-lib', that can be specified many times for multiple libs. On decoding, the dynamic_ref_table is used to determine which shared libraries were used, and when done they are stored in ascending order in apktool.yml as a usesLibrary list. The order within usesLibrary determines the package IDs that will be dynamically assigned to shared resources on recompile. Works perfectly with aapt2, doesn't seem to work with aapt1 since it's garbage and never worked properly. SharedLibraryTest was updated accordingly. "isFrameworkApk" and "sharedLibrary" flags are obsolete. We decide aapt options to use by package ID. values-godzilla dir omitted for now, currently aapt2 doesn't support it properly (needs more binary patching). drawableXhdpiTest commented out for now until we decide what to do with those old Samsung and HTC 9patch drawables. aapt2 stores them with ".9" or ".r" appended to resource name, and the decoded files are named ".9.9.qmg" or ".r.r.9.png". Some variable name tweaks for consistency.
Shared libraries are dynamic so must be provided in decode/build time.
I need some rest now. -___-'' |
damn nice work |
By the way, this: Apktool/brut.apktool/apktool-lib/src/test/resources/aapt1/testapp/res/values-mcc001/styles.xml Line 10 in bb8011c
and: Apktool/brut.apktool/apktool-lib/src/test/resources/aapt1/testapp/res/values-mcc001/styles.xml Line 14 in bb8011c
Are not a thing in aapt2 (I mean the string references for name ), so omitted.
|
I'm done with the tests. If you need help with removing aapt1 (and related "hacks" for it in the code) let me know. |
Are you wanting this branch to start the v3 branch? Or do you feel since none of the removals take place it should go out into wild under 2.x for a bit? |
It should be fine under 2.x as well, but it's up to you. Getting rid of aapt1 code is easy job in comparison to this. |
Okay so my plan then is:
|
Added a draft PR for docs for the new param - iBotPeaches/apktool.org#16 |
Fair enough, hopefully nobody touches anything that would conflict with this change. |
I'll keep things unmerged till this and I wasn't sure if you were done with commits so felt weekend was safe. |
Yeah, I'm done with this PR. Not touching more than that until we're ready to cut aapt1 out. |
All tests have been migrated to aapt2, no tests left for aapt1, as we phase out support.
Fixed shared library support using a custom option
-l
or-lib
, that can be specified many times for multiple libs. On decoding, thedynamic_ref_table
is used to determine which shared libraries were used, and when done they are stored in ascending order inapktool.yml
as ausesLibrary
list. The order withinusesLibrary
determines the package IDs that will be dynamically assigned to shared resources on recompile. Works perfectly with aapt2, doesn't seem to work with aapt1 since it's garbage and never worked properly.SharedLibraryTest
was updated accordingly.isFrameworkApk
andsharedLibrary
flags are obsolete. We decide aapt options to use by package ID.values-godzilla
dir omitted for now, currently aapt2 doesn't support it properly (needs more binary patching).drawableXhdpiTest
commented out for now until we decide what to do with those old Samsung and HTC 9patch drawables. aapt2 stores them with ".9" or ".r" appended to resource name, and the decoded files are named ".9.9.qmg" or ".r.r.9.png".Some variable name tweaks for consistency.