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

View File

@@ -522,6 +522,19 @@ func (library *libraryDecorator) shouldCreateSourceAbiDump(ctx ModuleContext) bo
if !ctx.shouldCreateSourceAbiDump() {
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) != ""
}