Merge "Support default-permission in aconfig_declarations" into main am: 1f82aea323
am: e1d9d9e633
am: f2f2ad86d0
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2704693 Change-Id: I2c0352036be4423f3f961b8f572677808ad26840 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -97,6 +97,15 @@ func joinAndPrefix(prefix string, values []string) string {
|
|||||||
return sb.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
|
// Provider published by aconfig_value_set
|
||||||
type declarationsProviderData struct {
|
type declarationsProviderData struct {
|
||||||
Package string
|
Package string
|
||||||
@@ -124,15 +133,17 @@ func (module *DeclarationsModule) GenerateAndroidBuildActions(ctx android.Module
|
|||||||
// Intermediate format
|
// Intermediate format
|
||||||
inputFiles := android.PathsForModuleSrc(ctx, module.properties.Srcs)
|
inputFiles := android.PathsForModuleSrc(ctx, module.properties.Srcs)
|
||||||
intermediatePath := android.PathForModuleOut(ctx, "intermediate.pb")
|
intermediatePath := android.PathForModuleOut(ctx, "intermediate.pb")
|
||||||
|
defaultPermission := ctx.Config().ReleaseAconfigFlagDefaultPermission()
|
||||||
ctx.Build(pctx, android.BuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: aconfigRule,
|
Rule: aconfigRule,
|
||||||
Output: intermediatePath,
|
Output: intermediatePath,
|
||||||
Description: "aconfig_declarations",
|
Description: "aconfig_declarations",
|
||||||
Args: map[string]string{
|
Args: map[string]string{
|
||||||
"release_version": ctx.Config().ReleaseVersion(),
|
"release_version": ctx.Config().ReleaseVersion(),
|
||||||
"package": module.properties.Package,
|
"package": module.properties.Package,
|
||||||
"declarations": android.JoinPathsWithPrefix(inputFiles, "--declarations "),
|
"declarations": android.JoinPathsWithPrefix(inputFiles, "--declarations "),
|
||||||
"values": joinAndPrefix(" --values ", module.properties.Values),
|
"values": joinAndPrefix(" --values ", module.properties.Values),
|
||||||
|
"default-permission": optionalVariable(" --default-permission ", defaultPermission),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@@ -30,6 +30,7 @@ var (
|
|||||||
` --package ${package}` +
|
` --package ${package}` +
|
||||||
` ${declarations}` +
|
` ${declarations}` +
|
||||||
` ${values}` +
|
` ${values}` +
|
||||||
|
` ${default-permission}` +
|
||||||
` --cache ${out}.tmp` +
|
` --cache ${out}.tmp` +
|
||||||
` && ( if cmp -s ${out}.tmp ${out} ; then rm ${out}.tmp ; else mv ${out}.tmp ${out} ; fi )`,
|
` && ( if cmp -s ${out}.tmp ${out} ; then rm ${out}.tmp ; else mv ${out}.tmp ${out} ; fi )`,
|
||||||
// ` --build-id ${release_version}` +
|
// ` --build-id ${release_version}` +
|
||||||
@@ -37,7 +38,7 @@ var (
|
|||||||
"${aconfig}",
|
"${aconfig}",
|
||||||
},
|
},
|
||||||
Restat: true,
|
Restat: true,
|
||||||
}, "release_version", "package", "declarations", "values")
|
}, "release_version", "package", "declarations", "values", "default-permission")
|
||||||
|
|
||||||
// For java_aconfig_library: Generate java file
|
// For java_aconfig_library: Generate java file
|
||||||
javaRule = pctx.AndroidStaticRule("java_aconfig_library",
|
javaRule = pctx.AndroidStaticRule("java_aconfig_library",
|
||||||
|
@@ -206,6 +206,12 @@ func (c Config) ReleaseAconfigValueSets() []string {
|
|||||||
return c.config.productVariables.ReleaseAconfigValueSets
|
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
|
// 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
|
// being built. For now there will only be one of these, but in the future there
|
||||||
// may be multiple devices being built.
|
// may be multiple devices being built.
|
||||||
|
@@ -482,6 +482,8 @@ type ProductVariables struct {
|
|||||||
ReleaseVersion string `json:",omitempty"`
|
ReleaseVersion string `json:",omitempty"`
|
||||||
ReleaseAconfigValueSets []string `json:",omitempty"`
|
ReleaseAconfigValueSets []string `json:",omitempty"`
|
||||||
|
|
||||||
|
ReleaseAconfigFlagDefaultPermission string `json:",omitempty"`
|
||||||
|
|
||||||
KeepVndk *bool `json:",omitempty"`
|
KeepVndk *bool `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user