Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6ad1e4b5 authored by Hsin-Yi Chen's avatar Hsin-Yi Chen
Browse files

Add diff_flags as a header_abi_checker property

The property allows developers to add extra flags to header-abi-diff for
specific libraries.

Bug: 232891473
Test: m libbinder.vendor
Change-Id: I203af73c784dfc7738bb64f57b224c08d5c595ce
Merged-In: I203af73c784dfc7738bb64f57b224c08d5c595ce
(cherry picked from commit 4f992b66)
parent 027881cf
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -957,9 +957,10 @@ func unzipRefDump(ctx android.ModuleContext, zippedRefDump android.Path, baseNam
	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,
	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")
	libName := strings.TrimSuffix(baseName, filepath.Ext(baseName))
@@ -990,6 +991,8 @@ func sourceAbiDiff(ctx android.ModuleContext, inputDump android.Path, referenceD
	if isVndkExt {
		extraFlags = append(extraFlags, "-allow-extensions")
	}
	// TODO(b/232891473): Simplify the above logic with diffFlags.
	extraFlags = append(extraFlags, diffFlags...)

	ctx.Build(pctx, android.BuildParams{
		Rule:        sAbiDiff,
+4 −0
Original line number Diff line number Diff line
@@ -110,6 +110,9 @@ type LibraryProperties struct {
		// Run checks on all APIs (in addition to the ones referred by
		// one of exported ELF symbols.)
		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.
@@ -1634,6 +1637,7 @@ func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, objs Objec
		if refAbiDumpFile != nil {
			library.sAbiDiff = sourceAbiDiff(ctx, library.sAbiOutputFile.Path(),
				refAbiDumpFile, fileName, exportedHeaderFlags,
				library.Properties.Header_abi_checker.Diff_flags,
				Bool(library.Properties.Header_abi_checker.Check_all_apis),
				ctx.IsLlndk(), ctx.isNdk(ctx.Config()), ctx.IsVndkExt())
		}