@@ -20,6 +20,7 @@ import (
20
20
"errors"
21
21
"strings"
22
22
23
+ "github.com/arduino/arduino-cli/arduino/cores"
23
24
"github.com/arduino/arduino-cli/commands"
24
25
rpc "github.com/arduino/arduino-cli/rpc/commands"
25
26
)
@@ -48,10 +49,42 @@ func ListAll(ctx context.Context, req *rpc.BoardListAllReq) (*rpc.BoardListAllRe
48
49
list := & rpc.BoardListAllResp {Boards : []* rpc.BoardListItem {}}
49
50
for _ , targetPackage := range pm .Packages {
50
51
for _ , platform := range targetPackage .Platforms {
51
- platformRelease := pm .GetInstalledPlatformRelease (platform )
52
- if platformRelease == nil {
52
+ installedPlatformRelease := pm .GetInstalledPlatformRelease (platform )
53
+ latestPlatformRelease := platform .GetLatestRelease ()
54
+
55
+ // No way to get list of boards if both releases are not found
56
+ if installedPlatformRelease == nil && latestPlatformRelease == nil {
53
57
continue
54
58
}
59
+
60
+ installedVersion := ""
61
+ if installedPlatformRelease != nil {
62
+ installedVersion = installedPlatformRelease .Version .String ()
63
+ }
64
+
65
+ latestVersion := ""
66
+ if latestPlatformRelease != nil {
67
+ latestVersion = latestPlatformRelease .Version .String ()
68
+ }
69
+
70
+ rpcPlatform := & rpc.Platform {
71
+ ID : platform .String (),
72
+ Installed : installedVersion ,
73
+ Latest : latestVersion ,
74
+ Name : platform .Name ,
75
+ Maintainer : platform .Package .Maintainer ,
76
+ Website : platform .Package .WebsiteURL ,
77
+ Email : platform .Package .Email ,
78
+ ManuallyInstalled : platform .ManuallyInstalled ,
79
+ }
80
+
81
+ var platformRelease * cores.PlatformRelease
82
+ if installedPlatformRelease != nil {
83
+ platformRelease = installedPlatformRelease
84
+ } else {
85
+ platformRelease = latestPlatformRelease
86
+ }
87
+
55
88
for _ , board := range platformRelease .Boards {
56
89
if ! match (board .Name ()) {
57
90
continue
@@ -63,6 +96,7 @@ func ListAll(ctx context.Context, req *rpc.BoardListAllReq) (*rpc.BoardListAllRe
63
96
Name : board .Name (),
64
97
FQBN : board .FQBN (),
65
98
IsHidden : board .IsHidden (),
99
+ Platform : rpcPlatform ,
66
100
})
67
101
}
68
102
}
0 commit comments