Merge "logical_partition.groups.partitions.filesystem can be empty" into main am: ae74fb63f1 am: a49acb5b68
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3241362
Change-Id: I06fa60bd3cf0d3795b7d3660a4f302f439204b64
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/filesystem/logical_partition.go b/filesystem/logical_partition.go
index e483fe4..988a57b 100644
--- a/filesystem/logical_partition.go
+++ b/filesystem/logical_partition.go
@@ -146,9 +146,16 @@
partitionNames[pName] = true
}
// Get size of the partition by reading the -size.txt file
- pSize := fmt.Sprintf("$(cat %s)", sparseImageSizes[pName])
+ var pSize string
+ if size, hasSize := sparseImageSizes[pName]; hasSize {
+ pSize = fmt.Sprintf("$(cat %s)", size)
+ } else {
+ pSize = "0"
+ }
cmd.FlagWithArg("--partition=", fmt.Sprintf("%s:readonly:%s:%s", pName, pSize, gName))
- cmd.FlagWithInput("--image="+pName+"=", sparseImages[pName])
+ if image, hasImage := sparseImages[pName]; hasImage {
+ cmd.FlagWithInput("--image="+pName+"=", image)
+ }
}
}
@@ -192,6 +199,9 @@
// Add a rule that converts the filesystem for the given partition to the given rule builder. The
// path to the sparse file and the text file having the size of the partition are returned.
func sparseFilesystem(ctx android.ModuleContext, p partitionProperties, builder *android.RuleBuilder) (sparseImg android.OutputPath, sizeTxt android.OutputPath) {
+ if p.Filesystem == nil {
+ return
+ }
img := android.PathForModuleSrc(ctx, proptools.String(p.Filesystem))
name := proptools.String(p.Name)
sparseImg = android.PathForModuleOut(ctx, name+".img").OutputPath