From a034b83988ccea3cd45cab1a5b1d87f571bdd685 Mon Sep 17 00:00:00 2001 From: Jiyong Park Date: Tue, 27 Aug 2019 14:02:19 +0900 Subject: [PATCH] Automatically enable abi checker for the stub libs The header ABI checker is enabled by default for the libs that are used across APEXes. Bug: 138219814 Test: m Change-Id: Ic0e9c5fdfa1259f500d990abc504c452436f3bd7 --- cc/library.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/cc/library.go b/cc/library.go index 6564fa151..52fd3466a 100644 --- a/cc/library.go +++ b/cc/library.go @@ -464,7 +464,7 @@ func (library *libraryDecorator) classifySourceAbiDump(ctx ModuleContext) string } } } - if enabled != nil && Bool(enabled) { + if Bool(enabled) || ctx.hasStubsVariants() { return "PLATFORM" } return "" @@ -894,7 +894,7 @@ func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, objs Objec } exportedHeaderFlags := strings.Join(SourceAbiFlags, " ") library.sAbiOutputFile = TransformDumpToLinkedDump(ctx, objs.sAbiDumpFiles, soFile, fileName, exportedHeaderFlags, - android.OptionalPathForModuleSrc(ctx, library.Properties.Header_abi_checker.Symbol_file), + android.OptionalPathForModuleSrc(ctx, library.symbolFileForAbiCheck(ctx)), library.Properties.Header_abi_checker.Exclude_symbol_versions, library.Properties.Header_abi_checker.Exclude_symbol_tags) @@ -1095,6 +1095,16 @@ func (library *libraryDecorator) buildStubs() bool { return library.MutatedProperties.BuildStubs } +func (library *libraryDecorator) symbolFileForAbiCheck(ctx ModuleContext) *string { + if library.Properties.Header_abi_checker.Symbol_file != nil { + return library.Properties.Header_abi_checker.Symbol_file + } + if ctx.hasStubsVariants() && library.Properties.Stubs.Symbol_file != nil { + return library.Properties.Stubs.Symbol_file + } + return nil +} + func (library *libraryDecorator) stubsVersion() string { return library.MutatedProperties.StubsVersion }