From 6227fed02911f5c6df9a12ea232bfb767a4183fb Mon Sep 17 00:00:00 2001 From: Logan Chien Date: Mon, 18 Feb 2019 13:12:21 +0800 Subject: [PATCH] Print --llndk to create_reference_dumps command This commands adds `--llndk` to `create_reference_dump.py` command if the module with incompatible ABI changes is an LLNDK or a NDK lib. This prevents people from uploading a CL that simply removes ABI dumps (the result even when the uploader runs the command). Bug: 124620774 Test: Make an incompatible ABI changes in libaaudio and see the flag. Change-Id: I9f07f879193bd4d73f5924baff298d28d6fe1506 --- cc/builder.go | 22 +++++++++++++--------- cc/library.go | 2 +- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/cc/builder.go b/cc/builder.go index 6e24d5666..97ae80608 100644 --- a/cc/builder.go +++ b/cc/builder.go @@ -197,8 +197,8 @@ var ( sAbiDiff = pctx.AndroidRuleFunc("sAbiDiff", func(ctx android.PackageRuleContext) blueprint.RuleParams { // TODO(b/78139997): Add -check-all-apis back - commandStr := "($sAbiDiffer $allowFlags -lib $libName -arch $arch -o ${out} -new $in -old $referenceDump)" - commandStr += "|| (echo ' ---- Please update abi references by running $$ANDROID_BUILD_TOP/development/vndk/tools/header-checker/utils/create_reference_dumps.py -l ${libName} ----'" + commandStr := "($sAbiDiffer ${allowFlags} -lib ${libName} -arch ${arch} -o ${out} -new ${in} -old ${referenceDump})" + commandStr += "|| (echo 'error: Please update ABI references with: $$ANDROID_BUILD_TOP/development/vndk/tools/header-checker/utils/create_reference_dumps.py ${createReferenceDumpFlags} -l ${libName}'" commandStr += " && (mkdir -p $$DIST_DIR/abidiffs && cp ${out} $$DIST_DIR/abidiffs/)" commandStr += " && exit 1)" return blueprint.RuleParams{ @@ -206,7 +206,7 @@ var ( CommandDeps: []string{"$sAbiDiffer"}, } }, - "allowFlags", "referenceDump", "libName", "arch") + "allowFlags", "referenceDump", "libName", "arch", "createReferenceDumpFlags") unzipRefSAbiDump = pctx.AndroidStaticRule("unzipRefSAbiDump", blueprint.RuleParams{ @@ -711,16 +711,19 @@ func UnzipRefDump(ctx android.ModuleContext, zippedRefDump android.Path, baseNam } func SourceAbiDiff(ctx android.ModuleContext, inputDump android.Path, referenceDump android.Path, - baseName, exportedHeaderFlags string, isVndkExt bool) android.OptionalPath { + baseName, exportedHeaderFlags string, isLlndk, isVndkExt bool) android.OptionalPath { outputFile := android.PathForModuleOut(ctx, baseName+".abidiff") libName := strings.TrimSuffix(baseName, filepath.Ext(baseName)) + createReferenceDumpFlags := "" + localAbiCheckAllowFlags := append([]string(nil), abiCheckAllowFlags...) if exportedHeaderFlags == "" { localAbiCheckAllowFlags = append(localAbiCheckAllowFlags, "-advice-only") } - if inList(libName, llndkLibraries) { + if isLlndk { localAbiCheckAllowFlags = append(localAbiCheckAllowFlags, "-consider-opaque-types-different") + createReferenceDumpFlags = "--llndk" } if isVndkExt { localAbiCheckAllowFlags = append(localAbiCheckAllowFlags, "-allow-extensions") @@ -733,10 +736,11 @@ func SourceAbiDiff(ctx android.ModuleContext, inputDump android.Path, referenceD Input: inputDump, Implicit: referenceDump, Args: map[string]string{ - "referenceDump": referenceDump.String(), - "libName": libName, - "arch": ctx.Arch().ArchType.Name, - "allowFlags": strings.Join(localAbiCheckAllowFlags, " "), + "referenceDump": referenceDump.String(), + "libName": libName, + "arch": ctx.Arch().ArchType.Name, + "allowFlags": strings.Join(localAbiCheckAllowFlags, " "), + "createReferenceDumpFlags": createReferenceDumpFlags, }, }) return android.OptionalPathForPath(outputFile) diff --git a/cc/library.go b/cc/library.go index a48b45dbb..c23f26bcd 100644 --- a/cc/library.go +++ b/cc/library.go @@ -794,7 +794,7 @@ func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, objs Objec refAbiDumpFile := getRefAbiDumpFile(ctx, vndkVersion, fileName) if refAbiDumpFile != nil { library.sAbiDiff = SourceAbiDiff(ctx, library.sAbiOutputFile.Path(), - refAbiDumpFile, fileName, exportedHeaderFlags, ctx.isVndkExt()) + refAbiDumpFile, fileName, exportedHeaderFlags, ctx.isLlndk(), ctx.isVndkExt()) } } }