Class: DependencyCollector Private
- Extended by:
- Cachable
- Defined in:
- extend/os/mac/dependency_collector.rb,
extend/os/linux/dependency_collector.rb,
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.
Instance Attribute Summary collapse
- #deps ⇒ Object readonly private
- #requirements ⇒ Object readonly private
Class Method Summary collapse
Instance Method Summary collapse
- #add(spec) ⇒ Object private
- #build(spec) ⇒ Object private
- #bzip2_dep_if_needed(tags) ⇒ Object private
- #cache_key(spec) ⇒ Object private
- #curl_dep_if_needed(tags) ⇒ Object private
- #cvs_dep_if_needed(tags) ⇒ Object private
- #fetch(spec) ⇒ Object private
- #freeze ⇒ Object private
- #gcc_dep_if_needed(related_formula_names) ⇒ Dependency? private
- #git_dep_if_needed(tags) ⇒ Object private
- #glibc_dep_if_needed(related_formula_names) ⇒ Dependency? private
- #initialize ⇒ void constructor private
- #initialize_dup(other) ⇒ Object private
- #subversion_dep_if_needed(tags) ⇒ Object private
- #unzip_dep_if_needed(tags) ⇒ Object private
- #xz_dep_if_needed(tags) ⇒ Object private
- #zstd_dep_if_needed(tags) ⇒ Object private
Methods included from Cachable
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.
26 27 28 29 30 31 32 |
# File 'dependency_collector.rb', line 26 def initialize # Ensure this is synced with `initialize_dup` and `freeze` (excluding simple objects like integers and booleans) @deps = Dependencies.new @requirements = Requirements.new init_global_dep_tree_if_needed! end |
Instance Attribute Details
#deps ⇒ Object (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.
23 24 25 |
# File 'dependency_collector.rb', line 23 def deps @deps end |
#requirements ⇒ Object (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.
23 24 25 |
# File 'dependency_collector.rb', line 23 def requirements @requirements end |
Class Method Details
.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.
125 126 127 |
# File 'dependency_collector.rb', line 125 def self.tar_needs_xz_dependency? !new.xz_dep_if_needed([]).nil? end |
Instance Method Details
#add(spec) ⇒ Object
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.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'dependency_collector.rb', line 46 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 |
#build(spec) ⇒ Object
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.
78 79 80 81 |
# File 'dependency_collector.rb', line 78 def build(spec) spec, = spec.is_a?(Hash) ? spec.first : spec parse_spec(spec, Array()) end |
#bzip2_dep_if_needed(tags) ⇒ Object
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.
22 |
# File 'extend/os/mac/dependency_collector.rb', line 22 def bzip2_dep_if_needed(); end |
#cache_key(spec) ⇒ Object
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.
67 68 69 70 71 72 73 74 75 76 |
# File 'dependency_collector.rb', line 67 def cache_key(spec) if spec.is_a?(Resource) if spec.download_strategy <= CurlDownloadStrategy return "#{spec.download_strategy}#{File.extname(spec.url).split("?").first}" end return spec.download_strategy end spec end |
#curl_dep_if_needed(tags) ⇒ Object
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.
95 96 97 |
# File 'dependency_collector.rb', line 95 def curl_dep_if_needed() Dependency.new("curl", [*, :implicit]) end |
#cvs_dep_if_needed(tags) ⇒ Object
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.
14 15 16 |
# File 'extend/os/mac/dependency_collector.rb', line 14 def cvs_dep_if_needed() Dependency.new("cvs", [*, :implicit]) end |
#fetch(spec) ⇒ Object
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.
63 64 65 |
# File 'dependency_collector.rb', line 63 def fetch(spec) self.class.cache.fetch(cache_key(spec)) { |key| self.class.cache[key] = build(spec) } end |
#freeze ⇒ Object
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.
40 41 42 43 44 |
# File 'dependency_collector.rb', line 40 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.
12 13 14 15 16 17 18 19 20 21 |
# File 'extend/os/linux/dependency_collector.rb', line 12 def gcc_dep_if_needed() # gcc is required for libgcc_s.so.1 if glibc or gcc are too old return unless DevelopmentTools.needs_build_formulae? return if building_global_dep_tree? return if .include?(GCC) return if global_dep_tree[GCC]&.intersect?() return unless formula_for(GCC) Dependency.new(GCC, [:implicit]) end |
#git_dep_if_needed(tags) ⇒ Object
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.
8 |
# File 'extend/os/mac/dependency_collector.rb', line 8 def git_dep_if_needed(); 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.
24 25 26 27 28 29 30 31 32 |
# File 'extend/os/linux/dependency_collector.rb', line 24 def glibc_dep_if_needed() return unless DevelopmentTools.needs_libc_formula? return if building_global_dep_tree? return if .include?(GLIBC) return if global_dep_tree[GLIBC]&.intersect?() return unless formula_for(GLIBC) Dependency.new(GLIBC, [:implicit]) end |
#initialize_dup(other) ⇒ Object
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.
34 35 36 37 38 |
# File 'dependency_collector.rb', line 34 def initialize_dup(other) super @deps = @deps.dup @requirements = @requirements.dup end |
#subversion_dep_if_needed(tags) ⇒ Object
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.
10 11 12 |
# File 'extend/os/mac/dependency_collector.rb', line 10 def subversion_dep_if_needed() Dependency.new("subversion", [*, :implicit]) end |
#unzip_dep_if_needed(tags) ⇒ Object
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.
20 |
# File 'extend/os/mac/dependency_collector.rb', line 20 def unzip_dep_if_needed(); end |
#xz_dep_if_needed(tags) ⇒ Object
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.
18 |
# File 'extend/os/mac/dependency_collector.rb', line 18 def xz_dep_if_needed(); end |
#zstd_dep_if_needed(tags) ⇒ Object
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.
113 114 115 |
# File 'dependency_collector.rb', line 113 def zstd_dep_if_needed() Dependency.new("zstd", [*, :implicit]) unless which("zstd") end |