Support text ABI dump file format
This commit adds an option to read ABI reference dump in text file
format directly from `prebuilts/abi-dumps`. If both the text file and
the gzip format exist, an error will be emitted.
Bug: 78650426
Test: create libexif.lsdump.gz and it works as usual
Test: create libexif.lsdump (decompressed) and it works
Test: touch both libexif.lsdump.gz and libexif.lsdump and it errors
Change-Id: I420a5953fb80855cb5c07e5a4d347fb6709f0340
diff --git a/android/paths.go b/android/paths.go
index f321a4b..31c5977 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -826,10 +826,15 @@
return PathForOutput(ctx, ".intermediates", ctx.ModuleDir(), ctx.ModuleName(), ctx.ModuleSubDir())
}
-// PathForVndkRefDump returns an OptionalPath representing the path of the reference
-// abi dump for the given module. This is not guaranteed to be valid.
-func PathForVndkRefAbiDump(ctx ModuleContext, version, fileName string, isLlndk bool) OptionalPath {
+// PathForVndkRefAbiDump returns an OptionalPath representing the path of the
+// reference abi dump for the given module. This is not guaranteed to be valid.
+func PathForVndkRefAbiDump(ctx ModuleContext, version, fileName string,
+ isLlndk, isGzip bool) OptionalPath {
+
arches := ctx.DeviceConfig().Arches()
+ if len(arches) == 0 {
+ panic("device build with no primary arch")
+ }
currentArch := ctx.Arch()
archNameAndVariant := currentArch.ArchType.String()
if currentArch.ArchVariant != "" {
@@ -843,14 +848,18 @@
dirName = "vndk"
}
- if len(arches) == 0 {
- panic("device build with no primary arch")
- }
binderBitness := ctx.DeviceConfig().BinderBitness()
- ext := ".lsdump.gz"
- refDumpFileStr := "prebuilts/abi-dumps/" + dirName + "/" + version + "/" + binderBitness + "/" +
- archNameAndVariant + "/source-based/" + fileName + ext
- return ExistentPathForSource(ctx, refDumpFileStr)
+
+ var ext string
+ if isGzip {
+ ext = ".lsdump.gz"
+ } else {
+ ext = ".lsdump"
+ }
+
+ return ExistentPathForSource(ctx, "prebuilts", "abi-dumps", dirName,
+ version, binderBitness, archNameAndVariant, "source-based",
+ fileName+ext)
}
// PathForModuleOut returns a Path representing the paths... under the module's