Commit 310553aa authored by David Airapetyan's avatar David Airapetyan

Issue 4887: Providing a better error message when project references are missing for other files

parent 93816cae
...@@ -26,6 +26,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -26,6 +26,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[Dimitris Koutsogiorgas](https://github.com/dnkoutso) [Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#6829](https://github.com/CocoaPods/CocoaPods/pull/6829) [#6829](https://github.com/CocoaPods/CocoaPods/pull/6829)
* Provide a better error message when references are missing for non-source files
[David Airapetyan](https://github.com/davidair)
[#4887](https://github.com/CocoaPods/CocoaPods/issues/4887)
## 1.3.0.beta.2 (2017-06-22) ## 1.3.0.beta.2 (2017-06-22)
##### Enhancements ##### Enhancements
......
...@@ -155,7 +155,7 @@ module Pod ...@@ -155,7 +155,7 @@ module Pod
add_header(build_file, public_headers, private_headers, native_target) add_header(build_file, public_headers, private_headers, native_target)
end end
other_file_refs = other_source_files.map { |sf| project.reference_for_path(sf) } other_file_refs = project_file_references_array(other_source_files, 'other source')
native_target.add_file_references(other_file_refs, nil) native_target.add_file_references(other_file_refs, nil)
next unless target.requires_frameworks? next unless target.requires_frameworks?
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "logo.png"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
#import <Foundation/Foundation.h>
/** Minions are awesome */
@interface MinionsObj : NSObject
@end
Pod::Spec.new do |s|
s.name = 'MinionsLib'
s.version = '1.0'
s.authors = 'Minions Corp', { 'Stuart' => 'stuart@minions-corp.local' }
s.homepage = 'http://minions-corp.local/minions-lib.html'
s.summary = 'Minions!'
s.description = 'Despicable Me'
s.source = { :git => 'http://minions-corp.local/minions-lib.git', :tag => 'v1.0' }
s.license = {
:type => 'MIT',
:file => 'LICENSE',
:text => 'Permission is hereby granted ...'
}
s.source_files = 'Classes/**/*'
end
...@@ -239,6 +239,43 @@ module Pod ...@@ -239,6 +239,43 @@ module Pod
end end
end end
describe 'test other files under sources' do
before do
config.sandbox.prepare
@podfile = Podfile.new do
platform :ios, '6.0'
project 'SampleProject/SampleProject'
target 'SampleProject'
end
@target_definition = @podfile.target_definitions['SampleProject']
@project = Project.new(config.sandbox.project_path)
config.sandbox.project = @project
@minions_spec = fixture_spec('minions-lib/MinionsLib.podspec')
# Add sources to the project.
file_accessor = Sandbox::FileAccessor.new(Sandbox::PathList.new(fixture('minions-lib')), @minions_spec.consumer(:ios))
@project.add_pod_group('MinionsLib', fixture('minions-lib'))
group = @project.group_for_spec('MinionsLib')
file_accessor.source_files.each do |file|
@project.add_file_reference(file, group) if file.fnmatch?('*.m') || file.fnmatch?('*.h')
end
@minions_pod_target = PodTarget.new([@minions_spec, *@minions_spec.recursive_subspecs], [@target_definition], config.sandbox)
@minions_pod_target.file_accessors = [file_accessor]
@minions_pod_target.user_build_configurations = { 'Debug' => :debug, 'Release' => :release }
@installer = PodTargetInstaller.new(config.sandbox, @minions_pod_target)
@first_json_file = file_accessor.source_files.find { |sf| sf.extname == '.json' }
end
it 'raises when references are missing for non-source files' do
@minions_pod_target.stubs(:requires_frameworks?).returns(true)
exception = lambda { @installer.install! }.should.raise Informative
exception.message.should.include "Unable to find other source ref for #{@first_json_file} for target MinionsLib."
end
end
#--------------------------------------# #--------------------------------------#
it 'adds the source files of each pod to the target of the Pod library' do it 'adds the source files of each pod to the target of the Pod library' do
......
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