Skip to content

Commit 517bf30

Browse files
committed
Be informative in build script
1 parent 4198b2f commit 517bf30

File tree

1 file changed

+43
-22
lines changed

1 file changed

+43
-22
lines changed

exe/arduino_ci_remote.rb

Lines changed: 43 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,20 @@ def assured_platform(purpose, name, config)
9090
installed_library_path = attempt("Installing library under test") do
9191
@arduino_cmd.install_local_library(Pathname.new("."))
9292
end
93+
if installed_library_path.exist?
94+
inform("Library installed at") { installed_library_path.to_s }
95+
else
96+
assure_multiline("Library installed successfully") do
97+
@arduino_cmd.lib_dir.ascend do |path_part|
98+
next unless path_part.exist?
99+
100+
break puts path_part.find.to_a.to_s
101+
end
102+
false
103+
end
104+
end
93105
library_examples = @arduino_cmd.library_examples(installed_library_path)
94106
cpp_library = ArduinoCI::CppLibrary.new(installed_library_path, @arduino_cmd.lib_dir)
95-
attempt("Library installed at #{installed_library_path}") { true }
96107

97108
# check GCC
98109
compilers = config.compilers_to_use
@@ -138,7 +149,7 @@ def assured_platform(purpose, name, config)
138149

139150
aux_libraries.each do |l|
140151
if @arduino_cmd.library_present?(l)
141-
assure("Using pre-existing library '#{l}'") { true }
152+
inform("Using pre-existing library") { l.to_s }
142153
else
143154
assure("Installing aux library '#{l}'") { @arduino_cmd.install_library(l) }
144155
end
@@ -147,11 +158,17 @@ def assured_platform(purpose, name, config)
147158
# iterate boards / tests
148159
last_board = nil
149160
if !cpp_library.tests_dir.exist?
150-
attempt("Skipping unit tests; no tests dir at #{cpp_library.tests_dir}") { true }
161+
inform_multiline("Skipping unit tests; no tests dir at #{cpp_library.tests_dir}") do
162+
puts cpp_library.tests_dir.find.to_a.to_s
163+
true
164+
end
151165
elsif cpp_library.test_files.empty?
152-
attempt("Skipping unit tests; no test files were found in #{cpp_library.tests_dir}") { true }
166+
inform_multiline("Skipping unit tests; no test files were found in #{cpp_library.tests_dir}") do
167+
puts cpp_library.tests_dir.find.to_a.to_s
168+
true
169+
end
153170
elsif config.platforms_to_unittest.empty?
154-
attempt("Skipping unit tests; no platforms were requested") { true }
171+
inform("Skipping unit tests") { "no platforms were requested" }
155172
else
156173
config.platforms_to_unittest.each do |p|
157174
board = all_platforms[p][:board]
@@ -181,26 +198,30 @@ def assured_platform(purpose, name, config)
181198
end
182199
end
183200

184-
unless library_examples.empty?
201+
if library_examples.empty?
202+
inform_multiline("Skipping libraries; no examples found in #{installed_library_path}") do
203+
puts installed_library_path.find.to_a.to_s
204+
end
205+
else
185206
attempt("Setting compiler warning level") { @arduino_cmd.set_pref("compiler.warning_level", "all") }
186-
end
187207

188-
# unlike previous, iterate examples / boards
189-
library_examples.each do |example_path|
190-
ovr_config = config.from_example(example_path)
191-
ovr_config.platforms_to_build.each do |p|
192-
board = all_platforms[p][:board]
193-
assure("Switching to board for #{p} (#{board})") { @arduino_cmd.use_board(board) } unless last_board == board
194-
last_board = board
195-
example_name = File.basename(example_path)
196-
attempt("Verifying #{example_name}") do
197-
ret = @arduino_cmd.verify_sketch(example_path)
198-
unless ret
199-
puts
200-
puts "Last command: #{@arduino_cmd.last_msg}"
201-
puts @arduino_cmd.last_err
208+
# unlike previous, iterate examples / boards
209+
library_examples.each do |example_path|
210+
ovr_config = config.from_example(example_path)
211+
ovr_config.platforms_to_build.each do |p|
212+
board = all_platforms[p][:board]
213+
assure("Switching to board for #{p} (#{board})") { @arduino_cmd.use_board(board) } unless last_board == board
214+
last_board = board
215+
example_name = File.basename(example_path)
216+
attempt("Verifying #{example_name}") do
217+
ret = @arduino_cmd.verify_sketch(example_path)
218+
unless ret
219+
puts
220+
puts "Last command: #{@arduino_cmd.last_msg}"
221+
puts @arduino_cmd.last_err
222+
end
223+
ret
202224
end
203-
ret
204225
end
205226
end
206227
end

0 commit comments

Comments
 (0)