Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e4bd962

Browse files
author
Akos Kitta
committed
Use BoardsManifest if Boards is not applicable
This patch falls back to the `BoardsManifest` when the `Boards` is not available. When the `Boards` are not installed, hence unavailable, the produced gRPC instance won't contain the `FQBN` but the `Name` only. Signed-off-by: Akos Kitta <kittaakos@typefox.io>
1 parent d876ac9 commit e4bd962

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

‎commands/core/core.go‎

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,30 @@ import (
2626
// Note: this function does not touch the "Installed" field of rpc.Platform as it's not always clear that the
2727
// platformRelease we're currently converting is actually installed.
2828
func platformReleaseToRPC(platformRelease *cores.PlatformRelease) *rpc.Platform {
29-
boards := make([]*rpc.Board, len(platformRelease.Boards))
30-
i := 0
31-
for _, b := range platformRelease.Boards {
32-
boards[i] = &rpc.Board{
33-
Name: b.Name(),
34-
Fqbn: b.FQBN(),
29+
// If the boards are not installed yet, the `platformRelease.Boards` will be a zero length slice.
30+
// In such case, we have to use the `platformRelease.BoardsManifest` instead.
31+
// So that we can retrieve the name of the boards at least.
32+
var boards []*rpc.Board
33+
if len(platformRelease.Boards) > 0 {
34+
boards = make([]*rpc.Board, len(platformRelease.Boards))
35+
i := 0
36+
for _, b := range platformRelease.Boards {
37+
boards[i] = &rpc.Board{
38+
Name: b.Name(),
39+
Fqbn: b.FQBN(),
40+
}
41+
i++
42+
}
43+
} else {
44+
boards = make([]*rpc.Board, len(platformRelease.BoardsManifest))
45+
i := 0
46+
for _, m := range platformRelease.BoardsManifest {
47+
boards[i] = &rpc.Board{
48+
Name: m.Name,
49+
// FBQN is not available. Boards have to be installed first (-> `boards.txt`).
50+
}
51+
i++
3552
}
36-
i++
3753
}
3854

3955
result := &rpc.Platform{

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /