apex_sdk_member.go 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // Copyright (C) 2022 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. package apex
  15. import (
  16. "android/soong/android"
  17. "github.com/google/blueprint"
  18. "github.com/google/blueprint/proptools"
  19. )
  20. // This file contains support for using apex modules within an sdk.
  21. func init() {
  22. // Register sdk member types.
  23. android.RegisterSdkMemberType(&apexSdkMemberType{
  24. SdkMemberTypeBase: android.SdkMemberTypeBase{
  25. PropertyName: "apexes",
  26. SupportsSdk: true,
  27. // The apexes property does not need to be included in the snapshot as adding an apex to an
  28. // sdk does not produce any prebuilts of the apex.
  29. PrebuiltsRequired: proptools.BoolPtr(false),
  30. },
  31. })
  32. }
  33. type apexSdkMemberType struct {
  34. android.SdkMemberTypeBase
  35. }
  36. func (mt *apexSdkMemberType) AddDependencies(ctx android.SdkDependencyContext, dependencyTag blueprint.DependencyTag, names []string) {
  37. ctx.AddVariationDependencies(nil, dependencyTag, names...)
  38. }
  39. func (mt *apexSdkMemberType) IsInstance(module android.Module) bool {
  40. _, ok := module.(*apexBundle)
  41. return ok
  42. }
  43. func (mt *apexSdkMemberType) AddPrebuiltModule(ctx android.SdkMemberContext, member android.SdkMember) android.BpModule {
  44. panic("Sdk does not create prebuilts of the apexes in its snapshot")
  45. }
  46. func (mt *apexSdkMemberType) CreateVariantPropertiesStruct() android.SdkMemberProperties {
  47. panic("Sdk does not create prebuilts of the apexes in its snapshot")
  48. }