diff --git a/Library/Homebrew/dependency_collector.rb b/Library/Homebrew/dependency_collector.rb index 96a0091081aed6..0b8c7c3841847d 100644 --- a/Library/Homebrew/dependency_collector.rb +++ b/Library/Homebrew/dependency_collector.rb @@ -45,6 +45,8 @@ def freeze def add(spec) case dep = fetch(spec) + when Array + dep.compact.each { |dep| @deps << dep } when Dependency @deps << dep when Requirement @@ -63,11 +65,14 @@ def fetch(spec) end def cache_key(spec) - if spec.is_a?(Resource) && spec.download_strategy <= CurlDownloadStrategy - File.extname(spec.url) - else - spec + if spec.is_a?(Resource) + if spec.download_strategy <= CurlDownloadStrategy + return "#{spec.download_strategy}#{File.extname(spec.url).split("?").first}" + else + return spec.download_strategy + end end + spec end def build(spec) @@ -128,7 +133,7 @@ def init_global_dep_tree_if_needed!; end sig { params(spec: T.any(String, Resource, Symbol, Requirement, Dependency, Class), - tags: T::Array[Symbol]).returns(T.any(Dependency, Requirement, NilClass)) + tags: T::Array[Symbol]).returns(T.any(Dependency, Requirement, Array, NilClass)) } def parse_spec(spec, tags) raise ArgumentError, "Implicit dependencies cannot be manually specified" if tags.include?(:implicit) @@ -177,8 +182,7 @@ def resource_dep(spec, tags) strategy = spec.download_strategy if strategy <= HomebrewCurlDownloadStrategy - @deps << curl_dep_if_needed(tags) - parse_url_spec(spec.url, tags) + [curl_dep_if_needed(tags), parse_url_spec(spec.url, tags)] elsif strategy <= NoUnzipCurlDownloadStrategy # ensure NoUnzip never adds any dependencies elsif strategy <= CurlDownloadStrategy