Merge "Do verify_uses_libraries check for APKs after patching library names." am: 97df5e65b0 am: e073aa2af2 am: d0f9821127

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1609481

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Iba51b522daa4a85ac3875bc4c101edff174ee0cc
This commit is contained in:
Ulyana Trafimovich 2021-03-03 00:23:35 +00:00 committed by Automerger Merge Worker
commit 65253cd2ac
2 changed files with 5 additions and 7 deletions

View File

@ -244,10 +244,6 @@ func (a *AndroidAppImport) generateAndroidBuildActions(ctx android.ModuleContext
srcApk := a.prebuilt.SingleSourcePath(ctx)
if a.usesLibrary.enforceUsesLibraries() {
srcApk = a.usesLibrary.verifyUsesLibrariesAPK(ctx, srcApk)
}
// TODO: Install or embed JNI libraries
// Uncompress JNI libraries in the apk
@ -276,6 +272,10 @@ func (a *AndroidAppImport) generateAndroidBuildActions(ctx android.ModuleContext
a.dexpreopter.enforceUsesLibs = a.usesLibrary.enforceUsesLibraries()
a.dexpreopter.classLoaderContexts = a.usesLibrary.classLoaderContextForUsesLibDeps(ctx)
if a.usesLibrary.enforceUsesLibraries() {
srcApk = a.usesLibrary.verifyUsesLibrariesAPK(ctx, srcApk)
}
a.dexpreopter.dexpreopt(ctx, jnisUncompressed)
if a.dexpreopter.uncompressedDex {
dexUncompressed := android.PathForModuleOut(ctx, "dex-uncompressed", ctx.ModuleName()+".apk")

View File

@ -2380,9 +2380,7 @@ func TestUsesLibraries(t *testing.T) {
// Test that all libraries are verified for an APK (library order matters).
verifyApkCmd := prebuilt.Rule("verify_uses_libraries").RuleParams.Command
// TODO(b/132357300): "non-sdk-lib" should not be here
// TODO(b/132357300): "com.non.sdk.lib" should be here
verifyApkReqLibs := `uses_library_names="foo non-sdk-lib android.test.runner"`
verifyApkReqLibs := `uses_library_names="foo com.non.sdk.lib android.test.runner"`
verifyApkOptLibs := `optional_uses_library_names="bar baz"`
if !strings.Contains(verifyApkCmd, verifyApkReqLibs) {
t.Errorf("wanted %q in %q", verifyApkReqLibs, verifyApkCmd)