xref: /aosp_15_r20/build/soong/android/team.go (revision 333d2b3687b3a337dbcca9d65000bca186795e39)
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
15package android
16
17import "github.com/google/blueprint"
18
19func init() {
20	RegisterTeamBuildComponents(InitRegistrationContext)
21}
22
23func RegisterTeamBuildComponents(ctx RegistrationContext) {
24	ctx.RegisterModuleType("team", TeamFactory)
25}
26
27var PrepareForTestWithTeamBuildComponents = GroupFixturePreparers(
28	FixtureRegisterWithContext(RegisterTeamBuildComponents),
29)
30
31type teamProperties struct {
32	Trendy_team_id *string `json:"trendy_team_id"`
33}
34
35type teamModule struct {
36	ModuleBase
37	DefaultableModuleBase
38
39	properties teamProperties
40}
41
42type TestModuleInformation struct {
43	TestOnly       bool
44	TopLevelTarget bool
45}
46
47var TestOnlyProviderKey = blueprint.NewProvider[TestModuleInformation]()
48
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.
51func (t *teamModule) GenerateAndroidBuildActions(ctx ModuleContext) {}
52
53func (t *teamModule) TrendyTeamId(ctx ModuleContext) string {
54	return *t.properties.Trendy_team_id
55}
56
57func 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}
68