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 Generator
class DummySource
def initialize(label="Pods")
@label = label.gsub(/[^a-zA-Z]/, '')
end
def save_as(pathname)
pathname.open('w') do |source|
source.puts "@interface #{@label}Dummy : NSObject"
source.puts "@interface PodsDummy : NSObject"
source.puts "@end"
source.puts "@implementation #{@label}Dummy"
source.puts "@implementation PodsDummy"
source.puts "@end"
end
end
......
......@@ -83,6 +83,7 @@ module Pod
end
generate_lock_file!(pods)
generate_dummy_source
puts "* Running post install hooks" if config.verbose?
# Post install hooks run _before_ saving of project, so that they can alter it before saving.
......@@ -152,6 +153,19 @@ module Pod
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
@specs_by_target ||= @resolver.resolve
end
......
......@@ -53,7 +53,7 @@ module Pod
end
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
# TODO move xcconfig related code into the xcconfig method, like copy_resources_script and generate_bridge_support.
......@@ -79,7 +79,6 @@ module Pod
xcconfig_file = support_files_group.files.where(:path => @target_definition.xcconfig_name)
configure_build_configurations(xcconfig_file)
create_files(pods, sandbox)
add_dummy_file(support_files_group)
end
def configure_build_configurations(xcconfig_file)
......@@ -91,11 +90,6 @@ module Pod
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)
if @podfile.generate_bridge_support?
bridge_support_metadata_path = sandbox.root + @target_definition.bridge_support_name
......@@ -109,8 +103,6 @@ module Pod
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?
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
private
......@@ -120,7 +112,7 @@ module Pod
end
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.join(" ")
end
......
......@@ -95,10 +95,6 @@ module Pod
def prefix_header_name
"#{label}-prefix.pch"
end
def dummy_source_name
"#{label}Dummy.m"
end
def bridge_support_name
"#{label}.bridgesupport"
......
......@@ -12,7 +12,7 @@ describe Pod::Generator::DummySource do
end
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'
generator.save_as(file)
file.read.should == <<-EOS
......
......@@ -26,8 +26,8 @@ describe "Pod::Installer" do
@xcconfig['ALWAYS_SEARCH_USER_PATHS'].should == 'YES'
end
it "configures the project to load categories from the static library" do
@xcconfig['OTHER_LDFLAGS'].should == '-ObjC -all_load'
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'
end
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