diff options
author | Logan Chien <loganchien@google.com> | 2018-07-11 03:08:31 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-07-11 03:08:31 +0000 |
commit | f33dca0ada3908edd2db76c0f5a00be44b14d70c (patch) | |
tree | 6f13eef194116976e1a6858a220225908323f2a6 | |
parent | 479884c93d676598a3ab28bd820fd8be11ea7a64 (diff) | |
parent | 2f2b890a18b2fc3dd2a7bcd86a6453ba9ca5c271 (diff) | |
download | android_build_soong-f33dca0ada3908edd2db76c0f5a00be44b14d70c.tar.gz android_build_soong-f33dca0ada3908edd2db76c0f5a00be44b14d70c.tar.bz2 android_build_soong-f33dca0ada3908edd2db76c0f5a00be44b14d70c.zip |
Merge "Cleanup createVndkSourceAbiDump()"
-rw-r--r-- | cc/cc.go | 33 | ||||
-rw-r--r-- | cc/library.go | 8 |
2 files changed, 27 insertions, 14 deletions
@@ -223,7 +223,7 @@ type ModuleContextIntf interface { isVndkSp() bool isVndkExt() bool inRecovery() bool - createVndkSourceAbiDump() bool + shouldCreateVndkSourceAbiDump() bool selectedStl() string baseModuleName() string getVndkExtendsModuleName() string @@ -562,16 +562,29 @@ func (ctx *moduleContextImpl) inRecovery() bool { 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 + } + 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 } - 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 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 { diff --git a/cc/library.go b/cc/library.go index 3bc10017..e92cf9d1 100644 --- a/cc/library.go +++ b/cc/library.go @@ -362,7 +362,7 @@ func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps Pa } return Objects{} } - if ctx.createVndkSourceAbiDump() || library.sabi.Properties.CreateSAbiDumps { + if ctx.shouldCreateVndkSourceAbiDump() || library.sabi.Properties.CreateSAbiDumps { exportIncludeDirs := library.flagExporter.exportedIncludes(ctx) var SourceAbiFlags []string 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) { - //Also take into account object re-use. - if len(objs.sAbiDumpFiles) > 0 && ctx.createVndkSourceAbiDump() { + if len(objs.sAbiDumpFiles) > 0 && ctx.shouldCreateVndkSourceAbiDump() { vndkVersion := ctx.DeviceConfig().PlatformVndkVersion() if ver := ctx.DeviceConfig().VndkVersion(); ver != "" && ver != "current" { vndkVersion = ver } - refSourceDumpFile := android.PathForVndkRefAbiDump(ctx, vndkVersion, fileName, vndkVsNdk(ctx), true) exportIncludeDirs := library.flagExporter.exportedIncludes(ctx) var SourceAbiFlags []string for _, dir := range exportIncludeDirs.Strings() { @@ -650,6 +648,8 @@ func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, objs Objec } exportedHeaderFlags := strings.Join(SourceAbiFlags, " ") library.sAbiOutputFile = TransformDumpToLinkedDump(ctx, objs.sAbiDumpFiles, soFile, fileName, exportedHeaderFlags) + + refSourceDumpFile := android.PathForVndkRefAbiDump(ctx, vndkVersion, fileName, vndkVsNdk(ctx), true) if refSourceDumpFile.Valid() { unzippedRefDump := UnzipRefDump(ctx, refSourceDumpFile.Path(), fileName) library.sAbiDiff = SourceAbiDiff(ctx, library.sAbiOutputFile.Path(), |