Merge "Add diff_flags as a header_abi_checker property" into tm-dev

This commit is contained in:
Hsin-Yi Chen 2022-05-26 04:21:54 +00:00 committed by Android (Google) Code Review
commit 39a9db3bae
2 changed files with 9 additions and 2 deletions

View file

@ -942,9 +942,10 @@ func unzipRefDump(ctx android.ModuleContext, zippedRefDump android.Path, baseNam
return outputFile return outputFile
} }
// sourceAbiDiff registers a build statement to compare linked sAbi dump files (.ldump). // sourceAbiDiff registers a build statement to compare linked sAbi dump files (.lsdump).
func sourceAbiDiff(ctx android.ModuleContext, inputDump android.Path, referenceDump android.Path, func sourceAbiDiff(ctx android.ModuleContext, inputDump android.Path, referenceDump android.Path,
baseName, exportedHeaderFlags string, checkAllApis, isLlndk, isNdk, isVndkExt bool) android.OptionalPath { baseName, exportedHeaderFlags string, diffFlags []string,
checkAllApis, isLlndk, isNdk, isVndkExt bool) android.OptionalPath {
outputFile := android.PathForModuleOut(ctx, baseName+".abidiff") outputFile := android.PathForModuleOut(ctx, baseName+".abidiff")
libName := strings.TrimSuffix(baseName, filepath.Ext(baseName)) libName := strings.TrimSuffix(baseName, filepath.Ext(baseName))
@ -975,6 +976,8 @@ func sourceAbiDiff(ctx android.ModuleContext, inputDump android.Path, referenceD
if isVndkExt { if isVndkExt {
extraFlags = append(extraFlags, "-allow-extensions") extraFlags = append(extraFlags, "-allow-extensions")
} }
// TODO(b/232891473): Simplify the above logic with diffFlags.
extraFlags = append(extraFlags, diffFlags...)
ctx.Build(pctx, android.BuildParams{ ctx.Build(pctx, android.BuildParams{
Rule: sAbiDiff, Rule: sAbiDiff,

View file

@ -110,6 +110,9 @@ type LibraryProperties struct {
// Run checks on all APIs (in addition to the ones referred by // Run checks on all APIs (in addition to the ones referred by
// one of exported ELF symbols.) // one of exported ELF symbols.)
Check_all_apis *bool Check_all_apis *bool
// Extra flags passed to header-abi-diff
Diff_flags []string
} }
// Inject boringssl hash into the shared library. This is only intended for use by external/boringssl. // Inject boringssl hash into the shared library. This is only intended for use by external/boringssl.
@ -1638,6 +1641,7 @@ func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, objs Objec
if refAbiDumpFile != nil { if refAbiDumpFile != nil {
library.sAbiDiff = sourceAbiDiff(ctx, library.sAbiOutputFile.Path(), library.sAbiDiff = sourceAbiDiff(ctx, library.sAbiOutputFile.Path(),
refAbiDumpFile, fileName, exportedHeaderFlags, refAbiDumpFile, fileName, exportedHeaderFlags,
library.Properties.Header_abi_checker.Diff_flags,
Bool(library.Properties.Header_abi_checker.Check_all_apis), Bool(library.Properties.Header_abi_checker.Check_all_apis),
ctx.IsLlndk(), ctx.isNdk(ctx.Config()), ctx.IsVndkExt()) ctx.IsLlndk(), ctx.isNdk(ctx.Config()), ctx.IsVndkExt())
} }