Merge "Support default-permission in aconfig_declarations" into main
This commit is contained in:
@@ -97,6 +97,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
|
||||
@@ -124,15 +133,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),
|
||||
},
|
||||
})
|
||||
|
||||
|
@@ -30,6 +30,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}` +
|
||||
@@ -37,7 +38,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",
|
||||
|
@@ -206,6 +206,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.
|
||||
|
@@ -482,6 +482,8 @@ type ProductVariables struct {
|
||||
ReleaseVersion string `json:",omitempty"`
|
||||
ReleaseAconfigValueSets []string `json:",omitempty"`
|
||||
|
||||
ReleaseAconfigFlagDefaultPermission string `json:",omitempty"`
|
||||
|
||||
KeepVndk *bool `json:",omitempty"`
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user