Commit 585abeb9 authored by Samuel E. Giddins's avatar Samuel E. Giddins

Merge pull request #4281 from sguillope/bugfix/no-integrate-skip-platform-check-for-podless-target

[Analyzer] Don't require platform for podless targets when not integrating
parents f2c9956c 36f261ea
...@@ -66,6 +66,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -66,6 +66,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[Samuel Giddins](https://github.com/segiddins) [Samuel Giddins](https://github.com/segiddins)
[#4119](https://github.com/CocoaPods/CocoaPods/issues/4119) [#4119](https://github.com/CocoaPods/CocoaPods/issues/4119)
* Don't require the `platform` attribute for targets without any declared pods
when running `pod install --no-integrate`.
[Sylvain Guillopé](https://github.com/sguillope)
[#3151](https://github.com/CocoaPods/CocoaPods/issues/3151)
## 0.39.0.beta.4 (2015-09-02) ## 0.39.0.beta.4 (2015-09-02)
......
...@@ -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.empty? && 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,57 @@ module Pod ...@@ -212,6 +212,57 @@ 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 an empty 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 'does not raise if a target with dependencies inherits the platform from its parent' do
podfile = Pod::Podfile.new do
source SpecHelper.test_repo_url
xcodeproj 'SampleProject/SampleProject'
platform :osx
target 'TestRunner' do
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 dependencies does not have 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