Merge "Cleanup createVndkSourceAbiDump()"

This commit is contained in:
Logan Chien
2018-07-11 03:08:31 +00:00
committed by Gerrit Code Review
2 changed files with 27 additions and 14 deletions

View File

@@ -223,7 +223,7 @@ type ModuleContextIntf interface {
isVndkSp() bool isVndkSp() bool
isVndkExt() bool isVndkExt() bool
inRecovery() bool inRecovery() bool
createVndkSourceAbiDump() bool shouldCreateVndkSourceAbiDump() bool
selectedStl() string selectedStl() string
baseModuleName() string baseModuleName() string
getVndkExtendsModuleName() string getVndkExtendsModuleName() string
@@ -562,16 +562,29 @@ func (ctx *moduleContextImpl) inRecovery() bool {
return ctx.mod.inRecovery() return ctx.mod.inRecovery()
} }
// Create source abi dumps if the module belongs to the list of VndkLibraries. // Check whether ABI dumps should be created for this module.
func (ctx *moduleContextImpl) createVndkSourceAbiDump() bool { func (ctx *moduleContextImpl) shouldCreateVndkSourceAbiDump() bool {
skipAbiChecks := ctx.ctx.Config().IsEnvTrue("SKIP_ABI_CHECKS") if ctx.ctx.Config().IsEnvTrue("SKIP_ABI_CHECKS") {
isVariantOnProductionDevice := true return false
sanitize := ctx.mod.sanitize
if sanitize != nil {
isVariantOnProductionDevice = sanitize.isVariantOnProductionDevice()
} }
vendorAvailable := Bool(ctx.mod.VendorProperties.Vendor_available) if sanitize := ctx.mod.sanitize; sanitize != nil {
return !skipAbiChecks && isVariantOnProductionDevice && ctx.ctx.Device() && ((ctx.useVndk() && ctx.isVndk() && (vendorAvailable || ctx.isVndkExt())) || inList(ctx.baseModuleName(), llndkLibraries)) 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 { func (ctx *moduleContextImpl) selectedStl() string {

View File

@@ -362,7 +362,7 @@ func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps Pa
} }
return Objects{} return Objects{}
} }
if ctx.createVndkSourceAbiDump() || library.sabi.Properties.CreateSAbiDumps { if ctx.shouldCreateVndkSourceAbiDump() || library.sabi.Properties.CreateSAbiDumps {
exportIncludeDirs := library.flagExporter.exportedIncludes(ctx) exportIncludeDirs := library.flagExporter.exportedIncludes(ctx)
var SourceAbiFlags []string var SourceAbiFlags []string
for _, dir := range exportIncludeDirs.Strings() { for _, dir := range exportIncludeDirs.Strings() {
@@ -632,14 +632,12 @@ func (library *libraryDecorator) linkShared(ctx ModuleContext,
} }
func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, objs Objects, fileName string, soFile android.Path) { func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, objs Objects, fileName string, soFile android.Path) {
//Also take into account object re-use. if len(objs.sAbiDumpFiles) > 0 && ctx.shouldCreateVndkSourceAbiDump() {
if len(objs.sAbiDumpFiles) > 0 && ctx.createVndkSourceAbiDump() {
vndkVersion := ctx.DeviceConfig().PlatformVndkVersion() vndkVersion := ctx.DeviceConfig().PlatformVndkVersion()
if ver := ctx.DeviceConfig().VndkVersion(); ver != "" && ver != "current" { if ver := ctx.DeviceConfig().VndkVersion(); ver != "" && ver != "current" {
vndkVersion = ver vndkVersion = ver
} }
refSourceDumpFile := android.PathForVndkRefAbiDump(ctx, vndkVersion, fileName, vndkVsNdk(ctx), true)
exportIncludeDirs := library.flagExporter.exportedIncludes(ctx) exportIncludeDirs := library.flagExporter.exportedIncludes(ctx)
var SourceAbiFlags []string var SourceAbiFlags []string
for _, dir := range exportIncludeDirs.Strings() { for _, dir := range exportIncludeDirs.Strings() {
@@ -650,6 +648,8 @@ func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, objs Objec
} }
exportedHeaderFlags := strings.Join(SourceAbiFlags, " ") exportedHeaderFlags := strings.Join(SourceAbiFlags, " ")
library.sAbiOutputFile = TransformDumpToLinkedDump(ctx, objs.sAbiDumpFiles, soFile, fileName, exportedHeaderFlags) library.sAbiOutputFile = TransformDumpToLinkedDump(ctx, objs.sAbiDumpFiles, soFile, fileName, exportedHeaderFlags)
refSourceDumpFile := android.PathForVndkRefAbiDump(ctx, vndkVersion, fileName, vndkVsNdk(ctx), true)
if refSourceDumpFile.Valid() { if refSourceDumpFile.Valid() {
unzippedRefDump := UnzipRefDump(ctx, refSourceDumpFile.Path(), fileName) unzippedRefDump := UnzipRefDump(ctx, refSourceDumpFile.Path(), fileName)
library.sAbiDiff = SourceAbiDiff(ctx, library.sAbiOutputFile.Path(), library.sAbiDiff = SourceAbiDiff(ctx, library.sAbiOutputFile.Path(),