Skip to content

Commit 2df7ce0

Browse files
committed
Fix board skipping logic
1 parent 1106bb6 commit 2df7ce0

File tree

2 files changed

+14
-2
lines changed
  • arduino/cores/packagemanager
  • test/testdata/platform_with_wrong_custom_board_options

2 files changed

+14
-2
lines changed

arduino/cores/packagemanager/loader.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,16 @@ func (pm *PackageManager) loadBoards(platform *cores.PlatformRelease) error {
387387
skippedBoards := []string{}
388388
for boardID, boardProperties := range propertiesByBoard {
389389
var board *cores.Board
390-
for _, key := range boardProperties.FirstLevelKeys() {
391-
if key == "menu" && platform.Menus.Size() == 0 {
390+
for key := range boardProperties.AsMap() {
391+
if !strings.HasPrefix(key, "menu") {
392+
continue
393+
}
394+
// Menu keys are formed like this:
395+
// menu.cache.off=false
396+
// menu.cache.on=true
397+
// so we assume that the a second element in the slice exists
398+
menuName := strings.Split(key, ".")[1]
399+
if !platform.Menus.ContainsKey(menuName) {
392400
fqbn := fmt.Sprintf("%s:%s:%s", platform.Platform.Package.Name, platform.Platform.Architecture, boardID)
393401
skippedBoards = append(skippedBoards, fqbn)
394402
goto next_board

test/testdata/platform_with_wrong_custom_board_options/boards.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
menu.cpu=Processor
2+
13
nessuno.name=Arduino Nessuno
24
nessuno.vid.0=0x2341
35
nessuno.pid.0=0x0043
@@ -56,3 +58,5 @@ altra.build.f_cpu=16000000L
5658
altra.build.board=AVR_ALTRA
5759
altra.build.core=arduino
5860
altra.build.variant=standard
61+
altra.menu.cpu.atmega328=ATmega328P
62+
altra.menu.cpu.atmega168=ATmega168

0 commit comments

Comments
 (0)