| atrost | db25ac0 | 2019-08-05 12:26:07 +0100 | [diff] [blame] | 1 | // Copyright 2019 Google Inc. All rights reserved. | 
|  | 2 | // | 
|  | 3 | // Licensed under the Apache License, Version 2.0 (the "License"); | 
|  | 4 | // you may not use this file except in compliance with the License. | 
|  | 5 | // You may obtain a copy of the License at | 
|  | 6 | // | 
|  | 7 | //     http://www.apache.org/licenses/LICENSE-2.0 | 
|  | 8 | // | 
|  | 9 | // Unless required by applicable law or agreed to in writing, software | 
|  | 10 | // distributed under the License is distributed on an "AS IS" BASIS, | 
|  | 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
|  | 12 | // See the License for the specific language governing permissions and | 
|  | 13 | // limitations under the License. | 
|  | 14 |  | 
|  | 15 | package java | 
|  | 16 |  | 
|  | 17 | import ( | 
| Paul Duffin | d796f6f | 2022-11-23 23:06:05 +0000 | [diff] [blame] | 18 | "fmt" | 
| Paul Duffin | 001b234 | 2021-03-11 18:43:31 +0000 | [diff] [blame] | 19 | "path/filepath" | 
|  | 20 |  | 
| atrost | db25ac0 | 2019-08-05 12:26:07 +0100 | [diff] [blame] | 21 | "android/soong/android" | 
| Cole Faust | a963b94 | 2024-04-11 17:43:00 -0700 | [diff] [blame] | 22 |  | 
| Paul Duffin | 001b234 | 2021-03-11 18:43:31 +0000 | [diff] [blame] | 23 | "github.com/google/blueprint" | 
| Spandan Das | e4c911e | 2024-01-19 00:22:22 +0000 | [diff] [blame] | 24 | "github.com/google/blueprint/proptools" | 
| atrost | db25ac0 | 2019-08-05 12:26:07 +0100 | [diff] [blame] | 25 | ) | 
|  | 26 |  | 
|  | 27 | func init() { | 
| Paul Duffin | 4eb4b41 | 2021-03-09 02:59:25 +0000 | [diff] [blame] | 28 | registerPlatformCompatConfigBuildComponents(android.InitRegistrationContext) | 
| Paul Duffin | 001b234 | 2021-03-11 18:43:31 +0000 | [diff] [blame] | 29 |  | 
| Paul Duffin | fcf7985 | 2022-07-20 14:18:24 +0000 | [diff] [blame] | 30 | android.RegisterSdkMemberType(CompatConfigSdkMemberType) | 
|  | 31 | } | 
|  | 32 |  | 
|  | 33 | var CompatConfigSdkMemberType = &compatConfigMemberType{ | 
|  | 34 | SdkMemberTypeBase: android.SdkMemberTypeBase{ | 
|  | 35 | PropertyName: "compat_configs", | 
|  | 36 | SupportsSdk:  true, | 
|  | 37 | }, | 
| Mathew Inwood | abd49ab | 2019-12-19 14:27:08 +0000 | [diff] [blame] | 38 | } | 
|  | 39 |  | 
| Paul Duffin | 4eb4b41 | 2021-03-09 02:59:25 +0000 | [diff] [blame] | 40 | func registerPlatformCompatConfigBuildComponents(ctx android.RegistrationContext) { | 
| LaMont Jones | 0c10e4d | 2023-05-16 00:58:37 +0000 | [diff] [blame] | 41 | ctx.RegisterParallelSingletonType("platform_compat_config_singleton", platformCompatConfigSingletonFactory) | 
| Paul Duffin | 4eb4b41 | 2021-03-09 02:59:25 +0000 | [diff] [blame] | 42 | ctx.RegisterModuleType("platform_compat_config", PlatformCompatConfigFactory) | 
| Paul Duffin | 1b29e00 | 2021-03-16 15:06:54 +0000 | [diff] [blame] | 43 | ctx.RegisterModuleType("prebuilt_platform_compat_config", prebuiltCompatConfigFactory) | 
| Paul Duffin | 4eb4b41 | 2021-03-09 02:59:25 +0000 | [diff] [blame] | 44 | ctx.RegisterModuleType("global_compat_config", globalCompatConfigFactory) | 
|  | 45 | } | 
|  | 46 |  | 
|  | 47 | var PrepareForTestWithPlatformCompatConfig = android.FixtureRegisterWithContext(registerPlatformCompatConfigBuildComponents) | 
|  | 48 |  | 
| Mathew Inwood | abd49ab | 2019-12-19 14:27:08 +0000 | [diff] [blame] | 49 | func platformCompatConfigPath(ctx android.PathContext) android.OutputPath { | 
|  | 50 | return android.PathForOutput(ctx, "compat_config", "merged_compat_config.xml") | 
| atrost | db25ac0 | 2019-08-05 12:26:07 +0100 | [diff] [blame] | 51 | } | 
|  | 52 |  | 
|  | 53 | type platformCompatConfigProperties struct { | 
| atrost | 87901b0 | 2019-08-29 12:48:43 +0100 | [diff] [blame] | 54 | Src *string `android:"path"` | 
| atrost | db25ac0 | 2019-08-05 12:26:07 +0100 | [diff] [blame] | 55 | } | 
|  | 56 |  | 
|  | 57 | type platformCompatConfig struct { | 
|  | 58 | android.ModuleBase | 
|  | 59 |  | 
|  | 60 | properties     platformCompatConfigProperties | 
| Colin Cross | 70dda7e | 2019-10-01 22:05:35 -0700 | [diff] [blame] | 61 | installDirPath android.InstallPath | 
| atrost | db25ac0 | 2019-08-05 12:26:07 +0100 | [diff] [blame] | 62 | configFile     android.OutputPath | 
| Mathew Inwood | 0dd06f6 | 2019-12-17 11:14:42 +0000 | [diff] [blame] | 63 | metadataFile   android.OutputPath | 
| Wei Li | 6033315 | 2024-06-18 16:38:31 -0700 | [diff] [blame] | 64 |  | 
|  | 65 | installConfigFile android.InstallPath | 
| atrost | db25ac0 | 2019-08-05 12:26:07 +0100 | [diff] [blame] | 66 | } | 
|  | 67 |  | 
| Paul Duffin | 29072a9 | 2021-03-16 10:12:49 +0000 | [diff] [blame] | 68 | func (p *platformCompatConfig) compatConfigMetadata() android.Path { | 
| Mathew Inwood | 4d0c19c | 2019-12-09 11:32:29 +0000 | [diff] [blame] | 69 | return p.metadataFile | 
|  | 70 | } | 
|  | 71 |  | 
| atrost | 6e12625 | 2020-01-27 17:01:16 +0000 | [diff] [blame] | 72 | func (p *platformCompatConfig) CompatConfig() android.OutputPath { | 
|  | 73 | return p.configFile | 
| Mathew Inwood | 4d0c19c | 2019-12-09 11:32:29 +0000 | [diff] [blame] | 74 | } | 
|  | 75 |  | 
| atrost | 6e12625 | 2020-01-27 17:01:16 +0000 | [diff] [blame] | 76 | func (p *platformCompatConfig) SubDir() string { | 
|  | 77 | return "compatconfig" | 
|  | 78 | } | 
|  | 79 |  | 
| Paul Duffin | 29072a9 | 2021-03-16 10:12:49 +0000 | [diff] [blame] | 80 | type platformCompatConfigMetadataProvider interface { | 
|  | 81 | compatConfigMetadata() android.Path | 
|  | 82 | } | 
|  | 83 |  | 
| atrost | 6e12625 | 2020-01-27 17:01:16 +0000 | [diff] [blame] | 84 | type PlatformCompatConfigIntf interface { | 
|  | 85 | android.Module | 
|  | 86 |  | 
| atrost | 6e12625 | 2020-01-27 17:01:16 +0000 | [diff] [blame] | 87 | CompatConfig() android.OutputPath | 
|  | 88 | // Sub dir under etc dir. | 
|  | 89 | SubDir() string | 
|  | 90 | } | 
|  | 91 |  | 
|  | 92 | var _ PlatformCompatConfigIntf = (*platformCompatConfig)(nil) | 
| Paul Duffin | 29072a9 | 2021-03-16 10:12:49 +0000 | [diff] [blame] | 93 | var _ platformCompatConfigMetadataProvider = (*platformCompatConfig)(nil) | 
| Mathew Inwood | 4d0c19c | 2019-12-09 11:32:29 +0000 | [diff] [blame] | 94 |  | 
| Paul Duffin | 9615433 | 2021-03-15 18:18:22 +0000 | [diff] [blame] | 95 | func (p *platformCompatConfig) GenerateAndroidBuildActions(ctx android.ModuleContext) { | 
|  | 96 | rule := android.NewRuleBuilder(pctx, ctx) | 
|  | 97 |  | 
|  | 98 | configFileName := p.Name() + ".xml" | 
|  | 99 | metadataFileName := p.Name() + "_meta.xml" | 
|  | 100 | p.configFile = android.PathForModuleOut(ctx, configFileName).OutputPath | 
|  | 101 | p.metadataFile = android.PathForModuleOut(ctx, metadataFileName).OutputPath | 
|  | 102 | path := android.PathForModuleSrc(ctx, String(p.properties.Src)) | 
|  | 103 |  | 
|  | 104 | rule.Command(). | 
|  | 105 | BuiltTool("process-compat-config"). | 
|  | 106 | FlagWithInput("--jar ", path). | 
|  | 107 | FlagWithOutput("--device-config ", p.configFile). | 
|  | 108 | FlagWithOutput("--merged-config ", p.metadataFile) | 
|  | 109 |  | 
|  | 110 | p.installDirPath = android.PathForModuleInstall(ctx, "etc", "compatconfig") | 
| Wei Li | 6033315 | 2024-06-18 16:38:31 -0700 | [diff] [blame] | 111 | p.installConfigFile = android.PathForModuleInstall(ctx, "etc", "compatconfig", p.configFile.Base()) | 
| Paul Duffin | 9615433 | 2021-03-15 18:18:22 +0000 | [diff] [blame] | 112 | rule.Build(configFileName, "Extract compat/compat_config.xml and install it") | 
| Wei Li | 6033315 | 2024-06-18 16:38:31 -0700 | [diff] [blame] | 113 | } | 
| Paul Duffin | 9615433 | 2021-03-15 18:18:22 +0000 | [diff] [blame] | 114 |  | 
| Wei Li | 6033315 | 2024-06-18 16:38:31 -0700 | [diff] [blame] | 115 | func (p *platformCompatConfig) FilesToInstall() android.InstallPaths { | 
|  | 116 | return android.InstallPaths{p.installConfigFile} | 
| Paul Duffin | 9615433 | 2021-03-15 18:18:22 +0000 | [diff] [blame] | 117 | } | 
|  | 118 |  | 
|  | 119 | func (p *platformCompatConfig) AndroidMkEntries() []android.AndroidMkEntries { | 
|  | 120 | return []android.AndroidMkEntries{android.AndroidMkEntries{ | 
|  | 121 | Class:      "ETC", | 
|  | 122 | OutputFile: android.OptionalPathForPath(p.configFile), | 
|  | 123 | Include:    "$(BUILD_PREBUILT)", | 
|  | 124 | ExtraEntries: []android.AndroidMkExtraEntriesFunc{ | 
|  | 125 | func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { | 
| Colin Cross | c68db4b | 2021-11-11 18:59:15 -0800 | [diff] [blame] | 126 | entries.SetString("LOCAL_MODULE_PATH", p.installDirPath.String()) | 
| Paul Duffin | 9615433 | 2021-03-15 18:18:22 +0000 | [diff] [blame] | 127 | entries.SetString("LOCAL_INSTALLED_MODULE_STEM", p.configFile.Base()) | 
|  | 128 | }, | 
|  | 129 | }, | 
|  | 130 | }} | 
|  | 131 | } | 
|  | 132 |  | 
|  | 133 | func PlatformCompatConfigFactory() android.Module { | 
|  | 134 | module := &platformCompatConfig{} | 
|  | 135 | module.AddProperties(&module.properties) | 
|  | 136 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) | 
|  | 137 | return module | 
|  | 138 | } | 
|  | 139 |  | 
| Paul Duffin | 001b234 | 2021-03-11 18:43:31 +0000 | [diff] [blame] | 140 | type compatConfigMemberType struct { | 
|  | 141 | android.SdkMemberTypeBase | 
|  | 142 | } | 
|  | 143 |  | 
| Paul Duffin | 296701e | 2021-07-14 10:29:36 +0100 | [diff] [blame] | 144 | func (b *compatConfigMemberType) AddDependencies(ctx android.SdkDependencyContext, dependencyTag blueprint.DependencyTag, names []string) { | 
|  | 145 | ctx.AddVariationDependencies(nil, dependencyTag, names...) | 
| Paul Duffin | 001b234 | 2021-03-11 18:43:31 +0000 | [diff] [blame] | 146 | } | 
|  | 147 |  | 
|  | 148 | func (b *compatConfigMemberType) IsInstance(module android.Module) bool { | 
|  | 149 | _, ok := module.(*platformCompatConfig) | 
|  | 150 | return ok | 
|  | 151 | } | 
|  | 152 |  | 
|  | 153 | func (b *compatConfigMemberType) AddPrebuiltModule(ctx android.SdkMemberContext, member android.SdkMember) android.BpModule { | 
|  | 154 | return ctx.SnapshotBuilder().AddPrebuiltModule(member, "prebuilt_platform_compat_config") | 
|  | 155 | } | 
|  | 156 |  | 
|  | 157 | func (b *compatConfigMemberType) CreateVariantPropertiesStruct() android.SdkMemberProperties { | 
|  | 158 | return &compatConfigSdkMemberProperties{} | 
|  | 159 | } | 
|  | 160 |  | 
|  | 161 | type compatConfigSdkMemberProperties struct { | 
|  | 162 | android.SdkMemberPropertiesBase | 
|  | 163 |  | 
|  | 164 | Metadata android.Path | 
|  | 165 | } | 
|  | 166 |  | 
|  | 167 | func (b *compatConfigSdkMemberProperties) PopulateFromVariant(ctx android.SdkMemberContext, variant android.Module) { | 
|  | 168 | module := variant.(*platformCompatConfig) | 
|  | 169 | b.Metadata = module.metadataFile | 
|  | 170 | } | 
|  | 171 |  | 
|  | 172 | func (b *compatConfigSdkMemberProperties) AddToPropertySet(ctx android.SdkMemberContext, propertySet android.BpPropertySet) { | 
|  | 173 | builder := ctx.SnapshotBuilder() | 
|  | 174 | if b.Metadata != nil { | 
|  | 175 | snapshotRelativePath := filepath.Join("compat_configs", ctx.Name(), b.Metadata.Base()) | 
|  | 176 | builder.CopyToSnapshot(b.Metadata, snapshotRelativePath) | 
|  | 177 | propertySet.AddProperty("metadata", snapshotRelativePath) | 
|  | 178 | } | 
|  | 179 | } | 
|  | 180 |  | 
|  | 181 | var _ android.SdkMemberType = (*compatConfigMemberType)(nil) | 
|  | 182 |  | 
| Paul Duffin | 1b29e00 | 2021-03-16 15:06:54 +0000 | [diff] [blame] | 183 | // A prebuilt version of the platform compat config module. | 
|  | 184 | type prebuiltCompatConfigModule struct { | 
|  | 185 | android.ModuleBase | 
| Paul Duffin | 1b29e00 | 2021-03-16 15:06:54 +0000 | [diff] [blame] | 186 | prebuilt android.Prebuilt | 
|  | 187 |  | 
|  | 188 | properties prebuiltCompatConfigProperties | 
|  | 189 |  | 
|  | 190 | metadataFile android.Path | 
|  | 191 | } | 
|  | 192 |  | 
|  | 193 | type prebuiltCompatConfigProperties struct { | 
|  | 194 | Metadata *string `android:"path"` | 
| Spandan Das | e4c911e | 2024-01-19 00:22:22 +0000 | [diff] [blame] | 195 |  | 
|  | 196 | // Name of the source soong module that gets shadowed by this prebuilt | 
|  | 197 | // If unspecified, follows the naming convention that the source module of | 
|  | 198 | // the prebuilt is Name() without "prebuilt_" prefix | 
|  | 199 | Source_module_name *string | 
| Paul Duffin | 1b29e00 | 2021-03-16 15:06:54 +0000 | [diff] [blame] | 200 | } | 
|  | 201 |  | 
|  | 202 | func (module *prebuiltCompatConfigModule) Prebuilt() *android.Prebuilt { | 
|  | 203 | return &module.prebuilt | 
|  | 204 | } | 
|  | 205 |  | 
|  | 206 | func (module *prebuiltCompatConfigModule) Name() string { | 
|  | 207 | return module.prebuilt.Name(module.ModuleBase.Name()) | 
|  | 208 | } | 
|  | 209 |  | 
|  | 210 | func (module *prebuiltCompatConfigModule) compatConfigMetadata() android.Path { | 
|  | 211 | return module.metadataFile | 
|  | 212 | } | 
|  | 213 |  | 
| Spandan Das | e4c911e | 2024-01-19 00:22:22 +0000 | [diff] [blame] | 214 | func (module *prebuiltCompatConfigModule) BaseModuleName() string { | 
|  | 215 | return proptools.StringDefault(module.properties.Source_module_name, module.ModuleBase.Name()) | 
|  | 216 | } | 
|  | 217 |  | 
| Paul Duffin | 1b29e00 | 2021-03-16 15:06:54 +0000 | [diff] [blame] | 218 | var _ platformCompatConfigMetadataProvider = (*prebuiltCompatConfigModule)(nil) | 
|  | 219 |  | 
|  | 220 | func (module *prebuiltCompatConfigModule) GenerateAndroidBuildActions(ctx android.ModuleContext) { | 
|  | 221 | module.metadataFile = module.prebuilt.SingleSourcePath(ctx) | 
|  | 222 | } | 
|  | 223 |  | 
|  | 224 | // A prebuilt version of platform_compat_config that provides the metadata. | 
|  | 225 | func prebuiltCompatConfigFactory() android.Module { | 
|  | 226 | m := &prebuiltCompatConfigModule{} | 
|  | 227 | m.AddProperties(&m.properties) | 
|  | 228 | android.InitSingleSourcePrebuiltModule(m, &m.properties, "Metadata") | 
| Paul Duffin | 1b29e00 | 2021-03-16 15:06:54 +0000 | [diff] [blame] | 229 | android.InitAndroidArchModule(m, android.DeviceSupported, android.MultilibCommon) | 
|  | 230 | return m | 
|  | 231 | } | 
|  | 232 |  | 
| Mathew Inwood | 4d0c19c | 2019-12-09 11:32:29 +0000 | [diff] [blame] | 233 | // compat singleton rules | 
| Paul Duffin | 9615433 | 2021-03-15 18:18:22 +0000 | [diff] [blame] | 234 | type platformCompatConfigSingleton struct { | 
|  | 235 | metadata android.Path | 
|  | 236 | } | 
|  | 237 |  | 
| Mathew Inwood | 4d0c19c | 2019-12-09 11:32:29 +0000 | [diff] [blame] | 238 | func (p *platformCompatConfigSingleton) GenerateBuildActions(ctx android.SingletonContext) { | 
|  | 239 |  | 
|  | 240 | var compatConfigMetadata android.Paths | 
|  | 241 |  | 
|  | 242 | ctx.VisitAllModules(func(module android.Module) { | 
| Cole Faust | a963b94 | 2024-04-11 17:43:00 -0700 | [diff] [blame] | 243 | if !module.Enabled(ctx) { | 
| Paul Duffin | bb9ff51 | 2021-03-24 12:08:53 +0000 | [diff] [blame] | 244 | return | 
|  | 245 | } | 
| Paul Duffin | 29072a9 | 2021-03-16 10:12:49 +0000 | [diff] [blame] | 246 | if c, ok := module.(platformCompatConfigMetadataProvider); ok { | 
| Paul Duffin | 458a15b | 2022-11-25 12:18:24 +0000 | [diff] [blame] | 247 | if !android.IsModulePreferred(module) { | 
| Paul Duffin | bb9ff51 | 2021-03-24 12:08:53 +0000 | [diff] [blame] | 248 | return | 
|  | 249 | } | 
| Mathew Inwood | 4d0c19c | 2019-12-09 11:32:29 +0000 | [diff] [blame] | 250 | metadata := c.compatConfigMetadata() | 
|  | 251 | compatConfigMetadata = append(compatConfigMetadata, metadata) | 
|  | 252 | } | 
|  | 253 | }) | 
|  | 254 |  | 
|  | 255 | if compatConfigMetadata == nil { | 
|  | 256 | // nothing to do. | 
|  | 257 | return | 
|  | 258 | } | 
|  | 259 |  | 
| Colin Cross | f1a035e | 2020-11-16 17:32:30 -0800 | [diff] [blame] | 260 | rule := android.NewRuleBuilder(pctx, ctx) | 
| Mathew Inwood | abd49ab | 2019-12-19 14:27:08 +0000 | [diff] [blame] | 261 | outputPath := platformCompatConfigPath(ctx) | 
| Mathew Inwood | 4d0c19c | 2019-12-09 11:32:29 +0000 | [diff] [blame] | 262 |  | 
|  | 263 | rule.Command(). | 
| Colin Cross | f1a035e | 2020-11-16 17:32:30 -0800 | [diff] [blame] | 264 | BuiltTool("process-compat-config"). | 
| Mathew Inwood | 4d0c19c | 2019-12-09 11:32:29 +0000 | [diff] [blame] | 265 | FlagForEachInput("--xml ", compatConfigMetadata). | 
|  | 266 | FlagWithOutput("--merged-config ", outputPath) | 
|  | 267 |  | 
| Colin Cross | f1a035e | 2020-11-16 17:32:30 -0800 | [diff] [blame] | 268 | rule.Build("merged-compat-config", "Merge compat config") | 
| Mathew Inwood | 4d0c19c | 2019-12-09 11:32:29 +0000 | [diff] [blame] | 269 |  | 
|  | 270 | p.metadata = outputPath | 
|  | 271 | } | 
|  | 272 |  | 
| Mathew Inwood | 653c78a | 2019-12-19 12:38:10 +0000 | [diff] [blame] | 273 | func (p *platformCompatConfigSingleton) MakeVars(ctx android.MakeVarsContext) { | 
|  | 274 | if p.metadata != nil { | 
| Herbert Xue | 67a41bc | 2024-06-06 15:17:10 +0800 | [diff] [blame] | 275 | ctx.DistForGoal("droidcore", p.metadata) | 
| Mathew Inwood | 653c78a | 2019-12-19 12:38:10 +0000 | [diff] [blame] | 276 | } | 
|  | 277 | } | 
|  | 278 |  | 
| Mathew Inwood | 4d0c19c | 2019-12-09 11:32:29 +0000 | [diff] [blame] | 279 | func platformCompatConfigSingletonFactory() android.Singleton { | 
|  | 280 | return &platformCompatConfigSingleton{} | 
|  | 281 | } | 
|  | 282 |  | 
| Colin Cross | d079e0b | 2022-08-16 10:27:33 -0700 | [diff] [blame] | 283 | // ============== merged_compat_config ================= | 
| Mathew Inwood | abd49ab | 2019-12-19 14:27:08 +0000 | [diff] [blame] | 284 | type globalCompatConfigProperties struct { | 
|  | 285 | // name of the file into which the metadata will be copied. | 
|  | 286 | Filename *string | 
|  | 287 | } | 
|  | 288 |  | 
|  | 289 | type globalCompatConfig struct { | 
|  | 290 | android.ModuleBase | 
|  | 291 |  | 
|  | 292 | properties globalCompatConfigProperties | 
|  | 293 |  | 
|  | 294 | outputFilePath android.OutputPath | 
|  | 295 | } | 
|  | 296 |  | 
|  | 297 | func (c *globalCompatConfig) GenerateAndroidBuildActions(ctx android.ModuleContext) { | 
|  | 298 | filename := String(c.properties.Filename) | 
|  | 299 |  | 
|  | 300 | inputPath := platformCompatConfigPath(ctx) | 
|  | 301 | c.outputFilePath = android.PathForModuleOut(ctx, filename).OutputPath | 
|  | 302 |  | 
|  | 303 | // This ensures that outputFilePath has the correct name for others to | 
|  | 304 | // use, as the source file may have a different name. | 
|  | 305 | ctx.Build(pctx, android.BuildParams{ | 
|  | 306 | Rule:   android.Cp, | 
|  | 307 | Output: c.outputFilePath, | 
|  | 308 | Input:  inputPath, | 
|  | 309 | }) | 
|  | 310 | } | 
|  | 311 |  | 
|  | 312 | func (h *globalCompatConfig) OutputFiles(tag string) (android.Paths, error) { | 
|  | 313 | switch tag { | 
|  | 314 | case "": | 
|  | 315 | return android.Paths{h.outputFilePath}, nil | 
|  | 316 | default: | 
|  | 317 | return nil, fmt.Errorf("unsupported module reference tag %q", tag) | 
|  | 318 | } | 
|  | 319 | } | 
|  | 320 |  | 
|  | 321 | // global_compat_config provides access to the merged compat config xml file generated by the build. | 
|  | 322 | func globalCompatConfigFactory() android.Module { | 
|  | 323 | module := &globalCompatConfig{} | 
|  | 324 | module.AddProperties(&module.properties) | 
|  | 325 | android.InitAndroidArchModule(module, android.HostAndDeviceSupported, android.MultilibCommon) | 
|  | 326 | return module | 
|  | 327 | } |