summaryrefslogtreecommitdiff
path: root/apex/apex.go
diff options
context:
space:
mode:
author Theotime Combes <tcombes@google.com> 2020-06-12 12:46:59 +0000
committer Theotime Combes <tcombes@google.com> 2020-08-28 12:03:00 +0000
commit4ba38c1a3fd4ec8e28aad19e35f84fb9373f9dd5 (patch)
tree23595204641a99f20d4e10b51f204cc51da9de72 /apex/apex.go
parent2d815963ba597cce3b2401d405d0ed3a7beb5737 (diff)
Add F2FS support for APEX build system
Add the new property payload_fs_type in apex module type. Either 'f2fs' or 'ext4'. Default 'ext4'. Test: m Bug: 158453869 Change-Id: I36f373251bd597e11acb62af75437a87e2a531ec Merged-In: I36f373251bd597e11acb62af75437a87e2a531ec
Diffstat (limited to 'apex/apex.go')
-rw-r--r--apex/apex.go36
1 files changed, 36 insertions, 0 deletions
diff --git a/apex/apex.go b/apex/apex.go
index 1267ec758..03d25d897 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -41,6 +41,9 @@ const (
imageApexType = "image"
zipApexType = "zip"
flattenedApexType = "flattened"
+
+ ext4FsType = "ext4"
+ f2fsFsType = "f2fs"
)
type dependencyTag struct {
@@ -1026,6 +1029,10 @@ type apexBundleProperties struct {
// Should be only used in non-system apexes (e.g. vendor: true).
// Default is false.
Use_vndk_as_stable *bool
+
+ // The type of filesystem to use for an image apex. Either 'ext4' or 'f2fs'.
+ // Default 'ext4'.
+ Payload_fs_type *string
}
type apexTargetBundleProperties struct {
@@ -1233,6 +1240,24 @@ func (af *apexFile) AvailableToPlatform() bool {
return false
}
+type fsType int
+
+const (
+ ext4 fsType = iota
+ f2fs
+)
+
+func (f fsType) string() string {
+ switch f {
+ case ext4:
+ return ext4FsType
+ case f2fs:
+ return f2fsFsType
+ default:
+ panic(fmt.Errorf("unknown APEX payload type %d", f))
+ }
+}
+
type apexBundle struct {
android.ModuleBase
android.DefaultableModuleBase
@@ -1298,6 +1323,8 @@ type apexBundle struct {
// Optional list of lint report zip files for apexes that contain java or app modules
lintReports android.Paths
+
+ payloadFsType fsType
}
func addDependenciesForNativeModules(ctx android.BottomUpMutatorContext,
@@ -2270,6 +2297,15 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
a.installDir = android.PathForModuleInstall(ctx, "apex")
a.filesInfo = filesInfo
+ switch proptools.StringDefault(a.properties.Payload_fs_type, ext4FsType) {
+ case ext4FsType:
+ a.payloadFsType = ext4
+ case f2fsFsType:
+ a.payloadFsType = f2fs
+ default:
+ ctx.PropertyErrorf("payload_fs_type", "%q is not a valid filesystem for apex [ext4, f2fs]", *a.properties.Payload_fs_type)
+ }
+
// Optimization. If we are building bundled APEX, for the files that are gathered due to the
// transitive dependencies, don't place them inside the APEX, but place a symlink pointing
// the same library in the system partition, thus effectively sharing the same libraries