From fc0f6e34ce874eba4b1f852c6b9ee92148379768 Mon Sep 17 00:00:00 2001 From: Ulya Trafimovich Date: Thu, 12 Aug 2021 16:16:11 +0100 Subject: Fix the way manifest fixer detects optional entries. Previously manifest_fixer used a naive way to distiniguish optional libs from required ones: it checked if a library is on the list of optional compatibility libraries. This works for compatibility libs, but not for other libs. Now we properly track optionality through all stages of the build, starting with the addition of the library as a dependency (here's where the `uses_libs`/`optional_uses_libs` distinction kicks in), store it in dependency tag and propagate to class loader context, and from there to the manifest_fixer. The tests have been updated accordingly. Bug: 196377222 Test: lunch bertha_x86_64-userdebug && m droid dist cts mts Change-Id: I3631ce59ebe47116ce7a9b3d33a86f636846ef0f --- java/sdk_library_test.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'java/sdk_library_test.go') diff --git a/java/sdk_library_test.go b/java/sdk_library_test.go index 8e0618e31..eeec50482 100644 --- a/java/sdk_library_test.go +++ b/java/sdk_library_test.go @@ -156,8 +156,9 @@ func TestJavaSdkLibrary(t *testing.T) { // test if baz has exported SDK lib names foo and bar to qux qux := result.ModuleForTests("qux", "android_common") if quxLib, ok := qux.Module().(*Library); ok { - sdkLibs := quxLib.ClassLoaderContexts().UsesLibs() - android.AssertDeepEquals(t, "qux exports", []string{"foo", "bar", "fred", "quuz"}, sdkLibs) + requiredSdkLibs, optionalSdkLibs := quxLib.ClassLoaderContexts().UsesLibs() + android.AssertDeepEquals(t, "qux exports (required)", []string{"foo", "bar", "fred", "quuz"}, requiredSdkLibs) + android.AssertDeepEquals(t, "qux exports (optional)", []string{}, optionalSdkLibs) } } -- cgit v1.2.3-59-g8ed1b