Skip to content

Commit 64b0886

Browse files
committed
allow switching to a particular board for compilation
1 parent d2d77b5 commit 64b0886

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-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

+9-1
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,21 @@
2424
"http://arduino.esp8266.com/stable/package_esp8266com_index.json"
2525
]
2626

27+
puts "Setting additional URLs"
2728
got_problem = true unless arduino_cmd.set_pref("boardsmanager.additional.urls", urls.join(","))
2829

30+
puts "Installing arduino:sam"
2931
got_problem = true unless arduino_cmd.install_board("arduino:sam")
32+
puts "Installing USBHost"
3033
got_problem = true unless arduino_cmd.install_library("USBHost")
34+
puts "checking that library is indexed"
3135
got_problem = true unless arduino_cmd.library_is_indexed
32-
36+
puts "setting compiler warning level"
3337
got_problem = true unless arduino_cmd.set_pref("compiler.warning_level", "all")
38+
puts "use board! (install board)"
39+
got_problem = true unless arduino_cmd.use_board!("arduino:samd:zero")
40+
puts "verify that board has been installed"
41+
got_problem = true unless arduino_cmd.board_installed?("arduino:samd:zero")
3442

3543
abort if got_problem
3644
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)