Ignore PrebuiltDepTag when processing APEX contents

When a source and a prebuilt module are present in the same build a
dependency is added from the source module to the prebuilt module.
Previously, the code for generating the APEX did not recognize that
tag and in some cases (e.g. for cc_(prebuilt_)library_shared) will
fail the build.

This change:
1) Adds a test to reproduce the problem.
2) Improves the debug message by pretty printing the tag.
3) Adds a new ExcludeFromApexContents interface that can be implemented
   by a tag to declare that it should be excluded from the APEX
   contents.
4) Ignores tags that implement that interface when generating APEX
   contents.
5) Implements that interface on prebuiltDependencyTag to fix the
   test.

Bug: 153326844
Bug: 153306490
Test: m nothing
Merged-In: I9dd4312c4f995c816c0a31d8d733eb5d7f56e1ea
Change-Id: I9dd4312c4f995c816c0a31d8d733eb5d7f56e1ea
This commit is contained in:
Paul Duffin
2020-04-07 15:25:44 +01:00
parent b20ad0a7d4
commit 3766cb7b6a
4 changed files with 33 additions and 2 deletions

View File

@@ -141,6 +141,7 @@ func testApexContext(t *testing.T, bp string, handlers ...testCustomizer) (*andr
"my_include": nil,
"foo/bar/MyClass.java": nil,
"prebuilt.jar": nil,
"prebuilt.so": nil,
"vendor/foo/devkeys/test.x509.pem": nil,
"vendor/foo/devkeys/test.pk8": nil,
"testkey.x509.pem": nil,
@@ -342,7 +343,7 @@ func TestBasicApex(t *testing.T) {
apex_available: [ "myapex" ],
}
cc_library {
cc_library_shared {
name: "mylib2",
srcs: ["mylib.cpp"],
system_shared_libs: [],
@@ -356,6 +357,16 @@ func TestBasicApex(t *testing.T) {
],
}
cc_prebuilt_library_shared {
name: "mylib2",
srcs: ["prebuilt.so"],
// TODO: remove //apex_available:platform
apex_available: [
"//apex_available:platform",
"myapex",
],
}
cc_library_static {
name: "libstatic",
srcs: ["mylib.cpp"],