Replace the build object rather than mutate it
This commit is contained in:
parent
0b468c528c
commit
b7b8b88cea
@ -1,7 +1,6 @@
|
|||||||
require 'options'
|
require 'options'
|
||||||
|
|
||||||
class BuildOptions
|
class BuildOptions
|
||||||
attr_accessor :args
|
|
||||||
attr_accessor :universal
|
attr_accessor :universal
|
||||||
|
|
||||||
def initialize(args, options)
|
def initialize(args, options)
|
||||||
@ -15,7 +14,7 @@ class BuildOptions
|
|||||||
end
|
end
|
||||||
|
|
||||||
def include? name
|
def include? name
|
||||||
args.include? '--' + name
|
@args.include?("--#{name}")
|
||||||
end
|
end
|
||||||
|
|
||||||
def with? val
|
def with? val
|
||||||
|
|||||||
@ -29,10 +29,9 @@ class Dependency
|
|||||||
end
|
end
|
||||||
|
|
||||||
def to_formula
|
def to_formula
|
||||||
f = Formulary.factory(name)
|
formula = Formulary.factory(name)
|
||||||
# Add this dependency's options to the formula's build args
|
formula.build = BuildOptions.new(options, formula.options)
|
||||||
f.build.args = f.build.args.concat(options)
|
formula
|
||||||
f
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def installed?
|
def installed?
|
||||||
|
|||||||
@ -303,15 +303,9 @@ class FormulaInstaller
|
|||||||
end
|
end
|
||||||
|
|
||||||
def effective_build_options_for(dependent, inherited_options=[])
|
def effective_build_options_for(dependent, inherited_options=[])
|
||||||
if dependent == f
|
args = dependent.build.used_options
|
||||||
build = dependent.build.dup
|
args |= dependent == f ? options : inherited_options
|
||||||
build.args |= options
|
BuildOptions.new(args, dependent.options)
|
||||||
build
|
|
||||||
else
|
|
||||||
build = dependent.build.dup
|
|
||||||
build.args |= inherited_options
|
|
||||||
build
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def inherited_options_for(dep)
|
def inherited_options_for(dep)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user