Merge "Run ABI checks for shared libs exported by APEX"

This commit is contained in:
Logan Chien
2019-12-10 17:36:55 +00:00
committed by Gerrit Code Review
2 changed files with 18 additions and 4 deletions

View File

@@ -286,6 +286,7 @@ type ModuleContextIntf interface {
isPgoCompile() bool isPgoCompile() bool
isNDKStubLibrary() bool isNDKStubLibrary() bool
useClangLld(actx ModuleContext) bool useClangLld(actx ModuleContext) bool
isForPlatform() bool
apexName() string apexName() string
hasStubsVariants() bool hasStubsVariants() bool
isStubs() bool isStubs() bool
@@ -1056,10 +1057,6 @@ func (ctx *moduleContextImpl) shouldCreateSourceAbiDump() bool {
// Host modules do not need ABI dumps. // Host modules do not need ABI dumps.
return false return false
} }
if !ctx.mod.IsForPlatform() {
// APEX variants do not need ABI dumps.
return false
}
if ctx.isStubs() { if ctx.isStubs() {
// Stubs do not need ABI dumps. // Stubs do not need ABI dumps.
return false return false
@@ -1086,6 +1083,10 @@ func (ctx *moduleContextImpl) getVndkExtendsModuleName() string {
return ctx.mod.getVndkExtendsModuleName() return ctx.mod.getVndkExtendsModuleName()
} }
func (ctx *moduleContextImpl) isForPlatform() bool {
return ctx.mod.IsForPlatform()
}
func (ctx *moduleContextImpl) apexName() string { func (ctx *moduleContextImpl) apexName() string {
return ctx.mod.ApexName() return ctx.mod.ApexName()
} }

View File

@@ -522,6 +522,19 @@ func (library *libraryDecorator) shouldCreateSourceAbiDump(ctx ModuleContext) bo
if !ctx.shouldCreateSourceAbiDump() { if !ctx.shouldCreateSourceAbiDump() {
return false return false
} }
if !ctx.isForPlatform() {
if !ctx.hasStubsVariants() {
// Skip ABI checks if this library is for APEX but isn't exported.
return false
}
if !Bool(library.Properties.Header_abi_checker.Enabled) {
// Skip ABI checks if this library is for APEX and did not explicitly enable
// ABI checks.
// TODO(b/145608479): ABI checks should be enabled by default. Remove this
// after evaluating the extra build time.
return false
}
}
return library.classifySourceAbiDump(ctx) != "" return library.classifySourceAbiDump(ctx) != ""
} }