• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 TeamInfo struct {
36	Properties teamProperties
37}
38
39var TeamInfoProvider = blueprint.NewProvider[TeamInfo]()
40
41type teamModule struct {
42	ModuleBase
43	DefaultableModuleBase
44
45	properties teamProperties
46}
47
48type TestModuleInformation struct {
49	TestOnly       bool
50	TopLevelTarget bool
51}
52
53var TestOnlyProviderKey = blueprint.NewProvider[TestModuleInformation]()
54
55// Real work is done for the module that depends on us.
56// If needed, the team can serialize the config to json/proto file as well.
57func (t *teamModule) GenerateAndroidBuildActions(ctx ModuleContext) {
58	SetProvider(ctx, TeamInfoProvider, TeamInfo{
59		Properties: t.properties,
60	})
61}
62
63func (t *teamModule) TrendyTeamId(ctx ModuleContext) string {
64	return *t.properties.Trendy_team_id
65}
66
67func TeamFactory() Module {
68	module := &teamModule{}
69
70	base := module.base()
71	module.AddProperties(&base.nameProperties, &module.properties)
72
73	InitAndroidModule(module)
74	InitDefaultableModule(module)
75
76	return module
77}
78