Reorganize the platform_compat_config.go file
The types and methods are separated and interleaved with each other
so this moves them so that they are together.
Bug: 182402754
Test: m nothing
Change-Id: I275f6af30491d2440499b9ee3f201eea227d23f8
diff --git a/java/platform_compat_config.go b/java/platform_compat_config.go
index 4bfd4e2..01e651b 100644
--- a/java/platform_compat_config.go
+++ b/java/platform_compat_config.go
@@ -35,10 +35,6 @@
return android.PathForOutput(ctx, "compat_config", "merged_compat_config.xml")
}
-type platformCompatConfigSingleton struct {
- metadata android.Path
-}
-
type platformCompatConfigProperties struct {
Src *string `android:"path"`
}
@@ -75,7 +71,52 @@
var _ PlatformCompatConfigIntf = (*platformCompatConfig)(nil)
+func (p *platformCompatConfig) GenerateAndroidBuildActions(ctx android.ModuleContext) {
+ rule := android.NewRuleBuilder(pctx, ctx)
+
+ configFileName := p.Name() + ".xml"
+ metadataFileName := p.Name() + "_meta.xml"
+ p.configFile = android.PathForModuleOut(ctx, configFileName).OutputPath
+ p.metadataFile = android.PathForModuleOut(ctx, metadataFileName).OutputPath
+ path := android.PathForModuleSrc(ctx, String(p.properties.Src))
+
+ rule.Command().
+ BuiltTool("process-compat-config").
+ FlagWithInput("--jar ", path).
+ FlagWithOutput("--device-config ", p.configFile).
+ FlagWithOutput("--merged-config ", p.metadataFile)
+
+ p.installDirPath = android.PathForModuleInstall(ctx, "etc", "compatconfig")
+ rule.Build(configFileName, "Extract compat/compat_config.xml and install it")
+
+}
+
+func (p *platformCompatConfig) AndroidMkEntries() []android.AndroidMkEntries {
+ return []android.AndroidMkEntries{android.AndroidMkEntries{
+ Class: "ETC",
+ OutputFile: android.OptionalPathForPath(p.configFile),
+ Include: "$(BUILD_PREBUILT)",
+ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
+ func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
+ entries.SetString("LOCAL_MODULE_PATH", p.installDirPath.ToMakePath().String())
+ entries.SetString("LOCAL_INSTALLED_MODULE_STEM", p.configFile.Base())
+ },
+ },
+ }}
+}
+
+func PlatformCompatConfigFactory() android.Module {
+ module := &platformCompatConfig{}
+ module.AddProperties(&module.properties)
+ android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
+ return module
+}
+
// compat singleton rules
+type platformCompatConfigSingleton struct {
+ metadata android.Path
+}
+
func (p *platformCompatConfigSingleton) GenerateBuildActions(ctx android.SingletonContext) {
var compatConfigMetadata android.Paths
@@ -111,51 +152,10 @@
}
}
-func (p *platformCompatConfig) GenerateAndroidBuildActions(ctx android.ModuleContext) {
- rule := android.NewRuleBuilder(pctx, ctx)
-
- configFileName := p.Name() + ".xml"
- metadataFileName := p.Name() + "_meta.xml"
- p.configFile = android.PathForModuleOut(ctx, configFileName).OutputPath
- p.metadataFile = android.PathForModuleOut(ctx, metadataFileName).OutputPath
- path := android.PathForModuleSrc(ctx, String(p.properties.Src))
-
- rule.Command().
- BuiltTool("process-compat-config").
- FlagWithInput("--jar ", path).
- FlagWithOutput("--device-config ", p.configFile).
- FlagWithOutput("--merged-config ", p.metadataFile)
-
- p.installDirPath = android.PathForModuleInstall(ctx, "etc", "compatconfig")
- rule.Build(configFileName, "Extract compat/compat_config.xml and install it")
-
-}
-
-func (p *platformCompatConfig) AndroidMkEntries() []android.AndroidMkEntries {
- return []android.AndroidMkEntries{android.AndroidMkEntries{
- Class: "ETC",
- OutputFile: android.OptionalPathForPath(p.configFile),
- Include: "$(BUILD_PREBUILT)",
- ExtraEntries: []android.AndroidMkExtraEntriesFunc{
- func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
- entries.SetString("LOCAL_MODULE_PATH", p.installDirPath.ToMakePath().String())
- entries.SetString("LOCAL_INSTALLED_MODULE_STEM", p.configFile.Base())
- },
- },
- }}
-}
-
func platformCompatConfigSingletonFactory() android.Singleton {
return &platformCompatConfigSingleton{}
}
-func PlatformCompatConfigFactory() android.Module {
- module := &platformCompatConfig{}
- module.AddProperties(&module.properties)
- android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
- return module
-}
-
//============== merged_compat_config =================
type globalCompatConfigProperties struct {
// name of the file into which the metadata will be copied.