Skip to content
Browse files

Merge branch 'ticket-291' into develop

* ticket-291:
  [TargetInstaller] Integrate with Xcodeproj f0d455bcd8.
  [TargetInstaller] Add source files in batch.
  • Loading branch information...
2 parents 16a324a + e46ed11 commit 9b45c7d5d3bf03a47db248bbb7414237a113cfd4 @fabiopelosin fabiopelosin committed Jun 25, 2012
View
12 Gemfile.lock
@@ -1,6 +1,6 @@
GIT
remote: git://github.com/CocoaPods/Xcodeproj.git
- revision: c651b216acd6db18128f5b2df77ed04d183e7a3f
+ revision: f0d455bcd839e8fdada2e117681ac93b296659b1
branch: develop
specs:
xcodeproj (0.2.0.rc2)
@@ -11,13 +11,13 @@ GEM
addressable (2.2.8)
awesome_print (1.0.2)
bacon (1.1.0)
- coderay (1.0.6)
+ coderay (1.0.7)
colored (1.2)
crack (0.3.1)
escape (0.0.4)
faraday (0.8.1)
multipart-post (~> 1.1)
- faraday_middleware (0.8.7)
+ faraday_middleware (0.8.8)
faraday (>= 0.7.4, < 0.9)
github-markup (0.7.2)
hashie (1.2.0)
@@ -32,7 +32,7 @@ GEM
mocha (>= 0.9.8)
multi_json (1.3.6)
multipart-post (1.1.5)
- octokit (1.4.0)
+ octokit (1.7.0)
addressable (~> 2.2)
faraday (~> 0.8)
faraday_middleware (~> 0.8)
@@ -47,11 +47,11 @@ GEM
rb-fsevent (0.9.1)
redcarpet (2.1.1)
slop (2.4.4)
- vcr (2.2.0)
+ vcr (2.2.2)
webmock (1.8.7)
addressable (>= 2.2.7)
crack (>= 0.1.7)
- yard (0.8.2)
+ yard (0.8.2.1)
PLATFORMS
ruby
View
4 lib/cocoapods/installer/target_installer.rb
@@ -62,13 +62,15 @@ def install!(pods, sandbox)
@target = @project.add_pod_target(@target_definition.label, @target_definition.platform)
+ source_file_descriptions = []
pods.each do |pod|
xcconfig.merge!(pod.xcconfig)
- pod.add_to_target(@target)
+ source_file_descriptions += pod.source_file_descriptions
# TODO: this doesn't need to be done here, it has nothing to do with the target
pod.link_headers
end
+ @target.add_source_files(source_file_descriptions)
xcconfig.merge!('HEADER_SEARCH_PATHS' => quoted(sandbox.header_search_paths).join(" "))
View
8 lib/cocoapods/local_pod.rb
@@ -328,13 +328,17 @@ def link_headers
#
# @return [void] Adds the pods source files to a given target.
#
- def add_to_target(target)
+ def source_file_descriptions
+ result = []
source_files_by_spec.each do | spec, files |
+ compiler_flags = spec.compiler_flags.strip
files.each do |file|
file = file.relative_path_from(@sandbox.root)
- target.add_source_file(file, nil, spec.compiler_flags.strip)
+ desc = Xcodeproj::Project::PBXNativeTarget::SourceFileDescription.new(file, compiler_flags, nil)
+ result << desc
end
end
+ result
end
# @return Whether the pod requires ARC.
View
2 spec/unit/installer/target_installer_spec.rb
@@ -40,7 +40,7 @@ def do_install!
end
it 'adds each pod to the static library target' do
- @pods[0].expects(:add_to_target).with(instance_of(Xcodeproj::Project::Object::PBXNativeTarget))
+ @pods[0].expects(:source_file_descriptions).returns([])
do_install!
end
View
15 spec/unit/local_pod_spec.rb
@@ -75,17 +75,18 @@
end
it "can add it's source files to an Xcode project target" do
- target = mock('target')
- target.expects(:add_source_file).with(Pathname.new("BananaLib/Classes/Banana.h"), anything, anything)
- target.expects(:add_source_file).with(Pathname.new("BananaLib/Classes/Banana.m"), anything, anything)
- @pod.add_to_target(target)
+ @pod.source_file_descriptions.should == [
+ Xcodeproj::Project::PBXNativeTarget::SourceFileDescription.new(Pathname.new("BananaLib/Classes/Banana.h"), "", nil),
+ Xcodeproj::Project::PBXNativeTarget::SourceFileDescription.new(Pathname.new("BananaLib/Classes/Banana.m"), "", nil)
+ ]
end
it "can add it's source files to a target with any specially configured compiler flags" do
@pod.top_specification.compiler_flags = '-d some_flag'
- target = mock('target')
- target.expects(:add_source_file).twice.with(anything, anything, "-d some_flag")
- @pod.add_to_target(target)
+ @pod.source_file_descriptions.should == [
+ Xcodeproj::Project::PBXNativeTarget::SourceFileDescription.new(Pathname.new("BananaLib/Classes/Banana.h"), '-d some_flag', nil),
+ Xcodeproj::Project::PBXNativeTarget::SourceFileDescription.new(Pathname.new("BananaLib/Classes/Banana.m"), '-d some_flag', nil)
+ ]
end
it "returns the platform" do

0 comments on commit 9b45c7d

Please sign in to comment.
Something went wrong with that request. Please try again.