diff options
author | 2023-12-19 10:24:47 -0800 | |
---|---|---|
committer | 2024-01-18 14:16:06 -0800 | |
commit | 73b08ffd0dc12eb4107700220979fb52fb642b92 (patch) | |
tree | 9a8bd516d550759f3392ebe23ba2225000912e93 /android/team_proto | |
parent | ee18a66643caddba76f13878ccfeaccd772a0940 (diff) |
Add team property to all modules.
This allows vendors (like google) to specify which team owns the test
module and code.
Team is a commonProperty on modules and points to the designate "team"
module. The DepsMutator adds the dependency on the "team" module and
"GenerateBuildActions" write the team data to intermediate files.
A new singleton rule, all_teams visits all modules and writes out
the proto containing the team for each module.
If a module doesn't have a team, then it finds the package in the
blueprint file and parent directory blueprint files that have a
default_team and uses that team.
Test: m all_teams
Test: go test ./python ./java ./cc ./rust ./android
Test: added team to HelloWorldHostTest and built the new asciiproto target
Test: added package default_team and checkout output proto.
Change-Id: I5c07bf489de460a04fc540f5fff0394f39f574a7
Diffstat (limited to 'android/team_proto')
-rw-r--r-- | android/team_proto/Android.bp | 29 | ||||
-rw-r--r-- | android/team_proto/OWNERS | 5 | ||||
-rwxr-xr-x | android/team_proto/regen.sh | 3 | ||||
-rw-r--r-- | android/team_proto/team.pb.go | 253 | ||||
-rw-r--r-- | android/team_proto/team.proto | 34 |
5 files changed, 324 insertions, 0 deletions
diff --git a/android/team_proto/Android.bp b/android/team_proto/Android.bp new file mode 100644 index 000000000..061e77e03 --- /dev/null +++ b/android/team_proto/Android.bp @@ -0,0 +1,29 @@ +// Copyright 2022 Google Inc. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +bootstrap_go_package { + name: "soong-android_team_proto", + pkgPath: "android/soong/android/team_proto", + deps: [ + "golang-protobuf-reflect-protoreflect", + "golang-protobuf-runtime-protoimpl", + ], + srcs: [ + "team.pb.go", + ], +} diff --git a/android/team_proto/OWNERS b/android/team_proto/OWNERS new file mode 100644 index 000000000..2beb4f47d --- /dev/null +++ b/android/team_proto/OWNERS @@ -0,0 +1,5 @@ +dariofreni@google.com +joeo@google.com +ronish@google.com +caditya@google.com +rbraunstein@google.com diff --git a/android/team_proto/regen.sh b/android/team_proto/regen.sh new file mode 100755 index 000000000..63b2016e1 --- /dev/null +++ b/android/team_proto/regen.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +aprotoc --go_out=paths=source_relative:. team.proto diff --git a/android/team_proto/team.pb.go b/android/team_proto/team.pb.go new file mode 100644 index 000000000..61260cf78 --- /dev/null +++ b/android/team_proto/team.pb.go @@ -0,0 +1,253 @@ +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.30.0 +// protoc v3.21.12 +// source: team.proto + +package team_proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Team struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // REQUIRED: Name of the build target + TargetName *string `protobuf:"bytes,1,opt,name=target_name,json=targetName" json:"target_name,omitempty"` + // REQUIRED: Code location of the target. + // To be used to support legacy/backup systems that use OWNERS file and is + // also required for our dashboard to support per code location basis UI + Path *string `protobuf:"bytes,2,opt,name=path" json:"path,omitempty"` + // REQUIRED: Team ID of the team that owns this target. + TrendyTeamId *string `protobuf:"bytes,3,opt,name=trendy_team_id,json=trendyTeamId" json:"trendy_team_id,omitempty"` + // OPTIONAL: Files directly owned by this module. + File []string `protobuf:"bytes,4,rep,name=file" json:"file,omitempty"` +} + +func (x *Team) Reset() { + *x = Team{} + if protoimpl.UnsafeEnabled { + mi := &file_team_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Team) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Team) ProtoMessage() {} + +func (x *Team) ProtoReflect() protoreflect.Message { + mi := &file_team_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Team.ProtoReflect.Descriptor instead. +func (*Team) Descriptor() ([]byte, []int) { + return file_team_proto_rawDescGZIP(), []int{0} +} + +func (x *Team) GetTargetName() string { + if x != nil && x.TargetName != nil { + return *x.TargetName + } + return "" +} + +func (x *Team) GetPath() string { + if x != nil && x.Path != nil { + return *x.Path + } + return "" +} + +func (x *Team) GetTrendyTeamId() string { + if x != nil && x.TrendyTeamId != nil { + return *x.TrendyTeamId + } + return "" +} + +func (x *Team) GetFile() []string { + if x != nil { + return x.File + } + return nil +} + +type AllTeams struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Teams []*Team `protobuf:"bytes,1,rep,name=teams" json:"teams,omitempty"` +} + +func (x *AllTeams) Reset() { + *x = AllTeams{} + if protoimpl.UnsafeEnabled { + mi := &file_team_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AllTeams) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AllTeams) ProtoMessage() {} + +func (x *AllTeams) ProtoReflect() protoreflect.Message { + mi := &file_team_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AllTeams.ProtoReflect.Descriptor instead. +func (*AllTeams) Descriptor() ([]byte, []int) { + return file_team_proto_rawDescGZIP(), []int{1} +} + +func (x *AllTeams) GetTeams() []*Team { + if x != nil { + return x.Teams + } + return nil +} + +var File_team_proto protoreflect.FileDescriptor + +var file_team_proto_rawDesc = []byte{ + 0x0a, 0x0a, 0x74, 0x65, 0x61, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x74, 0x65, + 0x61, 0x6d, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x75, 0x0a, 0x04, 0x54, 0x65, 0x61, 0x6d, + 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x4e, 0x61, 0x6d, + 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x24, 0x0a, 0x0e, 0x74, 0x72, 0x65, 0x6e, 0x64, 0x79, 0x5f, + 0x74, 0x65, 0x61, 0x6d, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x74, + 0x72, 0x65, 0x6e, 0x64, 0x79, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x66, + 0x69, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x22, + 0x32, 0x0a, 0x08, 0x41, 0x6c, 0x6c, 0x54, 0x65, 0x61, 0x6d, 0x73, 0x12, 0x26, 0x0a, 0x05, 0x74, + 0x65, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x74, 0x65, 0x61, + 0x6d, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x65, 0x61, 0x6d, 0x52, 0x05, 0x74, 0x65, + 0x61, 0x6d, 0x73, 0x42, 0x22, 0x5a, 0x20, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x2f, 0x73, + 0x6f, 0x6f, 0x6e, 0x67, 0x2f, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x2f, 0x74, 0x65, 0x61, + 0x6d, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, +} + +var ( + file_team_proto_rawDescOnce sync.Once + file_team_proto_rawDescData = file_team_proto_rawDesc +) + +func file_team_proto_rawDescGZIP() []byte { + file_team_proto_rawDescOnce.Do(func() { + file_team_proto_rawDescData = protoimpl.X.CompressGZIP(file_team_proto_rawDescData) + }) + return file_team_proto_rawDescData +} + +var file_team_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_team_proto_goTypes = []interface{}{ + (*Team)(nil), // 0: team_proto.Team + (*AllTeams)(nil), // 1: team_proto.AllTeams +} +var file_team_proto_depIdxs = []int32{ + 0, // 0: team_proto.AllTeams.teams:type_name -> team_proto.Team + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_team_proto_init() } +func file_team_proto_init() { + if File_team_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_team_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Team); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_team_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AllTeams); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_team_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_team_proto_goTypes, + DependencyIndexes: file_team_proto_depIdxs, + MessageInfos: file_team_proto_msgTypes, + }.Build() + File_team_proto = out.File + file_team_proto_rawDesc = nil + file_team_proto_goTypes = nil + file_team_proto_depIdxs = nil +} diff --git a/android/team_proto/team.proto b/android/team_proto/team.proto new file mode 100644 index 000000000..401eccc6e --- /dev/null +++ b/android/team_proto/team.proto @@ -0,0 +1,34 @@ +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto2"; +package team_proto; +option go_package = "android/soong/android/team_proto"; + +message Team { + // REQUIRED: Name of the build target + optional string target_name = 1; + + // REQUIRED: Code location of the target. + // To be used to support legacy/backup systems that use OWNERS file and is + // also required for our dashboard to support per code location basis UI + optional string path = 2; + + // REQUIRED: Team ID of the team that owns this target. + optional string trendy_team_id = 3; + + // OPTIONAL: Files directly owned by this module. + repeated string file = 4; +} + +message AllTeams { + repeated Team teams = 1; +} |