platform_build_soong/sdk
Paul Duffin 573989d821 Prevent ApexInfoMutator from creating unnecessary variants
Adds the AlwaysRequireApexVariantTag interface to enable
ApexInfoMutator to differentiate between a tag that is excluded from
apex contents but still requires an apex variant and a tag that is
excluded from apex contents and does not require an apex variant.

That is needed to support the sdkMemberVersionedDepTag which excludes
the target from being added to the APEX but requires an APEX variant.
A more detailed explanation is in the comments.

The AlwaysRequireApexVariant() method follows the pattern used in
ReplaceSourceWithPrebuilt of having a method that returns a bool to
trigger the behavior and not say ExcludeFromApexContentsTag that simply
relies on the tag implementing an interface to trigger. That is because
the former is more flexible and allows a tag type to parameterize the
behavior if necessary.

The tags that this will exclude from creating an apex variant are:
* PrebuiltDepTag - by the time the apex variant has been created any
  preferred prebuilts will have replaced the sources so there is no
  need to create an APEX variant if the only dependency path from the
  APEX to the prebuilt is via this tag.
* hiddenApiAnnotationsDependencyTag - the target of which is a purely
  build time artifect and MUST NEVER end up in the APEX.

It will also stop calling DepIsInSameApex for any dependency created
by the sdkMemberVersionedDepTag. Which will fix the issue reported in
the bug.

Bug: 182992071
Test: m nothing
Change-Id: I9569e488d6446ca45d3ea8f32a9b74524eb865df
2021-03-18 09:05:28 +00:00
..
Android.bp Add prebuilt_boot_image and add boot_images to sdk 2021-03-11 07:24:26 +00:00
boot_image_sdk_test.go Stop sdk package depending on testing.T being embedded in TestResult 2021-03-13 15:59:33 +00:00
bp.go Handle property structs and BpPropertySets as values to AddProperty. 2020-09-25 00:33:04 +01:00
bp_test.go Stop sdk package depending on testing.T being embedded in TestResult 2021-03-13 15:59:33 +00:00
cc_sdk_test.go Stop sdk package depending on testing.T being embedded in TestResult 2021-03-13 15:59:33 +00:00
exports.go Extract sdk registration code into function for reuse 2021-03-09 23:03:45 +00:00
exports_test.go Stop sdk package depending on testing.T being embedded in TestResult 2021-03-13 15:59:33 +00:00
java_sdk_test.go Stop sdk package depending on testing.T being embedded in TestResult 2021-03-13 15:59:33 +00:00
sdk.go Prevent ApexInfoMutator from creating unnecessary variants 2021-03-18 09:05:28 +00:00
sdk_test.go Stop sdk package depending on testing.T being embedded in TestResult 2021-03-13 15:59:33 +00:00
testing.go Stop sdk package depending on testing.T being embedded in TestResult 2021-03-13 15:59:33 +00:00
update.go Support testing versioned/unversioned sdk Android.bp files separately 2021-02-22 18:23:22 +00:00