Skip to content

Commit c8cba88

Browse files
committed
Clean up messaging about dependency installation
1 parent 7371c82 commit c8cba88

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

exe/arduino_ci.rb

+23-2
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,17 @@ def display_files(pathname)
128128
@log.indent { non_hidden.each(&@log.method(:iputs)) }
129129
end
130130

131+
# helper recursive function for library installation
132+
#
133+
# This recursively descends the dependency tree starting from an initial list,
134+
# and either uses existing installations (based on directory naming only) or
135+
# forcibly installs the dependency. Each child dependency logs which parent requested it
136+
#
137+
# @param library_names [Array<String>] the list of libraries to install
138+
# @param on_behalf_of [String] the requestor of a given dependency
139+
# @param already_installed [Array<String>] the set of depenencies installed by previous steps
131140
# @return [Array<String>] The list of installed libraries
132-
def install_arduino_library_dependencies(library_names, on_behalf_of, already_installed = [])
141+
def install_arduino_library_dependencies_h(library_names, on_behalf_of, already_installed)
133142
installed = already_installed.clone
134143
(library_names.map { |n| @backend.library_of_name(n) } - installed).each do |l|
135144
if l.installed?
@@ -142,11 +151,23 @@ def install_arduino_library_dependencies(library_names, on_behalf_of, already_in
142151
end
143152
end
144153
installed << l.name
145-
installed += install_arduino_library_dependencies(l.arduino_library_dependencies, l.name, installed)
154+
installed += install_arduino_library_dependencies_h(l.arduino_library_dependencies, l.name, installed)
146155
end
147156
installed
148157
end
149158

159+
# @return [Array<String>] The list of installed libraries
160+
def install_arduino_library_dependencies(library_names, on_behalf_of)
161+
if library_names.empty?
162+
@log.inform("Arduino library dependencies (configured in #{on_behalf_of}) to resolve") { library_names.length }
163+
return []
164+
end
165+
166+
@log.inform_multiline("Resolving #{library_names.length} Arduino library dependencies configured in #{on_behalf_of})") do
167+
install_arduino_library_dependencies_h(library_names, on_behalf_of, [])
168+
end
169+
end
170+
150171
# @param platforms [Array<String>] list of platforms to consider
151172
# @param specific_config [CIConfig] configuration to use
152173
def install_all_packages(platforms, specific_config)

0 commit comments

Comments
 (0)