Ronald Braunstein | 73b08ff | 2023-12-19 10:24:47 -0800 | [diff] [blame] | 1 | // Copyright 2020 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 | |
Ronald Braunstein | c560309 | 2024-03-27 06:46:47 -0700 | [diff] [blame^] | 17 | import "github.com/google/blueprint" |
| 18 | |
Ronald Braunstein | 73b08ff | 2023-12-19 10:24:47 -0800 | [diff] [blame] | 19 | func init() { |
| 20 | RegisterTeamBuildComponents(InitRegistrationContext) |
| 21 | } |
| 22 | |
| 23 | func RegisterTeamBuildComponents(ctx RegistrationContext) { |
| 24 | ctx.RegisterModuleType("team", TeamFactory) |
| 25 | } |
| 26 | |
| 27 | var PrepareForTestWithTeamBuildComponents = GroupFixturePreparers( |
| 28 | FixtureRegisterWithContext(RegisterTeamBuildComponents), |
| 29 | ) |
| 30 | |
| 31 | type teamProperties struct { |
| 32 | Trendy_team_id *string `json:"trendy_team_id"` |
| 33 | } |
| 34 | |
| 35 | type teamModule struct { |
| 36 | ModuleBase |
| 37 | DefaultableModuleBase |
| 38 | |
| 39 | properties teamProperties |
| 40 | } |
| 41 | |
Ronald Braunstein | c560309 | 2024-03-27 06:46:47 -0700 | [diff] [blame^] | 42 | type TestModuleInformation struct { |
| 43 | TestOnly bool |
| 44 | TopLevelTarget bool |
| 45 | } |
| 46 | |
| 47 | var TestOnlyProviderKey = blueprint.NewProvider[TestModuleInformation]() |
| 48 | |
Ronald Braunstein | 73b08ff | 2023-12-19 10:24:47 -0800 | [diff] [blame] | 49 | // Real work is done for the module that depends on us. |
| 50 | // If needed, the team can serialize the config to json/proto file as well. |
| 51 | func (t *teamModule) GenerateAndroidBuildActions(ctx ModuleContext) {} |
| 52 | |
| 53 | func (t *teamModule) TrendyTeamId(ctx ModuleContext) string { |
| 54 | return *t.properties.Trendy_team_id |
| 55 | } |
| 56 | |
| 57 | func TeamFactory() Module { |
| 58 | module := &teamModule{} |
| 59 | |
| 60 | base := module.base() |
| 61 | module.AddProperties(&base.nameProperties, &module.properties) |
| 62 | |
| 63 | InitAndroidModule(module) |
| 64 | InitDefaultableModule(module) |
| 65 | |
| 66 | return module |
| 67 | } |