Merge "Print --llndk to create_reference_dumps command"

This commit is contained in:
Logan Chien 2019-02-19 03:48:12 +00:00 committed by Gerrit Code Review
commit 8a851cfce8
2 changed files with 14 additions and 10 deletions

View file

@ -197,8 +197,8 @@ var (
sAbiDiff = pctx.AndroidRuleFunc("sAbiDiff", sAbiDiff = pctx.AndroidRuleFunc("sAbiDiff",
func(ctx android.PackageRuleContext) blueprint.RuleParams { func(ctx android.PackageRuleContext) blueprint.RuleParams {
// TODO(b/78139997): Add -check-all-apis back // TODO(b/78139997): Add -check-all-apis back
commandStr := "($sAbiDiffer $allowFlags -lib $libName -arch $arch -o ${out} -new $in -old $referenceDump)" 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 += "|| (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 += " && (mkdir -p $$DIST_DIR/abidiffs && cp ${out} $$DIST_DIR/abidiffs/)"
commandStr += " && exit 1)" commandStr += " && exit 1)"
return blueprint.RuleParams{ return blueprint.RuleParams{
@ -206,7 +206,7 @@ var (
CommandDeps: []string{"$sAbiDiffer"}, CommandDeps: []string{"$sAbiDiffer"},
} }
}, },
"allowFlags", "referenceDump", "libName", "arch") "allowFlags", "referenceDump", "libName", "arch", "createReferenceDumpFlags")
unzipRefSAbiDump = pctx.AndroidStaticRule("unzipRefSAbiDump", unzipRefSAbiDump = pctx.AndroidStaticRule("unzipRefSAbiDump",
blueprint.RuleParams{ 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, 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") outputFile := android.PathForModuleOut(ctx, baseName+".abidiff")
libName := strings.TrimSuffix(baseName, filepath.Ext(baseName)) libName := strings.TrimSuffix(baseName, filepath.Ext(baseName))
createReferenceDumpFlags := ""
localAbiCheckAllowFlags := append([]string(nil), abiCheckAllowFlags...) localAbiCheckAllowFlags := append([]string(nil), abiCheckAllowFlags...)
if exportedHeaderFlags == "" { if exportedHeaderFlags == "" {
localAbiCheckAllowFlags = append(localAbiCheckAllowFlags, "-advice-only") localAbiCheckAllowFlags = append(localAbiCheckAllowFlags, "-advice-only")
} }
if inList(libName, llndkLibraries) { if isLlndk {
localAbiCheckAllowFlags = append(localAbiCheckAllowFlags, "-consider-opaque-types-different") localAbiCheckAllowFlags = append(localAbiCheckAllowFlags, "-consider-opaque-types-different")
createReferenceDumpFlags = "--llndk"
} }
if isVndkExt { if isVndkExt {
localAbiCheckAllowFlags = append(localAbiCheckAllowFlags, "-allow-extensions") localAbiCheckAllowFlags = append(localAbiCheckAllowFlags, "-allow-extensions")
@ -733,10 +736,11 @@ func SourceAbiDiff(ctx android.ModuleContext, inputDump android.Path, referenceD
Input: inputDump, Input: inputDump,
Implicit: referenceDump, Implicit: referenceDump,
Args: map[string]string{ Args: map[string]string{
"referenceDump": referenceDump.String(), "referenceDump": referenceDump.String(),
"libName": libName, "libName": libName,
"arch": ctx.Arch().ArchType.Name, "arch": ctx.Arch().ArchType.Name,
"allowFlags": strings.Join(localAbiCheckAllowFlags, " "), "allowFlags": strings.Join(localAbiCheckAllowFlags, " "),
"createReferenceDumpFlags": createReferenceDumpFlags,
}, },
}) })
return android.OptionalPathForPath(outputFile) return android.OptionalPathForPath(outputFile)

View file

@ -794,7 +794,7 @@ func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, objs Objec
refAbiDumpFile := getRefAbiDumpFile(ctx, vndkVersion, fileName) refAbiDumpFile := getRefAbiDumpFile(ctx, vndkVersion, fileName)
if refAbiDumpFile != nil { if refAbiDumpFile != nil {
library.sAbiDiff = SourceAbiDiff(ctx, library.sAbiOutputFile.Path(), library.sAbiDiff = SourceAbiDiff(ctx, library.sAbiOutputFile.Path(),
refAbiDumpFile, fileName, exportedHeaderFlags, ctx.isVndkExt()) refAbiDumpFile, fileName, exportedHeaderFlags, ctx.isLlndk(), ctx.isVndkExt())
} }
} }
} }