xref: /aosp_15_r20/build/soong/android/team.go (revision 333d2b3687b3a337dbcca9d65000bca186795e39)
1*333d2b36SAndroid Build Coastguard Worker// Copyright 2020 Google Inc. All rights reserved.
2*333d2b36SAndroid Build Coastguard Worker//
3*333d2b36SAndroid Build Coastguard Worker// Licensed under the Apache License, Version 2.0 (the "License");
4*333d2b36SAndroid Build Coastguard Worker// you may not use this file except in compliance with the License.
5*333d2b36SAndroid Build Coastguard Worker// You may obtain a copy of the License at
6*333d2b36SAndroid Build Coastguard Worker//
7*333d2b36SAndroid Build Coastguard Worker//     http://www.apache.org/licenses/LICENSE-2.0
8*333d2b36SAndroid Build Coastguard Worker//
9*333d2b36SAndroid Build Coastguard Worker// Unless required by applicable law or agreed to in writing, software
10*333d2b36SAndroid Build Coastguard Worker// distributed under the License is distributed on an "AS IS" BASIS,
11*333d2b36SAndroid Build Coastguard Worker// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*333d2b36SAndroid Build Coastguard Worker// See the License for the specific language governing permissions and
13*333d2b36SAndroid Build Coastguard Worker// limitations under the License.
14*333d2b36SAndroid Build Coastguard Worker
15*333d2b36SAndroid Build Coastguard Workerpackage android
16*333d2b36SAndroid Build Coastguard Worker
17*333d2b36SAndroid Build Coastguard Workerimport "github.com/google/blueprint"
18*333d2b36SAndroid Build Coastguard Worker
19*333d2b36SAndroid Build Coastguard Workerfunc init() {
20*333d2b36SAndroid Build Coastguard Worker	RegisterTeamBuildComponents(InitRegistrationContext)
21*333d2b36SAndroid Build Coastguard Worker}
22*333d2b36SAndroid Build Coastguard Worker
23*333d2b36SAndroid Build Coastguard Workerfunc RegisterTeamBuildComponents(ctx RegistrationContext) {
24*333d2b36SAndroid Build Coastguard Worker	ctx.RegisterModuleType("team", TeamFactory)
25*333d2b36SAndroid Build Coastguard Worker}
26*333d2b36SAndroid Build Coastguard Worker
27*333d2b36SAndroid Build Coastguard Workervar PrepareForTestWithTeamBuildComponents = GroupFixturePreparers(
28*333d2b36SAndroid Build Coastguard Worker	FixtureRegisterWithContext(RegisterTeamBuildComponents),
29*333d2b36SAndroid Build Coastguard Worker)
30*333d2b36SAndroid Build Coastguard Worker
31*333d2b36SAndroid Build Coastguard Workertype teamProperties struct {
32*333d2b36SAndroid Build Coastguard Worker	Trendy_team_id *string `json:"trendy_team_id"`
33*333d2b36SAndroid Build Coastguard Worker}
34*333d2b36SAndroid Build Coastguard Worker
35*333d2b36SAndroid Build Coastguard Workertype teamModule struct {
36*333d2b36SAndroid Build Coastguard Worker	ModuleBase
37*333d2b36SAndroid Build Coastguard Worker	DefaultableModuleBase
38*333d2b36SAndroid Build Coastguard Worker
39*333d2b36SAndroid Build Coastguard Worker	properties teamProperties
40*333d2b36SAndroid Build Coastguard Worker}
41*333d2b36SAndroid Build Coastguard Worker
42*333d2b36SAndroid Build Coastguard Workertype TestModuleInformation struct {
43*333d2b36SAndroid Build Coastguard Worker	TestOnly       bool
44*333d2b36SAndroid Build Coastguard Worker	TopLevelTarget bool
45*333d2b36SAndroid Build Coastguard Worker}
46*333d2b36SAndroid Build Coastguard Worker
47*333d2b36SAndroid Build Coastguard Workervar TestOnlyProviderKey = blueprint.NewProvider[TestModuleInformation]()
48*333d2b36SAndroid Build Coastguard Worker
49*333d2b36SAndroid Build Coastguard Worker// Real work is done for the module that depends on us.
50*333d2b36SAndroid Build Coastguard Worker// If needed, the team can serialize the config to json/proto file as well.
51*333d2b36SAndroid Build Coastguard Workerfunc (t *teamModule) GenerateAndroidBuildActions(ctx ModuleContext) {}
52*333d2b36SAndroid Build Coastguard Worker
53*333d2b36SAndroid Build Coastguard Workerfunc (t *teamModule) TrendyTeamId(ctx ModuleContext) string {
54*333d2b36SAndroid Build Coastguard Worker	return *t.properties.Trendy_team_id
55*333d2b36SAndroid Build Coastguard Worker}
56*333d2b36SAndroid Build Coastguard Worker
57*333d2b36SAndroid Build Coastguard Workerfunc TeamFactory() Module {
58*333d2b36SAndroid Build Coastguard Worker	module := &teamModule{}
59*333d2b36SAndroid Build Coastguard Worker
60*333d2b36SAndroid Build Coastguard Worker	base := module.base()
61*333d2b36SAndroid Build Coastguard Worker	module.AddProperties(&base.nameProperties, &module.properties)
62*333d2b36SAndroid Build Coastguard Worker
63*333d2b36SAndroid Build Coastguard Worker	InitAndroidModule(module)
64*333d2b36SAndroid Build Coastguard Worker	InitDefaultableModule(module)
65*333d2b36SAndroid Build Coastguard Worker
66*333d2b36SAndroid Build Coastguard Worker	return module
67*333d2b36SAndroid Build Coastguard Worker}
68