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| ...@@ -491,16 +491,17 @@ Pod::Spec.new do |s|
s.description = 'An optional longer description of #{data[:name]}.' 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 # If this Pod runs only on iOS or OS X, then specify the platfrom and
# these, or none if it runs on both platforms. # the deployment target.
# 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'.
# #
# s.platform = :ios, '>= 5.0'
# s.platform = :ios # s.platform = :ios
# s.platform = :ios, { :deployment_target => "5.0" }
# s.platform = :osx # If this Pod runs on boths platforms, then specify the deployment
# s.platform = :osx, { :deployment_target => "10.7" } # 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 # A list of resources included with the Pod. These are copied into the
# target bundle with a build phase script. # target bundle with a build phase script.
......
...@@ -86,9 +86,12 @@ module Pod ...@@ -86,9 +86,12 @@ module Pod
end end
def validate_platform!(spec) def validate_platform!(spec)
plaform = @podfile.target_definitions[:default].platform platform = @podfile.target_definitions[:default].platform
unless plaform.support?(spec.platform) unless platform.support?(spec.platform)
raise Informative, "The platform required by the Podfile `#{plaform}' does not match that of #{spec} `#{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 end
end end
......
...@@ -34,6 +34,7 @@ module Pod ...@@ -34,6 +34,7 @@ module Pod
@define_for_platforms = [:osx, :ios] @define_for_platforms = [:osx, :ios]
@clean_paths, @subspecs = [], [] @clean_paths, @subspecs = [], []
@dependencies, @source_files, @resources = { :ios => [], :osx => [] }, { :ios => [], :osx => [] }, { :ios => [], :osx => [] } @dependencies, @source_files, @resources = { :ios => [], :osx => [] }, { :ios => [], :osx => [] }, { :ios => [], :osx => [] }
@deployment_target = {}
@platform = Platform.new(nil) @platform = Platform.new(nil)
@xcconfig = { :ios => Xcodeproj::Config.new, :osx => Xcodeproj::Config.new } @xcconfig = { :ios => Xcodeproj::Config.new, :osx => Xcodeproj::Config.new }
@compiler_flags = { :ios => '', :osx => '' } @compiler_flags = { :ios => '', :osx => '' }
...@@ -116,12 +117,11 @@ module Pod ...@@ -116,12 +117,11 @@ module Pod
def platform=(platform) def platform=(platform)
if platform.class == Array if platform.class == Array
name = platform[0] name = platform[0]
options = platform[1] @deployment_target[name] = Gem::Requirement.new(platform[1])
else else
name = platform name = platform
options = nil
end end
@platform = Platform.new(name, options) @platform = Platform.new(name)
end end
attr_reader :platform attr_reader :platform
...@@ -157,7 +157,7 @@ module Pod ...@@ -157,7 +157,7 @@ module Pod
@specification, @platform = specification, platform @specification, @platform = specification, platform
end 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| define_method(method) do |args|
@specification._on_platform(@platform) do @specification._on_platform(@platform) do
@specification.send(method, args) @specification.send(method, args)
...@@ -181,6 +181,13 @@ module Pod ...@@ -181,6 +181,13 @@ module Pod
end end
attr_reader :source_files 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) def resources=(patterns)
@define_for_platforms.each do |platform| @define_for_platforms.each do |platform|
@resources[platform] = pattern_list(patterns) @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