Merge "Split APEX ABI dumps from implementation ABI dumps" into main
This commit is contained in:
@@ -1261,6 +1261,18 @@ func (library *libraryDecorator) linkLlndkSAbiDumpFiles(ctx ModuleContext,
|
|||||||
"34")
|
"34")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (library *libraryDecorator) linkApexSAbiDumpFiles(ctx ModuleContext,
|
||||||
|
deps PathDeps, sAbiDumpFiles android.Paths, soFile android.Path, libFileName string,
|
||||||
|
excludeSymbolVersions, excludeSymbolTags []string, sdkVersion string) android.Path {
|
||||||
|
return transformDumpToLinkedDump(ctx,
|
||||||
|
sAbiDumpFiles, soFile, libFileName+".apex",
|
||||||
|
library.exportedIncludeDirsForAbiCheck(ctx),
|
||||||
|
android.OptionalPathForModuleSrc(ctx, library.Properties.Stubs.Symbol_file),
|
||||||
|
append([]string{"*_PLATFORM", "*_PRIVATE"}, excludeSymbolVersions...),
|
||||||
|
append([]string{"platform-only"}, excludeSymbolTags...),
|
||||||
|
sdkVersion)
|
||||||
|
}
|
||||||
|
|
||||||
func getRefAbiDumpFile(ctx android.ModuleInstallPathContext,
|
func getRefAbiDumpFile(ctx android.ModuleInstallPathContext,
|
||||||
versionedDumpDir, fileName string) android.OptionalPath {
|
versionedDumpDir, fileName string) android.OptionalPath {
|
||||||
|
|
||||||
@@ -1276,21 +1288,21 @@ func getRefAbiDumpFile(ctx android.ModuleInstallPathContext,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Return the previous and current SDK versions for cross-version ABI diff.
|
// Return the previous and current SDK versions for cross-version ABI diff.
|
||||||
func crossVersionAbiDiffSdkVersions(ctx ModuleContext, dumpDir string) (string, string) {
|
func crossVersionAbiDiffSdkVersions(ctx ModuleContext, dumpDir string) (int, int) {
|
||||||
sdkVersionInt := ctx.Config().PlatformSdkVersion().FinalInt()
|
sdkVersionInt := ctx.Config().PlatformSdkVersion().FinalInt()
|
||||||
sdkVersionStr := ctx.Config().PlatformSdkVersion().String()
|
|
||||||
|
|
||||||
if ctx.Config().PlatformSdkFinal() {
|
if ctx.Config().PlatformSdkFinal() {
|
||||||
return strconv.Itoa(sdkVersionInt - 1), sdkVersionStr
|
return sdkVersionInt - 1, sdkVersionInt
|
||||||
} else {
|
} else {
|
||||||
// The platform SDK version can be upgraded before finalization while the corresponding abi dumps hasn't
|
// The platform SDK version can be upgraded before finalization while the corresponding abi dumps hasn't
|
||||||
// been generated. Thus the Cross-Version Check chooses PLATFORM_SDK_VERION - 1 as previous version.
|
// been generated. Thus the Cross-Version Check chooses PLATFORM_SDK_VERION - 1 as previous version.
|
||||||
// This situation could be identified by checking the existence of the PLATFORM_SDK_VERION dump directory.
|
// This situation could be identified by checking the existence of the PLATFORM_SDK_VERION dump directory.
|
||||||
versionedDumpDir := android.ExistentPathForSource(ctx, dumpDir, sdkVersionStr)
|
versionedDumpDir := android.ExistentPathForSource(ctx,
|
||||||
|
dumpDir, ctx.Config().PlatformSdkVersion().String())
|
||||||
if versionedDumpDir.Valid() {
|
if versionedDumpDir.Valid() {
|
||||||
return sdkVersionStr, strconv.Itoa(sdkVersionInt + 1)
|
return sdkVersionInt, sdkVersionInt + 1
|
||||||
} else {
|
} else {
|
||||||
return strconv.Itoa(sdkVersionInt - 1), sdkVersionStr
|
return sdkVersionInt - 1, sdkVersionInt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1387,7 +1399,7 @@ func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, deps PathD
|
|||||||
headerAbiChecker.Exclude_symbol_tags,
|
headerAbiChecker.Exclude_symbol_tags,
|
||||||
currSdkVersion)
|
currSdkVersion)
|
||||||
|
|
||||||
var llndkDump android.Path
|
var llndkDump, apexVariantDump android.Path
|
||||||
tags := classifySourceAbiDump(ctx)
|
tags := classifySourceAbiDump(ctx)
|
||||||
for _, tag := range tags {
|
for _, tag := range tags {
|
||||||
if tag == llndkLsdumpTag {
|
if tag == llndkLsdumpTag {
|
||||||
@@ -1399,6 +1411,15 @@ func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, deps PathD
|
|||||||
headerAbiChecker.Exclude_symbol_tags)
|
headerAbiChecker.Exclude_symbol_tags)
|
||||||
}
|
}
|
||||||
addLsdumpPath(string(tag) + ":" + llndkDump.String())
|
addLsdumpPath(string(tag) + ":" + llndkDump.String())
|
||||||
|
} else if tag == apexLsdumpTag {
|
||||||
|
if apexVariantDump == nil {
|
||||||
|
apexVariantDump = library.linkApexSAbiDumpFiles(ctx,
|
||||||
|
deps, objs.sAbiDumpFiles, soFile, fileName,
|
||||||
|
headerAbiChecker.Exclude_symbol_versions,
|
||||||
|
headerAbiChecker.Exclude_symbol_tags,
|
||||||
|
currSdkVersion)
|
||||||
|
}
|
||||||
|
addLsdumpPath(string(tag) + ":" + apexVariantDump.String())
|
||||||
} else {
|
} else {
|
||||||
addLsdumpPath(string(tag) + ":" + implDump.String())
|
addLsdumpPath(string(tag) + ":" + implDump.String())
|
||||||
}
|
}
|
||||||
@@ -1412,11 +1433,14 @@ func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, deps PathD
|
|||||||
}
|
}
|
||||||
dumpDir := filepath.Join("prebuilts", "abi-dumps", dumpDirName)
|
dumpDir := filepath.Join("prebuilts", "abi-dumps", dumpDirName)
|
||||||
isLlndk := (tag == llndkLsdumpTag)
|
isLlndk := (tag == llndkLsdumpTag)
|
||||||
|
isApex := (tag == apexLsdumpTag)
|
||||||
isNdk := (tag == ndkLsdumpTag)
|
isNdk := (tag == ndkLsdumpTag)
|
||||||
binderBitness := ctx.DeviceConfig().BinderBitness()
|
binderBitness := ctx.DeviceConfig().BinderBitness()
|
||||||
nameExt := ""
|
nameExt := ""
|
||||||
if isLlndk {
|
if isLlndk {
|
||||||
nameExt = "llndk"
|
nameExt = "llndk"
|
||||||
|
} else if isApex {
|
||||||
|
nameExt = "apex"
|
||||||
}
|
}
|
||||||
// Check against the previous version.
|
// Check against the previous version.
|
||||||
var prevVersion, currVersion string
|
var prevVersion, currVersion string
|
||||||
@@ -1430,7 +1454,13 @@ func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, deps PathD
|
|||||||
sourceDump = llndkDump
|
sourceDump = llndkDump
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
prevVersion, currVersion = crossVersionAbiDiffSdkVersions(ctx, dumpDir)
|
prevVersionInt, currVersionInt := crossVersionAbiDiffSdkVersions(ctx, dumpDir)
|
||||||
|
prevVersion = strconv.Itoa(prevVersionInt)
|
||||||
|
currVersion = strconv.Itoa(currVersionInt)
|
||||||
|
// APEX dumps are generated by different rules after trunk stable.
|
||||||
|
if isApex && prevVersionInt > 34 {
|
||||||
|
sourceDump = apexVariantDump
|
||||||
|
}
|
||||||
}
|
}
|
||||||
prevDumpDir := filepath.Join(dumpDir, prevVersion, binderBitness)
|
prevDumpDir := filepath.Join(dumpDir, prevVersion, binderBitness)
|
||||||
prevDumpFile := getRefAbiDumpFile(ctx, prevDumpDir, fileName)
|
prevDumpFile := getRefAbiDumpFile(ctx, prevDumpDir, fileName)
|
||||||
@@ -1447,6 +1477,10 @@ func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, deps PathD
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
currVersion = currSdkVersion
|
currVersion = currSdkVersion
|
||||||
|
if isApex && (!ctx.Config().PlatformSdkFinal() ||
|
||||||
|
ctx.Config().PlatformSdkVersion().FinalInt() > 34) {
|
||||||
|
sourceDump = apexVariantDump
|
||||||
|
}
|
||||||
}
|
}
|
||||||
currDumpDir := filepath.Join(dumpDir, currVersion, binderBitness)
|
currDumpDir := filepath.Join(dumpDir, currVersion, binderBitness)
|
||||||
currDumpFile := getRefAbiDumpFile(ctx, currDumpDir, fileName)
|
currDumpFile := getRefAbiDumpFile(ctx, currDumpDir, fileName)
|
||||||
|
11
cc/sabi.go
11
cc/sabi.go
@@ -29,6 +29,7 @@ var (
|
|||||||
type lsdumpTag string
|
type lsdumpTag string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
apexLsdumpTag lsdumpTag = "APEX"
|
||||||
llndkLsdumpTag lsdumpTag = "LLNDK"
|
llndkLsdumpTag lsdumpTag = "LLNDK"
|
||||||
ndkLsdumpTag lsdumpTag = "NDK"
|
ndkLsdumpTag lsdumpTag = "NDK"
|
||||||
platformLsdumpTag lsdumpTag = "PLATFORM"
|
platformLsdumpTag lsdumpTag = "PLATFORM"
|
||||||
@@ -39,6 +40,8 @@ const (
|
|||||||
// Return the prebuilt ABI dump directory for a tag; an empty string for an opt-in dump.
|
// Return the prebuilt ABI dump directory for a tag; an empty string for an opt-in dump.
|
||||||
func (tag *lsdumpTag) dirName() string {
|
func (tag *lsdumpTag) dirName() string {
|
||||||
switch *tag {
|
switch *tag {
|
||||||
|
case apexLsdumpTag:
|
||||||
|
return "platform"
|
||||||
case ndkLsdumpTag:
|
case ndkLsdumpTag:
|
||||||
return "ndk"
|
return "ndk"
|
||||||
case llndkLsdumpTag:
|
case llndkLsdumpTag:
|
||||||
@@ -134,11 +137,13 @@ func classifySourceAbiDump(ctx android.BaseModuleContext) []lsdumpTag {
|
|||||||
if m.isImplementationForLLNDKPublic() {
|
if m.isImplementationForLLNDKPublic() {
|
||||||
result = append(result, llndkLsdumpTag)
|
result = append(result, llndkLsdumpTag)
|
||||||
}
|
}
|
||||||
// Return NDK if the library is both NDK and APEX.
|
|
||||||
// TODO(b/309880485): Split NDK and APEX ABI.
|
|
||||||
if m.IsNdk(ctx.Config()) {
|
if m.IsNdk(ctx.Config()) {
|
||||||
result = append(result, ndkLsdumpTag)
|
result = append(result, ndkLsdumpTag)
|
||||||
} else if m.library.hasStubsVariants() || headerAbiChecker.enabled() {
|
}
|
||||||
|
// APEX and opt-in platform dumps are placed in the same directory.
|
||||||
|
if m.library.hasStubsVariants() {
|
||||||
|
result = append(result, apexLsdumpTag)
|
||||||
|
} else if headerAbiChecker.enabled() {
|
||||||
result = append(result, platformLsdumpTag)
|
result = append(result, platformLsdumpTag)
|
||||||
}
|
}
|
||||||
} else if headerAbiChecker.enabled() {
|
} else if headerAbiChecker.enabled() {
|
||||||
|
Reference in New Issue
Block a user