From e95b53a55d130e7dc8f6c0eec241a0d12702076c Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Fri, 23 Apr 2021 20:41:23 +0100 Subject: [PATCH] Automatically add bootclasspath_fragment contents to sdk Previously, both a bootclasspath_fragment and its contents had to be explicitly added to the sdk. This change means that adding a bootclasspath_fragment to and sdk will automatically add its contents as if they were added using java_boot_libs. Bug: 177892522 Test: m nothing Change-Id: I8f7e70649f272c9a109d4606571a2d12c44b7904 --- java/bootclasspath_fragment.go | 16 ++++++++++++++-- sdk/bootclasspath_fragment_sdk_test.go | 3 --- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/java/bootclasspath_fragment.go b/java/bootclasspath_fragment.go index d0570b413..5c6a7b899 100644 --- a/java/bootclasspath_fragment.go +++ b/java/bootclasspath_fragment.go @@ -32,8 +32,9 @@ func init() { android.RegisterSdkMemberType(&bootclasspathFragmentMemberType{ SdkMemberTypeBase: android.SdkMemberTypeBase{ - PropertyName: "bootclasspath_fragments", - SupportsSdk: true, + PropertyName: "bootclasspath_fragments", + SupportsSdk: true, + TransitiveSdkMembers: true, }, }) } @@ -60,11 +61,22 @@ func (b bootclasspathFragmentContentDependencyTag) ReplaceSourceWithPrebuilt() b return false } +// SdkMemberType causes dependencies added with this tag to be automatically added to the sdk as if +// they were specified using java_boot_libs. +func (b bootclasspathFragmentContentDependencyTag) SdkMemberType() android.SdkMemberType { + return javaBootLibsSdkMemberType +} + +func (b bootclasspathFragmentContentDependencyTag) ExportMember() bool { + return true +} + // The tag used for the dependency between the bootclasspath_fragment module and its contents. var bootclasspathFragmentContentDepTag = bootclasspathFragmentContentDependencyTag{} var _ android.ExcludeFromVisibilityEnforcementTag = bootclasspathFragmentContentDepTag var _ android.ReplaceSourceWithPrebuilt = bootclasspathFragmentContentDepTag +var _ android.SdkMemberTypeDependencyTag = bootclasspathFragmentContentDepTag func IsBootclasspathFragmentContentDepTag(tag blueprint.DependencyTag) bool { return tag == bootclasspathFragmentContentDepTag diff --git a/sdk/bootclasspath_fragment_sdk_test.go b/sdk/bootclasspath_fragment_sdk_test.go index ef4d7cd45..6fb41411d 100644 --- a/sdk/bootclasspath_fragment_sdk_test.go +++ b/sdk/bootclasspath_fragment_sdk_test.go @@ -52,7 +52,6 @@ func TestSnapshotWithBootclasspathFragment_ImageName(t *testing.T) { sdk { name: "mysdk", bootclasspath_fragments: ["mybootclasspathfragment"], - java_boot_libs: ["mybootlib"], } apex { @@ -166,7 +165,6 @@ func TestSnapshotWithBootClasspathFragment_Contents(t *testing.T) { sdk { name: "mysdk", bootclasspath_fragments: ["mybootclasspathfragment"], - java_boot_libs: ["mybootlib"], } bootclasspath_fragment { @@ -288,7 +286,6 @@ func TestSnapshotWithBootclasspathFragment_HiddenAPI(t *testing.T) { sdk { name: "mysdk", bootclasspath_fragments: ["mybootclasspathfragment"], - java_boot_libs: ["mybootlib"], } bootclasspath_fragment {