Merge "Do not build ABI dumps for VNDK" into main am: 1c683b372d

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2900489

Change-Id: Icaf97c674bc130b7adf1a581a920349cd8fe86c6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Hsin-Yi Chen
2024-01-11 02:16:14 +00:00
committed by Automerger Merge Worker
2 changed files with 27 additions and 48 deletions

View File

@@ -1343,12 +1343,10 @@ func getRefAbiDumpFile(ctx android.ModuleInstallPathContext,
fileName+".lsdump") fileName+".lsdump")
} }
func getRefAbiDumpDir(isNdk, isVndk bool) string { func getRefAbiDumpDir(isNdk bool) string {
var dirName string var dirName string
if isNdk { if isNdk {
dirName = "ndk" dirName = "ndk"
} else if isVndk {
dirName = "vndk"
} else { } else {
dirName = "platform" dirName = "platform"
} }
@@ -1374,11 +1372,8 @@ func prevRefAbiDumpVersion(ctx ModuleContext, dumpDir string) int {
} }
} }
func currRefAbiDumpVersion(ctx ModuleContext, isVndk bool) string { func currRefAbiDumpVersion(ctx ModuleContext) string {
if isVndk { if ctx.Config().PlatformSdkFinal() {
// 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, // 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. // so choose PLATFORM_SDK_VERSION as the current version.
return ctx.Config().PlatformSdkVersion().String() 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, 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)) 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 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, "", library.sourceAbiDiff(ctx, referenceDump, baseName, "",
isLlndkOrNdk, allowExtensions, "current", errorMessage) isLlndkOrNdk, false /* allowExtensions */, "current", errorMessage)
} }
func (library *libraryDecorator) optInAbiDiff(ctx android.ModuleContext, referenceDump android.Path, 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, " ") exportedHeaderFlags := strings.Join(SourceAbiFlags, " ")
headerAbiChecker := library.getHeaderAbiCheckerProperties(ctx) headerAbiChecker := library.getHeaderAbiCheckerProperties(ctx)
// The logic must be consistent with classifySourceAbiDump. // The logic must be consistent with classifySourceAbiDump.
isVndk := ctx.useVndk() && ctx.isVndk()
isNdk := ctx.isNdk(ctx.Config()) isNdk := ctx.isNdk(ctx.Config())
isLlndk := ctx.isImplementationForLLNDKPublic() isLlndk := ctx.isImplementationForLLNDKPublic()
currVersion := currRefAbiDumpVersion(ctx, isVndk) currVersion := currRefAbiDumpVersion(ctx)
library.sAbiOutputFile = transformDumpToLinkedDump(ctx, objs.sAbiDumpFiles, soFile, fileName, exportedHeaderFlags, library.sAbiOutputFile = transformDumpToLinkedDump(ctx, objs.sAbiDumpFiles, soFile, fileName, exportedHeaderFlags,
android.OptionalPathForModuleSrc(ctx, library.symbolFileForAbiCheck(ctx)), android.OptionalPathForModuleSrc(ctx, library.symbolFileForAbiCheck(ctx)),
headerAbiChecker.Exclude_symbol_versions, headerAbiChecker.Exclude_symbol_versions,
@@ -1475,26 +1469,24 @@ func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, objs Objec
addLsdumpPath(classifySourceAbiDump(ctx) + ":" + library.sAbiOutputFile.String()) addLsdumpPath(classifySourceAbiDump(ctx) + ":" + library.sAbiOutputFile.String())
dumpDir := getRefAbiDumpDir(isNdk, isVndk) dumpDir := getRefAbiDumpDir(isNdk)
binderBitness := ctx.DeviceConfig().BinderBitness() binderBitness := ctx.DeviceConfig().BinderBitness()
// If NDK or PLATFORM library, check against previous version ABI. // Check against the previous version.
if !isVndk { prevVersionInt := prevRefAbiDumpVersion(ctx, dumpDir)
prevVersionInt := prevRefAbiDumpVersion(ctx, dumpDir) prevVersion := strconv.Itoa(prevVersionInt)
prevVersion := strconv.Itoa(prevVersionInt) prevDumpDir := filepath.Join(dumpDir, prevVersion, binderBitness)
prevDumpDir := filepath.Join(dumpDir, prevVersion, binderBitness) prevDumpFile := getRefAbiDumpFile(ctx, prevDumpDir, fileName)
prevDumpFile := getRefAbiDumpFile(ctx, prevDumpDir, fileName) if prevDumpFile.Valid() {
if prevDumpFile.Valid() { library.crossVersionAbiDiff(ctx, prevDumpFile.Path(),
library.crossVersionAbiDiff(ctx, prevDumpFile.Path(), fileName, isLlndk || isNdk,
fileName, isLlndk || isNdk, strconv.Itoa(prevVersionInt+1), prevVersion)
strconv.Itoa(prevVersionInt+1), prevVersion)
}
} }
// Check against the current version. // Check against the current version.
currDumpDir := filepath.Join(dumpDir, currVersion, binderBitness) currDumpDir := filepath.Join(dumpDir, currVersion, binderBitness)
currDumpFile := getRefAbiDumpFile(ctx, currDumpDir, fileName) currDumpFile := getRefAbiDumpFile(ctx, currDumpDir, fileName)
if currDumpFile.Valid() { if currDumpFile.Valid() {
library.sameVersionAbiDiff(ctx, currDumpFile.Path(), library.sameVersionAbiDiff(ctx, currDumpFile.Path(),
fileName, isLlndk || isNdk, ctx.IsVndkExt()) fileName, isLlndk || isNdk)
} }
// Check against the opt-in reference dumps. // Check against the opt-in reference dumps.
for i, optInDumpDir := range headerAbiChecker.Ref_dump_dirs { for i, optInDumpDir := range headerAbiChecker.Ref_dump_dirs {

View File

@@ -105,30 +105,17 @@ func classifySourceAbiDump(ctx android.BaseModuleContext) string {
if headerAbiChecker.explicitlyDisabled() { if headerAbiChecker.explicitlyDisabled() {
return "" return ""
} }
// Return NDK if the library is both NDK and LLNDK. if !m.InProduct() && !m.InVendor() {
if m.IsNdk(ctx.Config()) { // Return NDK if the library is both NDK and LLNDK.
return "NDK" if m.IsNdk(ctx.Config()) {
} return "NDK"
if m.isImplementationForLLNDKPublic() { }
return "LLNDK" if m.isImplementationForLLNDKPublic() {
} return "LLNDK"
if m.UseVndk() && m.IsVndk() && !m.IsVndkPrivate() { }
if m.IsVndkSp() { if m.library.hasStubsVariants() {
if m.IsVndkExt() { return "PLATFORM"
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() {
return "PLATFORM"
} }
if headerAbiChecker.enabled() { if headerAbiChecker.enabled() {
if m.InProduct() { if m.InProduct() {