Skip to content

Commit

Permalink
Merge pull request #1592 from alyssais/runtime_dependencies
Browse files Browse the repository at this point in the history
formula: runtime deps of build deps aren't runtime
  • Loading branch information
MikeMcQuaid committed Dec 12, 2016
2 parents c317c3c + 2b68da8 commit 666463c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Library/Homebrew/formula.rb
Expand Up @@ -1505,7 +1505,7 @@ def recursive_requirements(&block)
# Returns a list of Dependency objects that are required at runtime.
# @private
def runtime_dependencies
recursive_dependencies.reject(&:build?)
recursive_dependencies { |_, dep| Dependency.prune if dep.build? }
end

# Returns a list of formulae depended on by this formula that aren't
Expand Down
15 changes: 11 additions & 4 deletions Library/Homebrew/test/formula_test.rb
Expand Up @@ -651,12 +651,19 @@ def test_dependencies

f4 = formula("f4") do
url "f4-1.0"
depends_on "f3"
depends_on "f1"
end
stub_formula_loader f4

assert_equal %w[f3], f4.deps.map(&:name)
assert_equal %w[f1 f2 f3], f4.recursive_dependencies.map(&:name)
assert_equal %w[f2 f3], f4.runtime_dependencies.map(&:name)
f5 = formula("f5") do
url "f5-1.0"
depends_on "f3" => :build
depends_on "f4"
end

assert_equal %w[f3 f4], f5.deps.map(&:name)
assert_equal %w[f1 f2 f3 f4], f5.recursive_dependencies.map(&:name)
assert_equal %w[f1 f4], f5.runtime_dependencies.map(&:name)
end

def test_to_hash
Expand Down

0 comments on commit 666463c

Please sign in to comment.