@@ -137,8 +137,17 @@ def display_files(pathname)
137
137
@log . indent { non_hidden . each ( &@log . method ( :iputs ) ) }
138
138
end
139
139
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
140
149
# @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 )
142
151
installed = already_installed . clone
143
152
( library_names . map { |n | @backend . library_of_name ( n ) } - installed ) . each do |l |
144
153
if l . installed?
@@ -151,11 +160,23 @@ def install_arduino_library_dependencies(library_names, on_behalf_of, already_in
151
160
end
152
161
end
153
162
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 )
155
164
end
156
165
installed
157
166
end
158
167
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
+
159
180
# @param platforms [Array<String>] list of platforms to consider
160
181
# @param specific_config [CIConfig] configuration to use
161
182
def install_all_packages ( platforms , specific_config )
0 commit comments