Make some apex properties configurable

This allows using select statements with these.

* androidManifest
* canned_fs_config
* systemserverclasspath_fragments

Bug: 354824866
Test: m
Change-Id: I4c2182944ec14d99332f437c39a19ba0dc6b7731
This commit is contained in:
Inseob Kim 2024-07-23 13:39:54 +09:00 committed by Bartłomiej Rudecki
parent 3cc3ca4d62
commit 7889cf45fa
Signed by: przekichane
GPG key ID: 751F23C6F014EF76
2 changed files with 14 additions and 9 deletions

View file

@ -86,7 +86,7 @@ type apexBundleProperties struct {
// AndroidManifest.xml file used for the zip container of this APEX bundle. If unspecified,
// a default one is automatically generated.
AndroidManifest *string `android:"path"`
AndroidManifest proptools.Configurable[string] `android:"path,replace_instead_of_append"`
// Determines the file contexts file for setting the security contexts to files in this APEX
// bundle. For platform APEXes, this should points to a file under /system/sepolicy Default:
@ -104,7 +104,7 @@ type apexBundleProperties struct {
// path_or_glob is a path or glob pattern for a file or set of files,
// uid/gid are numerial values of user ID and group ID, mode is octal value
// for the file mode, and cap is hexadecimal value for the capability.
Canned_fs_config *string `android:"path"`
Canned_fs_config proptools.Configurable[string] `android:"path,replace_instead_of_append"`
ApexNativeDependencies
@ -117,7 +117,8 @@ type apexBundleProperties struct {
Bootclasspath_fragments []string
// List of systemserverclasspath fragments that are embedded inside this APEX bundle.
Systemserverclasspath_fragments []string
Systemserverclasspath_fragments proptools.Configurable[[]string]
ResolvedSystemserverclasspathFragments []string `blueprint:"mutated"`
// List of java libraries that are embedded inside this APEX bundle.
Java_libs []string
@ -842,11 +843,13 @@ func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) {
}
}
a.properties.ResolvedSystemserverclasspathFragments = a.properties.Systemserverclasspath_fragments.GetOrDefault(a.ConfigurableEvaluator(ctx), nil)
// Common-arch dependencies come next
commonVariation := ctx.Config().AndroidCommonTarget.Variations()
ctx.AddFarVariationDependencies(commonVariation, rroTag, a.properties.Rros...)
ctx.AddFarVariationDependencies(commonVariation, bcpfTag, a.properties.Bootclasspath_fragments...)
ctx.AddFarVariationDependencies(commonVariation, sscpfTag, a.properties.Systemserverclasspath_fragments...)
ctx.AddFarVariationDependencies(commonVariation, sscpfTag, a.properties.ResolvedSystemserverclasspathFragments...)
ctx.AddFarVariationDependencies(commonVariation, javaLibTag, a.properties.Java_libs...)
ctx.AddFarVariationDependencies(commonVariation, fsTag, a.properties.Filesystems...)
ctx.AddFarVariationDependencies(commonVariation, compatConfigTag, a.properties.Compat_configs...)
@ -2856,7 +2859,7 @@ func isStaticExecutableAllowed(apex string, exec string) bool {
func (a *apexBundle) IDEInfo(dpInfo *android.IdeInfo) {
dpInfo.Deps = append(dpInfo.Deps, a.properties.Java_libs...)
dpInfo.Deps = append(dpInfo.Deps, a.properties.Bootclasspath_fragments...)
dpInfo.Deps = append(dpInfo.Deps, a.properties.Systemserverclasspath_fragments...)
dpInfo.Deps = append(dpInfo.Deps, a.properties.ResolvedSystemserverclasspathFragments...)
}
var (

View file

@ -704,8 +704,9 @@ func (a *apexBundle) buildApex(ctx android.ModuleContext) {
optFlags = append(optFlags, "--override_apk_package_name "+manifestPackageName)
}
if a.properties.AndroidManifest != nil {
androidManifestFile := android.PathForModuleSrc(ctx, proptools.String(a.properties.AndroidManifest))
androidManifest := a.properties.AndroidManifest.GetOrDefault(a.ConfigurableEvaluator(ctx), "")
if androidManifest != "" {
androidManifestFile := android.PathForModuleSrc(ctx, androidManifest)
if a.testApex {
androidManifestFile = markManifestTestOnly(ctx, androidManifestFile)
@ -1195,8 +1196,9 @@ func (a *apexBundle) buildCannedFsConfig(ctx android.ModuleContext, defaultReadO
}
// Custom fs_config is "appended" to the last so that entries from the file are preferred
// over default ones set above.
if a.properties.Canned_fs_config != nil {
cmd.Text("cat").Input(android.PathForModuleSrc(ctx, *a.properties.Canned_fs_config))
customFsConfig := a.properties.Canned_fs_config.GetOrDefault(a.ConfigurableEvaluator(ctx), "")
if customFsConfig != "" {
cmd.Text("cat").Input(android.PathForModuleSrc(ctx, customFsConfig))
}
cmd.Text(")").FlagWithOutput("> ", cannedFsConfig)
builder.Build("generateFsConfig", fmt.Sprintf("Generating canned fs config for %s", a.BaseModuleName()))