Support default-permission in aconfig_declarations
Aconfig provides new argument, default-permission, for create-cache. When buld aconfig_declarations, aconfig_declarations will read the value from release configuration to pass this value to aconfig. Bug: 294417368 Test: presubmit Change-Id: Id55dab1d757e2366a62449c73e2497cc958c5e78
This commit is contained in:
parent
4fa1bfe169
commit
3f65a416b8
4 changed files with 25 additions and 5 deletions
|
@ -96,6 +96,15 @@ func joinAndPrefix(prefix string, values []string) string {
|
|||
return sb.String()
|
||||
}
|
||||
|
||||
func optionalVariable(prefix string, value string) string {
|
||||
var sb strings.Builder
|
||||
if value != "" {
|
||||
sb.WriteString(prefix)
|
||||
sb.WriteString(value)
|
||||
}
|
||||
return sb.String()
|
||||
}
|
||||
|
||||
// Provider published by aconfig_value_set
|
||||
type declarationsProviderData struct {
|
||||
Package string
|
||||
|
@ -123,15 +132,17 @@ func (module *DeclarationsModule) GenerateAndroidBuildActions(ctx android.Module
|
|||
// Intermediate format
|
||||
inputFiles := android.PathsForModuleSrc(ctx, module.properties.Srcs)
|
||||
intermediatePath := android.PathForModuleOut(ctx, "intermediate.pb")
|
||||
defaultPermission := ctx.Config().ReleaseAconfigFlagDefaultPermission()
|
||||
ctx.Build(pctx, android.BuildParams{
|
||||
Rule: aconfigRule,
|
||||
Output: intermediatePath,
|
||||
Description: "aconfig_declarations",
|
||||
Args: map[string]string{
|
||||
"release_version": ctx.Config().ReleaseVersion(),
|
||||
"package": module.properties.Package,
|
||||
"declarations": android.JoinPathsWithPrefix(inputFiles, "--declarations "),
|
||||
"values": joinAndPrefix(" --values ", module.properties.Values),
|
||||
"release_version": ctx.Config().ReleaseVersion(),
|
||||
"package": module.properties.Package,
|
||||
"declarations": android.JoinPathsWithPrefix(inputFiles, "--declarations "),
|
||||
"values": joinAndPrefix(" --values ", module.properties.Values),
|
||||
"default-permission": optionalVariable(" --default-permission ", defaultPermission),
|
||||
},
|
||||
})
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ var (
|
|||
` --package ${package}` +
|
||||
` ${declarations}` +
|
||||
` ${values}` +
|
||||
` ${default-permission}` +
|
||||
` --cache ${out}.tmp` +
|
||||
` && ( if cmp -s ${out}.tmp ${out} ; then rm ${out}.tmp ; else mv ${out}.tmp ${out} ; fi )`,
|
||||
// ` --build-id ${release_version}` +
|
||||
|
@ -36,7 +37,7 @@ var (
|
|||
"${aconfig}",
|
||||
},
|
||||
Restat: true,
|
||||
}, "release_version", "package", "declarations", "values")
|
||||
}, "release_version", "package", "declarations", "values", "default-permission")
|
||||
|
||||
// For java_aconfig_library: Generate java file
|
||||
javaRule = pctx.AndroidStaticRule("java_aconfig_library",
|
||||
|
|
|
@ -200,6 +200,12 @@ func (c Config) ReleaseAconfigValueSets() []string {
|
|||
return c.config.productVariables.ReleaseAconfigValueSets
|
||||
}
|
||||
|
||||
// The flag default permission value passed to aconfig
|
||||
// derived from RELEASE_ACONFIG_FLAG_DEFAULT_PERMISSION
|
||||
func (c Config) ReleaseAconfigFlagDefaultPermission() string {
|
||||
return c.config.productVariables.ReleaseAconfigFlagDefaultPermission
|
||||
}
|
||||
|
||||
// A DeviceConfig object represents the configuration for a particular device
|
||||
// being built. For now there will only be one of these, but in the future there
|
||||
// may be multiple devices being built.
|
||||
|
|
|
@ -491,6 +491,8 @@ type ProductVariables struct {
|
|||
ReleaseVersion string `json:",omitempty"`
|
||||
ReleaseAconfigValueSets []string `json:",omitempty"`
|
||||
|
||||
ReleaseAconfigFlagDefaultPermission string `json:",omitempty"`
|
||||
|
||||
KeepVndk *bool `json:",omitempty"`
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue