Colin Cross | f24a22a | 2019-01-31 14:12:44 -0800 | [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 | 1b033f5 | 2019-06-10 14:15:04 +0100 | [diff] [blame] | 18 | "fmt" |
| 19 | |
Colin Cross | f24a22a | 2019-01-31 14:12:44 -0800 | [diff] [blame] | 20 | "android/soong/android" |
| 21 | ) |
| 22 | |
| 23 | func init() { |
| 24 | android.RegisterSingletonType("hiddenapi", hiddenAPISingletonFactory) |
Paul Duffin | 1b033f5 | 2019-06-10 14:15:04 +0100 | [diff] [blame] | 25 | android.RegisterModuleType("hiddenapi_flags", hiddenAPIFlagsFactory) |
Colin Cross | f24a22a | 2019-01-31 14:12:44 -0800 | [diff] [blame] | 26 | } |
| 27 | |
| 28 | type hiddenAPISingletonPathsStruct struct { |
| 29 | stubFlags android.OutputPath |
| 30 | flags android.OutputPath |
| 31 | metadata android.OutputPath |
| 32 | } |
| 33 | |
| 34 | var hiddenAPISingletonPathsKey = android.NewOnceKey("hiddenAPISingletonPathsKey") |
| 35 | |
| 36 | // hiddenAPISingletonPaths creates all the paths for singleton files the first time it is called, which may be |
| 37 | // from a ModuleContext that needs to reference a file that will be created by a singleton rule that hasn't |
| 38 | // yet been created. |
| 39 | func hiddenAPISingletonPaths(ctx android.PathContext) hiddenAPISingletonPathsStruct { |
| 40 | return ctx.Config().Once(hiddenAPISingletonPathsKey, func() interface{} { |
| 41 | return hiddenAPISingletonPathsStruct{ |
| 42 | stubFlags: android.PathForOutput(ctx, "hiddenapi", "hiddenapi-stub-flags.txt"), |
| 43 | flags: android.PathForOutput(ctx, "hiddenapi", "hiddenapi-flags.csv"), |
| 44 | metadata: android.PathForOutput(ctx, "hiddenapi", "hiddenapi-greylist.csv"), |
| 45 | } |
| 46 | }).(hiddenAPISingletonPathsStruct) |
| 47 | } |
| 48 | |
Colin Cross | f24a22a | 2019-01-31 14:12:44 -0800 | [diff] [blame] | 49 | func hiddenAPISingletonFactory() android.Singleton { |
Colin Cross | ed023ec | 2019-02-19 12:38:45 -0800 | [diff] [blame] | 50 | return &hiddenAPISingleton{} |
Colin Cross | f24a22a | 2019-01-31 14:12:44 -0800 | [diff] [blame] | 51 | } |
| 52 | |
Colin Cross | ed023ec | 2019-02-19 12:38:45 -0800 | [diff] [blame] | 53 | type hiddenAPISingleton struct { |
| 54 | flags, metadata android.Path |
| 55 | } |
Colin Cross | f24a22a | 2019-01-31 14:12:44 -0800 | [diff] [blame] | 56 | |
| 57 | // hiddenAPI singleton rules |
Colin Cross | ed023ec | 2019-02-19 12:38:45 -0800 | [diff] [blame] | 58 | func (h *hiddenAPISingleton) GenerateBuildActions(ctx android.SingletonContext) { |
Colin Cross | f24a22a | 2019-01-31 14:12:44 -0800 | [diff] [blame] | 59 | // Don't run any hiddenapi rules if UNSAFE_DISABLE_HIDDENAPI_FLAGS=true |
| 60 | if ctx.Config().IsEnvTrue("UNSAFE_DISABLE_HIDDENAPI_FLAGS") { |
| 61 | return |
| 62 | } |
| 63 | |
| 64 | stubFlagsRule(ctx) |
| 65 | |
| 66 | // These rules depend on files located in frameworks/base, skip them if running in a tree that doesn't have them. |
Jiyong Park | 09cb629 | 2019-07-15 15:29:23 +0900 | [diff] [blame^] | 67 | if ctx.Config().FrameworksBaseDirExists(ctx) { |
Colin Cross | ed023ec | 2019-02-19 12:38:45 -0800 | [diff] [blame] | 68 | h.flags = flagsRule(ctx) |
| 69 | h.metadata = metadataRule(ctx) |
Colin Cross | f24a22a | 2019-01-31 14:12:44 -0800 | [diff] [blame] | 70 | } else { |
Colin Cross | ed023ec | 2019-02-19 12:38:45 -0800 | [diff] [blame] | 71 | h.flags = emptyFlagsRule(ctx) |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | // Export paths to Make. INTERNAL_PLATFORM_HIDDENAPI_FLAGS is used by Make rules in art/ and cts/. |
| 76 | // Both paths are used to call dist-for-goals. |
| 77 | func (h *hiddenAPISingleton) MakeVars(ctx android.MakeVarsContext) { |
| 78 | if ctx.Config().IsEnvTrue("UNSAFE_DISABLE_HIDDENAPI_FLAGS") { |
| 79 | return |
| 80 | } |
| 81 | |
| 82 | ctx.Strict("INTERNAL_PLATFORM_HIDDENAPI_FLAGS", h.flags.String()) |
| 83 | |
| 84 | if h.metadata != nil { |
| 85 | ctx.Strict("INTERNAL_PLATFORM_HIDDENAPI_GREYLIST_METADATA", h.metadata.String()) |
Colin Cross | f24a22a | 2019-01-31 14:12:44 -0800 | [diff] [blame] | 86 | } |
| 87 | } |
| 88 | |
| 89 | // stubFlagsRule creates the rule to build hiddenapi-stub-flags.txt out of dex jars from stub modules and boot image |
| 90 | // modules. |
| 91 | func stubFlagsRule(ctx android.SingletonContext) { |
| 92 | // Public API stubs |
| 93 | publicStubModules := []string{ |
| 94 | "android_stubs_current", |
Paul Duffin | 719fed4 | 2019-02-28 16:15:44 +0000 | [diff] [blame] | 95 | } |
| 96 | |
| 97 | // Add the android.test.base to the set of stubs only if the android.test.base module is on |
| 98 | // the boot jars list as the runtime will only enforce hiddenapi access against modules on |
| 99 | // that list. |
| 100 | if inList("android.test.base", ctx.Config().BootJars()) { |
| 101 | publicStubModules = append(publicStubModules, "android.test.base.stubs") |
Colin Cross | f24a22a | 2019-01-31 14:12:44 -0800 | [diff] [blame] | 102 | } |
| 103 | |
| 104 | // System API stubs |
| 105 | systemStubModules := []string{ |
| 106 | "android_system_stubs_current", |
| 107 | } |
| 108 | |
| 109 | // Test API stubs |
| 110 | testStubModules := []string{ |
| 111 | "android_test_stubs_current", |
| 112 | } |
| 113 | |
| 114 | // Core Platform API stubs |
| 115 | corePlatformStubModules := []string{ |
| 116 | "core.platform.api.stubs", |
| 117 | } |
| 118 | |
| 119 | // Allow products to define their own stubs for custom product jars that apps can use. |
| 120 | publicStubModules = append(publicStubModules, ctx.Config().ProductHiddenAPIStubs()...) |
| 121 | systemStubModules = append(systemStubModules, ctx.Config().ProductHiddenAPIStubsSystem()...) |
| 122 | testStubModules = append(testStubModules, ctx.Config().ProductHiddenAPIStubsTest()...) |
Allen Hair | de816cf | 2019-02-25 16:37:42 -0800 | [diff] [blame] | 123 | if ctx.Config().IsEnvTrue("EMMA_INSTRUMENT") { |
| 124 | publicStubModules = append(publicStubModules, "jacoco-stubs") |
| 125 | } |
Colin Cross | f24a22a | 2019-01-31 14:12:44 -0800 | [diff] [blame] | 126 | |
| 127 | publicStubPaths := make(android.Paths, len(publicStubModules)) |
| 128 | systemStubPaths := make(android.Paths, len(systemStubModules)) |
| 129 | testStubPaths := make(android.Paths, len(testStubModules)) |
| 130 | corePlatformStubPaths := make(android.Paths, len(corePlatformStubModules)) |
| 131 | |
| 132 | moduleListToPathList := map[*[]string]android.Paths{ |
| 133 | &publicStubModules: publicStubPaths, |
| 134 | &systemStubModules: systemStubPaths, |
| 135 | &testStubModules: testStubPaths, |
| 136 | &corePlatformStubModules: corePlatformStubPaths, |
| 137 | } |
| 138 | |
| 139 | var bootDexJars android.Paths |
| 140 | |
| 141 | ctx.VisitAllModules(func(module android.Module) { |
| 142 | // Collect dex jar paths for the modules listed above. |
| 143 | if j, ok := module.(Dependency); ok { |
| 144 | name := ctx.ModuleName(module) |
| 145 | for moduleList, pathList := range moduleListToPathList { |
| 146 | if i := android.IndexList(name, *moduleList); i != -1 { |
| 147 | pathList[i] = j.DexJar() |
| 148 | } |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | // Collect dex jar paths for modules that had hiddenapi encode called on them. |
| 153 | if h, ok := module.(hiddenAPIIntf); ok { |
| 154 | if jar := h.bootDexJar(); jar != nil { |
| 155 | bootDexJars = append(bootDexJars, jar) |
| 156 | } |
| 157 | } |
| 158 | }) |
| 159 | |
| 160 | var missingDeps []string |
| 161 | // Ensure all modules were converted to paths |
| 162 | for moduleList, pathList := range moduleListToPathList { |
| 163 | for i := range pathList { |
| 164 | if pathList[i] == nil { |
Colin Cross | caa0e1e | 2019-04-02 13:03:46 -0700 | [diff] [blame] | 165 | pathList[i] = android.PathForOutput(ctx, "missing") |
Colin Cross | f24a22a | 2019-01-31 14:12:44 -0800 | [diff] [blame] | 166 | if ctx.Config().AllowMissingDependencies() { |
| 167 | missingDeps = append(missingDeps, (*moduleList)[i]) |
Colin Cross | f24a22a | 2019-01-31 14:12:44 -0800 | [diff] [blame] | 168 | } else { |
| 169 | ctx.Errorf("failed to find dex jar path for module %q", |
| 170 | (*moduleList)[i]) |
| 171 | } |
| 172 | } |
| 173 | } |
| 174 | } |
| 175 | |
| 176 | // Singleton rule which applies hiddenapi on all boot class path dex files. |
| 177 | rule := android.NewRuleBuilder() |
| 178 | |
| 179 | outputPath := hiddenAPISingletonPaths(ctx).stubFlags |
| 180 | tempPath := android.PathForOutput(ctx, outputPath.Rel()+".tmp") |
| 181 | |
| 182 | rule.MissingDeps(missingDeps) |
| 183 | |
| 184 | rule.Command(). |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 185 | Tool(pctx.HostBinToolPath(ctx, "hiddenapi")). |
Colin Cross | f24a22a | 2019-01-31 14:12:44 -0800 | [diff] [blame] | 186 | Text("list"). |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 187 | FlagForEachInput("--boot-dex=", bootDexJars). |
| 188 | FlagWithInputList("--public-stub-classpath=", publicStubPaths, ":"). |
Andrei Onea | e04da07 | 2019-03-01 17:44:13 +0000 | [diff] [blame] | 189 | FlagWithInputList("--system-stub-classpath=", systemStubPaths, ":"). |
| 190 | FlagWithInputList("--test-stub-classpath=", testStubPaths, ":"). |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 191 | FlagWithInputList("--core-platform-stub-classpath=", corePlatformStubPaths, ":"). |
| 192 | FlagWithOutput("--out-api-flags=", tempPath) |
Colin Cross | f24a22a | 2019-01-31 14:12:44 -0800 | [diff] [blame] | 193 | |
| 194 | commitChangeForRestat(rule, tempPath, outputPath) |
| 195 | |
| 196 | rule.Build(pctx, ctx, "hiddenAPIStubFlagsFile", "hiddenapi stub flags") |
| 197 | } |
| 198 | |
| 199 | // flagsRule creates a rule to build hiddenapi-flags.csv out of flags.csv files generated for boot image modules and |
| 200 | // the greylists. |
Colin Cross | ed023ec | 2019-02-19 12:38:45 -0800 | [diff] [blame] | 201 | func flagsRule(ctx android.SingletonContext) android.Path { |
Colin Cross | f24a22a | 2019-01-31 14:12:44 -0800 | [diff] [blame] | 202 | var flagsCSV android.Paths |
| 203 | |
| 204 | var greylistIgnoreConflicts android.Path |
| 205 | |
| 206 | ctx.VisitAllModules(func(module android.Module) { |
| 207 | if h, ok := module.(hiddenAPIIntf); ok { |
| 208 | if csv := h.flagsCSV(); csv != nil { |
| 209 | flagsCSV = append(flagsCSV, csv) |
| 210 | } |
| 211 | } else if ds, ok := module.(*Droidstubs); ok && ctx.ModuleName(module) == "hiddenapi-lists-docs" { |
| 212 | greylistIgnoreConflicts = ds.removedDexApiFile |
| 213 | } |
| 214 | }) |
| 215 | |
| 216 | if greylistIgnoreConflicts == nil { |
| 217 | ctx.Errorf("failed to find removed_dex_api_filename from hiddenapi-lists-docs module") |
Colin Cross | ed023ec | 2019-02-19 12:38:45 -0800 | [diff] [blame] | 218 | return nil |
Colin Cross | f24a22a | 2019-01-31 14:12:44 -0800 | [diff] [blame] | 219 | } |
| 220 | |
| 221 | rule := android.NewRuleBuilder() |
| 222 | |
| 223 | outputPath := hiddenAPISingletonPaths(ctx).flags |
| 224 | tempPath := android.PathForOutput(ctx, outputPath.Rel()+".tmp") |
| 225 | |
| 226 | stubFlags := hiddenAPISingletonPaths(ctx).stubFlags |
| 227 | |
| 228 | rule.Command(). |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 229 | Tool(android.PathForSource(ctx, "frameworks/base/tools/hiddenapi/generate_hiddenapi_lists.py")). |
| 230 | FlagWithInput("--csv ", stubFlags). |
| 231 | Inputs(flagsCSV). |
Colin Cross | f24a22a | 2019-01-31 14:12:44 -0800 | [diff] [blame] | 232 | FlagWithInput("--greylist ", |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 233 | android.PathForSource(ctx, "frameworks/base/config/hiddenapi-greylist.txt")). |
Colin Cross | f24a22a | 2019-01-31 14:12:44 -0800 | [diff] [blame] | 234 | FlagWithInput("--greylist-ignore-conflicts ", |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 235 | greylistIgnoreConflicts). |
Colin Cross | f24a22a | 2019-01-31 14:12:44 -0800 | [diff] [blame] | 236 | FlagWithInput("--greylist-max-p ", |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 237 | android.PathForSource(ctx, "frameworks/base/config/hiddenapi-greylist-max-p.txt")). |
Colin Cross | f24a22a | 2019-01-31 14:12:44 -0800 | [diff] [blame] | 238 | FlagWithInput("--greylist-max-o-ignore-conflicts ", |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 239 | android.PathForSource(ctx, "frameworks/base/config/hiddenapi-greylist-max-o.txt")). |
Colin Cross | f24a22a | 2019-01-31 14:12:44 -0800 | [diff] [blame] | 240 | FlagWithInput("--blacklist ", |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 241 | android.PathForSource(ctx, "frameworks/base/config/hiddenapi-force-blacklist.txt")). |
Andrei Onea | 896237b | 2019-03-29 13:45:58 +0000 | [diff] [blame] | 242 | FlagWithInput("--greylist-packages ", |
| 243 | android.PathForSource(ctx, "frameworks/base/config/hiddenapi-greylist-packages.txt")). |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 244 | FlagWithOutput("--output ", tempPath) |
Colin Cross | f24a22a | 2019-01-31 14:12:44 -0800 | [diff] [blame] | 245 | |
| 246 | commitChangeForRestat(rule, tempPath, outputPath) |
| 247 | |
| 248 | rule.Build(pctx, ctx, "hiddenAPIFlagsFile", "hiddenapi flags") |
Colin Cross | ed023ec | 2019-02-19 12:38:45 -0800 | [diff] [blame] | 249 | |
| 250 | return outputPath |
Colin Cross | f24a22a | 2019-01-31 14:12:44 -0800 | [diff] [blame] | 251 | } |
| 252 | |
| 253 | // emptyFlagsRule creates a rule to build an empty hiddenapi-flags.csv, which is needed by master-art-host builds that |
| 254 | // have a partial manifest without frameworks/base but still need to build a boot image. |
Colin Cross | ed023ec | 2019-02-19 12:38:45 -0800 | [diff] [blame] | 255 | func emptyFlagsRule(ctx android.SingletonContext) android.Path { |
Colin Cross | f24a22a | 2019-01-31 14:12:44 -0800 | [diff] [blame] | 256 | rule := android.NewRuleBuilder() |
| 257 | |
| 258 | outputPath := hiddenAPISingletonPaths(ctx).flags |
| 259 | |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 260 | rule.Command().Text("rm").Flag("-f").Output(outputPath) |
| 261 | rule.Command().Text("touch").Output(outputPath) |
Colin Cross | f24a22a | 2019-01-31 14:12:44 -0800 | [diff] [blame] | 262 | |
| 263 | rule.Build(pctx, ctx, "emptyHiddenAPIFlagsFile", "empty hiddenapi flags") |
Colin Cross | ed023ec | 2019-02-19 12:38:45 -0800 | [diff] [blame] | 264 | |
| 265 | return outputPath |
Colin Cross | f24a22a | 2019-01-31 14:12:44 -0800 | [diff] [blame] | 266 | } |
| 267 | |
| 268 | // metadataRule creates a rule to build hiddenapi-greylist.csv out of the metadata.csv files generated for boot image |
| 269 | // modules. |
Colin Cross | ed023ec | 2019-02-19 12:38:45 -0800 | [diff] [blame] | 270 | func metadataRule(ctx android.SingletonContext) android.Path { |
Colin Cross | f24a22a | 2019-01-31 14:12:44 -0800 | [diff] [blame] | 271 | var metadataCSV android.Paths |
| 272 | |
| 273 | ctx.VisitAllModules(func(module android.Module) { |
| 274 | if h, ok := module.(hiddenAPIIntf); ok { |
| 275 | if csv := h.metadataCSV(); csv != nil { |
| 276 | metadataCSV = append(metadataCSV, csv) |
| 277 | } |
| 278 | } |
| 279 | }) |
| 280 | |
| 281 | rule := android.NewRuleBuilder() |
| 282 | |
| 283 | outputPath := hiddenAPISingletonPaths(ctx).metadata |
| 284 | |
| 285 | rule.Command(). |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 286 | Tool(android.PathForSource(ctx, "frameworks/base/tools/hiddenapi/merge_csv.py")). |
| 287 | Inputs(metadataCSV). |
Colin Cross | f24a22a | 2019-01-31 14:12:44 -0800 | [diff] [blame] | 288 | Text(">"). |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 289 | Output(outputPath) |
Colin Cross | f24a22a | 2019-01-31 14:12:44 -0800 | [diff] [blame] | 290 | |
| 291 | rule.Build(pctx, ctx, "hiddenAPIGreylistMetadataFile", "hiddenapi greylist metadata") |
Colin Cross | ed023ec | 2019-02-19 12:38:45 -0800 | [diff] [blame] | 292 | |
| 293 | return outputPath |
Colin Cross | f24a22a | 2019-01-31 14:12:44 -0800 | [diff] [blame] | 294 | } |
| 295 | |
| 296 | // commitChangeForRestat adds a command to a rule that updates outputPath from tempPath if they are different. It |
| 297 | // also marks the rule as restat and marks the tempPath as a temporary file that should not be considered an output of |
| 298 | // the rule. |
| 299 | func commitChangeForRestat(rule *android.RuleBuilder, tempPath, outputPath android.WritablePath) { |
| 300 | rule.Restat() |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 301 | rule.Temporary(tempPath) |
Colin Cross | f24a22a | 2019-01-31 14:12:44 -0800 | [diff] [blame] | 302 | rule.Command(). |
| 303 | Text("("). |
| 304 | Text("if"). |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 305 | Text("cmp -s").Input(tempPath).Output(outputPath).Text(";"). |
Colin Cross | f24a22a | 2019-01-31 14:12:44 -0800 | [diff] [blame] | 306 | Text("then"). |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 307 | Text("rm").Input(tempPath).Text(";"). |
Colin Cross | f24a22a | 2019-01-31 14:12:44 -0800 | [diff] [blame] | 308 | Text("else"). |
Colin Cross | 69f59a3 | 2019-02-15 10:39:37 -0800 | [diff] [blame] | 309 | Text("mv").Input(tempPath).Output(outputPath).Text(";"). |
Colin Cross | f24a22a | 2019-01-31 14:12:44 -0800 | [diff] [blame] | 310 | Text("fi"). |
| 311 | Text(")") |
| 312 | } |
Paul Duffin | 1b033f5 | 2019-06-10 14:15:04 +0100 | [diff] [blame] | 313 | |
| 314 | type hiddenAPIFlagsProperties struct { |
| 315 | // name of the file into which the flags will be copied. |
| 316 | Filename *string |
| 317 | } |
| 318 | |
| 319 | type hiddenAPIFlags struct { |
| 320 | android.ModuleBase |
| 321 | |
| 322 | properties hiddenAPIFlagsProperties |
| 323 | |
| 324 | outputFilePath android.OutputPath |
| 325 | } |
| 326 | |
| 327 | func (h *hiddenAPIFlags) GenerateAndroidBuildActions(ctx android.ModuleContext) { |
| 328 | filename := String(h.properties.Filename) |
| 329 | |
| 330 | inputPath := hiddenAPISingletonPaths(ctx).flags |
| 331 | h.outputFilePath = android.PathForModuleOut(ctx, filename).OutputPath |
| 332 | |
| 333 | // This ensures that outputFilePath has the correct name for others to |
| 334 | // use, as the source file may have a different name. |
| 335 | ctx.Build(pctx, android.BuildParams{ |
| 336 | Rule: android.Cp, |
| 337 | Output: h.outputFilePath, |
| 338 | Input: inputPath, |
| 339 | }) |
| 340 | } |
| 341 | |
| 342 | func (h *hiddenAPIFlags) OutputFiles(tag string) (android.Paths, error) { |
| 343 | switch tag { |
| 344 | case "": |
| 345 | return android.Paths{h.outputFilePath}, nil |
| 346 | default: |
| 347 | return nil, fmt.Errorf("unsupported module reference tag %q", tag) |
| 348 | } |
| 349 | } |
| 350 | |
| 351 | // hiddenapi-flags provides access to the hiddenapi-flags.csv file generated during the build. |
| 352 | func hiddenAPIFlagsFactory() android.Module { |
| 353 | module := &hiddenAPIFlags{} |
| 354 | module.AddProperties(&module.properties) |
| 355 | android.InitAndroidArchModule(module, android.HostAndDeviceSupported, android.MultilibCommon) |
| 356 | return module |
| 357 | } |