Cleanup createVndkSourceAbiDump()
This commit cleans up `createVndkSourceAbiDump()` and renames it to
`shouldcreateVndkSourceAbiDump()`.
Test: lunch aosp_walleye-userdebug && make
Change-Id: Iff4379e2812c4b5c5baff288b938eed5d92e024f
diff --git a/cc/cc.go b/cc/cc.go
index 8d05038..89d45a9 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -223,7 +223,7 @@
isVndkSp() bool
isVndkExt() bool
inRecovery() bool
- createVndkSourceAbiDump() bool
+ shouldCreateVndkSourceAbiDump() bool
selectedStl() string
baseModuleName() string
getVndkExtendsModuleName() string
@@ -562,16 +562,29 @@
return ctx.mod.inRecovery()
}
-// Create source abi dumps if the module belongs to the list of VndkLibraries.
-func (ctx *moduleContextImpl) createVndkSourceAbiDump() bool {
- skipAbiChecks := ctx.ctx.Config().IsEnvTrue("SKIP_ABI_CHECKS")
- isVariantOnProductionDevice := true
- sanitize := ctx.mod.sanitize
- if sanitize != nil {
- isVariantOnProductionDevice = sanitize.isVariantOnProductionDevice()
+// Check whether ABI dumps should be created for this module.
+func (ctx *moduleContextImpl) shouldCreateVndkSourceAbiDump() bool {
+ if ctx.ctx.Config().IsEnvTrue("SKIP_ABI_CHECKS") {
+ return false
}
- vendorAvailable := Bool(ctx.mod.VendorProperties.Vendor_available)
- return !skipAbiChecks && isVariantOnProductionDevice && ctx.ctx.Device() && ((ctx.useVndk() && ctx.isVndk() && (vendorAvailable || ctx.isVndkExt())) || inList(ctx.baseModuleName(), llndkLibraries))
+ if sanitize := ctx.mod.sanitize; sanitize != nil {
+ if !sanitize.isVariantOnProductionDevice() {
+ return false
+ }
+ }
+ if !ctx.ctx.Device() {
+ // Host modules do not need ABI dumps.
+ return false
+ }
+ if inList(ctx.baseModuleName(), llndkLibraries) {
+ return true
+ }
+ if ctx.useVndk() && ctx.isVndk() {
+ // Return true if this is VNDK-core, VNDK-SP, or VNDK-Ext and this is not
+ // VNDK-private.
+ return Bool(ctx.mod.VendorProperties.Vendor_available) || ctx.isVndkExt()
+ }
+ return false
}
func (ctx *moduleContextImpl) selectedStl() string {