Spandan Das | 0d53dd2 | 2023-10-24 18:55:12 +0000 | [diff] [blame^] | 1 | // Copyright 2023 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 android |
| 16 | |
| 17 | import ( |
| 18 | "github.com/google/blueprint/proptools" |
| 19 | ) |
| 20 | |
| 21 | func init() { |
| 22 | RegisterApexContributionsBuildComponents(InitRegistrationContext) |
| 23 | } |
| 24 | |
| 25 | func RegisterApexContributionsBuildComponents(ctx RegistrationContext) { |
| 26 | ctx.RegisterModuleType("apex_contributions", apexContributionsFactory) |
| 27 | } |
| 28 | |
| 29 | type apexContributions struct { |
| 30 | ModuleBase |
| 31 | properties contributionProps |
| 32 | } |
| 33 | |
| 34 | type contributionProps struct { |
| 35 | // Name of the mainline module |
| 36 | Api_domain *string |
| 37 | // A list of module names that should be used when this contribution |
| 38 | // is selected via product_config |
| 39 | // The name should be explicit (foo or prebuilt_foo) |
| 40 | Contents []string |
| 41 | } |
| 42 | |
| 43 | func (m *apexContributions) ApiDomain() string { |
| 44 | return proptools.String(m.properties.Api_domain) |
| 45 | } |
| 46 | |
| 47 | func (m *apexContributions) Contents() []string { |
| 48 | return m.properties.Contents |
| 49 | } |
| 50 | |
| 51 | // apex_contributions contains a list of module names (source or |
| 52 | // prebuilt) belonging to the mainline module |
| 53 | // An apex can have multiple apex_contributions modules |
| 54 | // with different combinations of source or prebuilts, but only one can be |
| 55 | // selected via product_config. |
| 56 | func apexContributionsFactory() Module { |
| 57 | module := &apexContributions{} |
| 58 | module.AddProperties(&module.properties) |
| 59 | InitAndroidModule(module) |
| 60 | return module |
| 61 | } |
| 62 | |
| 63 | // This module type does not have any build actions. |
| 64 | // It provides metadata that is used in post-deps mutator phase for source vs |
| 65 | // prebuilts selection. |
| 66 | func (m *apexContributions) GenerateAndroidBuildActions(ctx ModuleContext) { |
| 67 | } |