blob: c8c7b79df7f7fecd2698e32e2ffa48eedbc8bb8a [file] [log] [blame]
Jiyong Parkd1063c12019-07-17 20:08:41 +09001// Copyright (C) 2019 The Android Open Source Project
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 sdk
16
17import (
Jiyong Park9b409bc2019-10-11 14:59:13 +090018 "fmt"
Paul Duffin504b4612019-11-22 14:52:29 +000019 "io"
Jiyong Park9b409bc2019-10-11 14:59:13 +090020 "strconv"
21
Jiyong Parkd1063c12019-07-17 20:08:41 +090022 "github.com/google/blueprint"
Jiyong Park100f3fd2019-11-06 16:03:32 +090023 "github.com/google/blueprint/proptools"
Jiyong Parkd1063c12019-07-17 20:08:41 +090024
25 "android/soong/android"
26 // This package doesn't depend on the apex package, but import it to make its mutators to be
27 // registered before mutators in this package. See RegisterPostDepsMutators for more details.
28 _ "android/soong/apex"
29)
30
31func init() {
Jiyong Park232e7852019-11-04 12:23:40 +090032 pctx.Import("android/soong/android")
Paul Duffin375058f2019-11-29 20:17:53 +000033 pctx.Import("android/soong/java/config")
34
Paul Duffin6d9108f02021-03-09 22:59:28 +000035 registerSdkBuildComponents(android.InitRegistrationContext)
36}
37
38func registerSdkBuildComponents(ctx android.RegistrationContext) {
39 ctx.RegisterModuleType("sdk", SdkModuleFactory)
40 ctx.RegisterModuleType("sdk_snapshot", SnapshotModuleFactory)
41 ctx.PreDepsMutators(RegisterPreDepsMutators)
Jiyong Parkd1063c12019-07-17 20:08:41 +090042}
43
44type sdk struct {
45 android.ModuleBase
46 android.DefaultableModuleBase
47
Paul Duffin255f18e2019-12-13 11:22:16 +000048 // The dynamically generated information about the registered SdkMemberType
49 dynamicSdkMemberTypes *dynamicSdkMemberTypes
50
Paul Duffin62782de2021-07-14 12:05:16 +010051 // The dynamically created instance of the properties struct containing the sdk member type
Paul Duffin255f18e2019-12-13 11:22:16 +000052 // list properties, e.g. java_libs.
53 dynamicMemberTypeListProperties interface{}
54
Paul Duffind19f8942021-07-14 12:08:37 +010055 // The dynamically generated information about the registered SdkMemberTrait
56 dynamicSdkMemberTraits *dynamicSdkMemberTraits
57
58 // The dynamically created instance of the properties struct containing the sdk member trait
59 // list properties.
60 dynamicMemberTraitListProperties interface{}
61
Paul Duffin21827262021-04-24 12:16:36 +010062 // Information about the OsType specific member variants depended upon by this variant.
Paul Duffin1356d8c2020-02-25 19:26:33 +000063 //
Paul Duffin6a7e9532020-03-20 17:50:07 +000064 // Set by OsType specific variants in the collectMembers() method and used by the
65 // CommonOS variant when building the snapshot. That work is all done on separate
66 // calls to the sdk.GenerateAndroidBuildActions method which is guaranteed to be
67 // called for the OsType specific variants before the CommonOS variant (because
68 // the latter depends on the former).
Paul Duffin21827262021-04-24 12:16:36 +010069 memberVariantDeps []sdkMemberVariantDep
Paul Duffin1356d8c2020-02-25 19:26:33 +000070
Paul Duffin6a7e9532020-03-20 17:50:07 +000071 // The multilib variants that are used by this sdk variant.
72 multilibUsages multilibUsage
73
Jiyong Parkd1063c12019-07-17 20:08:41 +090074 properties sdkProperties
Jiyong Park9b409bc2019-10-11 14:59:13 +090075
Jiyong Park232e7852019-11-04 12:23:40 +090076 snapshotFile android.OptionalPath
Paul Duffinac37c502019-11-26 18:02:20 +000077
78 // The builder, preserved for testing.
79 builderForTests *snapshotBuilder
Jiyong Parkd1063c12019-07-17 20:08:41 +090080}
81
82type sdkProperties struct {
Jiyong Park9b409bc2019-10-11 14:59:13 +090083 Snapshot bool `blueprint:"mutated"`
Paul Duffin8150da62019-12-16 17:21:27 +000084
85 // True if this is a module_exports (or module_exports_snapshot) module type.
86 Module_exports bool `blueprint:"mutated"`
Paul Duffin157f40f2020-09-29 16:01:08 +010087
88 // The additional visibility to add to the prebuilt modules to allow them to
89 // reference each other.
90 //
91 // This can only be used to widen the visibility of the members:
92 //
93 // * Specifying //visibility:public here will make all members visible and
94 // essentially ignore their own visibility.
95 // * Specifying //visibility:private here is an error.
96 // * Specifying any other rule here will add it to the members visibility and
97 // be output to the member prebuilt in the snapshot. Duplicates will be
98 // dropped. Adding a rule to members that have //visibility:private will
99 // cause the //visibility:private to be discarded.
100 Prebuilt_visibility []string
Jiyong Parkd1063c12019-07-17 20:08:41 +0900101}
102
103// sdk defines an SDK which is a logical group of modules (e.g. native libs, headers, java libs, etc.)
104// which Mainline modules like APEX can choose to build with.
Paul Duffin8150da62019-12-16 17:21:27 +0000105func SdkModuleFactory() android.Module {
Paul Duffine6029182019-12-16 17:43:48 +0000106 return newSdkModule(false)
Paul Duffin8150da62019-12-16 17:21:27 +0000107}
Paul Duffin255f18e2019-12-13 11:22:16 +0000108
Paul Duffine6029182019-12-16 17:43:48 +0000109func newSdkModule(moduleExports bool) *sdk {
Paul Duffin8150da62019-12-16 17:21:27 +0000110 s := &sdk{}
Paul Duffine6029182019-12-16 17:43:48 +0000111 s.properties.Module_exports = moduleExports
Paul Duffin255f18e2019-12-13 11:22:16 +0000112 // Get the dynamic sdk member type data for the currently registered sdk member types.
Paul Duffin30c830b2021-09-22 11:49:47 +0100113 sdkMemberTypeKey, sdkMemberTypes := android.RegisteredSdkMemberTypes(moduleExports)
114 s.dynamicSdkMemberTypes = getDynamicSdkMemberTypes(sdkMemberTypeKey, sdkMemberTypes)
Paul Duffin255f18e2019-12-13 11:22:16 +0000115 // Create an instance of the dynamically created struct that contains all the
116 // properties for the member type specific list properties.
Paul Duffin62782de2021-07-14 12:05:16 +0100117 s.dynamicMemberTypeListProperties = s.dynamicSdkMemberTypes.createMemberTypeListProperties()
Paul Duffind19f8942021-07-14 12:08:37 +0100118
Paul Duffin30c830b2021-09-22 11:49:47 +0100119 sdkMemberTraitsKey, sdkMemberTraits := android.RegisteredSdkMemberTraits()
120 s.dynamicSdkMemberTraits = getDynamicSdkMemberTraits(sdkMemberTraitsKey, sdkMemberTraits)
Paul Duffind19f8942021-07-14 12:08:37 +0100121 // Create an instance of the dynamically created struct that contains all the properties for the
122 // member trait specific list properties.
123 s.dynamicMemberTraitListProperties = s.dynamicSdkMemberTraits.createMemberTraitListProperties()
124
125 // Create a wrapper around the dynamic trait specific properties so that they have to be
126 // specified within a traits:{} section in the .bp file.
127 traitsWrapper := struct {
128 Traits interface{}
129 }{s.dynamicMemberTraitListProperties}
130
131 s.AddProperties(&s.properties, s.dynamicMemberTypeListProperties, &traitsWrapper)
Paul Duffin157f40f2020-09-29 16:01:08 +0100132
133 // Make sure that the prebuilt visibility property is verified for errors.
134 android.AddVisibilityProperty(s, "prebuilt_visibility", &s.properties.Prebuilt_visibility)
Paul Duffin1356d8c2020-02-25 19:26:33 +0000135 android.InitCommonOSAndroidMultiTargetsArchModule(s, android.HostAndDeviceSupported, android.MultilibCommon)
Jiyong Parkd1063c12019-07-17 20:08:41 +0900136 android.InitDefaultableModule(s)
Jiyong Park100f3fd2019-11-06 16:03:32 +0900137 android.AddLoadHook(s, func(ctx android.LoadHookContext) {
138 type props struct {
139 Compile_multilib *string
140 }
141 p := &props{Compile_multilib: proptools.StringPtr("both")}
Martin Stjernholm26ab8e82020-06-30 20:34:00 +0100142 ctx.PrependProperties(p)
Jiyong Park100f3fd2019-11-06 16:03:32 +0900143 })
Jiyong Parkd1063c12019-07-17 20:08:41 +0900144 return s
145}
146
Jiyong Park9b409bc2019-10-11 14:59:13 +0900147// sdk_snapshot is a versioned snapshot of an SDK. This is an auto-generated module.
148func SnapshotModuleFactory() android.Module {
Paul Duffine6029182019-12-16 17:43:48 +0000149 s := newSdkModule(false)
Paul Duffin8150da62019-12-16 17:21:27 +0000150 s.properties.Snapshot = true
Jiyong Park9b409bc2019-10-11 14:59:13 +0900151 return s
152}
153
Paul Duffin62782de2021-07-14 12:05:16 +0100154func (s *sdk) memberTypeListProperties() []*sdkMemberTypeListProperty {
155 return s.dynamicSdkMemberTypes.memberTypeListProperties
Paul Duffin72910952020-01-20 18:16:30 +0000156}
157
Paul Duffin62782de2021-07-14 12:05:16 +0100158func (s *sdk) memberTypeListProperty(memberType android.SdkMemberType) *sdkMemberTypeListProperty {
Paul Duffincd064672021-04-24 00:47:29 +0100159 return s.dynamicSdkMemberTypes.memberTypeToProperty[memberType]
160}
161
Paul Duffind19f8942021-07-14 12:08:37 +0100162// memberTraitListProperties returns the list of *sdkMemberTraitListProperty instances for this sdk.
163func (s *sdk) memberTraitListProperties() []*sdkMemberTraitListProperty {
164 return s.dynamicSdkMemberTraits.memberTraitListProperties
165}
166
Jiyong Park9b409bc2019-10-11 14:59:13 +0900167func (s *sdk) snapshot() bool {
168 return s.properties.Snapshot
169}
170
Jiyong Parkd1063c12019-07-17 20:08:41 +0900171func (s *sdk) GenerateAndroidBuildActions(ctx android.ModuleContext) {
Paul Duffin1356d8c2020-02-25 19:26:33 +0000172 if s.snapshot() {
Jiyong Park232e7852019-11-04 12:23:40 +0900173 // We don't need to create a snapshot out of sdk_snapshot.
174 // That doesn't make sense. We need a snapshot to create sdk_snapshot.
Paul Duffin1356d8c2020-02-25 19:26:33 +0000175 return
176 }
177
178 // This method is guaranteed to be called on OsType specific variants before it is called
179 // on their corresponding CommonOS variant.
180 if !s.IsCommonOSVariant() {
Paul Duffin6a7e9532020-03-20 17:50:07 +0000181 // Update the OsType specific sdk variant with information about its members.
182 s.collectMembers(ctx)
Paul Duffin1356d8c2020-02-25 19:26:33 +0000183 } else {
184 // Get the OsType specific variants on which the CommonOS depends.
185 osSpecificVariants := android.GetOsSpecificVariantsOfCommonOSVariant(ctx)
186 var sdkVariants []*sdk
187 for _, m := range osSpecificVariants {
188 if sdkVariant, ok := m.(*sdk); ok {
189 sdkVariants = append(sdkVariants, sdkVariant)
190 }
191 }
192
193 // Generate the snapshot from the member info.
Nicolas Geoffray1228e9c2020-02-27 13:45:35 +0000194 p := s.buildSnapshot(ctx, sdkVariants)
Mathew Inwood60770e22021-05-05 17:00:29 +0100195 zip := ctx.InstallFile(android.PathForMainlineSdksInstall(ctx), p.Base(), p)
196 s.snapshotFile = android.OptionalPathForPath(zip)
Jiyong Park232e7852019-11-04 12:23:40 +0900197 }
Jiyong Park9b409bc2019-10-11 14:59:13 +0900198}
199
Jiyong Park0b0e1b92019-12-03 13:24:29 +0900200func (s *sdk) AndroidMkEntries() []android.AndroidMkEntries {
Jiyong Park232e7852019-11-04 12:23:40 +0900201 if !s.snapshotFile.Valid() {
Jiyong Park0b0e1b92019-12-03 13:24:29 +0900202 return []android.AndroidMkEntries{}
Jiyong Park232e7852019-11-04 12:23:40 +0900203 }
204
Jiyong Park0b0e1b92019-12-03 13:24:29 +0900205 return []android.AndroidMkEntries{android.AndroidMkEntries{
Jiyong Park232e7852019-11-04 12:23:40 +0900206 Class: "FAKE",
207 OutputFile: s.snapshotFile,
Jingwen Chen40fd90a2020-06-15 05:24:19 +0000208 DistFiles: android.MakeDefaultDistFiles(s.snapshotFile.Path()),
Jiyong Park232e7852019-11-04 12:23:40 +0900209 Include: "$(BUILD_PHONY_PACKAGE)",
Paul Duffin504b4612019-11-22 14:52:29 +0000210 ExtraFooters: []android.AndroidMkExtraFootersFunc{
Jaewoong Jung02b11a62020-12-07 10:23:54 -0800211 func(w io.Writer, name, prefix, moduleDir string) {
Paul Duffin504b4612019-11-22 14:52:29 +0000212 // Allow the sdk to be built by simply passing its name on the command line.
213 fmt.Fprintln(w, ".PHONY:", s.Name())
214 fmt.Fprintln(w, s.Name()+":", s.snapshotFile.String())
215 },
216 },
Jiyong Park0b0e1b92019-12-03 13:24:29 +0900217 }}
Jiyong Parkd1063c12019-07-17 20:08:41 +0900218}
219
Paul Duffind19f8942021-07-14 12:08:37 +0100220// gatherTraits gathers the traits from the dynamically generated trait specific properties.
221//
222// Returns a map from member name to the set of required traits.
223func (s *sdk) gatherTraits() map[string]android.SdkMemberTraitSet {
224 traitListByMember := map[string][]android.SdkMemberTrait{}
225 for _, memberListProperty := range s.memberTraitListProperties() {
226 names := memberListProperty.getter(s.dynamicMemberTraitListProperties)
227 for _, name := range names {
228 traitListByMember[name] = append(traitListByMember[name], memberListProperty.memberTrait)
229 }
230 }
231
232 traitSetByMember := map[string]android.SdkMemberTraitSet{}
233 for name, list := range traitListByMember {
234 traitSetByMember[name] = android.NewSdkMemberTraitSet(list)
235 }
236
237 return traitSetByMember
238}
239
Paul Duffin296701e2021-07-14 10:29:36 +0100240// newDependencyContext creates a new SdkDependencyContext for this sdk.
241func (s *sdk) newDependencyContext(mctx android.BottomUpMutatorContext) android.SdkDependencyContext {
Paul Duffind19f8942021-07-14 12:08:37 +0100242 traits := s.gatherTraits()
243
Paul Duffin296701e2021-07-14 10:29:36 +0100244 return &dependencyContext{
245 BottomUpMutatorContext: mctx,
Paul Duffind19f8942021-07-14 12:08:37 +0100246 requiredTraits: traits,
Paul Duffin296701e2021-07-14 10:29:36 +0100247 }
248}
249
250type dependencyContext struct {
251 android.BottomUpMutatorContext
Paul Duffind19f8942021-07-14 12:08:37 +0100252
253 // Map from member name to the set of traits that the sdk requires the member provides.
254 requiredTraits map[string]android.SdkMemberTraitSet
255}
256
257func (d *dependencyContext) RequiredTraits(name string) android.SdkMemberTraitSet {
258 if s, ok := d.requiredTraits[name]; ok {
259 return s
260 } else {
261 return android.EmptySdkMemberTraitSet()
262 }
263}
264
265func (d *dependencyContext) RequiresTrait(name string, trait android.SdkMemberTrait) bool {
266 return d.RequiredTraits(name).Contains(trait)
Paul Duffin296701e2021-07-14 10:29:36 +0100267}
268
269var _ android.SdkDependencyContext = (*dependencyContext)(nil)
270
Jiyong Parkd1063c12019-07-17 20:08:41 +0900271// RegisterPreDepsMutators registers pre-deps mutators to support modules implementing SdkAware
272// interface and the sdk module type. This function has been made public to be called by tests
273// outside of the sdk package
274func RegisterPreDepsMutators(ctx android.RegisterMutatorsContext) {
275 ctx.BottomUp("SdkMember", memberMutator).Parallel()
276 ctx.TopDown("SdkMember_deps", memberDepsMutator).Parallel()
277 ctx.BottomUp("SdkMemberInterVersion", memberInterVersionMutator).Parallel()
278}
279
Jiyong Parkd1063c12019-07-17 20:08:41 +0900280type dependencyTag struct {
281 blueprint.BaseDependencyTag
282}
283
Martin Stjernholmcc776012020-07-07 03:22:21 +0100284// Mark this tag so dependencies that use it are excluded from APEX contents.
285func (t dependencyTag) ExcludeFromApexContents() {}
286
287var _ android.ExcludeFromApexContentsTag = dependencyTag{}
288
Jiyong Parkd1063c12019-07-17 20:08:41 +0900289// For dependencies from an in-development version of an SDK member to frozen versions of the same member
290// e.g. libfoo -> libfoo.mysdk.11 and libfoo.mysdk.12
Paul Duffin573989d2021-03-17 13:25:29 +0000291//
292// The dependency represented by this tag requires that for every APEX variant created for the
293// `from` module that an equivalent APEX variant is created for the 'to' module. This is because an
294// APEX that requires a specific version of an sdk (via the `uses_sdks` property will replace
295// dependencies on the unversioned sdk member with a dependency on the appropriate versioned sdk
296// member. In order for that to work the versioned sdk member needs to have a variant for that APEX.
297// As it is not known at the time that the APEX variants are created which specific APEX variants of
298// a versioned sdk members will be required it is necessary for the versioned sdk members to have
299// variants for any APEX that it could be used within.
300//
301// If the APEX selects a versioned sdk member then it will not have a dependency on the `from`
302// module at all so any dependencies of that module will not affect the APEX. However, if the APEX
303// selects the unversioned sdk member then it must exclude all the versioned sdk members. In no
304// situation would this dependency cause the `to` module to be added to the APEX hence why this tag
305// also excludes the `to` module from being added to the APEX contents.
Paul Duffinfe149222020-01-14 14:06:09 +0000306type sdkMemberVersionedDepTag struct {
Jiyong Parkd1063c12019-07-17 20:08:41 +0900307 dependencyTag
308 member string
309 version string
310}
311
Paul Duffin573989d2021-03-17 13:25:29 +0000312func (t sdkMemberVersionedDepTag) AlwaysRequireApexVariant() bool {
313 return true
314}
315
Paul Duffinfe149222020-01-14 14:06:09 +0000316// Mark this tag so dependencies that use it are excluded from visibility enforcement.
317func (t sdkMemberVersionedDepTag) ExcludeFromVisibilityEnforcement() {}
318
Paul Duffin573989d2021-03-17 13:25:29 +0000319var _ android.AlwaysRequireApexVariantTag = sdkMemberVersionedDepTag{}
320
Jiyong Parkd1063c12019-07-17 20:08:41 +0900321// Step 1: create dependencies from an SDK module to its members.
322func memberMutator(mctx android.BottomUpMutatorContext) {
Paul Duffin255f18e2019-12-13 11:22:16 +0000323 if s, ok := mctx.Module().(*sdk); ok {
Paul Duffin1356d8c2020-02-25 19:26:33 +0000324 // Add dependencies from enabled and non CommonOS variants to the sdk member variants.
325 if s.Enabled() && !s.IsCommonOSVariant() {
Paul Duffin296701e2021-07-14 10:29:36 +0100326 ctx := s.newDependencyContext(mctx)
Paul Duffin62782de2021-07-14 12:05:16 +0100327 for _, memberListProperty := range s.memberTypeListProperties() {
Paul Duffin13082052021-05-11 00:31:38 +0100328 if memberListProperty.getter == nil {
329 continue
330 }
Paul Duffin583bf7e2020-02-20 13:39:41 +0000331 names := memberListProperty.getter(s.dynamicMemberTypeListProperties)
Paul Duffincc1b3da2020-02-27 13:29:56 +0000332 if len(names) > 0 {
Paul Duffind19f8942021-07-14 12:08:37 +0100333 memberType := memberListProperty.memberType
334
335 // Verify that the member type supports the specified traits.
336 supportedTraits := memberType.SupportedTraits()
337 for _, name := range names {
338 requiredTraits := ctx.RequiredTraits(name)
339 unsupportedTraits := requiredTraits.Subtract(supportedTraits)
340 if !unsupportedTraits.Empty() {
341 ctx.ModuleErrorf("sdk member %q has traits %s that are unsupported by its member type %q", name, unsupportedTraits, memberType.SdkPropertyName())
342 }
343 }
344
345 // Add dependencies using the appropriate tag.
Paul Duffincc1b3da2020-02-27 13:29:56 +0000346 tag := memberListProperty.dependencyTag
Paul Duffind19f8942021-07-14 12:08:37 +0100347 memberType.AddDependencies(ctx, tag, names)
Paul Duffincc1b3da2020-02-27 13:29:56 +0000348 }
Paul Duffin583bf7e2020-02-20 13:39:41 +0000349 }
Jiyong Parkd1063c12019-07-17 20:08:41 +0900350 }
351 }
352}
353
354// Step 2: record that dependencies of SDK modules are members of the SDK modules
355func memberDepsMutator(mctx android.TopDownMutatorContext) {
Jiyong Park9b409bc2019-10-11 14:59:13 +0900356 if s, ok := mctx.Module().(*sdk); ok {
Jiyong Parkd1063c12019-07-17 20:08:41 +0900357 mySdkRef := android.ParseSdkRef(mctx, mctx.ModuleName(), "name")
Jiyong Park9b409bc2019-10-11 14:59:13 +0900358 if s.snapshot() && mySdkRef.Unversioned() {
359 mctx.PropertyErrorf("name", "sdk_snapshot should be named as <name>@<version>. "+
360 "Did you manually modify Android.bp?")
361 }
362 if !s.snapshot() && !mySdkRef.Unversioned() {
363 mctx.PropertyErrorf("name", "sdk shouldn't be named as <name>@<version>.")
364 }
365 if mySdkRef.Version != "" && mySdkRef.Version != "current" {
366 if _, err := strconv.Atoi(mySdkRef.Version); err != nil {
367 mctx.PropertyErrorf("name", "version %q is neither a number nor \"current\"", mySdkRef.Version)
368 }
369 }
370
Jiyong Parkd1063c12019-07-17 20:08:41 +0900371 mctx.VisitDirectDeps(func(child android.Module) {
372 if member, ok := child.(android.SdkAware); ok {
373 member.MakeMemberOf(mySdkRef)
374 }
375 })
376 }
377}
378
Jiyong Park9b409bc2019-10-11 14:59:13 +0900379// Step 3: create dependencies from the unversioned SDK member to snapshot versions
Jiyong Parkd1063c12019-07-17 20:08:41 +0900380// of the same member. By having these dependencies, they are mutated for multiple Mainline modules
381// (apex and apk), each of which might want different sdks to be built with. For example, if both
382// apex A and B are referencing libfoo which is a member of sdk 'mysdk', the two APEXes can be
383// built with libfoo.mysdk.11 and libfoo.mysdk.12, respectively depending on which sdk they are
384// using.
385func memberInterVersionMutator(mctx android.BottomUpMutatorContext) {
Paul Duffinb9e7a3c2021-05-06 15:53:19 +0100386 if m, ok := mctx.Module().(android.SdkAware); ok && m.IsInAnySdk() && m.IsVersioned() {
Jiyong Park9b409bc2019-10-11 14:59:13 +0900387 if !m.ContainingSdk().Unversioned() {
Jiyong Parkd1063c12019-07-17 20:08:41 +0900388 memberName := m.MemberName()
Paul Duffinfe149222020-01-14 14:06:09 +0000389 tag := sdkMemberVersionedDepTag{member: memberName, version: m.ContainingSdk().Version}
Jiyong Parkd1063c12019-07-17 20:08:41 +0900390 mctx.AddReverseDependency(mctx.Module(), tag, memberName)
391 }
392 }
393}
394
Paul Duffin4c3e8e22021-03-18 15:41:29 +0000395// An interface that encapsulates all the functionality needed to manage the sdk dependencies.
396//
397// It is a mixture of apex and sdk module functionality.
398type sdkAndApexModule interface {
399 android.Module
400 android.DepIsInSameApex
Jiyong Parka7bc8ad2019-10-15 15:20:07 +0900401}