Set stem and suffix for vndk prebuilt libraries
This is to pass check_elf_files when vendor modules link against vndk
prebuilts. Because of the ".vendor" suffix, the intermediate path
becomes "libfoo.vendor.so" and it makes check_elf_files fail, when stem
and suffix is not specified.
Also, by adding such fields, devices with empty BOARD_VNDK_VERSION can
experience a build break due to collision between VNDK snapshot and VNDK
source module. To completely prevent such collision, all vndk snapshots
become explicitly uninstallable, and they are disabled if
BOARD_VNDK_VERSION is empty.
Test: build/soong/build_test.bash
Change-Id: I54a0f33fd0b84ab9376ee3d75b83113b94bbacae
diff --git a/cc/vndk_prebuilt.go b/cc/vndk_prebuilt.go
index 82a7732..dddd5ac 100644
--- a/cc/vndk_prebuilt.go
+++ b/cc/vndk_prebuilt.go
@@ -232,6 +232,14 @@
&prebuilt.properties,
)
+ android.AddLoadHook(module, func(ctx android.LoadHookContext) {
+ // empty BOARD_VNDK_VERSION implies that the device won't support
+ // system only OTA. In this case, VNDK snapshots aren't needed.
+ if ctx.DeviceConfig().VndkVersion() == "" {
+ ctx.Module().Disable()
+ }
+ })
+
return module
}