Commit db0d9b75 authored by Sylvain Guillopé's avatar Sylvain Guillopé

[Analyzer] Don't validate platform for podless targets

When using the '--no-integrate' option, it's not required to check that
the `platform` is specified if the target doesn't have any declared
dependencies.

Fixes #3151
parent 691e3de4
...@@ -255,7 +255,7 @@ module Pod ...@@ -255,7 +255,7 @@ module Pod
target.client_root = config.installation_root target.client_root = config.installation_root
target.user_target_uuids = [] target.user_target_uuids = []
target.user_build_configurations = target_definition.build_configurations || { 'Release' => :release, 'Debug' => :debug } target.user_build_configurations = target_definition.build_configurations || { 'Release' => :release, 'Debug' => :debug }
if target_definition.platform.name == :osx if target_definition.platform && target_definition.platform.name == :osx
target.archs = '$(ARCHS_STANDARD_64_BIT)' target.archs = '$(ARCHS_STANDARD_64_BIT)'
end end
end end
...@@ -636,7 +636,7 @@ module Pod ...@@ -636,7 +636,7 @@ module Pod
def verify_platforms_specified! def verify_platforms_specified!
unless config.integrate_targets? unless config.integrate_targets?
podfile.target_definition_list.each do |target_definition| podfile.target_definition_list.each do |target_definition|
unless target_definition.platform if target_definition.dependencies.size > 0 && target_definition.platform.nil?
raise Informative, 'It is necessary to specify the platform in the Podfile if not integrating.' raise Informative, 'It is necessary to specify the platform in the Podfile if not integrating.'
end end
end end
......
...@@ -212,6 +212,43 @@ module Pod ...@@ -212,6 +212,43 @@ module Pod
target.platform.to_s.should == 'iOS 6.0' target.platform.to_s.should == 'iOS 6.0'
end end
describe 'no-integrate platform validation' do
before do
repos = [fixture('spec-repos/test_repo')]
aggregate = Pod::Source::Aggregate.new(repos)
Pod::SourcesManager.stubs(:aggregate).returns(aggregate)
aggregate.sources.first.stubs(:url).returns(SpecHelper.test_repo_url)
config.integrate_targets = false
end
it 'does not require a platform for a podless target' do
podfile = Pod::Podfile.new do
source SpecHelper.test_repo_url
xcodeproj 'SampleProject/SampleProject'
target 'TestRunner' do
platform :osx
pod 'monkey'
end
end
analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile)
lambda { analyzer.analyze }.should.not.raise
end
it 'raises if a target with pods does not specify a platform' do
podfile = Pod::Podfile.new do
source SpecHelper.test_repo_url
xcodeproj 'SampleProject/SampleProject'
target 'TestRunner' do
pod 'monkey'
end
end
analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile)
lambda { analyzer.analyze }.should.raise Informative
end
end
it 'returns all the configurations the user has in any of its projects and/or targets' do it 'returns all the configurations the user has in any of its projects and/or targets' do
target_definition = @analyzer.podfile.target_definition_list.first target_definition = @analyzer.podfile.target_definition_list.first
target_definition.stubs(:build_configurations).returns('AdHoc' => :test) target_definition.stubs(:build_configurations).returns('AdHoc' => :test)
......
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