Merge "Move platform compat config to their own directory."

am: c772405d75

Change-Id: Ia8037254a105de27bcd6c871fa1a3ef2858a0826
This commit is contained in:
Anna Trostanetski 2019-08-29 10:08:30 -07:00 committed by android-build-merger
commit d5c734f2c3

View file

@ -23,8 +23,7 @@ func init() {
} }
type platformCompatConfigProperties struct { type platformCompatConfigProperties struct {
Src *string `android:"path"` Src *string `android:"path"`
Prefix *string
} }
type platformCompatConfig struct { type platformCompatConfig struct {
@ -38,13 +37,13 @@ type platformCompatConfig struct {
func (p *platformCompatConfig) GenerateAndroidBuildActions(ctx android.ModuleContext) { func (p *platformCompatConfig) GenerateAndroidBuildActions(ctx android.ModuleContext) {
rule := android.NewRuleBuilder() rule := android.NewRuleBuilder()
configFileName := String(p.properties.Prefix) + "_platform_compat_config.xml" configFileName := p.Name() + ".xml"
p.configFile = android.PathForModuleOut(ctx, configFileName).OutputPath p.configFile = android.PathForModuleOut(ctx, configFileName).OutputPath
path := android.PathForModuleSrc(ctx, String(p.properties.Src)) path := android.PathForModuleSrc(ctx, String(p.properties.Src))
// Use the empty config if the compat config file idoesn't exist (can happen if @ChangeId // Use the empty config if the compat config file idoesn't exist (can happen if @ChangeId
// annotation is not used). // annotation is not used).
emptyConfig := `<?xml version="1.0" encoding="UTF-8" standalone="no"?><config/>` emptyConfig := `'<?xml version="1.0" encoding="UTF-8" standalone="no"?><config/>'`
configPath := `compat/compat_config.xml` configPath := `compat/compat_config.xml`
rule.Command(). rule.Command().
@ -61,13 +60,13 @@ func (p *platformCompatConfig) GenerateAndroidBuildActions(ctx android.ModuleCon
Text(configPath). Text(configPath).
Text(`>`). Text(`>`).
Output(p.configFile). Output(p.configFile).
Text(`; else echo '`). Text(`; else echo `).
Text(emptyConfig). Text(emptyConfig).
Text(`' >`). Text(`>`).
Output(p.configFile). Output(p.configFile).
Text(`; fi`) Text(`; fi`)
p.installDirPath = android.PathForModuleInstall(ctx, "etc", "sysconfig") p.installDirPath = android.PathForModuleInstall(ctx, "etc", "compatconfig")
rule.Build(pctx, ctx, configFileName, "Extract compat/compat_config.xml and install it") rule.Build(pctx, ctx, configFileName, "Extract compat/compat_config.xml and install it")
} }