Because of some quirks in how formulae are loaded, DSL methods invoked
in the class definition are called multiple times. This results in, for
example, duplicate dependencies and requirements.
Code that iterates over requirements and takes some action for each can
thus repeat things that shouldn't be repeated, like appending to
environment variables.
Make DependencyCollector's external_deps a Set, and define eql? and hash
on Requirement to prevent these duplicates.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Rather than doing type introspection in build.rb, just define a method
to perform the necessary environment setup for Requirements.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Some times the module to import is different than the module to install
when dealing with external dependencies. This change allows an optional
import name to be specififed when it is different from the module name.
ClosesHomebrew/homebrew#11078.