blob: 4003aea0031ffac730da4d1b55098e76b431e542 [file] [log] [blame]
Colin Crossf24a22a2019-01-31 14:12:44 -08001// 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
15package java
16
17import (
Paul Duffin1b033f52019-06-10 14:15:04 +010018 "fmt"
19
Colin Crossf24a22a2019-01-31 14:12:44 -080020 "android/soong/android"
Anton Hanssonb3cbd612020-10-06 12:04:34 +010021 "android/soong/genrule"
Colin Crossf24a22a2019-01-31 14:12:44 -080022)
23
24func init() {
25 android.RegisterSingletonType("hiddenapi", hiddenAPISingletonFactory)
Artur Satayevb5df8a02020-02-19 16:39:59 +000026 android.RegisterSingletonType("hiddenapi_index", hiddenAPIIndexSingletonFactory)
Paul Duffin1b033f52019-06-10 14:15:04 +010027 android.RegisterModuleType("hiddenapi_flags", hiddenAPIFlagsFactory)
Colin Crossf24a22a2019-01-31 14:12:44 -080028}
29
30type hiddenAPISingletonPathsStruct struct {
Colin Crossf24a22a2019-01-31 14:12:44 -080031 flags android.OutputPath
Artur Satayevb5df8a02020-02-19 16:39:59 +000032 index android.OutputPath
Colin Crossf24a22a2019-01-31 14:12:44 -080033 metadata android.OutputPath
Artur Satayevb5df8a02020-02-19 16:39:59 +000034 stubFlags android.OutputPath
Colin Crossf24a22a2019-01-31 14:12:44 -080035}
36
37var hiddenAPISingletonPathsKey = android.NewOnceKey("hiddenAPISingletonPathsKey")
38
39// hiddenAPISingletonPaths creates all the paths for singleton files the first time it is called, which may be
40// from a ModuleContext that needs to reference a file that will be created by a singleton rule that hasn't
41// yet been created.
42func hiddenAPISingletonPaths(ctx android.PathContext) hiddenAPISingletonPathsStruct {
43 return ctx.Config().Once(hiddenAPISingletonPathsKey, func() interface{} {
44 return hiddenAPISingletonPathsStruct{
Colin Crossf24a22a2019-01-31 14:12:44 -080045 flags: android.PathForOutput(ctx, "hiddenapi", "hiddenapi-flags.csv"),
Artur Satayevb5df8a02020-02-19 16:39:59 +000046 index: android.PathForOutput(ctx, "hiddenapi", "hiddenapi-index.csv"),
Andrei Onea47841972020-08-10 17:23:52 +010047 metadata: android.PathForOutput(ctx, "hiddenapi", "hiddenapi-unsupported.csv"),
Artur Satayevb5df8a02020-02-19 16:39:59 +000048 stubFlags: android.PathForOutput(ctx, "hiddenapi", "hiddenapi-stub-flags.txt"),
Colin Crossf24a22a2019-01-31 14:12:44 -080049 }
50 }).(hiddenAPISingletonPathsStruct)
51}
52
Colin Crossf24a22a2019-01-31 14:12:44 -080053func hiddenAPISingletonFactory() android.Singleton {
Colin Crossed023ec2019-02-19 12:38:45 -080054 return &hiddenAPISingleton{}
Colin Crossf24a22a2019-01-31 14:12:44 -080055}
56
Colin Crossed023ec2019-02-19 12:38:45 -080057type hiddenAPISingleton struct {
58 flags, metadata android.Path
59}
Colin Crossf24a22a2019-01-31 14:12:44 -080060
61// hiddenAPI singleton rules
Colin Crossed023ec2019-02-19 12:38:45 -080062func (h *hiddenAPISingleton) GenerateBuildActions(ctx android.SingletonContext) {
Colin Crossf24a22a2019-01-31 14:12:44 -080063 // Don't run any hiddenapi rules if UNSAFE_DISABLE_HIDDENAPI_FLAGS=true
64 if ctx.Config().IsEnvTrue("UNSAFE_DISABLE_HIDDENAPI_FLAGS") {
65 return
66 }
67
68 stubFlagsRule(ctx)
69
70 // These rules depend on files located in frameworks/base, skip them if running in a tree that doesn't have them.
Jiyong Park09cb6292019-07-15 15:29:23 +090071 if ctx.Config().FrameworksBaseDirExists(ctx) {
Colin Crossed023ec2019-02-19 12:38:45 -080072 h.flags = flagsRule(ctx)
73 h.metadata = metadataRule(ctx)
Colin Crossf24a22a2019-01-31 14:12:44 -080074 } else {
Colin Crossed023ec2019-02-19 12:38:45 -080075 h.flags = emptyFlagsRule(ctx)
76 }
77}
78
79// Export paths to Make. INTERNAL_PLATFORM_HIDDENAPI_FLAGS is used by Make rules in art/ and cts/.
80// Both paths are used to call dist-for-goals.
81func (h *hiddenAPISingleton) MakeVars(ctx android.MakeVarsContext) {
82 if ctx.Config().IsEnvTrue("UNSAFE_DISABLE_HIDDENAPI_FLAGS") {
83 return
84 }
85
86 ctx.Strict("INTERNAL_PLATFORM_HIDDENAPI_FLAGS", h.flags.String())
87
88 if h.metadata != nil {
89 ctx.Strict("INTERNAL_PLATFORM_HIDDENAPI_GREYLIST_METADATA", h.metadata.String())
Colin Crossf24a22a2019-01-31 14:12:44 -080090 }
91}
92
93// stubFlagsRule creates the rule to build hiddenapi-stub-flags.txt out of dex jars from stub modules and boot image
94// modules.
95func stubFlagsRule(ctx android.SingletonContext) {
Anton Hanssona2adc372020-07-03 15:31:32 +010096 var publicStubModules []string
97 var systemStubModules []string
98 var testStubModules []string
99 var corePlatformStubModules []string
100
101 if ctx.Config().AlwaysUsePrebuiltSdks() {
102 // Build configuration mandates using prebuilt stub modules
103 publicStubModules = append(publicStubModules, "sdk_public_current_android")
104 systemStubModules = append(systemStubModules, "sdk_system_current_android")
105 testStubModules = append(testStubModules, "sdk_test_current_android")
106 } else {
107 // Use stub modules built from source
108 publicStubModules = append(publicStubModules, "android_stubs_current")
109 systemStubModules = append(systemStubModules, "android_system_stubs_current")
110 testStubModules = append(testStubModules, "android_test_stubs_current")
Paul Duffin719fed42019-02-28 16:15:44 +0000111 }
Anton Hanssona2adc372020-07-03 15:31:32 +0100112 // We do not have prebuilts of the core platform api yet
113 corePlatformStubModules = append(corePlatformStubModules, "legacy.core.platform.api.stubs")
Paul Duffin719fed42019-02-28 16:15:44 +0000114
115 // Add the android.test.base to the set of stubs only if the android.test.base module is on
116 // the boot jars list as the runtime will only enforce hiddenapi access against modules on
117 // that list.
Anton Hanssona2adc372020-07-03 15:31:32 +0100118 if inList("android.test.base", ctx.Config().BootJars()) {
119 if ctx.Config().AlwaysUsePrebuiltSdks() {
120 publicStubModules = append(publicStubModules, "sdk_public_current_android.test.base")
121 } else {
122 publicStubModules = append(publicStubModules, "android.test.base.stubs")
123 }
Colin Crossf24a22a2019-01-31 14:12:44 -0800124 }
125
126 // Allow products to define their own stubs for custom product jars that apps can use.
127 publicStubModules = append(publicStubModules, ctx.Config().ProductHiddenAPIStubs()...)
128 systemStubModules = append(systemStubModules, ctx.Config().ProductHiddenAPIStubsSystem()...)
129 testStubModules = append(testStubModules, ctx.Config().ProductHiddenAPIStubsTest()...)
Allen Hairde816cf2019-02-25 16:37:42 -0800130 if ctx.Config().IsEnvTrue("EMMA_INSTRUMENT") {
131 publicStubModules = append(publicStubModules, "jacoco-stubs")
132 }
Colin Crossf24a22a2019-01-31 14:12:44 -0800133
134 publicStubPaths := make(android.Paths, len(publicStubModules))
135 systemStubPaths := make(android.Paths, len(systemStubModules))
136 testStubPaths := make(android.Paths, len(testStubModules))
137 corePlatformStubPaths := make(android.Paths, len(corePlatformStubModules))
138
139 moduleListToPathList := map[*[]string]android.Paths{
140 &publicStubModules: publicStubPaths,
141 &systemStubModules: systemStubPaths,
142 &testStubModules: testStubPaths,
143 &corePlatformStubModules: corePlatformStubPaths,
144 }
145
146 var bootDexJars android.Paths
147
148 ctx.VisitAllModules(func(module android.Module) {
149 // Collect dex jar paths for the modules listed above.
150 if j, ok := module.(Dependency); ok {
151 name := ctx.ModuleName(module)
152 for moduleList, pathList := range moduleListToPathList {
153 if i := android.IndexList(name, *moduleList); i != -1 {
Ulyana Trafimovich5539e7b2020-06-04 14:08:17 +0000154 pathList[i] = j.DexJarBuildPath()
Colin Crossf24a22a2019-01-31 14:12:44 -0800155 }
156 }
157 }
158
159 // Collect dex jar paths for modules that had hiddenapi encode called on them.
160 if h, ok := module.(hiddenAPIIntf); ok {
161 if jar := h.bootDexJar(); jar != nil {
Jiyong Park4ed468c2019-12-19 02:11:10 +0000162 // For a java lib included in an APEX, only take the one built for
163 // the platform variant, and skip the variants for APEXes.
164 // Otherwise, the hiddenapi tool will complain about duplicated classes
Colin Cross56a83212020-09-15 18:30:11 -0700165 apexInfo := ctx.ModuleProvider(module, android.ApexInfoProvider).(android.ApexInfo)
166 if !apexInfo.IsForPlatform() {
167 return
Jiyong Park7f7766d2019-07-25 22:02:35 +0900168 }
Liz Kammer5ca3a622020-08-05 15:40:41 -0700169
Colin Crossf24a22a2019-01-31 14:12:44 -0800170 bootDexJars = append(bootDexJars, jar)
171 }
172 }
173 })
174
175 var missingDeps []string
176 // Ensure all modules were converted to paths
177 for moduleList, pathList := range moduleListToPathList {
178 for i := range pathList {
179 if pathList[i] == nil {
Colin Crosscaa0e1e2019-04-02 13:03:46 -0700180 pathList[i] = android.PathForOutput(ctx, "missing")
Colin Crossf24a22a2019-01-31 14:12:44 -0800181 if ctx.Config().AllowMissingDependencies() {
182 missingDeps = append(missingDeps, (*moduleList)[i])
Colin Crossf24a22a2019-01-31 14:12:44 -0800183 } else {
184 ctx.Errorf("failed to find dex jar path for module %q",
185 (*moduleList)[i])
186 }
187 }
188 }
189 }
190
191 // Singleton rule which applies hiddenapi on all boot class path dex files.
192 rule := android.NewRuleBuilder()
193
194 outputPath := hiddenAPISingletonPaths(ctx).stubFlags
195 tempPath := android.PathForOutput(ctx, outputPath.Rel()+".tmp")
196
197 rule.MissingDeps(missingDeps)
198
199 rule.Command().
Martin Stjernholm7260d062019-12-09 21:47:14 +0000200 Tool(ctx.Config().HostToolPath(ctx, "hiddenapi")).
Colin Crossf24a22a2019-01-31 14:12:44 -0800201 Text("list").
Colin Cross69f59a32019-02-15 10:39:37 -0800202 FlagForEachInput("--boot-dex=", bootDexJars).
203 FlagWithInputList("--public-stub-classpath=", publicStubPaths, ":").
Andrei Oneae04da072019-03-01 17:44:13 +0000204 FlagWithInputList("--system-stub-classpath=", systemStubPaths, ":").
205 FlagWithInputList("--test-stub-classpath=", testStubPaths, ":").
Colin Cross69f59a32019-02-15 10:39:37 -0800206 FlagWithInputList("--core-platform-stub-classpath=", corePlatformStubPaths, ":").
207 FlagWithOutput("--out-api-flags=", tempPath)
Colin Crossf24a22a2019-01-31 14:12:44 -0800208
209 commitChangeForRestat(rule, tempPath, outputPath)
210
211 rule.Build(pctx, ctx, "hiddenAPIStubFlagsFile", "hiddenapi stub flags")
212}
213
Eric Jeong9791efa2020-06-04 17:56:18 -0700214func moduleForGreyListRemovedApis(ctx android.SingletonContext, module android.Module) bool {
215 switch ctx.ModuleName(module) {
216 case "api-stubs-docs", "system-api-stubs-docs", "android.car-stubs-docs", "android.car-system-stubs-docs":
217 return true
218 default:
219 return false
220 }
221}
222
Colin Crossf24a22a2019-01-31 14:12:44 -0800223// flagsRule creates a rule to build hiddenapi-flags.csv out of flags.csv files generated for boot image modules and
Aleksei Kalinovf0f5cdc2020-07-28 13:44:24 +0000224// the unsupported API.
Colin Crossed023ec2019-02-19 12:38:45 -0800225func flagsRule(ctx android.SingletonContext) android.Path {
Colin Crossf24a22a2019-01-31 14:12:44 -0800226 var flagsCSV android.Paths
Anton Hanssonb3cbd612020-10-06 12:04:34 +0100227 var combinedRemovedApis android.Path
Colin Crossf24a22a2019-01-31 14:12:44 -0800228
229 ctx.VisitAllModules(func(module android.Module) {
230 if h, ok := module.(hiddenAPIIntf); ok {
231 if csv := h.flagsCSV(); csv != nil {
232 flagsCSV = append(flagsCSV, csv)
233 }
Anton Hanssonb3cbd612020-10-06 12:04:34 +0100234 } else if g, ok := module.(*genrule.Module); ok {
235 if ctx.ModuleName(module) == "combined-removed-dex" {
236 if len(g.GeneratedSourceFiles()) != 1 || combinedRemovedApis != nil {
237 ctx.Errorf("Expected 1 combined-removed-dex module that generates 1 output file.")
238 }
239 combinedRemovedApis = g.GeneratedSourceFiles()[0]
Artur Satayevc7fb5c92020-03-25 16:48:49 +0000240 }
Colin Crossf24a22a2019-01-31 14:12:44 -0800241 }
242 })
243
Anton Hanssonb3cbd612020-10-06 12:04:34 +0100244 if combinedRemovedApis == nil {
245 ctx.Errorf("Failed to find combined-removed-dex.")
246 }
Colin Crossf24a22a2019-01-31 14:12:44 -0800247
248 rule := android.NewRuleBuilder()
249
250 outputPath := hiddenAPISingletonPaths(ctx).flags
251 tempPath := android.PathForOutput(ctx, outputPath.Rel()+".tmp")
252
253 stubFlags := hiddenAPISingletonPaths(ctx).stubFlags
254
255 rule.Command().
Colin Cross69f59a32019-02-15 10:39:37 -0800256 Tool(android.PathForSource(ctx, "frameworks/base/tools/hiddenapi/generate_hiddenapi_lists.py")).
257 FlagWithInput("--csv ", stubFlags).
258 Inputs(flagsCSV).
Aleksei Kalinovf0f5cdc2020-07-28 13:44:24 +0000259 FlagWithInput("--unsupported ",
Andrei Oneaca790812020-08-04 15:34:35 +0100260 android.PathForSource(ctx, "frameworks/base/config/hiddenapi-unsupported.txt")).
Mathew Inwooda44e8c52020-10-20 15:23:04 +0100261 FlagWithInput("--unsupported ", combinedRemovedApis).Flag("--ignore-conflicts ").FlagWithArg("--tag ", "removed").
Aleksei Kalinovf0f5cdc2020-07-28 13:44:24 +0000262 FlagWithInput("--max-target-q ",
Andrei Oneaca790812020-08-04 15:34:35 +0100263 android.PathForSource(ctx, "frameworks/base/config/hiddenapi-max-target-q.txt")).
Aleksei Kalinovf0f5cdc2020-07-28 13:44:24 +0000264 FlagWithInput("--max-target-p ",
Andrei Oneaca790812020-08-04 15:34:35 +0100265 android.PathForSource(ctx, "frameworks/base/config/hiddenapi-max-target-p.txt")).
Mathew Inwooda44e8c52020-10-20 15:23:04 +0100266 FlagWithInput("--max-target-o ", android.PathForSource(
Mathew Inwood1ef4ba92020-11-10 14:49:43 +0000267 ctx, "frameworks/base/config/hiddenapi-max-target-o.txt")).Flag("--ignore-conflicts ").FlagWithArg("--tag ", "lo-prio").
Aleksei Kalinovf0f5cdc2020-07-28 13:44:24 +0000268 FlagWithInput("--blocked ",
Andrei Oneaca790812020-08-04 15:34:35 +0100269 android.PathForSource(ctx, "frameworks/base/config/hiddenapi-force-blocked.txt")).
Mathew Inwooda44e8c52020-10-20 15:23:04 +0100270 FlagWithInput("--unsupported ", android.PathForSource(
271 ctx, "frameworks/base/config/hiddenapi-unsupported-packages.txt")).Flag("--packages ").
Colin Cross69f59a32019-02-15 10:39:37 -0800272 FlagWithOutput("--output ", tempPath)
Colin Crossf24a22a2019-01-31 14:12:44 -0800273
274 commitChangeForRestat(rule, tempPath, outputPath)
275
276 rule.Build(pctx, ctx, "hiddenAPIFlagsFile", "hiddenapi flags")
Colin Crossed023ec2019-02-19 12:38:45 -0800277
278 return outputPath
Colin Crossf24a22a2019-01-31 14:12:44 -0800279}
280
281// emptyFlagsRule creates a rule to build an empty hiddenapi-flags.csv, which is needed by master-art-host builds that
282// have a partial manifest without frameworks/base but still need to build a boot image.
Colin Crossed023ec2019-02-19 12:38:45 -0800283func emptyFlagsRule(ctx android.SingletonContext) android.Path {
Colin Crossf24a22a2019-01-31 14:12:44 -0800284 rule := android.NewRuleBuilder()
285
286 outputPath := hiddenAPISingletonPaths(ctx).flags
287
Colin Cross69f59a32019-02-15 10:39:37 -0800288 rule.Command().Text("rm").Flag("-f").Output(outputPath)
289 rule.Command().Text("touch").Output(outputPath)
Colin Crossf24a22a2019-01-31 14:12:44 -0800290
291 rule.Build(pctx, ctx, "emptyHiddenAPIFlagsFile", "empty hiddenapi flags")
Colin Crossed023ec2019-02-19 12:38:45 -0800292
293 return outputPath
Colin Crossf24a22a2019-01-31 14:12:44 -0800294}
295
Andrei Onea47841972020-08-10 17:23:52 +0100296// metadataRule creates a rule to build hiddenapi-unsupported.csv out of the metadata.csv files generated for boot image
Colin Crossf24a22a2019-01-31 14:12:44 -0800297// modules.
Colin Crossed023ec2019-02-19 12:38:45 -0800298func metadataRule(ctx android.SingletonContext) android.Path {
Colin Crossf24a22a2019-01-31 14:12:44 -0800299 var metadataCSV android.Paths
300
301 ctx.VisitAllModules(func(module android.Module) {
302 if h, ok := module.(hiddenAPIIntf); ok {
303 if csv := h.metadataCSV(); csv != nil {
304 metadataCSV = append(metadataCSV, csv)
305 }
306 }
307 })
308
309 rule := android.NewRuleBuilder()
310
311 outputPath := hiddenAPISingletonPaths(ctx).metadata
312
313 rule.Command().
Artur Satayevb01dd442020-01-20 17:53:31 +0000314 BuiltTool(ctx, "merge_csv").
Artur Satayev79fac052020-01-20 19:11:33 +0000315 FlagWithOutput("--output=", outputPath).
316 Inputs(metadataCSV)
Colin Crossf24a22a2019-01-31 14:12:44 -0800317
318 rule.Build(pctx, ctx, "hiddenAPIGreylistMetadataFile", "hiddenapi greylist metadata")
Colin Crossed023ec2019-02-19 12:38:45 -0800319
320 return outputPath
Colin Crossf24a22a2019-01-31 14:12:44 -0800321}
322
323// commitChangeForRestat adds a command to a rule that updates outputPath from tempPath if they are different. It
324// also marks the rule as restat and marks the tempPath as a temporary file that should not be considered an output of
325// the rule.
326func commitChangeForRestat(rule *android.RuleBuilder, tempPath, outputPath android.WritablePath) {
327 rule.Restat()
Colin Cross69f59a32019-02-15 10:39:37 -0800328 rule.Temporary(tempPath)
Colin Crossf24a22a2019-01-31 14:12:44 -0800329 rule.Command().
330 Text("(").
331 Text("if").
Colin Cross69f59a32019-02-15 10:39:37 -0800332 Text("cmp -s").Input(tempPath).Output(outputPath).Text(";").
Colin Crossf24a22a2019-01-31 14:12:44 -0800333 Text("then").
Colin Cross69f59a32019-02-15 10:39:37 -0800334 Text("rm").Input(tempPath).Text(";").
Colin Crossf24a22a2019-01-31 14:12:44 -0800335 Text("else").
Colin Cross69f59a32019-02-15 10:39:37 -0800336 Text("mv").Input(tempPath).Output(outputPath).Text(";").
Colin Crossf24a22a2019-01-31 14:12:44 -0800337 Text("fi").
338 Text(")")
339}
Paul Duffin1b033f52019-06-10 14:15:04 +0100340
341type hiddenAPIFlagsProperties struct {
342 // name of the file into which the flags will be copied.
343 Filename *string
344}
345
346type hiddenAPIFlags struct {
347 android.ModuleBase
348
349 properties hiddenAPIFlagsProperties
350
351 outputFilePath android.OutputPath
352}
353
354func (h *hiddenAPIFlags) GenerateAndroidBuildActions(ctx android.ModuleContext) {
355 filename := String(h.properties.Filename)
356
357 inputPath := hiddenAPISingletonPaths(ctx).flags
358 h.outputFilePath = android.PathForModuleOut(ctx, filename).OutputPath
359
360 // This ensures that outputFilePath has the correct name for others to
361 // use, as the source file may have a different name.
362 ctx.Build(pctx, android.BuildParams{
363 Rule: android.Cp,
364 Output: h.outputFilePath,
365 Input: inputPath,
366 })
367}
368
369func (h *hiddenAPIFlags) OutputFiles(tag string) (android.Paths, error) {
370 switch tag {
371 case "":
372 return android.Paths{h.outputFilePath}, nil
373 default:
374 return nil, fmt.Errorf("unsupported module reference tag %q", tag)
375 }
376}
377
378// hiddenapi-flags provides access to the hiddenapi-flags.csv file generated during the build.
379func hiddenAPIFlagsFactory() android.Module {
380 module := &hiddenAPIFlags{}
381 module.AddProperties(&module.properties)
382 android.InitAndroidArchModule(module, android.HostAndDeviceSupported, android.MultilibCommon)
383 return module
384}
Artur Satayevb5df8a02020-02-19 16:39:59 +0000385
386func hiddenAPIIndexSingletonFactory() android.Singleton {
387 return &hiddenAPIIndexSingleton{}
388}
389
390type hiddenAPIIndexSingleton struct {
391 index android.Path
392}
393
394func (h *hiddenAPIIndexSingleton) GenerateBuildActions(ctx android.SingletonContext) {
395 // Don't run any hiddenapi rules if UNSAFE_DISABLE_HIDDENAPI_FLAGS=true
396 if ctx.Config().IsEnvTrue("UNSAFE_DISABLE_HIDDENAPI_FLAGS") {
397 return
398 }
399
400 indexes := android.Paths{}
401 ctx.VisitAllModules(func(module android.Module) {
402 if h, ok := module.(hiddenAPIIntf); ok {
403 if h.indexCSV() != nil {
404 indexes = append(indexes, h.indexCSV())
405 }
406 }
407 })
408
409 rule := android.NewRuleBuilder()
410 rule.Command().
411 BuiltTool(ctx, "merge_csv").
412 FlagWithArg("--header=", "signature,file,startline,startcol,endline,endcol,properties").
413 FlagWithOutput("--output=", hiddenAPISingletonPaths(ctx).index).
414 Inputs(indexes)
415 rule.Build(pctx, ctx, "singleton-merged-hiddenapi-index", "Singleton merged Hidden API index")
416
417 h.index = hiddenAPISingletonPaths(ctx).index
418}
419
420func (h *hiddenAPIIndexSingleton) MakeVars(ctx android.MakeVarsContext) {
421 if ctx.Config().IsEnvTrue("UNSAFE_DISABLE_HIDDENAPI_FLAGS") {
422 return
423 }
424
425 ctx.Strict("INTERNAL_PLATFORM_HIDDENAPI_INDEX", h.index.String())
426}