Skip to content

Commit 5e5a5d2

Browse files
committed
allow switching to a particular board for compilation
1 parent d2d77b5 commit 5e5a5d2

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1313
- `ArduinoCmd` sets preferences
1414
- `ArduinoCmd` installs boards
1515
- `ArduinoCmd` installs libraries
16+
- `ArduinoCmd` selects boards (compiler preference)
1617

1718
### Changed
1819
- `DisplayManger.with_display` doesn't `disable` if the display was enabled prior to starting the block

exe/ci_system_check.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@
2929
got_problem = true unless arduino_cmd.install_board("arduino:sam")
3030
got_problem = true unless arduino_cmd.install_library("USBHost")
3131
got_problem = true unless arduino_cmd.library_is_indexed
32-
3332
got_problem = true unless arduino_cmd.set_pref("compiler.warning_level", "all")
33+
got_problem = true unless arduino_cmd.use_board!("arduino:sam:arduino_due_x")
34+
got_problem = true unless arduino_cmd.board_installed?("arduino:sam:arduino_due_x")
35+
3436

3537
abort if got_problem
3638
exit(0)

lib/arduino_ci/arduino_cmd.rb

+14
Original file line numberDiff line numberDiff line change
@@ -137,5 +137,19 @@ def update_library_index
137137
install_library("USBHost")
138138
end
139139

140+
# use a particular board for compilation
141+
def use_board(boardname)
142+
run_with_gui_guess(" about board not installed", "--board", boardname, "--save-prefs")
143+
end
144+
145+
# use a particular board for compilation, installing it if necessary
146+
def use_board!(boardname)
147+
return true if use_board(boardname)
148+
boardfamily = boardname.split(":")[0..1].join(":")
149+
puts "Board '#{boardname}' not found; attempting to install '#{boardfamily}'"
150+
return false unless install_board(boardfamily) # guess board family from first 2 :-separated fields
151+
use_board(boardname)
152+
end
153+
140154
end
141155
end

0 commit comments

Comments
 (0)