@@ -137,8 +137,17 @@ def display_files(pathname)
137137 @log . indent { non_hidden . each ( &@log . method ( :iputs ) ) }
138138end
139139
140+ # helper recursive function for library installation
141+ #
142+ # This recursively descends the dependency tree starting from an initial list,
143+ # and either uses existing installations (based on directory naming only) or
144+ # forcibly installs the dependency. Each child dependency logs which parent requested it
145+ #
146+ # @param library_names [Array<String>] the list of libraries to install
147+ # @param on_behalf_of [String] the requestor of a given dependency
148+ # @param already_installed [Array<String>] the set of dependencies installed by previous steps
140149# @return [Array<String>] The list of installed libraries
141- def install_arduino_library_dependencies ( library_names , on_behalf_of , already_installed = [ ] )
150+ def install_arduino_library_dependencies_h ( library_names , on_behalf_of , already_installed )
142151 installed = already_installed . clone
143152 ( library_names . map { |n | @backend . library_of_name ( n ) } - installed ) . each do |l |
144153 if l . installed?
@@ -151,11 +160,23 @@ def install_arduino_library_dependencies(library_names, on_behalf_of, already_in
151160 end
152161 end
153162 installed << l . name
154- installed += install_arduino_library_dependencies ( l . arduino_library_dependencies , l . name , installed )
163+ installed += install_arduino_library_dependencies_h ( l . arduino_library_dependencies , l . name , installed )
155164 end
156165 installed
157166end
158167
168+ # @return [Array<String>] The list of installed libraries
169+ def install_arduino_library_dependencies ( library_names , on_behalf_of )
170+ if library_names . empty?
171+ @log . inform ( "Arduino library dependencies (configured in #{ on_behalf_of } ) to resolve" ) { library_names . length }
172+ return [ ]
173+ end
174+
175+ @log . inform_multiline ( "Resolving #{ library_names . length } Arduino library dependencies configured in #{ on_behalf_of } )" ) do
176+ install_arduino_library_dependencies_h ( library_names , on_behalf_of , [ ] )
177+ end
178+ end
179+
159180# @param platforms [Array<String>] list of platforms to consider
160181# @param specific_config [CIConfig] configuration to use
161182def install_all_packages ( platforms , specific_config )
0 commit comments