summaryrefslogtreecommitdiff
path: root/scripts/manifest_check_test.py
AgeCommit message (Collapse)Author
2021-03-31Emit a better error message in manifest_check.py.Ulya Trafimovich
Bug: 132357300 Test: lunch aosp_cf_x86_64_phone-userdebug && m Test: temporarily patch Gallery2 to fail the check, observe the error Change-Id: Id67e359188396f68dcecd8b3f4d1bc26271af56d
2021-03-15Reimplement verify_uses_libraries.sh in manifest_check.py.Ulya Trafimovich
Previously there were two different scripts that did similar things: 1) build/soong/scripts/manifest_check.py 2) build/make/core/verify_uses_libraries.sh Both scripts extracted <uses-library> tags and `targetSdkVersion` from the manifests of Java modules, but 1) worked for XML manifests, and 2) worked for APKs. This CL reimplements the functionality from 2) in 1), so that one script can handle both XML manifests and APKs. Bug: 132357300 Test: lunch cf_x86_64_phone-userdebug && m && launch_cvd \ adb wait-for-device && adb root && adb logcat \ | grep -E 'ClassLoaderContext [a-z ]+ mismatch' # empty grep output, no errors Change-Id: Id1b66e4f3f30f307dba70cb111c7571762cb546a
2021-02-22Add non-fatal mode for verify_uses_libraries check.Ulya Trafimovich
The new mode is enabled with environment variable RELAX_USES_LIBRARY_CHECK. If the variable is set to true, then a verify_uses_libraries check failure does not fail the build, instead it sets a special compiler filter "extract" for dexpreopt, which means that the DEX file will be extracted, but it won't be compiled to native code. Class loader context will be set to empty in this case (not &, as it is going to be deprecated soon). If the variable RELAX_USES_LIBRARY_CHECK is unset or set to something other than "true", then the old behaviour of the verify_uses_libraries check is preserved. The intended use case for this flag is to have a smoother migration path for the Java modules that need to add <uses-library> information in the build files. The flag allows to quickly silence build errors. This flag should be used with caution and only as a temporary measure, as it masks real errors and affects performance. verify_uses_libraries check is reworked so that it writes the error message to a status file (which is used instead of the former timestamp file). Currently the stored error message is not used, but it may be used later to produce a warning. Dexpreopt command checks if the status file exists and is nonempty; if that is the case, then compiler filter is set to "extract". Bug: 132357300 Test: Manually add some mismatch between the libraries in the Android.bp and Android.mk files for dexpreopted apps, build with RELAX_USES_LIBRARY_CHECK=true and obsserve that the build doesn't fail and they are compiled with compiler-filter "extract". Unset RELAX_USES_LIBRARY_CHECK and observe that the build fails. Change-Id: Ibb5d993a25b1df1d2e70b7d5aafc6997f9d64e67
2019-05-24Add manifest_check toolColin Cross
Add a tool that can check that the <uses-library> tags in an AndroidManifest.xml file match a list provided by the build. Bug: 132357300 Test: manifest_check_test Change-Id: If15abf792282bef677469595e80f19923b87ab62