bootclasspath_fragment: Add hidden API flag files to snapshot
These are needed at the moment to ensure the hidden API processing generates the same set of flags whether it is being generated from source or prebuilts. Soon these will be needed to ensure that the hidden API flags generated for the individual modules are compatible with previous releases. Bug: 179354495 Test: m art-module-sdk and check snapshot zip contains the files and the generated Android.bp references them. Change-Id: I9a3334cc48faa381bbbcbbb59479db719042796a
This commit is contained in:
@@ -16,6 +16,7 @@ package java
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"android/soong/android"
|
||||
@@ -324,6 +325,9 @@ type bootImageSdkMemberProperties struct {
|
||||
|
||||
// Contents of the bootclasspath fragment
|
||||
Contents []string
|
||||
|
||||
// Flag files by *hiddenAPIFlagFileCategory
|
||||
Flag_files_by_category map[*hiddenAPIFlagFileCategory]android.Paths
|
||||
}
|
||||
|
||||
func (b *bootImageSdkMemberProperties) PopulateFromVariant(ctx android.SdkMemberContext, variant android.Module) {
|
||||
@@ -336,6 +340,11 @@ func (b *bootImageSdkMemberProperties) PopulateFromVariant(ctx android.SdkMember
|
||||
// boot image. Therefore, contents property is only copied if the image name is not specified.
|
||||
b.Contents = module.properties.Contents
|
||||
}
|
||||
|
||||
// Get the flag file information from the module.
|
||||
mctx := ctx.SdkModuleContext()
|
||||
flagFileInfo := mctx.OtherModuleProvider(module, hiddenAPIFlagFileInfoProvider).(hiddenAPIFlagFileInfo)
|
||||
b.Flag_files_by_category = flagFileInfo.categoryToPaths
|
||||
}
|
||||
|
||||
func (b *bootImageSdkMemberProperties) AddToPropertySet(ctx android.SdkMemberContext, propertySet android.BpPropertySet) {
|
||||
@@ -346,6 +355,23 @@ func (b *bootImageSdkMemberProperties) AddToPropertySet(ctx android.SdkMemberCon
|
||||
if len(b.Contents) > 0 {
|
||||
propertySet.AddPropertyWithTag("contents", b.Contents, ctx.SnapshotBuilder().SdkMemberReferencePropertyTag(true))
|
||||
}
|
||||
|
||||
builder := ctx.SnapshotBuilder()
|
||||
if b.Flag_files_by_category != nil {
|
||||
hiddenAPISet := propertySet.AddPropertySet("hidden_api")
|
||||
for _, category := range hiddenAPIFlagFileCategories {
|
||||
paths := b.Flag_files_by_category[category]
|
||||
if len(paths) > 0 {
|
||||
dests := []string{}
|
||||
for _, p := range paths {
|
||||
dest := filepath.Join("hiddenapi", p.Base())
|
||||
builder.CopyToSnapshot(p, dest)
|
||||
dests = append(dests, dest)
|
||||
}
|
||||
hiddenAPISet.AddProperty(category.propertyName, dests)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var _ android.SdkMemberType = (*bootImageMemberType)(nil)
|
||||
|
Reference in New Issue
Block a user