Merge "Singleton build rule for merged compat config." am: ac65c69913
am: a8da239ade
Change-Id: Ib86634f5ac9934cc513d9c3572d4b16216f1d897
This commit is contained in:
@@ -19,9 +19,14 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
android.RegisterSingletonType("platform_compat_config_singleton", platformCompatConfigSingletonFactory)
|
||||||
android.RegisterModuleType("platform_compat_config", platformCompatConfigFactory)
|
android.RegisterModuleType("platform_compat_config", platformCompatConfigFactory)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type platformCompatConfigSingleton struct {
|
||||||
|
metadata android.Path
|
||||||
|
}
|
||||||
|
|
||||||
type platformCompatConfigProperties struct {
|
type platformCompatConfigProperties struct {
|
||||||
Src *string `android:"path"`
|
Src *string `android:"path"`
|
||||||
}
|
}
|
||||||
@@ -35,6 +40,46 @@ type platformCompatConfig struct {
|
|||||||
metadataFile android.OutputPath
|
metadataFile android.OutputPath
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *platformCompatConfig) compatConfigMetadata() android.OutputPath {
|
||||||
|
return p.metadataFile
|
||||||
|
}
|
||||||
|
|
||||||
|
type platformCompatConfigIntf interface {
|
||||||
|
compatConfigMetadata() android.OutputPath
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ platformCompatConfigIntf = (*platformCompatConfig)(nil)
|
||||||
|
|
||||||
|
// compat singleton rules
|
||||||
|
func (p *platformCompatConfigSingleton) GenerateBuildActions(ctx android.SingletonContext) {
|
||||||
|
|
||||||
|
var compatConfigMetadata android.Paths
|
||||||
|
|
||||||
|
ctx.VisitAllModules(func(module android.Module) {
|
||||||
|
if c, ok := module.(platformCompatConfigIntf); ok {
|
||||||
|
metadata := c.compatConfigMetadata()
|
||||||
|
compatConfigMetadata = append(compatConfigMetadata, metadata)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
if compatConfigMetadata == nil {
|
||||||
|
// nothing to do.
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
rule := android.NewRuleBuilder()
|
||||||
|
outputPath := android.PathForOutput(ctx, "compat_config", "merged_compat_config.xml")
|
||||||
|
|
||||||
|
rule.Command().
|
||||||
|
BuiltTool(ctx, "process-compat-config").
|
||||||
|
FlagForEachInput("--xml ", compatConfigMetadata).
|
||||||
|
FlagWithOutput("--merged-config ", outputPath)
|
||||||
|
|
||||||
|
rule.Build(pctx, ctx, "merged-compat-config", "Merge compat config")
|
||||||
|
|
||||||
|
p.metadata = outputPath
|
||||||
|
}
|
||||||
|
|
||||||
func (p *platformCompatConfig) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
func (p *platformCompatConfig) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder()
|
||||||
|
|
||||||
@@ -69,6 +114,10 @@ func (p *platformCompatConfig) AndroidMkEntries() []android.AndroidMkEntries {
|
|||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func platformCompatConfigSingletonFactory() android.Singleton {
|
||||||
|
return &platformCompatConfigSingleton{}
|
||||||
|
}
|
||||||
|
|
||||||
func platformCompatConfigFactory() android.Module {
|
func platformCompatConfigFactory() android.Module {
|
||||||
module := &platformCompatConfig{}
|
module := &platformCompatConfig{}
|
||||||
module.AddProperties(&module.properties)
|
module.AddProperties(&module.properties)
|
||||||
|
Reference in New Issue
Block a user