Unverified Commit 8bd0d0fd authored by Cristian Maglie's avatar Cristian Maglie Committed by GitHub

Show if debugging is supported in board details command (#1067)

* Improved comments

* Show if debugging is supported in board details command

* Update i18n

* Added test for 'debugging_supported' field
parent df9f204f
...@@ -124,14 +124,20 @@ func (pm *PackageManager) FindBoardWithFQBN(fqbnIn string) (*cores.Board, error) ...@@ -124,14 +124,20 @@ func (pm *PackageManager) FindBoardWithFQBN(fqbnIn string) (*cores.Board, error)
} }
// ResolveFQBN returns, in order: // ResolveFQBN returns, in order:
//
// - the Package pointed by the fqbn // - the Package pointed by the fqbn
//
// - the PlatformRelease pointed by the fqbn // - the PlatformRelease pointed by the fqbn
//
// - the Board pointed by the fqbn // - the Board pointed by the fqbn
//
// - the build properties for the board considering also the // - the build properties for the board considering also the
// configuration part of the fqbn // configuration part of the fqbn
//
// - the PlatformRelease to be used for the build (if the board // - the PlatformRelease to be used for the build (if the board
// requires a 3rd party core it may be different from the // requires a 3rd party core it may be different from the
// PlatformRelease pointed by the fqbn) // PlatformRelease pointed by the fqbn)
//
// - an error if any of the above is not found // - an error if any of the above is not found
// //
// In case of error the partial results found in the meantime are // In case of error the partial results found in the meantime are
......
...@@ -124,6 +124,9 @@ func (dr detailsResult) String() string { ...@@ -124,6 +124,9 @@ func (dr detailsResult) String() string {
t.AddRow(tr("Board name:"), details.Name) t.AddRow(tr("Board name:"), details.Name)
t.AddRow("FQBN:", details.Fqbn) t.AddRow("FQBN:", details.Fqbn)
addIfNotEmpty(tr("Board version:"), details.Version) addIfNotEmpty(tr("Board version:"), details.Version)
if details.GetDebuggingSupported() {
t.AddRow(tr("Debugging supported:"), table.NewCell("✔", color.New(color.FgGreen)))
}
if details.Official { if details.Official {
t.AddRow() // get some space from above t.AddRow() // get some space from above
......
...@@ -38,7 +38,8 @@ func Details(ctx context.Context, req *rpc.BoardDetailsReq) (*rpc.BoardDetailsRe ...@@ -38,7 +38,8 @@ func Details(ctx context.Context, req *rpc.BoardDetailsReq) (*rpc.BoardDetailsRe
return nil, fmt.Errorf("parsing fqbn: %s", err) return nil, fmt.Errorf("parsing fqbn: %s", err)
} }
boardPackage, boardPlatform, board, _, _, err := pm.ResolveFQBN(fqbn) boardPackage, boardPlatform, board, boardProperties, boardRefPlatform, err := pm.ResolveFQBN(fqbn)
if err != nil { if err != nil {
return nil, fmt.Errorf("loading board data: %s", err) return nil, fmt.Errorf("loading board data: %s", err)
} }
...@@ -50,6 +51,13 @@ func Details(ctx context.Context, req *rpc.BoardDetailsReq) (*rpc.BoardDetailsRe ...@@ -50,6 +51,13 @@ func Details(ctx context.Context, req *rpc.BoardDetailsReq) (*rpc.BoardDetailsRe
details.Official = fqbn.Package == "arduino" details.Official = fqbn.Package == "arduino"
details.Version = board.PlatformRelease.Version.String() details.Version = board.PlatformRelease.Version.String()
details.DebuggingSupported = boardProperties.ContainsKey("debug.executable") ||
boardPlatform.Properties.ContainsKey("debug.executable") ||
(boardRefPlatform != nil && boardRefPlatform.Properties.ContainsKey("debug.executable")) ||
// HOTFIX: Remove me when the `arduino:samd` core is updated
boardPlatform.String() == "arduino:samd@1.8.9" ||
boardPlatform.String() == "arduino:samd@1.8.8"
details.Package = &rpc.Package{ details.Package = &rpc.Package{
Name: boardPackage.Name, Name: boardPackage.Name,
Maintainer: boardPackage.Maintainer, Maintainer: boardPackage.Maintainer,
......
...@@ -81,6 +81,7 @@ func getDebugProperties(req *debug.DebugConfigReq, pm *packagemanager.PackageMan ...@@ -81,6 +81,7 @@ func getDebugProperties(req *debug.DebugConfigReq, pm *packagemanager.PackageMan
toolProperties.Merge(boardProperties) toolProperties.Merge(boardProperties)
// HOTFIX: Remove me when the `arduino:samd` core is updated // HOTFIX: Remove me when the `arduino:samd` core is updated
// (remember to remove it also in arduino/board/details.go)
if !toolProperties.ContainsKey("debug.executable") { if !toolProperties.ContainsKey("debug.executable") {
if platformRelease.String() == "arduino:samd@1.8.9" || platformRelease.String() == "arduino:samd@1.8.8" { if platformRelease.String() == "arduino:samd@1.8.9" || platformRelease.String() == "arduino:samd@1.8.8" {
toolProperties.Set("debug.executable", "{build.path}/{build.project_name}.elf") toolProperties.Set("debug.executable", "{build.path}/{build.project_name}.elf")
......
...@@ -21,10 +21,14 @@ msgstr "Board name:" ...@@ -21,10 +21,14 @@ msgstr "Board name:"
msgid "Board version:" msgid "Board version:"
msgstr "Board version:" msgstr "Board version:"
#: cli/board/details.go:169 #: cli/board/details.go:172
msgid "Checksum:" msgid "Checksum:"
msgstr "Checksum:" msgstr "Checksum:"
#: cli/board/details.go:128
msgid "Debugging supported:"
msgstr "Debugging supported:"
#: cli/board/details.go:60 #: cli/board/details.go:60
#: cli/board/details.go:75 #: cli/board/details.go:75
msgid "Error getting board details: %v" msgid "Error getting board details: %v"
...@@ -34,7 +38,7 @@ msgstr "Error getting board details: %v" ...@@ -34,7 +38,7 @@ msgstr "Error getting board details: %v"
msgid "Examples:" msgid "Examples:"
msgstr "Examples:" msgstr "Examples:"
#: cli/board/details.go:167 #: cli/board/details.go:170
msgid "File:" msgid "File:"
msgstr "File:" msgstr "File:"
...@@ -47,75 +51,75 @@ msgid "Global Flags:" ...@@ -47,75 +51,75 @@ msgid "Global Flags:"
msgstr "Global Flags:" msgstr "Global Flags:"
#: cli/board/details.go:97 #: cli/board/details.go:97
#: cli/board/details.go:195 #: cli/board/details.go:198
msgid "Id" msgid "Id"
msgstr "Id" msgstr "Id"
#: cli/board/details.go:137 #: cli/board/details.go:140
msgid "Identification properties:" msgid "Identification properties:"
msgstr "Identification properties:" msgstr "Identification properties:"
#: cli/board/details.go:195 #: cli/board/details.go:198
msgid "Name" msgid "Name"
msgstr "Name" msgstr "Name"
#: cli/board/details.go:166 #: cli/board/details.go:169
msgid "OS:" msgid "OS:"
msgstr "OS:" msgstr "OS:"
#: cli/board/details.go:130 #: cli/board/details.go:133
msgid "Official Arduino board:" msgid "Official Arduino board:"
msgstr "Official Arduino board:" msgstr "Official Arduino board:"
#: cli/board/details.go:178 #: cli/board/details.go:181
msgid "Option:" msgid "Option:"
msgstr "Option:" msgstr "Option:"
#: cli/board/details.go:146 #: cli/board/details.go:149
msgid "Package URL:" msgid "Package URL:"
msgstr "Package URL:" msgstr "Package URL:"
#: cli/board/details.go:145 #: cli/board/details.go:148
msgid "Package maintainer:" msgid "Package maintainer:"
msgstr "Package maintainer:" msgstr "Package maintainer:"
#: cli/board/details.go:144 #: cli/board/details.go:147
msgid "Package name:" msgid "Package name:"
msgstr "Package name:" msgstr "Package name:"
#: cli/board/details.go:148 #: cli/board/details.go:151
msgid "Package online help:" msgid "Package online help:"
msgstr "Package online help:" msgstr "Package online help:"
#: cli/board/details.go:147 #: cli/board/details.go:150
msgid "Package website:" msgid "Package website:"
msgstr "Package website:" msgstr "Package website:"
#: cli/board/details.go:154 #: cli/board/details.go:157
msgid "Platform URL:" msgid "Platform URL:"
msgstr "Platform URL:" msgstr "Platform URL:"
#: cli/board/details.go:153 #: cli/board/details.go:156
msgid "Platform architecture:" msgid "Platform architecture:"
msgstr "Platform architecture:" msgstr "Platform architecture:"
#: cli/board/details.go:152 #: cli/board/details.go:155
msgid "Platform category:" msgid "Platform category:"
msgstr "Platform category:" msgstr "Platform category:"
#: cli/board/details.go:159 #: cli/board/details.go:162
msgid "Platform checksum:" msgid "Platform checksum:"
msgstr "Platform checksum:" msgstr "Platform checksum:"
#: cli/board/details.go:155 #: cli/board/details.go:158
msgid "Platform file name:" msgid "Platform file name:"
msgstr "Platform file name:" msgstr "Platform file name:"
#: cli/board/details.go:151 #: cli/board/details.go:154
msgid "Platform name:" msgid "Platform name:"
msgstr "Platform name:" msgstr "Platform name:"
#: cli/board/details.go:157 #: cli/board/details.go:160
msgid "Platform size (bytes):" msgid "Platform size (bytes):"
msgstr "Platform size (bytes):" msgstr "Platform size (bytes):"
...@@ -127,11 +131,11 @@ msgstr "Print details about a board." ...@@ -127,11 +131,11 @@ msgstr "Print details about a board."
msgid "Programmer name" msgid "Programmer name"
msgstr "Programmer name" msgstr "Programmer name"
#: cli/board/details.go:195 #: cli/board/details.go:198
msgid "Programmers:" msgid "Programmers:"
msgstr "Programmers:" msgstr "Programmers:"
#: cli/board/details.go:163 #: cli/board/details.go:166
msgid "Required tool:" msgid "Required tool:"
msgstr "Required tool:" msgstr "Required tool:"
...@@ -147,7 +151,7 @@ msgstr "Show information about a board, in particular if the board has options t ...@@ -147,7 +151,7 @@ msgstr "Show information about a board, in particular if the board has options t
msgid "Show list of available programmers" msgid "Show list of available programmers"
msgstr "Show list of available programmers" msgstr "Show list of available programmers"
#: cli/board/details.go:168 #: cli/board/details.go:171
msgid "Size (bytes):" msgid "Size (bytes):"
msgstr "Size (bytes):" msgstr "Size (bytes):"
......
This diff is collapsed.
This diff is collapsed.
...@@ -57,6 +57,8 @@ message BoardDetailsResp { ...@@ -57,6 +57,8 @@ message BoardDetailsResp {
repeated IdentificationPref identification_pref = 12; repeated IdentificationPref identification_pref = 12;
// List of programmers supported by the board // List of programmers supported by the board
repeated Programmer programmers = 13; repeated Programmer programmers = 13;
// Set to true if the board supports debugging
bool debugging_supported = 14;
} }
message IdentificationPref { message IdentificationPref {
......
...@@ -467,6 +467,14 @@ def test_board_details(run_command): ...@@ -467,6 +467,14 @@ def test_board_details(run_command):
for programmer in gold_board_details["programmers"]: for programmer in gold_board_details["programmers"]:
assert programmer in result["programmers"] assert programmer in result["programmers"]
# Download samd core pinned to 1.8.8
run_command("core install arduino:samd@1.8.8")
result = run_command("board details -b arduino:samd:nano_33_iot --format json")
assert result.ok
result = json.loads(result.stdout)
assert result["debugging_supported"] is True
# old `arduino-cli board details` did not need -b <fqbn> flag to work # old `arduino-cli board details` did not need -b <fqbn> flag to work
def test_board_details_old(run_command): def test_board_details_old(run_command):
......
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