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

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

Fix the ABI dump directory name for vendor libraries

The condition for vendor libraries is inconsistent between
getRefAbiDumpFile and linkSAbiDumpFiles. It causes the ABI check not to
be triggered for vendor libraries. This commit fixes linkSAbiDumpFiles.
The vendor libraries' ABI dumps are placed in the "platform" directory
for now. A follow-up commit will allow configuring the dump directory
paths.

Test: make
Bug: 227282691
Change-Id: Iad8f92145bce6264bf51efb4b8180bb917a1476d
parent 7584bda2
Loading
Loading
Loading
Loading
+18 −19
Original line number Diff line number Diff line
@@ -1875,25 +1875,21 @@ func prevDumpRefVersion(ctx ModuleContext) int {
	}
}

func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, objs Objects, fileName string, soFile android.Path) {
	if library.sabi.shouldCreateSourceAbiDump() {
		var version string
		var prevVersion int

		if ctx.useVndk() {
			// For modules linking against vndk, follow its vndk version
			version = ctx.Module().(*Module).VndkVersion()
		} else {
			// After sdk finalizatoin, the ABI of the latest API level must be consistent with the source code
			// so the chosen reference dump is the PLATFORM_SDK_VERSION.
			if ctx.Config().PlatformSdkFinal() {
				version = ctx.Config().PlatformSdkVersion().String()
func currRefAbiDumpVersion(ctx ModuleContext, isVndk bool) string {
	if isVndk {
		// Each version of VNDK is independent, so follow the VNDK version which is the codename or PLATFORM_SDK_VERSION.
		return ctx.Module().(*Module).VndkVersion()
	} else if ctx.Config().PlatformSdkFinal() {
		// After sdk finalization, the ABI of the latest API level must be consistent with the source code,
		// so choose PLATFORM_SDK_VERSION as the current version.
		return ctx.Config().PlatformSdkVersion().String()
	} else {
				version = "current"
		return "current"
	}
			prevVersion = prevDumpRefVersion(ctx)
}

func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, objs Objects, fileName string, soFile android.Path) {
	if library.sabi.shouldCreateSourceAbiDump() {
		exportIncludeDirs := library.flagExporter.exportedIncludes(ctx)
		var SourceAbiFlags []string
		for _, dir := range exportIncludeDirs.Strings() {
@@ -1910,10 +1906,12 @@ func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, objs Objec

		addLsdumpPath(classifySourceAbiDump(ctx) + ":" + library.sAbiOutputFile.String())

		isVndk := ctx.useVndk() && ctx.isVndk()
		isNdk := ctx.isNdk(ctx.Config())
		isLlndk := ctx.isImplementationForLLNDKPublic()
		// If NDK or PLATFORM library, check against previous version ABI.
		if !ctx.useVndk() {
		if !isVndk {
			prevVersion := prevDumpRefVersion(ctx)
			prevRefAbiDumpFile := getRefAbiDumpFile(ctx, strconv.Itoa(prevVersion), fileName)
			if prevRefAbiDumpFile != nil {
				library.prevSAbiDiff = sourceAbiDiff(ctx, library.sAbiOutputFile.Path(),
@@ -1924,7 +1922,8 @@ func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, objs Objec
			}
		}

		refAbiDumpFile := getRefAbiDumpFile(ctx, version, fileName)
		currVersion := currRefAbiDumpVersion(ctx, isVndk)
		refAbiDumpFile := getRefAbiDumpFile(ctx, currVersion, fileName)
		if refAbiDumpFile != nil {
			library.sAbiDiff = sourceAbiDiff(ctx, library.sAbiOutputFile.Path(),
				refAbiDumpFile, fileName,