blob: bc3b4746ac78fa1beedb2f6a3a3478dfd3d0aa83 [file] [log] [blame]
Colin Cross8faf8fc2019-01-16 15:15:52 -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 (
Colin Cross8faf8fc2019-01-16 15:15:52 -080018 "github.com/google/blueprint"
19
20 "android/soong/android"
21)
22
23var hiddenAPIGenerateCSVRule = pctx.AndroidStaticRule("hiddenAPIGenerateCSV", blueprint.RuleParams{
Andrei Onea23fea042020-08-12 16:48:23 +010024 Command: "${config.Class2NonSdkList} --stub-api-flags ${stubAPIFlags} $in $outFlag $out",
25 CommandDeps: []string{"${config.Class2NonSdkList}"},
David Brazdil0f670a22019-01-18 16:30:03 +000026}, "outFlag", "stubAPIFlags")
Colin Cross8faf8fc2019-01-16 15:15:52 -080027
Colin Crossf24a22a2019-01-31 14:12:44 -080028type hiddenAPI struct {
Paul Duffinf75e5272021-02-09 14:34:25 +000029 // The name of the module as it would be used in the boot jars configuration, e.g. without any
Paul Duffinf8f4af82021-02-12 15:42:20 +000030 // prebuilt_ prefix (if it is a prebuilt) and without any ".impl" suffix if it is a
31 // java_sdk_library implementation library.
Paul Duffinf75e5272021-02-09 14:34:25 +000032 configurationName string
33
34 // True if the module containing this structure contributes to the hiddenapi information or has
35 // that information encoded within it.
Paul Duffin4103e922021-02-01 19:01:34 +000036 active bool
37
Paul Duffinf75e5272021-02-09 14:34:25 +000038 // Identifies the active module variant which will be used as the source of hiddenapi information.
39 //
40 // A class may be compiled into a number of different module variants each of which will need the
41 // hiddenapi information encoded into it and so will be marked as active. However, only one of
42 // them must be used as a source of information by hiddenapi otherwise it will end up with
43 // duplicate entries. That module will have primary=true.
44 //
45 // Note, that modules <x>-hiddenapi that provide additional annotation information for module <x>
46 // that is on the bootclasspath are marked as primary=true as they are the primary source of that
47 // annotation information.
48 primary bool
49
Paul Duffinff774a02021-01-29 12:53:15 +000050 // The path to the dex jar that is in the boot class path. If this is nil then the associated
51 // module is not a boot jar, but could be one of the <x>-hiddenapi modules that provide additional
52 // annotations for the <x> boot dex jar but which do not actually provide a boot dex jar
53 // themselves.
Paul Duffin4103e922021-02-01 19:01:34 +000054 //
55 // This must be the path to the unencoded dex jar as the encoded dex jar indirectly depends on
56 // this file so using the encoded dex jar here would result in a cycle in the ninja rules.
Paul Duffinff774a02021-01-29 12:53:15 +000057 bootDexJarPath android.Path
58
59 // The path to the CSV file that contains mappings from Java signature to various flags derived
60 // from annotations in the source, e.g. whether it is public or the sdk version above which it
61 // can no longer be used.
62 //
63 // It is created by the Class2NonSdkList tool which processes the .class files in the class
64 // implementation jar looking for UnsupportedAppUsage and CovariantReturnType annotations. The
65 // tool also consumes the hiddenAPISingletonPathsStruct.stubFlags file in order to perform
66 // consistency checks on the information in the annotations and to filter out bridge methods
67 // that are already part of the public API.
68 flagsCSVPath android.Path
69
70 // The path to the CSV file that contains mappings from Java signature to the value of properties
71 // specified on UnsupportedAppUsage annotations in the source.
72 //
73 // Like the flagsCSVPath file this is also created by the Class2NonSdkList in the same way.
74 // Although the two files could potentially be created in a single invocation of the
75 // Class2NonSdkList at the moment they are created using their own invocation, with the behavior
76 // being determined by the property that is used.
Artur Satayevb5df8a02020-02-19 16:39:59 +000077 metadataCSVPath android.Path
Paul Duffinff774a02021-01-29 12:53:15 +000078
79 // The path to the CSV file that contains mappings from Java signature to source location
80 // information.
81 //
82 // It is created by the merge_csv tool which processes the class implementation jar, extracting
83 // all the files ending in .uau (which are CSV files) and merges them together. The .uau files are
84 // created by the unsupported app usage annotation processor during compilation of the class
85 // implementation jar.
86 indexCSVPath android.Path
Paul Duffin36187b22021-04-22 16:43:06 +010087
88 // The paths to the classes jars that contain classes and class members annotated with
89 // the UnsupportedAppUsage annotation that need to be extracted as part of the hidden API
90 // processing.
91 classesJarPaths android.Paths
Colin Crossf24a22a2019-01-31 14:12:44 -080092}
93
94func (h *hiddenAPI) flagsCSV() android.Path {
95 return h.flagsCSVPath
96}
97
98func (h *hiddenAPI) metadataCSV() android.Path {
99 return h.metadataCSVPath
100}
101
102func (h *hiddenAPI) bootDexJar() android.Path {
103 return h.bootDexJarPath
104}
105
Artur Satayevb5df8a02020-02-19 16:39:59 +0000106func (h *hiddenAPI) indexCSV() android.Path {
107 return h.indexCSVPath
108}
109
Paul Duffin36187b22021-04-22 16:43:06 +0100110func (h *hiddenAPI) classesJars() android.Paths {
111 return h.classesJarPaths
112}
113
Colin Crossf24a22a2019-01-31 14:12:44 -0800114type hiddenAPIIntf interface {
Colin Crossf24a22a2019-01-31 14:12:44 -0800115 bootDexJar() android.Path
Artur Satayevb5df8a02020-02-19 16:39:59 +0000116 flagsCSV() android.Path
117 indexCSV() android.Path
118 metadataCSV() android.Path
Paul Duffin36187b22021-04-22 16:43:06 +0100119 classesJars() android.Paths
Colin Crossf24a22a2019-01-31 14:12:44 -0800120}
121
122var _ hiddenAPIIntf = (*hiddenAPI)(nil)
123
Paul Duffin1ba24672021-04-12 23:26:14 +0100124// hiddenAPISupportingModule is the interface that is implemented by any module that supports
125// contributing to the hidden API processing.
126type hiddenAPISupportingModule interface {
127 android.Module
128 hiddenAPIIntf
129}
130
Paul Duffin4103e922021-02-01 19:01:34 +0000131// Initialize the hiddenapi structure
Paul Duffinf8f4af82021-02-12 15:42:20 +0000132func (h *hiddenAPI) initHiddenAPI(ctx android.BaseModuleContext, configurationName string) {
Paul Duffin4103e922021-02-01 19:01:34 +0000133 // If hiddenapi processing is disabled treat this as inactive.
134 if ctx.Config().IsEnvTrue("UNSAFE_DISABLE_HIDDENAPI_FLAGS") {
135 return
136 }
137
Paul Duffinf75e5272021-02-09 14:34:25 +0000138 h.configurationName = configurationName
Paul Duffin4103e922021-02-01 19:01:34 +0000139
140 // It is important that hiddenapi information is only gathered for/from modules that are actually
141 // on the boot jars list because the runtime only enforces access to the hidden API for the
142 // bootclassloader. If information is gathered for modules not on the list then that will cause
143 // failures in the CtsHiddenApiBlocklist... tests.
Paul Duffin82b3fcf2021-02-12 15:42:46 +0000144 module := ctx.Module()
145 h.active = isModuleInBootClassPath(ctx, module)
Paul Duffinf75e5272021-02-09 14:34:25 +0000146 if !h.active {
147 // The rest of the properties will be ignored if active is false.
148 return
149 }
Paul Duffin4103e922021-02-01 19:01:34 +0000150
Paul Duffinf75e5272021-02-09 14:34:25 +0000151 // Determine whether this module is the primary module or not.
152 primary := true
153
154 // A prebuilt module is only primary if it is preferred and conversely a source module is only
155 // primary if it has not been replaced by a prebuilt module.
Paul Duffinf75e5272021-02-09 14:34:25 +0000156 if pi, ok := module.(android.PrebuiltInterface); ok {
157 if p := pi.Prebuilt(); p != nil {
158 primary = p.UsePrebuilt()
159 }
160 } else {
Paul Duffinf8f4af82021-02-12 15:42:20 +0000161 // The only module that will pass a different configurationName to its module name to this
162 // method is the implementation library of a java_sdk_library. It has a configuration name of
163 // <x> the same as its parent java_sdk_library but a module name of <x>.impl. It is not the
164 // primary module, the java_sdk_library with the name of <x> is.
165 primary = configurationName == ctx.ModuleName()
Paul Duffinf75e5272021-02-09 14:34:25 +0000166
167 // A source module that has been replaced by a prebuilt can never be the primary module.
Paul Duffinec0fe172021-02-25 15:34:13 +0000168 if module.IsReplacedByPrebuilt() {
Paul Duffin894546d2021-04-21 01:03:30 +0100169 if ctx.HasProvider(android.ApexInfoProvider) {
170 // The source module is in an APEX but the prebuilt module on which it depends is not in an
171 // APEX and so is not the one that will actually be used for hidden API processing. That
172 // means it is not possible to check to see if it is a suitable replacement so just assume
173 // that it is.
174 primary = false
175 } else {
176 ctx.VisitDirectDepsWithTag(android.PrebuiltDepTag, func(prebuilt android.Module) {
177 if h, ok := prebuilt.(hiddenAPIIntf); ok && h.bootDexJar() != nil {
178 primary = false
179 } else {
180 ctx.ModuleErrorf(
181 "hiddenapi has determined that the source module %q should be ignored as it has been"+
182 " replaced by the prebuilt module %q but unfortunately it does not provide a"+
183 " suitable boot dex jar", ctx.ModuleName(), ctx.OtherModuleName(prebuilt))
184 }
185 })
186 }
Paul Duffinec0fe172021-02-25 15:34:13 +0000187 }
Paul Duffinf75e5272021-02-09 14:34:25 +0000188 }
189 h.primary = primary
Paul Duffin4103e922021-02-01 19:01:34 +0000190}
191
Paul Duffin82b3fcf2021-02-12 15:42:46 +0000192func isModuleInBootClassPath(ctx android.BaseModuleContext, module android.Module) bool {
193 // Get the configured non-updatable and updatable boot jars.
194 nonUpdatableBootJars := ctx.Config().NonUpdatableBootJars()
195 updatableBootJars := ctx.Config().UpdatableBootJars()
196 active := isModuleInConfiguredList(ctx, module, nonUpdatableBootJars) ||
197 isModuleInConfiguredList(ctx, module, updatableBootJars)
198 return active
199}
200
Paul Duffin4fd997b2021-02-03 20:06:33 +0000201// hiddenAPIExtractAndEncode is called by any module that could contribute to the hiddenapi
202// processing.
Paul Duffin4103e922021-02-01 19:01:34 +0000203//
204// It ignores any module that has not had initHiddenApi() called on it and which is not in the boot
205// jar list.
206//
207// Otherwise, it generates ninja rules to do the following:
Paul Duffin4fd997b2021-02-03 20:06:33 +0000208// 1. Extract information needed for hiddenapi processing from the module and output it into CSV
209// files.
Paul Duffin4103e922021-02-01 19:01:34 +0000210// 2. Conditionally adds the supplied dex file to the list of files used to generate the
211// hiddenAPISingletonPathsStruct.stubsFlag file.
212// 3. Conditionally creates a copy of the supplied dex file into which it has encoded the hiddenapi
213// flags and returns this instead of the supplied dex jar, otherwise simply returns the supplied
214// dex jar.
Paul Duffinf75e5272021-02-09 14:34:25 +0000215func (h *hiddenAPI) hiddenAPIExtractAndEncode(ctx android.ModuleContext, dexJar android.OutputPath,
Paul Duffin612e6102021-02-02 13:38:13 +0000216 implementationJar android.Path, uncompressDex bool) android.OutputPath {
Paul Duffind2aceca2019-02-28 16:13:20 +0000217
Paul Duffin4103e922021-02-01 19:01:34 +0000218 if !h.active {
219 return dexJar
220 }
Paul Duffind2aceca2019-02-28 16:13:20 +0000221
Paul Duffinf75e5272021-02-09 14:34:25 +0000222 h.hiddenAPIExtractInformation(ctx, dexJar, implementationJar)
Paul Duffind2aceca2019-02-28 16:13:20 +0000223
Paul Duffinf8f4af82021-02-12 15:42:20 +0000224 hiddenAPIJar := android.PathForModuleOut(ctx, "hiddenapi", h.configurationName+".jar").OutputPath
Paul Duffina2058f82020-06-24 16:22:38 +0100225
Paul Duffinf8f4af82021-02-12 15:42:20 +0000226 // Create a copy of the dex jar which has been encoded with hiddenapi flags.
227 hiddenAPIEncodeDex(ctx, hiddenAPIJar, dexJar, uncompressDex)
Paul Duffin4103e922021-02-01 19:01:34 +0000228
Paul Duffinf8f4af82021-02-12 15:42:20 +0000229 // Use the encoded dex jar from here onwards.
230 dexJar = hiddenAPIJar
Colin Crossf24a22a2019-01-31 14:12:44 -0800231
232 return dexJar
233}
234
Paul Duffin4fd997b2021-02-03 20:06:33 +0000235// hiddenAPIExtractInformation generates ninja rules to extract the information from the classes
236// jar, and outputs it to the appropriate module specific CSV file.
237//
238// It also makes the dex jar available for use when generating the
239// hiddenAPISingletonPathsStruct.stubFlags.
Paul Duffinf75e5272021-02-09 14:34:25 +0000240func (h *hiddenAPI) hiddenAPIExtractInformation(ctx android.ModuleContext, dexJar, classesJar android.Path) {
Paul Duffin9d67ca62021-02-03 20:06:33 +0000241 if !h.active {
242 return
243 }
244
245 // More than one library with the same classes may need to be encoded but only one should be
246 // used as a source of information for hidden API processing otherwise it will result in
247 // duplicate entries in the files.
Paul Duffinf75e5272021-02-09 14:34:25 +0000248 if !h.primary {
Paul Duffin9d67ca62021-02-03 20:06:33 +0000249 return
250 }
251
Paul Duffin031d8692021-02-12 11:46:42 +0000252 classesJars := android.Paths{classesJar}
253 ctx.VisitDirectDepsWithTag(hiddenApiAnnotationsTag, func(dep android.Module) {
254 javaInfo := ctx.OtherModuleProvider(dep, JavaInfoProvider).(JavaInfo)
255 classesJars = append(classesJars, javaInfo.ImplementationJars...)
256 })
Paul Duffin36187b22021-04-22 16:43:06 +0100257 h.classesJarPaths = classesJars
Paul Duffin031d8692021-02-12 11:46:42 +0000258
Colin Crossf24a22a2019-01-31 14:12:44 -0800259 stubFlagsCSV := hiddenAPISingletonPaths(ctx).stubFlags
Colin Cross8faf8fc2019-01-16 15:15:52 -0800260
Paul Duffin34982f12021-01-27 15:11:42 +0000261 flagsCSV := android.PathForModuleOut(ctx, "hiddenapi", "flags.csv")
Colin Cross8faf8fc2019-01-16 15:15:52 -0800262 ctx.Build(pctx, android.BuildParams{
263 Rule: hiddenAPIGenerateCSVRule,
264 Description: "hiddenapi flags",
Paul Duffin031d8692021-02-12 11:46:42 +0000265 Inputs: classesJars,
Colin Cross8faf8fc2019-01-16 15:15:52 -0800266 Output: flagsCSV,
David Brazdil0f670a22019-01-18 16:30:03 +0000267 Implicit: stubFlagsCSV,
Colin Cross8faf8fc2019-01-16 15:15:52 -0800268 Args: map[string]string{
David Brazdil0f670a22019-01-18 16:30:03 +0000269 "outFlag": "--write-flags-csv",
270 "stubAPIFlags": stubFlagsCSV.String(),
Colin Cross8faf8fc2019-01-16 15:15:52 -0800271 },
272 })
Artur Satayevb5df8a02020-02-19 16:39:59 +0000273 h.flagsCSVPath = flagsCSV
Colin Cross8faf8fc2019-01-16 15:15:52 -0800274
Paul Duffin34982f12021-01-27 15:11:42 +0000275 metadataCSV := android.PathForModuleOut(ctx, "hiddenapi", "metadata.csv")
Colin Cross8faf8fc2019-01-16 15:15:52 -0800276 ctx.Build(pctx, android.BuildParams{
277 Rule: hiddenAPIGenerateCSVRule,
278 Description: "hiddenapi metadata",
Paul Duffin031d8692021-02-12 11:46:42 +0000279 Inputs: classesJars,
Colin Cross8faf8fc2019-01-16 15:15:52 -0800280 Output: metadataCSV,
David Brazdil0f670a22019-01-18 16:30:03 +0000281 Implicit: stubFlagsCSV,
Colin Cross8faf8fc2019-01-16 15:15:52 -0800282 Args: map[string]string{
David Brazdil0f670a22019-01-18 16:30:03 +0000283 "outFlag": "--write-metadata-csv",
284 "stubAPIFlags": stubFlagsCSV.String(),
Colin Cross8faf8fc2019-01-16 15:15:52 -0800285 },
286 })
Artur Satayevb5df8a02020-02-19 16:39:59 +0000287 h.metadataCSVPath = metadataCSV
Colin Cross8faf8fc2019-01-16 15:15:52 -0800288
Paul Duffin34982f12021-01-27 15:11:42 +0000289 indexCSV := android.PathForModuleOut(ctx, "hiddenapi", "index.csv")
Colin Crossf1a035e2020-11-16 17:32:30 -0800290 rule := android.NewRuleBuilder(pctx, ctx)
Artur Satayevb5df8a02020-02-19 16:39:59 +0000291 rule.Command().
Colin Crossf1a035e2020-11-16 17:32:30 -0800292 BuiltTool("merge_csv").
Paul Duffin031d8692021-02-12 11:46:42 +0000293 Flag("--zip_input").
Paul Duffin2c36f242021-02-16 16:57:06 +0000294 Flag("--key_field signature").
Paul Duffin031d8692021-02-12 11:46:42 +0000295 FlagWithOutput("--output=", indexCSV).
296 Inputs(classesJars)
Colin Crossf1a035e2020-11-16 17:32:30 -0800297 rule.Build("merged-hiddenapi-index", "Merged Hidden API index")
Artur Satayevb5df8a02020-02-19 16:39:59 +0000298 h.indexCSVPath = indexCSV
Paul Duffin4fd997b2021-02-03 20:06:33 +0000299
300 // Save the unencoded dex jar so it can be used when generating the
301 // hiddenAPISingletonPathsStruct.stubFlags file.
302 h.bootDexJarPath = dexJar
Colin Cross8faf8fc2019-01-16 15:15:52 -0800303}
304
305var hiddenAPIEncodeDexRule = pctx.AndroidStaticRule("hiddenAPIEncodeDex", blueprint.RuleParams{
Artur Satayevb5df8a02020-02-19 16:39:59 +0000306 Command: `rm -rf $tmpDir && mkdir -p $tmpDir && mkdir $tmpDir/dex-input && mkdir $tmpDir/dex-output &&
Colin Crossd783bbb2020-07-11 22:30:45 -0700307 unzip -qoDD $in 'classes*.dex' -d $tmpDir/dex-input &&
Artur Satayevb5df8a02020-02-19 16:39:59 +0000308 for INPUT_DEX in $$(find $tmpDir/dex-input -maxdepth 1 -name 'classes*.dex' | sort); do
309 echo "--input-dex=$${INPUT_DEX}";
310 echo "--output-dex=$tmpDir/dex-output/$$(basename $${INPUT_DEX})";
311 done | xargs ${config.HiddenAPI} encode --api-flags=$flagsCsv $hiddenapiFlags &&
312 ${config.SoongZipCmd} $soongZipFlags -o $tmpDir/dex.jar -C $tmpDir/dex-output -f "$tmpDir/dex-output/classes*.dex" &&
313 ${config.MergeZipsCmd} -D -zipToNotStrip $tmpDir/dex.jar -stripFile "classes*.dex" -stripFile "**/*.uau" $out $tmpDir/dex.jar $in`,
Colin Cross8faf8fc2019-01-16 15:15:52 -0800314 CommandDeps: []string{
315 "${config.HiddenAPI}",
316 "${config.SoongZipCmd}",
317 "${config.MergeZipsCmd}",
318 },
David Brazdil91b4e3e2019-01-23 21:04:05 +0000319}, "flagsCsv", "hiddenapiFlags", "tmpDir", "soongZipFlags")
Colin Cross8faf8fc2019-01-16 15:15:52 -0800320
Colin Crossf24a22a2019-01-31 14:12:44 -0800321func hiddenAPIEncodeDex(ctx android.ModuleContext, output android.WritablePath, dexInput android.Path,
Colin Crosscd964b32019-01-18 22:03:02 -0800322 uncompressDex bool) {
323
Colin Crossf24a22a2019-01-31 14:12:44 -0800324 flagsCSV := hiddenAPISingletonPaths(ctx).flags
Colin Cross8faf8fc2019-01-16 15:15:52 -0800325
Colin Crosscd964b32019-01-18 22:03:02 -0800326 // The encode dex rule requires unzipping and rezipping the classes.dex files, ensure that if it was uncompressed
327 // in the input it stays uncompressed in the output.
328 soongZipFlags := ""
David Brazdil91b4e3e2019-01-23 21:04:05 +0000329 hiddenapiFlags := ""
Nicolas Geoffray65fd8ba2019-01-21 23:20:23 +0000330 tmpOutput := output
331 tmpDir := android.PathForModuleOut(ctx, "hiddenapi", "dex")
Colin Crosscd964b32019-01-18 22:03:02 -0800332 if uncompressDex {
333 soongZipFlags = "-L 0"
Nicolas Geoffray65fd8ba2019-01-21 23:20:23 +0000334 tmpOutput = android.PathForModuleOut(ctx, "hiddenapi", "unaligned", "unaligned.jar")
335 tmpDir = android.PathForModuleOut(ctx, "hiddenapi", "unaligned")
Colin Crosscd964b32019-01-18 22:03:02 -0800336 }
Jiyong Park93e57a02020-02-21 16:04:53 +0900337
338 enforceHiddenApiFlagsToAllMembers := true
David Brazdil91b4e3e2019-01-23 21:04:05 +0000339 // If frameworks/base doesn't exist we must be building with the 'master-art' manifest.
340 // Disable assertion that all methods/fields have hidden API flags assigned.
341 if !ctx.Config().FrameworksBaseDirExists(ctx) {
Jiyong Park93e57a02020-02-21 16:04:53 +0900342 enforceHiddenApiFlagsToAllMembers = false
343 }
344 // b/149353192: when a module is instrumented, jacoco adds synthetic members
345 // $jacocoData and $jacocoInit. Since they don't exist when building the hidden API flags,
346 // don't complain when we don't find hidden API flags for the synthetic members.
Paul Duffinc495d2b2020-05-19 21:07:52 +0100347 if j, ok := ctx.Module().(interface {
348 shouldInstrument(android.BaseModuleContext) bool
349 }); ok && j.shouldInstrument(ctx) {
Jiyong Park93e57a02020-02-21 16:04:53 +0900350 enforceHiddenApiFlagsToAllMembers = false
351 }
352
353 if !enforceHiddenApiFlagsToAllMembers {
David Brazdil91b4e3e2019-01-23 21:04:05 +0000354 hiddenapiFlags = "--no-force-assign-all"
355 }
Colin Crosscd964b32019-01-18 22:03:02 -0800356
Colin Cross8faf8fc2019-01-16 15:15:52 -0800357 ctx.Build(pctx, android.BuildParams{
358 Rule: hiddenAPIEncodeDexRule,
359 Description: "hiddenapi encode dex",
360 Input: dexInput,
Nicolas Geoffray65fd8ba2019-01-21 23:20:23 +0000361 Output: tmpOutput,
Colin Crossf24a22a2019-01-31 14:12:44 -0800362 Implicit: flagsCSV,
Colin Cross8faf8fc2019-01-16 15:15:52 -0800363 Args: map[string]string{
Colin Crossf24a22a2019-01-31 14:12:44 -0800364 "flagsCsv": flagsCSV.String(),
David Brazdil91b4e3e2019-01-23 21:04:05 +0000365 "tmpDir": tmpDir.String(),
366 "soongZipFlags": soongZipFlags,
367 "hiddenapiFlags": hiddenapiFlags,
Colin Cross8faf8fc2019-01-16 15:15:52 -0800368 },
369 })
370
Nicolas Geoffray65fd8ba2019-01-21 23:20:23 +0000371 if uncompressDex {
372 TransformZipAlign(ctx, output, tmpOutput)
373 }
Colin Cross8faf8fc2019-01-16 15:15:52 -0800374}
Paul Duffin031d8692021-02-12 11:46:42 +0000375
376type hiddenApiAnnotationsDependencyTag struct {
377 blueprint.BaseDependencyTag
378}
379
380// Tag used to mark dependencies on java_library instances that contains Java source files whose
381// sole purpose is to provide additional hiddenapi annotations.
382var hiddenApiAnnotationsTag hiddenApiAnnotationsDependencyTag
383
384// Mark this tag so dependencies that use it are excluded from APEX contents.
385func (t hiddenApiAnnotationsDependencyTag) ExcludeFromApexContents() {}
386
387var _ android.ExcludeFromApexContentsTag = hiddenApiAnnotationsTag