formula API: expose uses_from_macos list
This commit is contained in:
parent
1544988201
commit
9bd77b1819
@ -4,12 +4,18 @@ class SoftwareSpec
|
||||
undef uses_from_macos
|
||||
|
||||
def uses_from_macos(deps, **args)
|
||||
@uses_from_macos_elements ||= []
|
||||
|
||||
if deps.is_a?(Hash)
|
||||
args = deps
|
||||
deps = Hash[*args.shift]
|
||||
end
|
||||
|
||||
depends_on(deps) if add_mac_dependency?(args)
|
||||
if add_mac_dependency?(args)
|
||||
depends_on(deps)
|
||||
else
|
||||
@uses_from_macos_elements << deps
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@ -428,6 +428,9 @@ class Formula
|
||||
# The {Dependency}s for the currently active {SoftwareSpec}.
|
||||
delegate deps: :active_spec
|
||||
|
||||
# Dependencies provided by macOS for the currently active {SoftwareSpec}.
|
||||
delegate uses_from_macos_elements: :active_spec
|
||||
|
||||
# The {Requirement}s for the currently active {SoftwareSpec}.
|
||||
delegate requirements: :active_spec
|
||||
|
||||
@ -1589,6 +1592,7 @@ class Formula
|
||||
# @private
|
||||
def to_hash
|
||||
dependencies = deps
|
||||
uses_from_macos = uses_from_macos_elements || []
|
||||
|
||||
hsh = {
|
||||
"name" => name,
|
||||
@ -1624,6 +1628,7 @@ class Formula
|
||||
"optional_dependencies" => dependencies.select(&:optional?)
|
||||
.map(&:name)
|
||||
.uniq,
|
||||
"uses_from_macos" => uses_from_macos.uniq,
|
||||
"requirements" => [],
|
||||
"conflicts_with" => conflicts.map(&:name),
|
||||
"caveats" => caveats&.gsub(HOMEBREW_PREFIX, "$(brew --prefix)"),
|
||||
|
||||
@ -26,6 +26,7 @@ class SoftwareSpec
|
||||
attr_reader :dependency_collector
|
||||
attr_reader :bottle_specification
|
||||
attr_reader :compiler_failures
|
||||
attr_reader :uses_from_macos_elements
|
||||
|
||||
def_delegators :@resource, :stage, :fetch, :verify_download_integrity, :source_modified_time
|
||||
def_delegators :@resource, :download_name, :cached_download, :clear_cache
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user