Skip to content

Commit 05d1446

Browse files
authored
Added Type field to Platform gRPC struct (#1853)
* Added Category field to Platform gRPC struct * Renamed gRPC response from Category string to Type []string
1 parent aa41d72 commit 05d1446

File tree

4 files changed

+47
-22
lines changed

4 files changed

+47
-22
lines changed

Diff for: commands/core.go

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ func PlatformReleaseToRPC(platformRelease *cores.PlatformRelease) *rpc.Platform
6060
Latest: platformRelease.Version.String(),
6161
ManuallyInstalled: platformRelease.Platform.ManuallyInstalled,
6262
Deprecated: platformRelease.Platform.Deprecated,
63+
Type: []string{platformRelease.Platform.Category},
6364
}
6465

6566
return result

Diff for: commands/core/search_test.go

+11
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ func TestPlatformSearch(t *testing.T) {
6161
Website: "https://www.retrokits.com",
6262
Email: "info@retrokits.com",
6363
Boards: []*rpc.Board{{Name: "RK002"}},
64+
Type: []string{"Contributed"},
6465
})
6566
require.Contains(t, res.SearchOutput, &rpc.Platform{
6667
Id: "Retrokits-RK002:arm",
@@ -71,6 +72,7 @@ func TestPlatformSearch(t *testing.T) {
7172
Website: "https://www.retrokits.com",
7273
Email: "info@retrokits.com",
7374
Boards: []*rpc.Board{{Name: "RK002"}},
75+
Type: []string{"Contributed"},
7476
})
7577

7678
res, stat = PlatformSearch(&rpc.PlatformSearchRequest{
@@ -90,6 +92,7 @@ func TestPlatformSearch(t *testing.T) {
9092
Website: "https://www.retrokits.com",
9193
Email: "info@retrokits.com",
9294
Boards: []*rpc.Board{{Name: "RK002"}},
95+
Type: []string{"Contributed"},
9396
})
9497

9598
// Search the Package Maintainer
@@ -110,6 +113,7 @@ func TestPlatformSearch(t *testing.T) {
110113
Website: "https://www.retrokits.com",
111114
Email: "info@retrokits.com",
112115
Boards: []*rpc.Board{{Name: "RK002"}},
116+
Type: []string{"Contributed"},
113117
})
114118
require.Contains(t, res.SearchOutput, &rpc.Platform{
115119
Id: "Retrokits-RK002:arm",
@@ -120,6 +124,7 @@ func TestPlatformSearch(t *testing.T) {
120124
Website: "https://www.retrokits.com",
121125
Email: "info@retrokits.com",
122126
Boards: []*rpc.Board{{Name: "RK002"}},
127+
Type: []string{"Contributed"},
123128
})
124129

125130
// Search using the Package name
@@ -140,6 +145,7 @@ func TestPlatformSearch(t *testing.T) {
140145
Website: "https://www.retrokits.com",
141146
Email: "info@retrokits.com",
142147
Boards: []*rpc.Board{{Name: "RK002"}},
148+
Type: []string{"Contributed"},
143149
})
144150
require.Contains(t, res.SearchOutput, &rpc.Platform{
145151
Id: "Retrokits-RK002:arm",
@@ -150,6 +156,7 @@ func TestPlatformSearch(t *testing.T) {
150156
Website: "https://www.retrokits.com",
151157
Email: "info@retrokits.com",
152158
Boards: []*rpc.Board{{Name: "RK002"}},
159+
Type: []string{"Contributed"},
153160
})
154161

155162
// Search using the Platform name
@@ -170,6 +177,7 @@ func TestPlatformSearch(t *testing.T) {
170177
Website: "https://www.retrokits.com",
171178
Email: "info@retrokits.com",
172179
Boards: []*rpc.Board{{Name: "RK002"}},
180+
Type: []string{"Contributed"},
173181
})
174182
require.Contains(t, res.SearchOutput, &rpc.Platform{
175183
Id: "Retrokits-RK002:arm",
@@ -180,6 +188,7 @@ func TestPlatformSearch(t *testing.T) {
180188
Website: "https://www.retrokits.com",
181189
Email: "info@retrokits.com",
182190
Boards: []*rpc.Board{{Name: "RK002"}},
191+
Type: []string{"Contributed"},
183192
})
184193

185194
// Search using a board name
@@ -199,6 +208,7 @@ func TestPlatformSearch(t *testing.T) {
199208
Maintainer: "Arduino",
200209
Website: "https://www.arduino.cc/",
201210
Email: "packages@arduino.cc",
211+
Type: []string{"Arduino"},
202212
Boards: []*rpc.Board{
203213
{Name: "Arduino Yún"},
204214
{Name: "Arduino Uno"},
@@ -245,6 +255,7 @@ func TestPlatformSearch(t *testing.T) {
245255
Maintainer: "Arduino",
246256
Website: "https://www.arduino.cc/",
247257
Email: "packages@arduino.cc",
258+
Type: []string{"Arduino"},
248259
Boards: []*rpc.Board{
249260
{Name: "Arduino Yún"},
250261
{Name: "Arduino Uno"},

Diff for: rpc/cc/arduino/cli/commands/v1/common.pb.go

+33-22
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: rpc/cc/arduino/cli/commands/v1/common.proto

+2
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ message Platform {
8080
bool manually_installed = 9;
8181
// If true this Platform has been deprecated
8282
bool deprecated = 10;
83+
// Type of the platform.
84+
repeated string type = 11;
8385
}
8486

8587
message InstalledPlatformReference {

0 commit comments

Comments
 (0)