Copy apex_available properties to snapshot modules
Bug: 142935992
Test: m nothing
Change-Id: I1cdaae5b4e13a89dc46541dacd34ef5a44735b6a
diff --git a/sdk/cc_sdk_test.go b/sdk/cc_sdk_test.go
index 45b548c..a14890e 100644
--- a/sdk/cc_sdk_test.go
+++ b/sdk/cc_sdk_test.go
@@ -414,6 +414,7 @@
"Test.cpp",
"aidl/foo/bar/Test.aidl",
],
+ apex_available: ["apex1", "apex2"],
export_include_dirs: ["include"],
aidl: {
export_aidl_headers: true,
@@ -430,6 +431,10 @@
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 {
name: "mynativelib",
prefer: false,
+ apex_available: [
+ "apex1",
+ "apex2",
+ ],
export_include_dirs: ["include/include"],
arch: {
arm64: {
diff --git a/sdk/update.go b/sdk/update.go
index 087b8bc..b335777 100644
--- a/sdk/update.go
+++ b/sdk/update.go
@@ -550,6 +550,8 @@
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 @@
} 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 @@
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