Copy apex_available properties to snapshot modules

Bug: 142935992
Test: m nothing
Change-Id: I1cdaae5b4e13a89dc46541dacd34ef5a44735b6a
This commit is contained in:
Paul Duffin 2020-03-04 14:22:45 +00:00
parent c6d627b268
commit befa4b91d7
3 changed files with 24 additions and 1 deletions

View File

@ -116,6 +116,10 @@ func (m *ApexModuleBase) apexModuleBase() *ApexModuleBase {
return m
}
func (m *ApexModuleBase) ApexAvailable() []string {
return m.ApexProperties.Apex_available
}
func (m *ApexModuleBase) BuildForApexes(apexes []ApexInfo) {
m.apexVariationsLock.Lock()
defer m.apexVariationsLock.Unlock()

View File

@ -414,6 +414,7 @@ func TestSnapshotWithCcSharedLibrary(t *testing.T) {
"Test.cpp",
"aidl/foo/bar/Test.aidl",
],
apex_available: ["apex1", "apex2"],
export_include_dirs: ["include"],
aidl: {
export_aidl_headers: true,
@ -430,6 +431,10 @@ func TestSnapshotWithCcSharedLibrary(t *testing.T) {
cc_prebuilt_library_shared {
name: "mysdk_mynativelib@current",
sdk_member_name: "mynativelib",
apex_available: [
"apex1",
"apex2",
],
export_include_dirs: ["include/include"],
arch: {
arm64: {
@ -448,6 +453,10 @@ cc_prebuilt_library_shared {
cc_prebuilt_library_shared {
name: "mynativelib",
prefer: false,
apex_available: [
"apex1",
"apex2",
],
export_include_dirs: ["include/include"],
arch: {
arm64: {

View File

@ -550,6 +550,8 @@ func (s *snapshotBuilder) AddPrebuiltModule(member android.SdkMember, moduleType
m := s.bpFile.newModule(moduleType)
m.AddProperty("name", name)
variant := member.Variants()[0]
if s.sdk.isInternalMember(name) {
// An internal member is only referenced from the sdk snapshot which is in the
// same package so can be marked as private.
@ -557,7 +559,7 @@ func (s *snapshotBuilder) AddPrebuiltModule(member android.SdkMember, moduleType
} else {
// Extract visibility information from a member variant. All variants have the same
// visibility so it doesn't matter which one is used.
visibility := android.EffectiveVisibilityRules(s.ctx, member.Variants()[0])
visibility := android.EffectiveVisibilityRules(s.ctx, variant)
if len(visibility) != 0 {
m.AddProperty("visibility", visibility)
}
@ -565,6 +567,14 @@ func (s *snapshotBuilder) AddPrebuiltModule(member android.SdkMember, moduleType
addHostDeviceSupportedProperties(&s.sdk.ModuleBase, m)
// Where available copy apex_available properties from the member.
if apexAware, ok := variant.(interface{ ApexAvailable() []string }); ok {
apexAvailable := apexAware.ApexAvailable()
if len(apexAvailable) > 0 {
m.AddProperty("apex_available", apexAvailable)
}
}
s.prebuiltModules[name] = m
s.prebuiltOrder = append(s.prebuiltOrder, m)
return m