Shrink DependencyCollector#parse_symbol_spec and add tests
This commit is contained in:
parent
b38d555030
commit
803649bf04
@ -76,13 +76,9 @@ private
|
|||||||
case spec
|
case spec
|
||||||
when :autoconf, :automake, :bsdmake, :libtool
|
when :autoconf, :automake, :bsdmake, :libtool
|
||||||
# Xcode no longer provides autotools or some other build tools
|
# Xcode no longer provides autotools or some other build tools
|
||||||
Dependency.new(spec.to_s, [:build, *tag]) unless MacOS::Xcode.provides_autotools?
|
autotools_dep(spec, tag)
|
||||||
when *X11Dependency::Proxy::PACKAGES
|
when *X11Dependency::Proxy::PACKAGES
|
||||||
if MacOS.version >= :mountain_lion
|
x11_dep(spec, tag)
|
||||||
Dependency.new(spec.to_s, tag)
|
|
||||||
else
|
|
||||||
X11Dependency::Proxy.for(spec.to_s, tag)
|
|
||||||
end
|
|
||||||
when :cairo, :pixman
|
when :cairo, :pixman
|
||||||
# We no longer use X11 psuedo-deps for cairo or pixman,
|
# We no longer use X11 psuedo-deps for cairo or pixman,
|
||||||
# so just return a standard formula dependency.
|
# so just return a standard formula dependency.
|
||||||
@ -97,4 +93,18 @@ private
|
|||||||
raise "Unsupported special dependency #{spec}"
|
raise "Unsupported special dependency #{spec}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def x11_dep(spec, tag)
|
||||||
|
if MacOS.version >= :mountain_lion
|
||||||
|
Dependency.new(spec.to_s, tag)
|
||||||
|
else
|
||||||
|
X11Dependency::Proxy.for(spec.to_s, tag)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def autotools_dep(spec, tag)
|
||||||
|
unless MacOS::Xcode.provides_autotools?
|
||||||
|
Dependency.new(spec.to_s, [:build, *tag])
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -81,6 +81,28 @@ class DependencyCollectorTests < Test::Unit::TestCase
|
|||||||
assert_equal '2.5.1', dep.min_version
|
assert_equal '2.5.1', dep.min_version
|
||||||
assert dep.optional?
|
assert dep.optional?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_autotools_dep_no_system_autotools
|
||||||
|
MacOS::Xcode.stubs(:provides_autotools?).returns(false)
|
||||||
|
dep = @d.build(:libtool)
|
||||||
|
assert_equal Dependency.new("libtool"), dep
|
||||||
|
assert dep.build?
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_autotools_dep_system_autotools
|
||||||
|
MacOS::Xcode.stubs(:provides_autotools?).returns(true)
|
||||||
|
assert_nil @d.build(:libtool)
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_x11_proxy_dep_mountain_lion
|
||||||
|
MacOS.stubs(:version).returns(MacOS::Version.new(10.8))
|
||||||
|
assert_equal Dependency.new("libpng"), @d.build(:libpng)
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_x11_proxy_dep_lion_or_older
|
||||||
|
MacOS.stubs(:version).returns(MacOS::Version.new(10.7))
|
||||||
|
assert_equal X11Dependency::Proxy.new(:libpng), @d.build(:libpng)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class LanguageModuleDependencyTests < Test::Unit::TestCase
|
class LanguageModuleDependencyTests < Test::Unit::TestCase
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user