Commit ec3d6542 authored by Eloy Duran's avatar Eloy Duran

Merge branch 'dependency-targets'. Closes #11.

parents 99417d11 340bdb1e
...@@ -4,3 +4,11 @@ generate_bridge_support! ...@@ -4,3 +4,11 @@ generate_bridge_support!
dependency 'ASIHTTPRequest' dependency 'ASIHTTPRequest'
dependency 'SBJson' dependency 'SBJson'
target :debug do
dependency 'CocoaLumberjack'
end
target :test, :exclusive => true do
dependency 'Kiwi'
end
...@@ -330,7 +330,7 @@ ...@@ -330,7 +330,7 @@
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "${SRCROOT}/Pods/PodsResources.sh"; shellScript = "${SRCROOT}/Pods/Pods-resources.sh";
showEnvVarsInLog = 0; showEnvVarsInLog = 0;
}; };
/* End PBXShellScriptBuildPhase section */ /* End PBXShellScriptBuildPhase section */
......
...@@ -15,11 +15,9 @@ module Pod ...@@ -15,11 +15,9 @@ module Pod
@headers.map { |header| "-I '#{header.dirname}'" }.uniq @headers.map { |header| "-I '#{header.dirname}'" }.uniq
end end
def create_in(root) def save_as(pathname)
puts "==> Generating BridgeSupport metadata file" unless config.silent? puts "==> Generating BridgeSupport metadata file" unless config.silent?
file = root + "Pods.bridgesupport" gen_bridge_metadata %{-c "#{search_paths.join(' ')}" -o '#{pathname}' '#{headers.join("' '")}'}
gen_bridge_metadata %{-c "#{search_paths.join(' ')}" -o '#{file}' '#{headers.join("' '")}'}
file
end end
end end
end end
This diff is collapsed.
module Pod module Pod
class Podfile class Podfile
class Target
attr_reader :name, :parent, :target_dependencies
def initialize(name, parent = nil)
@name, @parent, @target_dependencies = name, parent, []
end
def lib_name
name == :default ? "Pods" : "Pods-#{name}"
end
# Returns *all* dependencies of this target, not only the target specific
# ones in `target_dependencies`.
def dependencies
@target_dependencies + (@parent ? @parent.dependencies : [])
end
end
def self.from_file(path) def self.from_file(path)
podfile = Podfile.new do podfile = Podfile.new do
eval(path.read, nil, path.to_s) eval(path.read, nil, path.to_s)
...@@ -9,8 +27,10 @@ module Pod ...@@ -9,8 +27,10 @@ module Pod
podfile podfile
end end
include Config::Mixin
def initialize(&block) def initialize(&block)
@dependencies = [] @targets = { :default => (@target = Target.new(:default)) }
instance_eval(&block) instance_eval(&block)
end end
...@@ -58,10 +78,12 @@ module Pod ...@@ -58,10 +78,12 @@ module Pod
# * http://semver.org # * http://semver.org
# * http://docs.rubygems.org/read/chapter/7 # * http://docs.rubygems.org/read/chapter/7
def dependency(name, *version_requirements) def dependency(name, *version_requirements)
@dependencies << Dependency.new(name, *version_requirements) @target.target_dependencies << Dependency.new(name, *version_requirements)
end end
attr_reader :dependencies def dependencies
@targets.values.map(&:target_dependencies).flatten
end
# Specifies that a BridgeSupport metadata should be generated from the # Specifies that a BridgeSupport metadata should be generated from the
# headers of all installed Pods. # headers of all installed Pods.
...@@ -72,6 +94,42 @@ module Pod ...@@ -72,6 +94,42 @@ module Pod
@generate_bridge_support = true @generate_bridge_support = true
end end
attr_reader :targets
# Defines a new static library target and scopes dependencies defined from
# the given block. The target will by default include the dependencies
# defined outside of the block, unless the `:exclusive => true` option is
# given.
#
# Consider the following Podfile:
#
# dependency 'ASIHTTPRequest'
#
# target :debug do
# dependency 'SSZipArchive'
# end
#
# target :test, :exclusive => true do
# dependency 'JSONKit'
# end
#
# This Podfile defines three targets. The first one is the `:default` target,
# which produces the `libPods.a` file. The second and third are the `:debug`
# and `:test` ones, which produce the `libPods-debug.a` and `libPods-test.a`
# files.
#
# The `:default` target has only one dependency (ASIHTTPRequest), whereas the
# `:debug` target has two (ASIHTTPRequest, SSZipArchive). The `:test` target,
# however, is an exclusive target which means it will only have one
# dependency (JSONKit).
def target(name, options = {})
parent = @target
@targets[name] = @target = Target.new(name, options[:exclusive] ? nil : parent)
yield
ensure
@target = parent
end
# This is to be compatible with a Specification for use in the Installer and # This is to be compatible with a Specification for use in the Installer and
# Resolver. # Resolver.
...@@ -86,13 +144,13 @@ module Pod ...@@ -86,13 +144,13 @@ module Pod
end end
def dependency_by_name(name) def dependency_by_name(name)
@dependencies.find { |d| d.name == name } dependencies.find { |d| d.name == name }
end end
def validate! def validate!
lines = [] lines = []
lines << "* the `platform` attribute should be either `:osx` or `:ios`" unless [:osx, :ios].include?(@platform) lines << "* the `platform` attribute should be either `:osx` or `:ios`" unless [:osx, :ios].include?(@platform)
lines << "* no dependencies were specified, which is, well, kinda pointless" if @dependencies.empty? lines << "* no dependencies were specified, which is, well, kinda pointless" if dependencies.empty?
raise(Informative, (["The Podfile at `#{@defined_in_file}' is invalid:"] + lines).join("\n")) unless lines.empty? raise(Informative, (["The Podfile at `#{@defined_in_file}' is invalid:"] + lines).join("\n")) unless lines.empty?
end end
end end
......
module Pod module Pod
class Resolver class Resolver
def initialize(specification) def initialize(specification, dependencies = nil)
@specification = specification @specification, @dependencies = specification, dependencies || specification.dependencies
end end
def resolve def resolve
@sets = [] @sets = []
find_dependency_sets(@specification) find_dependency_sets(@specification, @dependencies)
@sets @sets
end end
def find_dependency_sets(specification) def find_dependency_sets(specification, dependencies = nil)
specification.dependencies.each do |dependency| (dependencies || specification.dependencies).each do |dependency|
set = find_dependency_set(dependency) set = find_dependency_set(dependency)
set.required_by(specification) set.required_by(specification)
unless @sets.include?(set) unless @sets.include?(set)
......
...@@ -325,17 +325,18 @@ module Pod ...@@ -325,17 +325,18 @@ module Pod
# This is a convenience method which gets called after all pods have been # This is a convenience method which gets called after all pods have been
# downloaded, installed, and the Xcode project and related files have been # downloaded, installed, and the Xcode project and related files have been
# generated. Override this to, for instance, add to the prefix header: # generated. (It receives the Pod::Installer::Target instance for the current
# target.) Override this to, for instance, add to the prefix header:
# #
# Pod::Spec.new do |s| # Pod::Spec.new do |s|
# def s.post_install # def s.post_install(target)
# prefix_header = config.project_pods_root + 'Pods-Prefix.pch' # prefix_header = config.project_pods_root + target.prefix_header_filename
# prefix_header.open('a') do |file| # prefix_header.open('a') do |file|
# file.puts(%{#ifdef __OBJC__\n#import "SSToolkitDefines.h"\n#endif}) # file.puts(%{#ifdef __OBJC__\n#import "SSToolkitDefines.h"\n#endif})
# end # end
# end # end
# end # end
def post_install def post_install(target)
end end
end end
......
...@@ -25,8 +25,8 @@ module Pod ...@@ -25,8 +25,8 @@ module Pod
@attributes.map { |key, value| "#{key} = #{value}" }.join("\n") @attributes.map { |key, value| "#{key} = #{value}" }.join("\n")
end end
def create_in(pods_root) def save_as(pathname)
(pods_root + 'Pods.xcconfig').open('w') { |file| file << to_s } pathname.open('w') { |file| file << to_s }
end end
end end
end end
......
module Pod module Pod
module Xcode module Xcode
class CopyResourcesScript class CopyResourcesScript
CONTENT = <<EOS
#!/bin/sh
install_resource()
{
echo "cp -R ${SRCROOT}/Pods/$1 ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
cp -R ${SRCROOT}/Pods/$1 ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}
}
EOS
attr_reader :resources attr_reader :resources
# A list of files relative to the project pods root. # A list of files relative to the project pods root.
...@@ -8,13 +18,15 @@ module Pod ...@@ -8,13 +18,15 @@ module Pod
@resources = resources @resources = resources
end end
def create_in(root) def save_as(pathname)
return if @resources.empty? pathname.open('w') do |script|
(root + 'PodsResources.sh').open('a') do |script| script.puts CONTENT
@resources.each do |resource| @resources.each do |resource|
script.puts "install_resource '#{resource}'" script.puts "install_resource '#{resource}'"
end end
end end
# TODO use File api
system("chmod +x '#{pathname}'")
end end
end end
end end
......
This diff is collapsed.
...@@ -38,8 +38,6 @@ else ...@@ -38,8 +38,6 @@ else
config.silent = true config.silent = true
config.repos_dir = fixture('spec-repos') config.repos_dir = fixture('spec-repos')
config.project_pods_root = temporary_directory + 'Pods' config.project_pods_root = temporary_directory + 'Pods'
def config.ios?; true; end
def config.osx?; false; end
FileUtils.cp_r(fixture('integration/.'), config.project_pods_root) FileUtils.cp_r(fixture('integration/.'), config.project_pods_root)
end end
...@@ -51,6 +49,9 @@ else ...@@ -51,6 +49,9 @@ else
# TODO add a simple source file which uses the compiled lib to check that it really really works # TODO add a simple source file which uses the compiled lib to check that it really really works
it "should activate required pods and create a working static library xcode project" do it "should activate required pods and create a working static library xcode project" do
spec = Pod::Podfile.new do spec = Pod::Podfile.new do
# first ensure that the correct info is available to the specs when they load
config.rootspec = self
self.platform platform self.platform platform
dependency 'ASIWebPageRequest', '>= 1.8.1' dependency 'ASIWebPageRequest', '>= 1.8.1'
dependency 'JSONKit', '>= 1.0' dependency 'JSONKit', '>= 1.0'
...@@ -61,26 +62,29 @@ else ...@@ -61,26 +62,29 @@ else
installer.install! installer.install!
root = config.project_pods_root root = config.project_pods_root
(root + 'Reachability.podspec').should.exist (root + 'Reachability.podspec').should.exist if platform == :ios
(root + 'ASIHTTPRequest.podspec').should.exist (root + 'ASIHTTPRequest.podspec').should.exist
(root + 'ASIWebPageRequest.podspec').should.exist (root + 'ASIWebPageRequest.podspec').should.exist
(root + 'JSONKit.podspec').should.exist (root + 'JSONKit.podspec').should.exist
(root + 'SSZipArchive.podspec').should.exist (root + 'SSZipArchive.podspec').should.exist
(root + 'Pods.xcconfig').read.should == installer.xcconfig.to_s (root + 'Pods.xcconfig').read.should == installer.targets.first.xcconfig.to_s
project_file = (root + 'Pods.xcodeproj/project.pbxproj').to_s project_file = (root + 'Pods.xcodeproj/project.pbxproj').to_s
NSDictionary.dictionaryWithContentsOfFile(project_file).should == installer.xcodeproj.to_hash NSDictionary.dictionaryWithContentsOfFile(project_file).should == installer.xcodeproj.to_hash
#puts "\n[!] Compiling static library..." puts "\n[!] Compiling static library..."
#Dir.chdir(config.project_pods_root) do Dir.chdir(config.project_pods_root) do
#system("xcodebuild > /dev/null 2>&1").should == true system("xcodebuild > /dev/null 2>&1").should == true
#system("xcodebuild").should == true #system("xcodebuild").should == true
#end end
end end
it "does not activate pods that are only part of other pods" do it "does not activate pods that are only part of other pods" do
spec = Pod::Podfile.new do spec = Pod::Podfile.new do
# first ensure that the correct info is available to the specs when they load
config.rootspec = self
self.platform platform self.platform platform
dependency 'Reachability' dependency 'Reachability'
end end
...@@ -94,16 +98,18 @@ else ...@@ -94,16 +98,18 @@ else
it "adds resources to the xcode copy script" do it "adds resources to the xcode copy script" do
spec = Pod::Podfile.new do spec = Pod::Podfile.new do
# first ensure that the correct info is available to the specs when they load
config.rootspec = self
self.platform platform self.platform platform
dependency 'SSZipArchive' dependency 'SSZipArchive'
end end
installer = SpecHelper::Installer.new(spec) installer = SpecHelper::Installer.new(spec)
dependency_spec = installer.build_specifications.first installer.targets.first.build_specifications.first.resources = 'LICEN*', 'Readme.*'
dependency_spec.resources = 'LICEN*', 'Readme.*'
installer.install! installer.install!
contents = (config.project_pods_root + 'PodsResources.sh').read contents = (config.project_pods_root + 'Pods-resources.sh').read
contents.should.include "install_resource 'SSZipArchive/LICENSE'\n" \ contents.should.include "install_resource 'SSZipArchive/LICENSE'\n" \
"install_resource 'SSZipArchive/Readme.markdown'" "install_resource 'SSZipArchive/Readme.markdown'"
end end
...@@ -111,6 +117,9 @@ else ...@@ -111,6 +117,9 @@ else
# TODO we need to do more cleaning and/or add a --prune task # TODO we need to do more cleaning and/or add a --prune task
it "overwrites an existing project.pbxproj file" do it "overwrites an existing project.pbxproj file" do
spec = Pod::Podfile.new do spec = Pod::Podfile.new do
# first ensure that the correct info is available to the specs when they load
config.rootspec = self
self.platform platform self.platform platform
dependency 'JSONKit' dependency 'JSONKit'
end end
...@@ -120,18 +129,60 @@ else ...@@ -120,18 +129,60 @@ else
Pod::Source.reset! Pod::Source.reset!
Pod::Spec::Set.reset! Pod::Spec::Set.reset!
spec = Pod::Podfile.new do spec = Pod::Podfile.new do
# first ensure that the correct info is available to the specs when they load
config.rootspec = self
self.platform platform self.platform platform
dependency 'SSZipArchive' dependency 'SSZipArchive'
end end
installer = SpecHelper::Installer.new(spec) installer = SpecHelper::Installer.new(spec)
installer.install! installer.install!
installer = Pod::Installer.new(spec)
installer.generate_project
project = Pod::Xcode::Project.new(config.project_pods_root + 'Pods.xcodeproj') project = Pod::Xcode::Project.new(config.project_pods_root + 'Pods.xcodeproj')
project.source_files.should == installer.xcodeproj.source_files project.source_files.should == installer.xcodeproj.source_files
end end
it "creates a project with multiple targets" do
Pod::Source.reset!
Pod::Spec::Set.reset!
podfile = Pod::Podfile.new do
# first ensure that the correct info is available to the specs when they load
config.rootspec = self
self.platform platform
target(:debug) { dependency 'SSZipArchive' }
target(:test, :exclusive => true) { dependency 'JSONKit' }
dependency 'ASIHTTPRequest'
end
installer = Pod::Installer.new(podfile)
installer.install!
#project = Pod::Xcode::Project.new(config.project_pods_root + 'Pods.xcodeproj')
#p project
#project.targets.each do |target|
#target.source_build_phases.
#end
root = config.project_pods_root
(root + 'Pods.xcconfig').should.exist
(root + 'Pods-debug.xcconfig').should.exist
(root + 'Pods-test.xcconfig').should.exist
(root + 'Pods-resources.sh').should.exist
(root + 'Pods-debug-resources.sh').should.exist
(root + 'Pods-test-resources.sh').should.exist
Dir.chdir(config.project_pods_root) do
puts "\n[!] Compiling static library `Pods'..."
#system("xcodebuild -target Pods").should == true
system("xcodebuild -target Pods > /dev/null 2>&1").should == true
puts "\n[!] Compiling static library `Pods-debug'..."
system("xcodebuild -target Pods-debug > /dev/null 2>&1").should == true
puts "\n[!] Compiling static library `Pods-test'..."
system("xcodebuild -target Pods-test > /dev/null 2>&1").should == true
end
end
it "sets up an existing project with pods" do it "sets up an existing project with pods" do
basename = platform == :ios ? 'iPhone' : 'Mac' basename = platform == :ios ? 'iPhone' : 'Mac'
projpath = temporary_directory + 'ASIHTTPRequest.xcodeproj' projpath = temporary_directory + 'ASIHTTPRequest.xcodeproj'
...@@ -143,27 +194,26 @@ else ...@@ -143,27 +194,26 @@ else
installer = SpecHelper::Installer.new(spec) installer = SpecHelper::Installer.new(spec)
installer.install! installer.install!
installer.configure_project(projpath) installer.configure_project(projpath)
xcworkspace = temporary_directory + 'ASIHTTPRequest.xcworkspace' xcworkspace = temporary_directory + 'ASIHTTPRequest.xcworkspace'
workspace = Pod::Xcode::Workspace.new_from_xcworkspace(xcworkspace) workspace = Pod::Xcode::Workspace.new_from_xcworkspace(xcworkspace)
workspace.projpaths.sort.should == ['ASIHTTPRequest.xcodeproj', 'Pods/Pods.xcodeproj'] workspace.projpaths.sort.should == ['ASIHTTPRequest.xcodeproj', 'Pods/Pods.xcodeproj']
project = Pod::Xcode::Project.new(projpath) project = Pod::Xcode::Project.new(projpath)
config = project.files.find { |f| f.path =~ /Pods.xcconfig$/ } libPods = project.files.find { |f| f.name == 'libPods.a' }
config.should.not.equal nil
copy_resources = project.objects.select_by_class(Pod::Xcode::Project::PBXShellScriptBuildPhase).find do |ss|
ss.shellScript['PodsResources.sh']
end
copy_resources.should.not.equal nil
project.targets.each do |target| project.targets.each do |target|
bases = target.buildConfigurationList.buildConfigurations.map(&:baseConfigurationReference) target.buildConfigurations.each do |config|
bases.uniq[0].uuid.should == config.uuid config.baseConfiguration.path.should == 'Pods/Pods.xcconfig'
target.buildPhases.map(&:uuid).should.include copy_resources.uuid end
end
lib = project.files.find { |f| f.path =~ /libPods.a$/ } phase = target.frameworks_build_phases.first
lib.should.not.equal nil phase.files.map { |buildFile| buildFile.file }.should.include libPods
project.objects.select_by_class(Pod::Xcode::Project::PBXFrameworksBuildPhase).each do |build_phase|
build_phase.files.map(&:uuid).should.include lib.build_file.uuid # should be the last phase
target.buildPhases.last.shellScript.should == "${SRCROOT}/Pods/Pods-resources.sh\n"
end end
end end
end end
end end
end end
...@@ -7,8 +7,8 @@ describe "Pod::BridgeSupportGenerator" do ...@@ -7,8 +7,8 @@ describe "Pod::BridgeSupportGenerator" do
def generator.gen_bridge_metadata(command) def generator.gen_bridge_metadata(command)
@command = command @command = command
end end
generator.create_in(Pathname.new("/path/to/Pods")) generator.save_as(Pathname.new("/path/to/Pods.bridgesupport"))
generator.instance_variable_get(:@command).should == generator.instance_variable_get(:@command).should ==
%{-c "-I '/some/dir' -I '/some/other/dir'" -o '/path/to/Pods/Pods.bridgesupport' '#{headers.join("' '")}'} %{-c "-I '/some/dir' -I '/some/other/dir'" -o '/path/to/Pods.bridgesupport' '#{headers.join("' '")}'}
end end
end end
...@@ -3,7 +3,7 @@ require File.expand_path('../../spec_helper', __FILE__) ...@@ -3,7 +3,7 @@ require File.expand_path('../../spec_helper', __FILE__)
describe "Pod::Installer" do describe "Pod::Installer" do
describe ", by default," do describe ", by default," do
before do before do
@xcconfig = Pod::Installer.new(Pod::Spec.new).xcconfig.to_hash @xcconfig = Pod::Installer.new(Pod::Podfile.new { platform :ios }).targets.first.xcconfig.to_hash
end end
it "sets the header search paths where installed Pod headers can be found" do it "sets the header search paths where installed Pod headers can be found" do
...@@ -33,9 +33,9 @@ describe "Pod::Installer" do ...@@ -33,9 +33,9 @@ describe "Pod::Installer" do
end end
it "generates a BridgeSupport metadata file from all the pod headers" do it "generates a BridgeSupport metadata file from all the pod headers" do
spec = Pod::Spec.new do |s| spec = Pod::Podfile.new do
s.platform = :osx platform :osx
s.dependency 'ASIHTTPRequest' dependency 'ASIHTTPRequest'
end end
expected = [] expected = []
installer = Pod::Installer.new(spec) installer = Pod::Installer.new(spec)
...@@ -44,71 +44,6 @@ describe "Pod::Installer" do ...@@ -44,71 +44,6 @@ describe "Pod::Installer" do
expected << config.project_pods_root + header expected << config.project_pods_root + header
end end
end end
installer.bridge_support_generator.headers.should == expected installer.targets.first.bridge_support_generator.headers.should == expected
end
it "adds all source files that should be included in the library to the xcode project" do
[
[
'ASIHTTPRequest',
['Classes'],
{ 'ASIHTTPRequest' => "Classes/*.{h,m}", 'Reachability' => "External/Reachability/*.{h,m}" },
{
"USER_HEADER_SEARCH_PATHS" => '"$(BUILT_PRODUCTS_DIR)/Pods" ' \
'"$(BUILT_PRODUCTS_DIR)/Pods/ASIHTTPRequest" ' \
'"$(BUILT_PRODUCTS_DIR)/Pods/Reachability"',
"ALWAYS_SEARCH_USER_PATHS" => "YES",
"OTHER_LDFLAGS" => "-ObjC -all_load " \
"-framework SystemConfiguration -framework MobileCoreServices " \
"-framework CFNetwork -lz.1"
}
],
[
'Reachability',
["External/Reachability/*.h", "External/Reachability/*.m"],
{ 'Reachability' => "External/Reachability/*.{h,m}", },
{
"USER_HEADER_SEARCH_PATHS" => '"$(BUILT_PRODUCTS_DIR)/Pods" ' \
'"$(BUILT_PRODUCTS_DIR)/Pods/Reachability"',
"ALWAYS_SEARCH_USER_PATHS" => "YES",
"OTHER_LDFLAGS" => "-ObjC -all_load"
}
],
[
'ASIWebPageRequest',
['**/ASIWebPageRequest.*'],
{ 'ASIHTTPRequest' => "Classes/*.{h,m}", 'ASIWebPageRequest' => "Classes/ASIWebPageRequest/*.{h,m}", 'Reachability' => "External/Reachability/*.{h,m}" },
{
"USER_HEADER_SEARCH_PATHS" => '"$(BUILT_PRODUCTS_DIR)/Pods" ' \
'"$(BUILT_PRODUCTS_DIR)/Pods/ASIHTTPRequest" ' \
'"$(BUILT_PRODUCTS_DIR)/Pods/Reachability"',
"ALWAYS_SEARCH_USER_PATHS" => "YES",
"HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2",
"OTHER_LDFLAGS" => "-ObjC -all_load " \
"-lxml2.2.7.3 -framework SystemConfiguration " \
"-framework MobileCoreServices -framework CFNetwork -lz.1"
}
],
].each do |name, patterns, expected_patterns, xcconfig|
Pod::Source.reset!
Pod::Spec::Set.reset!
installer = Pod::Installer.new(Pod::Spec.new do |s|
s.platform = :ios
s.dependency(name)
s.source_files = *patterns
end)
installer.generate_project
expected_patterns.each do |name, pattern|
pattern = config.project_pods_root + 'ASIHTTPRequest' + pattern
expected = pattern.glob.map do |file|
file.relative_path_from(config.project_pods_root)
end
installer.xcodeproj.source_files[name].size.should == expected.size
installer.xcodeproj.source_files[name].sort.should == expected.sort
end
installer.xcconfig.to_hash.should == xcconfig
end
end end
end end
...@@ -23,6 +23,47 @@ describe "Pod::Podfile" do ...@@ -23,6 +23,47 @@ describe "Pod::Podfile" do
podfile.generate_bridge_support?.should == true podfile.generate_bridge_support?.should == true
end end
describe "concerning targets (dependency groups)" do
before do
@podfile = Pod::Podfile.new do
target :debug do
dependency 'SSZipArchive'
end
target :test, :exclusive => true do
dependency 'JSONKit'
end
dependency 'ASIHTTPRequest'
end
end
it "returns all dependencies of all targets combined, which is used during resolving to enusre compatible dependencies" do
@podfile.dependencies.map(&:name).sort.should == %w{ ASIHTTPRequest JSONKit SSZipArchive }
end
it "adds dependencies outside of any explicit target block to the default target" do
target = @podfile.targets[:default]
target.lib_name.should == 'Pods'
target.dependencies.should == [Pod::Dependency.new('ASIHTTPRequest')]
end
it "adds dependencies of the outer target to non-exclusive targets" do
target = @podfile.targets[:debug]
target.lib_name.should == 'Pods-debug'
target.dependencies.sort_by(&:name).should == [
Pod::Dependency.new('ASIHTTPRequest'),
Pod::Dependency.new('SSZipArchive')
]
end
it "does not add dependencies of the outer target to exclusive targets" do
target = @podfile.targets[:test]
target.lib_name.should == 'Pods-test'
target.dependencies.should == [Pod::Dependency.new('JSONKit')]
end
end
describe "concerning validations" do describe "concerning validations" do
it "raises if no platform is specified" do it "raises if no platform is specified" do
exception = lambda { exception = lambda {
......
...@@ -25,7 +25,7 @@ describe "Pod::Xcode::Config" do ...@@ -25,7 +25,7 @@ describe "Pod::Xcode::Config" do
it "creates the config file" do it "creates the config file" do
@config.merge!('HEADER_SEARCH_PATHS' => '/some/path') @config.merge!('HEADER_SEARCH_PATHS' => '/some/path')
@config.merge!('OTHER_LD_FLAGS' => '-l xml2.2.7.3') @config.merge!('OTHER_LD_FLAGS' => '-l xml2.2.7.3')
@config.create_in(temporary_directory) @config.save_as(temporary_directory + 'Pods.xcconfig')
(temporary_directory + 'Pods.xcconfig').read.split("\n").sort.should == [ (temporary_directory + 'Pods.xcconfig').read.split("\n").sort.should == [
"OTHER_LD_FLAGS = -framework Foundation -l xml2.2.7.3", "OTHER_LD_FLAGS = -framework Foundation -l xml2.2.7.3",
"HEADER_SEARCH_PATHS = /some/path" "HEADER_SEARCH_PATHS = /some/path"
......
This diff is collapsed.
//
// Prefix header for all source files of the 'Pods' target in the 'Pods' project
//
#ifdef __OBJC__
#import <Cocoa/Cocoa.h>
#endif
...@@ -6,33 +6,14 @@ ...@@ -6,33 +6,14 @@
objectVersion = 46; objectVersion = 46;
objects = { objects = {
/* Begin PBXBuildFile section */
518ACD3F1446050200F6BE80 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 518ACD3E1446050200F6BE80 /* Cocoa.framework */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
518ACD3B1446050200F6BE80 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; };
518ACD3E1446050200F6BE80 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; 518ACD3E1446050200F6BE80 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
518ACD461446050200F6BE80 /* Pods-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Pods-Prefix.pch"; sourceTree = "<group>"; };
518ACD53144605B400F6BE80 /* Pods.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Pods.xcconfig; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
518ACD381446050200F6BE80 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
518ACD3F1446050200F6BE80 /* Cocoa.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */ /* Begin PBXGroup section */
518ACD301446050100F6BE80 = { 518ACD301446050100F6BE80 = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
518ACD53144605B400F6BE80 /* Pods.xcconfig */,
518ACD5B1446449B00F6BE80 /* Pods */, 518ACD5B1446449B00F6BE80 /* Pods */,
518ACD3D1446050200F6BE80 /* Frameworks */, 518ACD3D1446050200F6BE80 /* Frameworks */,
518ACD3C1446050200F6BE80 /* Products */, 518ACD3C1446050200F6BE80 /* Products */,
...@@ -42,7 +23,6 @@ ...@@ -42,7 +23,6 @@
518ACD3C1446050200F6BE80 /* Products */ = { 518ACD3C1446050200F6BE80 /* Products */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
518ACD3B1446050200F6BE80 /* libPods.a */,
); );
name = Products; name = Products;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -55,55 +35,15 @@ ...@@ -55,55 +35,15 @@
name = Frameworks; name = Frameworks;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
518ACD451446050200F6BE80 /* Supporting Files */ = {
isa = PBXGroup;
children = (
518ACD461446050200F6BE80 /* Pods-Prefix.pch */,
);
name = "Supporting Files";
path = Pods;
sourceTree = "<group>";
};
518ACD5B1446449B00F6BE80 /* Pods */ = { 518ACD5B1446449B00F6BE80 /* Pods */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
518ACD451446050200F6BE80 /* Supporting Files */,
); );
name = Pods; name = Pods;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
/* End PBXGroup section */ /* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
518ACD391446050200F6BE80 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
518ACD3A1446050200F6BE80 /* Pods */ = {
isa = PBXNativeTarget;
buildConfigurationList = 518ACD4C1446050200F6BE80 /* Build configuration list for PBXNativeTarget "Pods" */;
buildPhases = (
518ACD371446050200F6BE80 /* Sources */,
518ACD381446050200F6BE80 /* Frameworks */,
518ACD391446050200F6BE80 /* Headers */,
);
buildRules = (
);
dependencies = (
);
name = Pods;
productName = Pods;
productReference = 518ACD3B1446050200F6BE80 /* libPods.a */;
productType = "com.apple.product-type.library.static";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */ /* Begin PBXProject section */
518ACD321446050100F6BE80 /* Project object */ = { 518ACD321446050100F6BE80 /* Project object */ = {
isa = PBXProject; isa = PBXProject;
...@@ -122,21 +62,10 @@ ...@@ -122,21 +62,10 @@
projectDirPath = ""; projectDirPath = "";
projectRoot = ""; projectRoot = "";
targets = ( targets = (
518ACD3A1446050200F6BE80 /* Pods */,
); );
}; };
/* End PBXProject section */ /* End PBXProject section */
/* Begin PBXSourcesBuildPhase section */
518ACD371446050200F6BE80 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */ /* Begin XCBuildConfiguration section */
518ACD4A1446050200F6BE80 /* Debug */ = { 518ACD4A1446050200F6BE80 /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
...@@ -185,30 +114,6 @@ ...@@ -185,30 +114,6 @@
}; };
name = Release; name = Release;
}; };
518ACD4D1446050200F6BE80 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 518ACD53144605B400F6BE80 /* Pods.xcconfig */;
buildSettings = {
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Pods-Prefix.pch";
OTHER_LDFLAGS = (
);
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
518ACD4E1446050200F6BE80 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 518ACD53144605B400F6BE80 /* Pods.xcconfig */;
buildSettings = {
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Pods-Prefix.pch";
OTHER_LDFLAGS = (
);
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
/* End XCBuildConfiguration section */ /* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */ /* Begin XCConfigurationList section */
...@@ -221,15 +126,6 @@ ...@@ -221,15 +126,6 @@
defaultConfigurationIsVisible = 0; defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release; defaultConfigurationName = Release;
}; };
518ACD4C1446050200F6BE80 /* Build configuration list for PBXNativeTarget "Pods" */ = {
isa = XCConfigurationList;
buildConfigurations = (
518ACD4D1446050200F6BE80 /* Debug */,
518ACD4E1446050200F6BE80 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */ /* End XCConfigurationList section */
}; };
rootObject = 518ACD321446050100F6BE80 /* Project object */; rootObject = 518ACD321446050100F6BE80 /* Project object */;
......
#!/bin/sh
install_resource()
{
echo "cp -R ${SRCROOT}/Pods/$1 ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
cp -R ${SRCROOT}/Pods/$1 ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}
}
//
// Prefix header for all source files of the 'Pods' target in the 'Pods' project
//
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#endif
...@@ -6,46 +6,14 @@ ...@@ -6,46 +6,14 @@
objectVersion = 46; objectVersion = 46;
objects = { objects = {
/* Begin PBXBuildFile section */
515B0FB9141D52E0001DC3E6 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 515B0FB8141D52E0001DC3E6 /* Foundation.framework */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
82A8B61C142F7EC7006897C9 /* Copy Public Headers */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "$(PUBLIC_HEADERS_FOLDER_PATH)";
dstSubfolderSpec = 16;
files = (
);
name = "Copy Public Headers";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
515160D0141EC5D100EBB823 /* Pods.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Pods.xcconfig; sourceTree = "<group>"; };
515B0FB5141D52E0001DC3E6 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; };
515B0FB8141D52E0001DC3E6 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 515B0FB8141D52E0001DC3E6 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
515B0FBC141D52E0001DC3E6 /* Pods-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Pods-Prefix.pch"; sourceTree = SOURCE_ROOT; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
515B0FB2141D52E0001DC3E6 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
515B0FB9141D52E0001DC3E6 /* Foundation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */ /* Begin PBXGroup section */
515B0FAA141D52E0001DC3E6 = { 515B0FAA141D52E0001DC3E6 = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
515160D0141EC5D100EBB823 /* Pods.xcconfig */,
515B0FC9141D5FBE001DC3E6 /* Pods */, 515B0FC9141D5FBE001DC3E6 /* Pods */,
515B0FB7141D52E0001DC3E6 /* Frameworks */, 515B0FB7141D52E0001DC3E6 /* Frameworks */,
515B0FB6141D52E0001DC3E6 /* Products */, 515B0FB6141D52E0001DC3E6 /* Products */,
...@@ -55,7 +23,6 @@ ...@@ -55,7 +23,6 @@
515B0FB6141D52E0001DC3E6 /* Products */ = { 515B0FB6141D52E0001DC3E6 /* Products */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
515B0FB5141D52E0001DC3E6 /* libPods.a */,
); );
name = Products; name = Products;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -68,59 +35,21 @@ ...@@ -68,59 +35,21 @@
name = Frameworks; name = Frameworks;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
515B0FBB141D52E0001DC3E6 /* Supporting Files */ = {
isa = PBXGroup;
children = (
515B0FBC141D52E0001DC3E6 /* Pods-Prefix.pch */,
);
name = "Supporting Files";
path = Pods;
sourceTree = "<group>";
};
515B0FC9141D5FBE001DC3E6 /* Pods */ = { 515B0FC9141D5FBE001DC3E6 /* Pods */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
515B0FBB141D52E0001DC3E6 /* Supporting Files */,
); );
name = Pods; name = Pods;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
/* End PBXGroup section */ /* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
515B0FB3141D52E0001DC3E6 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
515B0FB4141D52E0001DC3E6 /* Pods */ = {
isa = PBXNativeTarget;
buildConfigurationList = 515B0FC2141D52E0001DC3E6 /* Build configuration list for PBXNativeTarget "Pods" */;
buildPhases = (
515B0FB1141D52E0001DC3E6 /* Sources */,
515B0FB2141D52E0001DC3E6 /* Frameworks */,
515B0FB3141D52E0001DC3E6 /* Headers */,
82A8B61C142F7EC7006897C9 /* Copy Public Headers */,
);
buildRules = (
);
dependencies = (
);
name = Pods;
productName = Pods;
productReference = 515B0FB5141D52E0001DC3E6 /* libPods.a */;
productType = "com.apple.product-type.library.static";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */ /* Begin PBXProject section */
515B0FAC141D52E0001DC3E6 /* Project object */ = { 515B0FAC141D52E0001DC3E6 /* Project object */ = {
isa = PBXProject; isa = PBXProject;
attributes = {
LastUpgradeCheck = 0420;
};
buildConfigurationList = 515B0FAF141D52E0001DC3E6 /* Build configuration list for PBXProject "Pods" */; buildConfigurationList = 515B0FAF141D52E0001DC3E6 /* Build configuration list for PBXProject "Pods" */;
compatibilityVersion = "Xcode 3.2"; compatibilityVersion = "Xcode 3.2";
developmentRegion = English; developmentRegion = English;
...@@ -133,21 +62,10 @@ ...@@ -133,21 +62,10 @@
projectDirPath = ""; projectDirPath = "";
projectRoot = ""; projectRoot = "";
targets = ( targets = (
515B0FB4141D52E0001DC3E6 /* Pods */,
); );
}; };
/* End PBXProject section */ /* End PBXProject section */
/* Begin PBXSourcesBuildPhase section */
515B0FB1141D52E0001DC3E6 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */ /* Begin XCBuildConfiguration section */
515B0FC0141D52E0001DC3E6 /* Debug */ = { 515B0FC0141D52E0001DC3E6 /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
...@@ -193,34 +111,6 @@ ...@@ -193,34 +111,6 @@
}; };
name = Release; name = Release;
}; };
515B0FC3141D52E0001DC3E6 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 515160D0141EC5D100EBB823 /* Pods.xcconfig */;
buildSettings = {
DSTROOT = /tmp/Pods.dst;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Pods-Prefix.pch";
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
name = Debug;
};
515B0FC4141D52E0001DC3E6 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 515160D0141EC5D100EBB823 /* Pods.xcconfig */;
buildSettings = {
DSTROOT = /tmp/Pods.dst;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Pods-Prefix.pch";
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
name = Release;
};
/* End XCBuildConfiguration section */ /* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */ /* Begin XCConfigurationList section */
...@@ -233,15 +123,6 @@ ...@@ -233,15 +123,6 @@
defaultConfigurationIsVisible = 0; defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release; defaultConfigurationName = Release;
}; };
515B0FC2141D52E0001DC3E6 /* Build configuration list for PBXNativeTarget "Pods" */ = {
isa = XCConfigurationList;
buildConfigurations = (
515B0FC3141D52E0001DC3E6 /* Debug */,
515B0FC4141D52E0001DC3E6 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */ /* End XCConfigurationList section */
}; };
rootObject = 515B0FAC141D52E0001DC3E6 /* Project object */; rootObject = 515B0FAC141D52E0001DC3E6 /* Project object */;
......
#!/bin/sh
install_resource()
{
echo "cp -R ${SRCROOT}/Pods/$1 ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
cp -R ${SRCROOT}/Pods/$1 ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}
}
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