Commit 86be3d31 authored by Fabio Pelosin's avatar Fabio Pelosin

[#212] Check for deployment target

parent 03138241
......@@ -491,16 +491,17 @@ Pod::Spec.new do |s|
s.description = 'An optional longer description of #{data[:name]}.'
# If this Pod runs only on iOS or OS X, then specify that with one of
# these, or none if it runs on both platforms.
# If the pod runs on both plafroms but presents different deployment
# targets, source files, etc. create two different pods: `#{data[:name]}-iOS'
# and `#{data[:name]}-OSX'.
# If this Pod runs only on iOS or OS X, then specify the platfrom and
# the deployment target.
#
# s.platform = :ios, '>= 5.0'
# s.platform = :ios
# s.platform = :ios, { :deployment_target => "5.0" }
# s.platform = :osx
# s.platform = :osx, { :deployment_target => "10.7" }
# If this Pod runs on boths platforms, then specify the deployment
# targets.
#
# s.ios.deployment_target = '>= 5.0'
# s.osx.deployment_target = '>= 10.7'
# A list of resources included with the Pod. These are copied into the
# target bundle with a build phase script.
......
......@@ -86,9 +86,12 @@ module Pod
end
def validate_platform!(spec)
plaform = @podfile.target_definitions[:default].platform
unless plaform.support?(spec.platform)
raise Informative, "The platform required by the Podfile `#{plaform}' does not match that of #{spec} `#{spec.platform}'"
platform = @podfile.target_definitions[:default].platform
unless platform.support?(spec.platform)
raise Informative, "The platform required by the Podfile `#{platform}' does not match that of #{spec} `#{spec.platform}'"
end
unless !platform.deployment_target || !spec.deployment_target[platform.name] || spec.deployment_target[platform.name].satisfied_by?(platform.deployment_target)
raise Informative, "The platform required by the Podfile `#{platform}' does not match that of #{spec} `#{spec.platform} #{spec.deployment_target[platform.name]}'".magenta
end
end
end
......
......@@ -34,6 +34,7 @@ module Pod
@define_for_platforms = [:osx, :ios]
@clean_paths, @subspecs = [], []
@dependencies, @source_files, @resources = { :ios => [], :osx => [] }, { :ios => [], :osx => [] }, { :ios => [], :osx => [] }
@deployment_target = {}
@platform = Platform.new(nil)
@xcconfig = { :ios => Xcodeproj::Config.new, :osx => Xcodeproj::Config.new }
@compiler_flags = { :ios => '', :osx => '' }
......@@ -116,12 +117,11 @@ module Pod
def platform=(platform)
if platform.class == Array
name = platform[0]
options = platform[1]
@deployment_target[name] = Gem::Requirement.new(platform[1])
else
name = platform
options = nil
end
@platform = Platform.new(name, options)
@platform = Platform.new(name)
end
attr_reader :platform
......@@ -157,7 +157,7 @@ module Pod
@specification, @platform = specification, platform
end
%w{ source_files= resource= resources= xcconfig= framework= frameworks= library= libraries= compiler_flags= dependency }.each do |method|
%w{ source_files= resource= resources= xcconfig= framework= frameworks= library= libraries= compiler_flags= deployment_target= dependency }.each do |method|
define_method(method) do |args|
@specification._on_platform(@platform) do
@specification.send(method, args)
......@@ -181,6 +181,13 @@ module Pod
end
attr_reader :source_files
def deployment_target=(requirement)
@define_for_platforms.each do |platform|
@deployment_target[platform] = Gem::Requirement.new(requirement)
end
end
attr_reader :deployment_target
def resources=(patterns)
@define_for_platforms.each do |platform|
@resources[platform] = pattern_list(patterns)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment