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