Unverified Commit 05d14464 authored by Cristian Maglie's avatar Cristian Maglie Committed by GitHub

Added Type field to Platform gRPC struct (#1853)

* Added Category field to Platform gRPC struct

* Renamed gRPC response from Category string to Type []string
parent aa41d72e
...@@ -60,6 +60,7 @@ func PlatformReleaseToRPC(platformRelease *cores.PlatformRelease) *rpc.Platform ...@@ -60,6 +60,7 @@ func PlatformReleaseToRPC(platformRelease *cores.PlatformRelease) *rpc.Platform
Latest: platformRelease.Version.String(), Latest: platformRelease.Version.String(),
ManuallyInstalled: platformRelease.Platform.ManuallyInstalled, ManuallyInstalled: platformRelease.Platform.ManuallyInstalled,
Deprecated: platformRelease.Platform.Deprecated, Deprecated: platformRelease.Platform.Deprecated,
Type: []string{platformRelease.Platform.Category},
} }
return result return result
......
...@@ -61,6 +61,7 @@ func TestPlatformSearch(t *testing.T) { ...@@ -61,6 +61,7 @@ func TestPlatformSearch(t *testing.T) {
Website: "https://www.retrokits.com", Website: "https://www.retrokits.com",
Email: "info@retrokits.com", Email: "info@retrokits.com",
Boards: []*rpc.Board{{Name: "RK002"}}, Boards: []*rpc.Board{{Name: "RK002"}},
Type: []string{"Contributed"},
}) })
require.Contains(t, res.SearchOutput, &rpc.Platform{ require.Contains(t, res.SearchOutput, &rpc.Platform{
Id: "Retrokits-RK002:arm", Id: "Retrokits-RK002:arm",
...@@ -71,6 +72,7 @@ func TestPlatformSearch(t *testing.T) { ...@@ -71,6 +72,7 @@ func TestPlatformSearch(t *testing.T) {
Website: "https://www.retrokits.com", Website: "https://www.retrokits.com",
Email: "info@retrokits.com", Email: "info@retrokits.com",
Boards: []*rpc.Board{{Name: "RK002"}}, Boards: []*rpc.Board{{Name: "RK002"}},
Type: []string{"Contributed"},
}) })
res, stat = PlatformSearch(&rpc.PlatformSearchRequest{ res, stat = PlatformSearch(&rpc.PlatformSearchRequest{
...@@ -90,6 +92,7 @@ func TestPlatformSearch(t *testing.T) { ...@@ -90,6 +92,7 @@ func TestPlatformSearch(t *testing.T) {
Website: "https://www.retrokits.com", Website: "https://www.retrokits.com",
Email: "info@retrokits.com", Email: "info@retrokits.com",
Boards: []*rpc.Board{{Name: "RK002"}}, Boards: []*rpc.Board{{Name: "RK002"}},
Type: []string{"Contributed"},
}) })
// Search the Package Maintainer // Search the Package Maintainer
...@@ -110,6 +113,7 @@ func TestPlatformSearch(t *testing.T) { ...@@ -110,6 +113,7 @@ func TestPlatformSearch(t *testing.T) {
Website: "https://www.retrokits.com", Website: "https://www.retrokits.com",
Email: "info@retrokits.com", Email: "info@retrokits.com",
Boards: []*rpc.Board{{Name: "RK002"}}, Boards: []*rpc.Board{{Name: "RK002"}},
Type: []string{"Contributed"},
}) })
require.Contains(t, res.SearchOutput, &rpc.Platform{ require.Contains(t, res.SearchOutput, &rpc.Platform{
Id: "Retrokits-RK002:arm", Id: "Retrokits-RK002:arm",
...@@ -120,6 +124,7 @@ func TestPlatformSearch(t *testing.T) { ...@@ -120,6 +124,7 @@ func TestPlatformSearch(t *testing.T) {
Website: "https://www.retrokits.com", Website: "https://www.retrokits.com",
Email: "info@retrokits.com", Email: "info@retrokits.com",
Boards: []*rpc.Board{{Name: "RK002"}}, Boards: []*rpc.Board{{Name: "RK002"}},
Type: []string{"Contributed"},
}) })
// Search using the Package name // Search using the Package name
...@@ -140,6 +145,7 @@ func TestPlatformSearch(t *testing.T) { ...@@ -140,6 +145,7 @@ func TestPlatformSearch(t *testing.T) {
Website: "https://www.retrokits.com", Website: "https://www.retrokits.com",
Email: "info@retrokits.com", Email: "info@retrokits.com",
Boards: []*rpc.Board{{Name: "RK002"}}, Boards: []*rpc.Board{{Name: "RK002"}},
Type: []string{"Contributed"},
}) })
require.Contains(t, res.SearchOutput, &rpc.Platform{ require.Contains(t, res.SearchOutput, &rpc.Platform{
Id: "Retrokits-RK002:arm", Id: "Retrokits-RK002:arm",
...@@ -150,6 +156,7 @@ func TestPlatformSearch(t *testing.T) { ...@@ -150,6 +156,7 @@ func TestPlatformSearch(t *testing.T) {
Website: "https://www.retrokits.com", Website: "https://www.retrokits.com",
Email: "info@retrokits.com", Email: "info@retrokits.com",
Boards: []*rpc.Board{{Name: "RK002"}}, Boards: []*rpc.Board{{Name: "RK002"}},
Type: []string{"Contributed"},
}) })
// Search using the Platform name // Search using the Platform name
...@@ -170,6 +177,7 @@ func TestPlatformSearch(t *testing.T) { ...@@ -170,6 +177,7 @@ func TestPlatformSearch(t *testing.T) {
Website: "https://www.retrokits.com", Website: "https://www.retrokits.com",
Email: "info@retrokits.com", Email: "info@retrokits.com",
Boards: []*rpc.Board{{Name: "RK002"}}, Boards: []*rpc.Board{{Name: "RK002"}},
Type: []string{"Contributed"},
}) })
require.Contains(t, res.SearchOutput, &rpc.Platform{ require.Contains(t, res.SearchOutput, &rpc.Platform{
Id: "Retrokits-RK002:arm", Id: "Retrokits-RK002:arm",
...@@ -180,6 +188,7 @@ func TestPlatformSearch(t *testing.T) { ...@@ -180,6 +188,7 @@ func TestPlatformSearch(t *testing.T) {
Website: "https://www.retrokits.com", Website: "https://www.retrokits.com",
Email: "info@retrokits.com", Email: "info@retrokits.com",
Boards: []*rpc.Board{{Name: "RK002"}}, Boards: []*rpc.Board{{Name: "RK002"}},
Type: []string{"Contributed"},
}) })
// Search using a board name // Search using a board name
...@@ -199,6 +208,7 @@ func TestPlatformSearch(t *testing.T) { ...@@ -199,6 +208,7 @@ func TestPlatformSearch(t *testing.T) {
Maintainer: "Arduino", Maintainer: "Arduino",
Website: "https://www.arduino.cc/", Website: "https://www.arduino.cc/",
Email: "packages@arduino.cc", Email: "packages@arduino.cc",
Type: []string{"Arduino"},
Boards: []*rpc.Board{ Boards: []*rpc.Board{
{Name: "Arduino Yún"}, {Name: "Arduino Yún"},
{Name: "Arduino Uno"}, {Name: "Arduino Uno"},
...@@ -245,6 +255,7 @@ func TestPlatformSearch(t *testing.T) { ...@@ -245,6 +255,7 @@ func TestPlatformSearch(t *testing.T) {
Maintainer: "Arduino", Maintainer: "Arduino",
Website: "https://www.arduino.cc/", Website: "https://www.arduino.cc/",
Email: "packages@arduino.cc", Email: "packages@arduino.cc",
Type: []string{"Arduino"},
Boards: []*rpc.Board{ Boards: []*rpc.Board{
{Name: "Arduino Yún"}, {Name: "Arduino Yún"},
{Name: "Arduino Uno"}, {Name: "Arduino Uno"},
......
...@@ -335,6 +335,8 @@ type Platform struct { ...@@ -335,6 +335,8 @@ type Platform struct {
ManuallyInstalled bool `protobuf:"varint,9,opt,name=manually_installed,json=manuallyInstalled,proto3" json:"manually_installed,omitempty"` ManuallyInstalled bool `protobuf:"varint,9,opt,name=manually_installed,json=manuallyInstalled,proto3" json:"manually_installed,omitempty"`
// If true this Platform has been deprecated // If true this Platform has been deprecated
Deprecated bool `protobuf:"varint,10,opt,name=deprecated,proto3" json:"deprecated,omitempty"` Deprecated bool `protobuf:"varint,10,opt,name=deprecated,proto3" json:"deprecated,omitempty"`
// Type of the platform.
Type []string `protobuf:"bytes,11,rep,name=type,proto3" json:"type,omitempty"`
} }
func (x *Platform) Reset() { func (x *Platform) Reset() {
...@@ -439,6 +441,13 @@ func (x *Platform) GetDeprecated() bool { ...@@ -439,6 +441,13 @@ func (x *Platform) GetDeprecated() bool {
return false return false
} }
func (x *Platform) GetType() []string {
if x != nil {
return x.Type
}
return nil
}
type InstalledPlatformReference struct { type InstalledPlatformReference struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
...@@ -659,7 +668,7 @@ var file_cc_arduino_cli_commands_v1_common_proto_rawDesc = []byte{ ...@@ -659,7 +668,7 @@ var file_cc_arduino_cli_commands_v1_common_proto_rawDesc = []byte{
0x08, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x08, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x08, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18,
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d,
0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0xbe, 0x02, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0xd2, 0x02,
0x0a, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x6e,
0x73, 0x74, 0x61, 0x6c, 0x6c, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x69, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x69,
...@@ -679,27 +688,29 @@ var file_cc_arduino_cli_commands_v1_common_proto_rawDesc = []byte{ ...@@ -679,27 +688,29 @@ var file_cc_arduino_cli_commands_v1_common_proto_rawDesc = []byte{
0x61, 0x6c, 0x6c, 0x65, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x6d, 0x61, 0x6e, 0x61, 0x6c, 0x6c, 0x65, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x6d, 0x61, 0x6e,
0x75, 0x61, 0x6c, 0x6c, 0x79, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x65, 0x64, 0x12, 0x1e, 0x75, 0x61, 0x6c, 0x6c, 0x79, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x65, 0x64, 0x12, 0x1e,
0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x0a, 0x20, 0x01,
0x28, 0x08, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x22, 0x88, 0x28, 0x08, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x12,
0x01, 0x0a, 0x1a, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x65, 0x64, 0x50, 0x6c, 0x61, 0x74, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79,
0x66, 0x6f, 0x72, 0x6d, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x0e, 0x0a, 0x70, 0x65, 0x22, 0x88, 0x01, 0x0a, 0x1a, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x65, 0x64,
0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63,
0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69,
0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01,
0x6c, 0x6c, 0x5f, 0x64, 0x69, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x69, 0x6e, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x0b, 0x69,
0x73, 0x74, 0x61, 0x6c, 0x6c, 0x44, 0x69, 0x72, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x61, 0x63, 0x6b, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x5f, 0x64, 0x69, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
0x61, 0x67, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x52, 0x0a, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x44, 0x69, 0x72, 0x12, 0x1f, 0x0a, 0x0b,
0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x55, 0x72, 0x6c, 0x22, 0x2f, 0x0a, 0x05, 0x42, 0x6f, 0x61, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28,
0x72, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x09, 0x52, 0x0a, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x55, 0x72, 0x6c, 0x22, 0x2f, 0x0a,
0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x71, 0x62, 0x6e, 0x18, 0x02, 0x05, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x66, 0x71, 0x62, 0x6e, 0x22, 0x31, 0x0a, 0x07, 0x50, 0x72, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x71,
0x6f, 0x66, 0x69, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x62, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x66, 0x71, 0x62, 0x6e, 0x22, 0x31,
0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x71, 0x62, 0x0a, 0x07, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d,
0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x66, 0x71, 0x62, 0x6e, 0x42, 0x48, 0x5a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a,
0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x72, 0x64, 0x75, 0x04, 0x66, 0x71, 0x62, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x66, 0x71, 0x62,
0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2d, 0x63, 0x6c, 0x69, 0x2f, 0x6e, 0x42, 0x48, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
0x72, 0x70, 0x63, 0x2f, 0x63, 0x63, 0x2f, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2f, 0x63, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2d,
0x6c, 0x69, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2f, 0x76, 0x31, 0x3b, 0x63, 0x63, 0x6c, 0x69, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x63, 0x63, 0x2f, 0x61, 0x72, 0x64, 0x75, 0x69,
0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x6e, 0x6f, 0x2f, 0x63, 0x6c, 0x69, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2f,
0x76, 0x31, 0x3b, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
} }
var ( var (
......
...@@ -80,6 +80,8 @@ message Platform { ...@@ -80,6 +80,8 @@ message Platform {
bool manually_installed = 9; bool manually_installed = 9;
// If true this Platform has been deprecated // If true this Platform has been deprecated
bool deprecated = 10; bool deprecated = 10;
// Type of the platform.
repeated string type = 11;
} }
message InstalledPlatformReference { message InstalledPlatformReference {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment