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

Commit 1c683b37 authored by Hsin-Yi Chen's avatar Hsin-Yi Chen Committed by Gerrit Code Review
Browse files

Merge "Do not build ABI dumps for VNDK" into main

parents 91ef5bb8 27bafd02
Loading
Loading
Loading
Loading
+17 −25
Original line number Diff line number Diff line
@@ -1343,12 +1343,10 @@ func getRefAbiDumpFile(ctx android.ModuleInstallPathContext,
		fileName+".lsdump")
}

func getRefAbiDumpDir(isNdk, isVndk bool) string {
func getRefAbiDumpDir(isNdk bool) string {
	var dirName string
	if isNdk {
		dirName = "ndk"
	} else if isVndk {
		dirName = "vndk"
	} else {
		dirName = "platform"
	}
@@ -1374,11 +1372,8 @@ func prevRefAbiDumpVersion(ctx ModuleContext, dumpDir string) int {
	}
}

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() {
func currRefAbiDumpVersion(ctx ModuleContext) string {
	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()
@@ -1427,13 +1422,13 @@ func (library *libraryDecorator) crossVersionAbiDiff(ctx android.ModuleContext,
}

func (library *libraryDecorator) sameVersionAbiDiff(ctx android.ModuleContext, referenceDump android.Path,
	baseName string, isLlndkOrNdk, allowExtensions bool) {
	baseName string, isLlndkOrNdk bool) {

	libName := strings.TrimSuffix(baseName, filepath.Ext(baseName))
	errorMessage := "error: Please update ABI references with: $$ANDROID_BUILD_TOP/development/vndk/tools/header-checker/utils/create_reference_dumps.py -l " + libName

	library.sourceAbiDiff(ctx, referenceDump, baseName, "",
		isLlndkOrNdk, allowExtensions, "current", errorMessage)
		isLlndkOrNdk, false /* allowExtensions */, "current", errorMessage)
}

func (library *libraryDecorator) optInAbiDiff(ctx android.ModuleContext, referenceDump android.Path,
@@ -1463,10 +1458,9 @@ func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, objs Objec
		exportedHeaderFlags := strings.Join(SourceAbiFlags, " ")
		headerAbiChecker := library.getHeaderAbiCheckerProperties(ctx)
		// The logic must be consistent with classifySourceAbiDump.
		isVndk := ctx.useVndk() && ctx.isVndk()
		isNdk := ctx.isNdk(ctx.Config())
		isLlndk := ctx.isImplementationForLLNDKPublic()
		currVersion := currRefAbiDumpVersion(ctx, isVndk)
		currVersion := currRefAbiDumpVersion(ctx)
		library.sAbiOutputFile = transformDumpToLinkedDump(ctx, objs.sAbiDumpFiles, soFile, fileName, exportedHeaderFlags,
			android.OptionalPathForModuleSrc(ctx, library.symbolFileForAbiCheck(ctx)),
			headerAbiChecker.Exclude_symbol_versions,
@@ -1475,10 +1469,9 @@ func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, objs Objec

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

		dumpDir := getRefAbiDumpDir(isNdk, isVndk)
		dumpDir := getRefAbiDumpDir(isNdk)
		binderBitness := ctx.DeviceConfig().BinderBitness()
		// If NDK or PLATFORM library, check against previous version ABI.
		if !isVndk {
		// Check against the previous version.
		prevVersionInt := prevRefAbiDumpVersion(ctx, dumpDir)
		prevVersion := strconv.Itoa(prevVersionInt)
		prevDumpDir := filepath.Join(dumpDir, prevVersion, binderBitness)
@@ -1488,13 +1481,12 @@ func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, objs Objec
				fileName, isLlndk || isNdk,
				strconv.Itoa(prevVersionInt+1), prevVersion)
		}
		}
		// Check against the current version.
		currDumpDir := filepath.Join(dumpDir, currVersion, binderBitness)
		currDumpFile := getRefAbiDumpFile(ctx, currDumpDir, fileName)
		if currDumpFile.Valid() {
			library.sameVersionAbiDiff(ctx, currDumpFile.Path(),
				fileName, isLlndk || isNdk, ctx.IsVndkExt())
				fileName, isLlndk || isNdk)
		}
		// Check against the opt-in reference dumps.
		for i, optInDumpDir := range headerAbiChecker.Ref_dump_dirs {
+10 −23
Original line number Diff line number Diff line
@@ -105,6 +105,7 @@ func classifySourceAbiDump(ctx android.BaseModuleContext) string {
	if headerAbiChecker.explicitlyDisabled() {
		return ""
	}
	if !m.InProduct() && !m.InVendor() {
		// Return NDK if the library is both NDK and LLNDK.
		if m.IsNdk(ctx.Config()) {
			return "NDK"
@@ -112,24 +113,10 @@ func classifySourceAbiDump(ctx android.BaseModuleContext) string {
		if m.isImplementationForLLNDKPublic() {
			return "LLNDK"
		}
	if m.UseVndk() && m.IsVndk() && !m.IsVndkPrivate() {
		if m.IsVndkSp() {
			if m.IsVndkExt() {
				return "VNDK-SP-ext"
			} else {
				return "VNDK-SP"
			}
		} else {
			if m.IsVndkExt() {
				return "VNDK-ext"
			} else {
				return "VNDK-core"
			}
		}
	}
	if m.library.hasStubsVariants() && !m.InProduct() && !m.InVendor() {
		if m.library.hasStubsVariants() {
			return "PLATFORM"
		}
	}
	if headerAbiChecker.enabled() {
		if m.InProduct() {
			return "PRODUCT"