@@ -128,8 +128,17 @@ def display_files(pathname)
128
128
@log . indent { non_hidden . each ( &@log . method ( :iputs ) ) }
129
129
end
130
130
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
131
140
# @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 )
133
142
installed = already_installed . clone
134
143
( library_names . map { |n | @backend . library_of_name ( n ) } - installed ) . each do |l |
135
144
if l . installed?
@@ -142,11 +151,23 @@ def install_arduino_library_dependencies(library_names, on_behalf_of, already_in
142
151
end
143
152
end
144
153
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 )
146
155
end
147
156
installed
148
157
end
149
158
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
+
150
171
# @param platforms [Array<String>] list of platforms to consider
151
172
# @param specific_config [CIConfig] configuration to use
152
173
def install_all_packages ( platforms , specific_config )
0 commit comments