diff options
author | 2020-12-03 16:50:22 +0000 | |
---|---|---|
committer | 2020-12-03 16:50:22 +0000 | |
commit | 65b031910bc36bd079759d002ab7b3d66668f132 (patch) | |
tree | b1ee873a1d8f7bf691ef024381ffd122b46ab0c5 /java/app_test.go | |
parent | 78210f6c9b607d411a5466d90c68db52d546aabf (diff) |
Do not propagate <uses-library> deps through static SDK component libs.
If some Java library/app depends on an SDK component library (e.g. stubs
library), then it transitively depends on the SDK library itself
(because the component library has a dependency on its SDK library).
Previously having this transitive dependency resulted in adding the SDK
library to the <uses-library> dependencies of the library/app. However,
this doesn't make sense if the app has a *static* dependency on the
component library. This patch stops adding <uses-library> dependency in
that case.
Bug: 132357300
Test: m nothing
Test: added new Soong test that would previously fail with an error:
invalid build path for <uses-library> "fred"
Change-Id: I697a65e461037c95ec56b6c321afa4ec52ccbbec
Diffstat (limited to 'java/app_test.go')
-rw-r--r-- | java/app_test.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/java/app_test.go b/java/app_test.go index 6efb0dcb3..8523b874f 100644 --- a/java/app_test.go +++ b/java/app_test.go @@ -2730,6 +2730,13 @@ func TestUsesLibraries(t *testing.T) { } java_sdk_library { + name: "fred", + srcs: ["a.java"], + api_packages: ["fred"], + sdk_version: "current", + } + + java_sdk_library { name: "bar", srcs: ["a.java"], api_packages: ["bar"], @@ -2753,7 +2760,12 @@ func TestUsesLibraries(t *testing.T) { name: "app", srcs: ["a.java"], libs: ["qux", "quuz.stubs"], - static_libs: ["static-runtime-helper"], + static_libs: [ + "static-runtime-helper", + // statically linked component libraries should not pull their SDK libraries, + // so "fred" should not be added to class loader context + "fred.stubs", + ], uses_libs: ["foo"], sdk_version: "current", optional_uses_libs: [ |