Class: DependencyCollector Private
- Extended by:
- Cachable, T::Generic
- Defined in:
- dependency_collector.rb
Overview
This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.
This class is used by depends_on in the formula DSL to turn dependency
specifications into the proper kinds of dependencies and requirements.
Constant Summary collapse
- Cache =
This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.
type_template { { fixed: T::Hash[T.untyped, T.untyped] } }
Instance Attribute Summary collapse
- #deps ⇒ Dependencies readonly private
- #requirements ⇒ Requirements readonly private
Class Method Summary collapse
Instance Method Summary collapse
- #add(spec) ⇒ T.untyped private
- #bubblewrap_dep_if_needed(related_formula_names) ⇒ Dependency? private
- #build(spec) ⇒ T.untyped private
- #bzip2_dep_if_needed(tags) ⇒ Dependency? private
- #cache_key(spec) ⇒ T.untyped private
- #curl_dep_if_needed(tags) ⇒ Dependency private
- #cvs_dep_if_needed(tags) ⇒ Dependency? private
- #fetch(spec) ⇒ T.untyped private
- #freeze ⇒ void private
- #gcc_dep_if_needed(related_formula_names) ⇒ Dependency? private
- #git_dep_if_needed(tags) ⇒ Dependency? private
- #glibc_dep_if_needed(related_formula_names) ⇒ Dependency? private
-
#implicit_dependency_names ⇒ Set<String>
private
Names implicitly added to any formula's deps right now, reusing the same checks
Formula#add_global_deps_to_specuses to inject them onto a real formula. - #initialize ⇒ void constructor private
- #initialize_dup(other) ⇒ void private
- #subversion_dep_if_needed(tags) ⇒ Dependency? private
- #unzip_dep_if_needed(tags) ⇒ Dependency? private
- #xz_dep_if_needed(tags) ⇒ Dependency? private
- #zstd_dep_if_needed(tags) ⇒ Dependency? private
Methods included from Cachable
Methods included from OS::Linux::DependencyCollector
Constructor Details
#initialize ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
33 34 35 36 37 38 39 |
# File 'dependency_collector.rb', line 33 def initialize # Ensure this is synced with `initialize_dup` and `freeze` (excluding simple objects like integers and booleans) @deps = T.let(Dependencies.new, Dependencies) @requirements = T.let(Requirements.new, Requirements) init_global_dep_tree_if_needed! end |
Instance Attribute Details
#deps ⇒ Dependencies (readonly)
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
27 28 29 |
# File 'dependency_collector.rb', line 27 def deps @deps end |
#requirements ⇒ Requirements (readonly)
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
30 31 32 |
# File 'dependency_collector.rb', line 30 def requirements @requirements end |
Class Method Details
.tar_needs_bzip2_dependency? ⇒ Boolean
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
168 169 170 |
# File 'dependency_collector.rb', line 168 def self.tar_needs_bzip2_dependency? !new.bzip2_dep_if_needed([]).nil? end |
.tar_needs_xz_dependency? ⇒ Boolean
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
163 164 165 |
# File 'dependency_collector.rb', line 163 def self.tar_needs_xz_dependency? !new.xz_dep_if_needed([]).nil? end |
Instance Method Details
#add(spec) ⇒ T.untyped
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'dependency_collector.rb', line 56 def add(spec) case dep = fetch(spec) when Array dep.compact.each { |dep| @deps << dep } when Dependency @deps << dep when Requirement @requirements << dep when nil # no-op when we have a nil value nil else raise ArgumentError, "DependencyCollector#add passed something that isn't a Dependency or Requirement!" end dep end |
#bubblewrap_dep_if_needed(related_formula_names) ⇒ Dependency?
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
103 |
# File 'dependency_collector.rb', line 103 def bubblewrap_dep_if_needed(); end |
#build(spec) ⇒ T.untyped
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
91 92 93 94 |
# File 'dependency_collector.rb', line 91 def build(spec) spec, = spec.is_a?(Hash) ? spec.first : spec parse_spec(spec, Array()) end |
#bzip2_dep_if_needed(tags) ⇒ Dependency?
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
158 159 160 |
# File 'dependency_collector.rb', line 158 def bzip2_dep_if_needed() Dependency.new("bzip2", [*, :implicit]) unless which("bzip2") end |
#cache_key(spec) ⇒ T.untyped
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
79 80 81 82 83 84 85 86 87 88 |
# File 'dependency_collector.rb', line 79 def cache_key(spec) if spec.is_a?(Resource) if spec.download_strategy <= CurlDownloadStrategy return "#{spec.download_strategy}#{File.extname(T.must(spec.url)).split("?").first}" end return spec.download_strategy end spec end |
#curl_dep_if_needed(tags) ⇒ Dependency
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
125 126 127 |
# File 'dependency_collector.rb', line 125 def curl_dep_if_needed() Dependency.new("curl", [*, :implicit]) end |
#cvs_dep_if_needed(tags) ⇒ Dependency?
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
138 139 140 |
# File 'dependency_collector.rb', line 138 def cvs_dep_if_needed() Dependency.new("cvs", [*, :implicit]) unless which("cvs") end |
#fetch(spec) ⇒ T.untyped
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
74 75 76 |
# File 'dependency_collector.rb', line 74 def fetch(spec) self.class.cache.fetch(cache_key(spec)) { |key| self.class.cache[key] = build(spec) } end |
#freeze ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
This method returns an undefined value.
49 50 51 52 53 |
# File 'dependency_collector.rb', line 49 def freeze @deps.freeze @requirements.freeze super end |
#gcc_dep_if_needed(related_formula_names) ⇒ Dependency?
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
97 |
# File 'dependency_collector.rb', line 97 def gcc_dep_if_needed(); end |
#git_dep_if_needed(tags) ⇒ Dependency?
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
117 118 119 120 121 122 |
# File 'dependency_collector.rb', line 117 def git_dep_if_needed() require "utils/git" return if Utils::Git.available? Dependency.new("git", [*, :implicit]) end |
#glibc_dep_if_needed(related_formula_names) ⇒ Dependency?
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
100 |
# File 'dependency_collector.rb', line 100 def glibc_dep_if_needed(); end |
#implicit_dependency_names ⇒ Set<String>
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Names implicitly added to any formula's deps right now, reusing the same checks
Formula#add_global_deps_to_spec uses to inject them onto a real formula.
108 109 110 111 112 113 114 |
# File 'dependency_collector.rb', line 108 def implicit_dependency_names [ bubblewrap_dep_if_needed(Set.new), gcc_dep_if_needed(Set.new), glibc_dep_if_needed(Set.new), ].compact.to_set(&:name) end |
#initialize_dup(other) ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
This method returns an undefined value.
42 43 44 45 46 |
# File 'dependency_collector.rb', line 42 def initialize_dup(other) super @deps = @deps.dup @requirements = @requirements.dup end |
#subversion_dep_if_needed(tags) ⇒ Dependency?
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
130 131 132 133 134 135 |
# File 'dependency_collector.rb', line 130 def subversion_dep_if_needed() require "utils/svn" return if Utils::Svn.available? Dependency.new("subversion", [*, :implicit]) end |
#unzip_dep_if_needed(tags) ⇒ Dependency?
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
153 154 155 |
# File 'dependency_collector.rb', line 153 def unzip_dep_if_needed() Dependency.new("unzip", [*, :implicit]) unless which("unzip") end |
#xz_dep_if_needed(tags) ⇒ Dependency?
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
143 144 145 |
# File 'dependency_collector.rb', line 143 def xz_dep_if_needed() Dependency.new("xz", [*, :implicit]) unless which("xz") end |
#zstd_dep_if_needed(tags) ⇒ Dependency?
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
148 149 150 |
# File 'dependency_collector.rb', line 148 def zstd_dep_if_needed() Dependency.new("zstd", [*, :implicit]) unless which("zstd") end |