Commit 96f9bab6 authored by Fabio Pelosin's avatar Fabio Pelosin

Merge branch 'master' of github.com:CocoaPods/CocoaPods

* 'master' of github.com:CocoaPods/CocoaPods:
  Instead of generate a dummy source file for each target, generate one in pod installer#install!
  Remove the '-all_load' linker flags by default. Issue #234.
parents 16f610eb 873234f1
module Pod module Pod
module Generator module Generator
class DummySource class DummySource
def initialize(label="Pods")
@label = label.gsub(/[^a-zA-Z]/, '')
end
def save_as(pathname) def save_as(pathname)
pathname.open('w') do |source| pathname.open('w') do |source|
source.puts "@interface #{@label}Dummy : NSObject" source.puts "@interface PodsDummy : NSObject"
source.puts "@end" source.puts "@end"
source.puts "@implementation #{@label}Dummy" source.puts "@implementation PodsDummy"
source.puts "@end" source.puts "@end"
end end
end end
......
...@@ -83,6 +83,7 @@ module Pod ...@@ -83,6 +83,7 @@ module Pod
end end
generate_lock_file!(pods) generate_lock_file!(pods)
generate_dummy_source
puts "* Running post install hooks" if config.verbose? puts "* Running post install hooks" if config.verbose?
# Post install hooks run _before_ saving of project, so that they can alter it before saving. # Post install hooks run _before_ saving of project, so that they can alter it before saving.
...@@ -152,6 +153,19 @@ module Pod ...@@ -152,6 +153,19 @@ module Pod
end end
end end
def generate_dummy_source
filename = "PodsDummy.m"
pathname = Pathname.new(sandbox.root + filename)
Generator::DummySource.new.save_as(pathname)
project_file = project.files.new('path' => filename)
project.group("Targets Support Files") << project_file
target_installers.each do |target_installer|
target_installer.target.source_build_phases.first << project_file
end
end
def specs_by_target def specs_by_target
@specs_by_target ||= @resolver.resolve @specs_by_target ||= @resolver.resolve
end end
......
...@@ -53,7 +53,7 @@ module Pod ...@@ -53,7 +53,7 @@ module Pod
end end
def target_support_files def target_support_files
[:copy_resources_script_name, :prefix_header_name, :xcconfig_name, :dummy_source_name].map { |file| @target_definition.send(file) } [:copy_resources_script_name, :prefix_header_name, :xcconfig_name].map { |file| @target_definition.send(file) }
end end
# TODO move xcconfig related code into the xcconfig method, like copy_resources_script and generate_bridge_support. # TODO move xcconfig related code into the xcconfig method, like copy_resources_script and generate_bridge_support.
...@@ -79,7 +79,6 @@ module Pod ...@@ -79,7 +79,6 @@ module Pod
xcconfig_file = support_files_group.files.where(:path => @target_definition.xcconfig_name) xcconfig_file = support_files_group.files.where(:path => @target_definition.xcconfig_name)
configure_build_configurations(xcconfig_file) configure_build_configurations(xcconfig_file)
create_files(pods, sandbox) create_files(pods, sandbox)
add_dummy_file(support_files_group)
end end
def configure_build_configurations(xcconfig_file) def configure_build_configurations(xcconfig_file)
...@@ -91,11 +90,6 @@ module Pod ...@@ -91,11 +90,6 @@ module Pod
end end
end end
def add_dummy_file(support_files_group)
dummy = Pathname.new(@target_definition.dummy_source_name)
@target.add_source_file(dummy)
end
def create_files(pods, sandbox) def create_files(pods, sandbox)
if @podfile.generate_bridge_support? if @podfile.generate_bridge_support?
bridge_support_metadata_path = sandbox.root + @target_definition.bridge_support_name bridge_support_metadata_path = sandbox.root + @target_definition.bridge_support_name
...@@ -109,8 +103,6 @@ module Pod ...@@ -109,8 +103,6 @@ module Pod
save_prefix_header_as(sandbox.root + @target_definition.prefix_header_name, pods) save_prefix_header_as(sandbox.root + @target_definition.prefix_header_name, pods)
puts "* Generating copy resources script at `#{sandbox.root + @target_definition.copy_resources_script_name}'" if config.verbose? puts "* Generating copy resources script at `#{sandbox.root + @target_definition.copy_resources_script_name}'" if config.verbose?
copy_resources_script_for(pods).save_as(sandbox.root + @target_definition.copy_resources_script_name) copy_resources_script_for(pods).save_as(sandbox.root + @target_definition.copy_resources_script_name)
puts "* Generating dummy source at `#{sandbox.root + @target_definition.dummy_source_name}'" if config.verbose?
Generator::DummySource.new(@target_definition.label).save_as(sandbox.root + @target_definition.dummy_source_name)
end end
private private
...@@ -120,7 +112,7 @@ module Pod ...@@ -120,7 +112,7 @@ module Pod
end end
def default_ld_flags def default_ld_flags
flags = %w{-ObjC -all_load} flags = %w{-ObjC}
flags << '-fobjc-arc' if @podfile.set_arc_compatibility_flag? && self.requires_arc flags << '-fobjc-arc' if @podfile.set_arc_compatibility_flag? && self.requires_arc
flags.join(" ") flags.join(" ")
end end
......
...@@ -95,10 +95,6 @@ module Pod ...@@ -95,10 +95,6 @@ module Pod
def prefix_header_name def prefix_header_name
"#{label}-prefix.pch" "#{label}-prefix.pch"
end end
def dummy_source_name
"#{label}Dummy.m"
end
def bridge_support_name def bridge_support_name
"#{label}.bridgesupport" "#{label}.bridgesupport"
......
...@@ -12,7 +12,7 @@ describe Pod::Generator::DummySource do ...@@ -12,7 +12,7 @@ describe Pod::Generator::DummySource do
end end
it "generates a dummy sourcefile with the appropriate class" do it "generates a dummy sourcefile with the appropriate class" do
generator = Pod::Generator::DummySource.new("Pods") generator = Pod::Generator::DummySource.new
file = temporary_directory + 'PodsDummy.m' file = temporary_directory + 'PodsDummy.m'
generator.save_as(file) generator.save_as(file)
file.read.should == <<-EOS file.read.should == <<-EOS
......
...@@ -26,8 +26,8 @@ describe "Pod::Installer" do ...@@ -26,8 +26,8 @@ describe "Pod::Installer" do
@xcconfig['ALWAYS_SEARCH_USER_PATHS'].should == 'YES' @xcconfig['ALWAYS_SEARCH_USER_PATHS'].should == 'YES'
end end
it "configures the project to load categories from the static library" do it "configures the project to load all members that implement Objective-c classes or categories from the static library" do
@xcconfig['OTHER_LDFLAGS'].should == '-ObjC -all_load' @xcconfig['OTHER_LDFLAGS'].should == '-ObjC'
end end
it "sets the PODS_ROOT build variable" do it "sets the PODS_ROOT build variable" 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