Refactor CC to prep for Rust sanitizable modules.
Adds a PlatformSanitizable interface which both CC and Rust can implement so that the sanitizer mutators in CC can sanitize Rust shared/static libraries appropriately. Bug: 147140513 Test: m nothing Change-Id: Ib31103b6c4902a4d5df2565c0d7c981298d100a3
This commit is contained in:
40
cc/image.go
40
cc/image.go
@@ -26,36 +26,18 @@ import (
|
||||
|
||||
var _ android.ImageInterface = (*Module)(nil)
|
||||
|
||||
type imageVariantType string
|
||||
type ImageVariantType string
|
||||
|
||||
const (
|
||||
coreImageVariant imageVariantType = "core"
|
||||
vendorImageVariant imageVariantType = "vendor"
|
||||
productImageVariant imageVariantType = "product"
|
||||
ramdiskImageVariant imageVariantType = "ramdisk"
|
||||
vendorRamdiskImageVariant imageVariantType = "vendor_ramdisk"
|
||||
recoveryImageVariant imageVariantType = "recovery"
|
||||
hostImageVariant imageVariantType = "host"
|
||||
coreImageVariant ImageVariantType = "core"
|
||||
vendorImageVariant ImageVariantType = "vendor"
|
||||
productImageVariant ImageVariantType = "product"
|
||||
ramdiskImageVariant ImageVariantType = "ramdisk"
|
||||
vendorRamdiskImageVariant ImageVariantType = "vendor_ramdisk"
|
||||
recoveryImageVariant ImageVariantType = "recovery"
|
||||
hostImageVariant ImageVariantType = "host"
|
||||
)
|
||||
|
||||
func (c *Module) getImageVariantType() imageVariantType {
|
||||
if c.Host() {
|
||||
return hostImageVariant
|
||||
} else if c.inVendor() {
|
||||
return vendorImageVariant
|
||||
} else if c.InProduct() {
|
||||
return productImageVariant
|
||||
} else if c.InRamdisk() {
|
||||
return ramdiskImageVariant
|
||||
} else if c.InVendorRamdisk() {
|
||||
return vendorRamdiskImageVariant
|
||||
} else if c.InRecovery() {
|
||||
return recoveryImageVariant
|
||||
} else {
|
||||
return coreImageVariant
|
||||
}
|
||||
}
|
||||
|
||||
const (
|
||||
// VendorVariationPrefix is the variant prefix used for /vendor code that compiles
|
||||
// against the VNDK.
|
||||
@@ -75,7 +57,7 @@ func (ctx *moduleContext) ProductSpecific() bool {
|
||||
func (ctx *moduleContext) SocSpecific() bool {
|
||||
// Additionally check if this module is inVendor() that means it is a "vendor" variant of a
|
||||
// module. As well as SoC specific modules, vendor variants must be installed to /vendor.
|
||||
return ctx.ModuleContext.SocSpecific() || ctx.mod.inVendor()
|
||||
return ctx.ModuleContext.SocSpecific() || ctx.mod.InVendor()
|
||||
}
|
||||
|
||||
func (ctx *moduleContextImpl) inProduct() bool {
|
||||
@@ -83,7 +65,7 @@ func (ctx *moduleContextImpl) inProduct() bool {
|
||||
}
|
||||
|
||||
func (ctx *moduleContextImpl) inVendor() bool {
|
||||
return ctx.mod.inVendor()
|
||||
return ctx.mod.InVendor()
|
||||
}
|
||||
|
||||
func (ctx *moduleContextImpl) inRamdisk() bool {
|
||||
@@ -119,7 +101,7 @@ func (c *Module) InProduct() bool {
|
||||
}
|
||||
|
||||
// Returns true if the module is "vendor" variant. Usually these modules are installed in /vendor
|
||||
func (c *Module) inVendor() bool {
|
||||
func (c *Module) InVendor() bool {
|
||||
return c.Properties.ImageVariationPrefix == VendorVariationPrefix
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user