Merge "android_filesystem modules can be included in APEX"
This commit is contained in:
@@ -7,6 +7,7 @@ bootstrap_go_package {
|
|||||||
"soong-android",
|
"soong-android",
|
||||||
"soong-bpf",
|
"soong-bpf",
|
||||||
"soong-cc",
|
"soong-cc",
|
||||||
|
"soong-filesystem",
|
||||||
"soong-java",
|
"soong-java",
|
||||||
"soong-python",
|
"soong-python",
|
||||||
"soong-rust",
|
"soong-rust",
|
||||||
|
17
apex/apex.go
17
apex/apex.go
@@ -30,6 +30,7 @@ import (
|
|||||||
"android/soong/bpf"
|
"android/soong/bpf"
|
||||||
"android/soong/cc"
|
"android/soong/cc"
|
||||||
prebuilt_etc "android/soong/etc"
|
prebuilt_etc "android/soong/etc"
|
||||||
|
"android/soong/filesystem"
|
||||||
"android/soong/java"
|
"android/soong/java"
|
||||||
"android/soong/python"
|
"android/soong/python"
|
||||||
"android/soong/rust"
|
"android/soong/rust"
|
||||||
@@ -96,6 +97,9 @@ type apexBundleProperties struct {
|
|||||||
// List of BPF programs inside this APEX bundle.
|
// List of BPF programs inside this APEX bundle.
|
||||||
Bpfs []string
|
Bpfs []string
|
||||||
|
|
||||||
|
// List of filesystem images that are embedded inside this APEX bundle.
|
||||||
|
Filesystems []string
|
||||||
|
|
||||||
// Name of the apex_key module that provides the private key to sign this APEX bundle.
|
// Name of the apex_key module that provides the private key to sign this APEX bundle.
|
||||||
Key *string
|
Key *string
|
||||||
|
|
||||||
@@ -530,6 +534,7 @@ var (
|
|||||||
bpfTag = dependencyTag{name: "bpf", payload: true}
|
bpfTag = dependencyTag{name: "bpf", payload: true}
|
||||||
certificateTag = dependencyTag{name: "certificate"}
|
certificateTag = dependencyTag{name: "certificate"}
|
||||||
executableTag = dependencyTag{name: "executable", payload: true}
|
executableTag = dependencyTag{name: "executable", payload: true}
|
||||||
|
fsTag = dependencyTag{name: "filesystem", payload: true}
|
||||||
javaLibTag = dependencyTag{name: "javaLib", payload: true}
|
javaLibTag = dependencyTag{name: "javaLib", payload: true}
|
||||||
jniLibTag = dependencyTag{name: "jniLib", payload: true}
|
jniLibTag = dependencyTag{name: "jniLib", payload: true}
|
||||||
keyTag = dependencyTag{name: "key"}
|
keyTag = dependencyTag{name: "key"}
|
||||||
@@ -709,6 +714,7 @@ func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) {
|
|||||||
commonVariation := ctx.Config().AndroidCommonTarget.Variations()
|
commonVariation := ctx.Config().AndroidCommonTarget.Variations()
|
||||||
ctx.AddFarVariationDependencies(commonVariation, javaLibTag, a.properties.Java_libs...)
|
ctx.AddFarVariationDependencies(commonVariation, javaLibTag, a.properties.Java_libs...)
|
||||||
ctx.AddFarVariationDependencies(commonVariation, bpfTag, a.properties.Bpfs...)
|
ctx.AddFarVariationDependencies(commonVariation, bpfTag, a.properties.Bpfs...)
|
||||||
|
ctx.AddFarVariationDependencies(commonVariation, fsTag, a.properties.Filesystems...)
|
||||||
|
|
||||||
// With EMMA_INSTRUMENT_FRAMEWORK=true the ART boot image includes jacoco library.
|
// With EMMA_INSTRUMENT_FRAMEWORK=true the ART boot image includes jacoco library.
|
||||||
if a.artApex && ctx.Config().IsEnvTrue("EMMA_INSTRUMENT_FRAMEWORK") {
|
if a.artApex && ctx.Config().IsEnvTrue("EMMA_INSTRUMENT_FRAMEWORK") {
|
||||||
@@ -1481,6 +1487,11 @@ func apexFileForBpfProgram(ctx android.BaseModuleContext, builtFile android.Path
|
|||||||
return newApexFile(ctx, builtFile, builtFile.Base(), dirInApex, etc, bpfProgram)
|
return newApexFile(ctx, builtFile, builtFile.Base(), dirInApex, etc, bpfProgram)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func apexFileForFilesystem(ctx android.BaseModuleContext, buildFile android.Path, fs filesystem.Filesystem) apexFile {
|
||||||
|
dirInApex := filepath.Join("etc", "fs")
|
||||||
|
return newApexFile(ctx, buildFile, buildFile.Base(), dirInApex, etc, fs)
|
||||||
|
}
|
||||||
|
|
||||||
// WalyPayloadDeps visits dependencies that contributes to the payload of this APEX. For each of the
|
// WalyPayloadDeps visits dependencies that contributes to the payload of this APEX. For each of the
|
||||||
// visited module, the `do` callback is executed. Returning true in the callback continues the visit
|
// visited module, the `do` callback is executed. Returning true in the callback continues the visit
|
||||||
// to the child modules. Returning false makes the visit to continue in the sibling or the parent
|
// to the child modules. Returning false makes the visit to continue in the sibling or the parent
|
||||||
@@ -1655,6 +1666,12 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
} else {
|
} else {
|
||||||
ctx.PropertyErrorf("bpfs", "%q is not a bpf module", depName)
|
ctx.PropertyErrorf("bpfs", "%q is not a bpf module", depName)
|
||||||
}
|
}
|
||||||
|
case fsTag:
|
||||||
|
if fs, ok := child.(filesystem.Filesystem); ok {
|
||||||
|
filesInfo = append(filesInfo, apexFileForFilesystem(ctx, fs.OutputPath(), fs))
|
||||||
|
} else {
|
||||||
|
ctx.PropertyErrorf("filesystems", "%q is not a filesystem module", depName)
|
||||||
|
}
|
||||||
case prebuiltTag:
|
case prebuiltTag:
|
||||||
if prebuilt, ok := child.(prebuilt_etc.PrebuiltEtcModule); ok {
|
if prebuilt, ok := child.(prebuilt_etc.PrebuiltEtcModule); ok {
|
||||||
filesInfo = append(filesInfo, apexFileForPrebuiltEtc(ctx, prebuilt, depName))
|
filesInfo = append(filesInfo, apexFileForPrebuiltEtc(ctx, prebuilt, depName))
|
||||||
|
@@ -46,7 +46,10 @@ func filesystemFactory() android.Module {
|
|||||||
return module
|
return module
|
||||||
}
|
}
|
||||||
|
|
||||||
var dependencyTag = struct{ blueprint.BaseDependencyTag }{}
|
var dependencyTag = struct {
|
||||||
|
blueprint.BaseDependencyTag
|
||||||
|
android.InstallAlwaysNeededDependencyTag
|
||||||
|
}{}
|
||||||
|
|
||||||
func (f *filesystem) DepsMutator(ctx android.BottomUpMutatorContext) {
|
func (f *filesystem) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||||
f.AddDeps(ctx, dependencyTag)
|
f.AddDeps(ctx, dependencyTag)
|
||||||
@@ -80,7 +83,7 @@ func (f *filesystem) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
Text(">").Output(propFile).
|
Text(">").Output(propFile).
|
||||||
Implicit(mkuserimg)
|
Implicit(mkuserimg)
|
||||||
|
|
||||||
f.output = android.PathForModuleOut(ctx, "filesystem.img").OutputPath
|
f.output = android.PathForModuleOut(ctx, f.installFileName()).OutputPath
|
||||||
builder.Command().BuiltTool("build_image").
|
builder.Command().BuiltTool("build_image").
|
||||||
Text(rootDir.String()). // input directory
|
Text(rootDir.String()). // input directory
|
||||||
Input(propFile).
|
Input(propFile).
|
||||||
@@ -109,3 +112,16 @@ func (f *filesystem) AndroidMkEntries() []android.AndroidMkEntries {
|
|||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Filesystem is the public interface for the filesystem struct. Currently, it's only for the apex
|
||||||
|
// package to have access to the output file.
|
||||||
|
type Filesystem interface {
|
||||||
|
android.Module
|
||||||
|
OutputPath() android.Path
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ Filesystem = (*filesystem)(nil)
|
||||||
|
|
||||||
|
func (f *filesystem) OutputPath() android.Path {
|
||||||
|
return f.output
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user