Commit b329ce0b authored by Fabio Pelosin's avatar Fabio Pelosin

Merge pull request #1238 from CocoaPods/feature-frameworks-bundles

[Specification] Add support for framework_bundles
parents 1726172e 59b1b018
......@@ -6,29 +6,45 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
###### Enhancements
* Added license information to `podfile-info` subcommand.
[#1219](https://github.com/CocoaPods/CocoaPods/issues/1219)
* Restructured `.cocoapods` folder to contain repos in a subdirectory.
* Added support for resource bundles.
[#743](https://github.com/CocoaPods/CocoaPods/issues/743),
[#1186](https://github.com/CocoaPods/CocoaPods/issues/1186)
* Added support for bundled frameworks.
[#809](https://github.com/CocoaPods/CocoaPods/issues/809),
[#1075](https://github.com/CocoaPods/CocoaPods/issues/1075)
* Added support for bundled libraries.
[#809](https://github.com/CocoaPods/CocoaPods/issues/809),
[#1075](https://github.com/CocoaPods/CocoaPods/issues/1075)
* Restructured `.cocoapods` folder to contain repos in a subdirectory.
[#1150](https://github.com/CocoaPods/CocoaPods/issues/1150)
[Ian Ynda-Hummel](https://github.com/ianyh)
* Improved `pod spec create` template.
* Improved `pod spec create` template.
[#1223](https://github.com/CocoaPods/CocoaPods/issues/1223)
* Added copy&paste-friendly dependency to `pod search`.
* Added copy&paste-friendly dependency to `pod search`.
[#1073](https://github.com/CocoaPods/CocoaPods/issues/1073)
* Improved performance of the installation of Pods with git
sources which specify a tag.
sources which specify a tag.
[#1077](https://github.com/CocoaPods/CocoaPods/issues/1077)
* Core Data `xcdatamodeld` files are now properly referenced from the Pods
project.
project.
[#1155](https://github.com/CocoaPods/CocoaPods/issues/1155)
* Removed punctuation check from specification validations.
[#1155](https://github.com/CocoaPods/CocoaPods/issues/1155)
* Deprecated the `documentation` DSL attribute of the podspec format.
[Core#20](https://github.com/CocoaPods/Core/issues/20)
###### Bug Fixes
* Fix copy resource script issue related to filenames with spaces.
* Fix copy resource script issue related to filenames with spaces.
[#1231](https://github.com/CocoaPods/CocoaPods/issues/1231)
<!------------------------------------------------------------------------ ->
......
......@@ -7,7 +7,7 @@ gemspec
group :development do
# To develop the deps in tandem use the `LOCAL GIT REPOS` feature of Bundler.
gem 'cocoapods-core', :git => "https://github.com/CocoaPods/Core.git", :branch => 'master'
gem 'cocoapods-core', :git => "https://github.com/CocoaPods/Core.git", :branch => 'feature-frameworks-bundles'
gem 'xcodeproj', :git => "https://github.com/CocoaPods/Xcodeproj.git", :branch => 'master'
gem 'cocoapods-downloader', :git => "https://github.com/CocoaPods/cocoapods-downloader.git", :branch => 'master'
gem 'claide', :git => 'https://github.com/CocoaPods/CLAide.git', :branch => 'master'
......
......@@ -7,8 +7,8 @@ GIT
GIT
remote: https://github.com/CocoaPods/Core.git
revision: 92692426f9ed7a5daee4ee1521e47cc716dce3e9
branch: master
revision: 0bcb90602afc9fdd5772b8079ab77bd20d9ef3a4
branch: feature-frameworks-bundles
specs:
cocoapods-core (0.22.3)
activesupport (~> 3.2.13)
......@@ -17,7 +17,7 @@ GIT
GIT
remote: https://github.com/CocoaPods/Xcodeproj.git
revision: 8400134c1299d9cdb5c233d84513a7eec0f9f37b
revision: 254fbb313e7219c9c99d0b31facb510c065aa906
branch: master
specs:
xcodeproj (0.8.1)
......@@ -26,7 +26,7 @@ GIT
GIT
remote: https://github.com/CocoaPods/cocoapods-downloader.git
revision: 2cc10348d9eb35862d900d79c72cd967388962b9
revision: 951ebcc7f6b10874ff09796b0add04d7b3ce34d1
branch: master
specs:
cocoapods-downloader (0.1.1)
......
......@@ -42,9 +42,6 @@ module Pod
autoload :PrefixHeader, 'cocoapods/generator/prefix_header'
autoload :TargetEnvironmentHeader, 'cocoapods/generator/target_environment_header'
autoload :XCConfig, 'cocoapods/generator/xcconfig'
autoload :AggregateXCConfig, 'cocoapods/generator/xcconfig/aggregate_xcconfig'
autoload :PublicPodXCConfig, 'cocoapods/generator/xcconfig/public_pod_xcconfig'
autoload :PrivatePodXCConfig, 'cocoapods/generator/xcconfig/private_pod_xcconfig'
end
module Hooks
......
......@@ -70,7 +70,7 @@ module Pod
def script
script = install_resources_function
resources.each do |resource|
script += "install_resource '#{resource}'\n"
script += %Q[install_resource "#{resource}"\n]
end
script += RSYNC_CALL
script
......@@ -109,6 +109,10 @@ install_resource()
echo "xcrun momc \\"${PODS_ROOT}/$1\\" \\"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\\""
xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd"
;;
/*)
echo "$1"
echo "$1" >> "$RESOURCES_TO_COPY"
;;
*)
echo "${PODS_ROOT}/$1"
echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY"
......
......@@ -5,124 +5,12 @@ module Pod
# for each Pod and for each Pod target definition. The aggregates the
# configurations of the Pods and define target specific settings.
#
class XCConfig
module XCConfig
# @return [Target] the target represented by this xcconfig.
#
attr_reader :target
# @param [Target] target @see target
#
def initialize(target)
@target = target
end
# @return [Sandbox] the sandbox of this target.
#
def sandbox
target.sandbox
end
# @return [Xcodeproj::Config] The generated xcconfig.
#
attr_reader :xcconfig
# Generates and saves the xcconfig to the given path.
#
# @param [Pathname] path
# the path where the prefix header should be stored.
#
# @return [void]
#
def save_as(path)
generate.save_as(path)
end
#-----------------------------------------------------------------------#
# @!group Private helpers.
private
# @return [String] the default linker flags. `-ObjC` is always included
# while `-fobjc-arc` is included only if requested in the
# Podfile.
#
def default_ld_flags
ld_flags = '-ObjC'
if target.target_definition.podfile.set_arc_compatibility_flag? and
target.spec_consumers.any? { |consumer| consumer.requires_arc? }
ld_flags << ' -fobjc-arc'
end
ld_flags
end
# Converts an array of strings to a single string where the each string
# is surrounded by double quotes and separated by a space. Used to
# represent strings in a xcconfig file.
#
# @param [Array<String>] strings
# a list of strings.
#
# @return [String] the resulting string.
#
def quote(strings)
strings.sort.map { |s| %W|"#{s}"| }.join(" ")
end
# Configures the given Xcconfig according to the build settings of the
# given Specification.
#
# @param [Specification::Consumer] consumer
# The consumer of the specification.
#
# @param [Xcodeproj::Config] xcconfig
# The xcconfig to edit.
#
def add_spec_build_settings_to_xcconfig(consumer, xcconfig)
xcconfig.merge!(consumer.xcconfig)
xcconfig.libraries.merge(consumer.libraries)
xcconfig.frameworks.merge(consumer.frameworks)
xcconfig.weak_frameworks.merge(consumer.weak_frameworks)
add_developers_frameworks_if_needed(consumer, xcconfig)
end
# @return [Array<String>] The search paths for the developer frameworks.
#
# @todo Inheritance should be properly handled in Xcconfigs.
#
DEVELOPER_FRAMEWORKS_SEARCH_PATHS = [
'$(inherited)',
'"$(SDKROOT)/Developer/Library/Frameworks"',
'"$(DEVELOPER_LIBRARY_DIR)/Frameworks"'
]
# Adds the search paths of the developer frameworks to the specification
# if needed. This is done because the `SenTestingKit` requires them and
# adding them to each specification which requires it is repetitive and
# error prone.
#
# @param [Specification::Consumer] consumer
# The consumer of the specification.
#
# @param [Xcodeproj::Config] xcconfig
# The xcconfig to edit.
#
# @return [void]
#
def add_developers_frameworks_if_needed(consumer, xcconfig)
if xcconfig.frameworks.include?('SenTestingKit')
search_paths = xcconfig.attributes['FRAMEWORK_SEARCH_PATHS'] ||= ''
DEVELOPER_FRAMEWORKS_SEARCH_PATHS.each do |search_path|
unless search_paths.include?(search_path)
search_paths << ' ' unless search_paths.empty?
search_paths << search_path
end
end
end
end
#-----------------------------------------------------------------------#
autoload :AggregateXCConfig, 'cocoapods/generator/xcconfig/aggregate_xcconfig'
autoload :PublicPodXCConfig, 'cocoapods/generator/xcconfig/public_pod_xcconfig'
autoload :PrivatePodXCConfig, 'cocoapods/generator/xcconfig/private_pod_xcconfig'
autoload :XCConfigHelper, 'cocoapods/generator/xcconfig/xcconfig_helper'
end
end
......
module Pod
module Generator
module XCConfig
# Generates the xcconfigs for the aggregate targets.
#
class AggregateXCConfig < XCConfig
class AggregateXCConfig
# @return [Target] the target represented by this xcconfig.
#
attr_reader :target
# @param [Target] target @see target
#
def initialize(target)
@target = target
end
# @return [Xcodeproj::Config] The generated xcconfig.
#
attr_reader :xcconfig
# Generates and saves the xcconfig to the given path.
#
# @param [Pathname] path
# the path where the prefix header should be stored.
#
# @return [void]
#
def save_as(path)
generate.save_as(path)
end
# Generates the xcconfig.
#
......@@ -12,19 +38,28 @@ module Pod
# Each namespaced configuration value is merged into the Pod
# xcconfig file.
#
# @todo This doesn't include the specs xcconfigs anymore and now the
# logic is duplicated.
#
# @return [Xcodeproj::Config]
#
def generate
@xcconfig = Xcodeproj::Config.new({
'OTHER_LDFLAGS' => default_ld_flags,
'HEADER_SEARCH_PATHS' => quote(sandbox.public_headers.search_paths),
'PODS_ROOT' => target.relative_pods_root,
'OTHER_LDFLAGS' => XCConfigHelper.default_ld_flags(target),
'HEADER_SEARCH_PATHS' => XCConfigHelper.quote(target.sandbox.public_headers.search_paths),
'PODS_ROOT' => target.relative_pods_root,
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1',
})
target.pod_targets.each do |pod_target|
pod_target.spec_consumers.each do |consumer|
add_spec_build_settings_to_xcconfig(consumer, @xcconfig)
pod_target.file_accessors.each do |file_accessor|
XCConfigHelper.add_spec_build_settings_to_xcconfig(file_accessor.spec_consumer, @xcconfig)
file_accessor.vendored_frameworks.each do |vendored_framework|
XCConfigHelper.add_framework_build_settings(vendored_framework, @xcconfig, target.sandbox.root)
end
file_accessor.vendored_libraries.each do |vendored_library|
XCConfigHelper.add_library_build_settings(vendored_library, @xcconfig, target.sandbox.root)
end
end
end
......@@ -42,3 +77,4 @@ module Pod
end
end
end
end
module Pod
module Generator
module XCConfig
# Generates the private xcconfigs for the pod targets.
#
......@@ -7,7 +8,11 @@ module Pod
# values of the public namespaced xcconfig with the default private
# configuration values required by CocoaPods.
#
class PrivatePodXCConfig < XCConfig
class PrivatePodXCConfig
# @return [Target] the target represented by this xcconfig.
#
attr_reader :target
# @return [Xcodeproj::Config] The public xcconfig which this one will
# use.
......@@ -18,21 +23,37 @@ module Pod
# @param [Xcodeproj::Config] public_xcconfig @see public_xcconfig
#
def initialize(target, public_xcconfig)
super(target)
@target = target
@public_xcconfig = public_xcconfig
end
# @return [Xcodeproj::Config] The generated xcconfig.
#
attr_reader :xcconfig
# Generates and saves the xcconfig to the given path.
#
# @param [Pathname] path
# the path where the prefix header should be stored.
#
# @return [void]
#
def save_as(path)
generate.save_as(path)
end
# Generates the xcconfig.
#
# @return [Xcodeproj::Config]
#
def generate
search_pahts = target.build_headers.search_paths.concat(target.sandbox.public_headers.search_paths)
config = {
'OTHER_LDFLAGS' => default_ld_flags,
'PODS_ROOT' => '${SRCROOT}',
'HEADER_SEARCH_PATHS' => quote(target.build_headers.search_paths) + ' ' + quote(sandbox.public_headers.search_paths),
'OTHER_LDFLAGS' => XCConfigHelper.default_ld_flags(target),
'PODS_ROOT' => '${SRCROOT}',
'HEADER_SEARCH_PATHS' => XCConfigHelper.quote(search_pahts),
'GCC_PREPROCESSOR_DEFINITIONS' => 'COCOAPODS=1',
# 'USE_HEADERMAP' => 'NO'
# 'USE_HEADERMAP' => 'NO'
}
xcconfig_hash = add_xcconfig_namespaced_keys(public_xcconfig.to_hash, config, target.xcconfig_prefix)
......@@ -93,3 +114,4 @@ module Pod
end
end
end
end
module Pod
module Generator
module XCConfig
# Generates the public xcconfigs for the pod targets.
#
......@@ -8,7 +9,21 @@ module Pod
# xcconfig includes the standard podspec defined values including
# libraries, frameworks, weak frameworks and xcconfig overrides.
#
class PublicPodXCConfig < XCConfig
class PublicPodXCConfig
# @return [Target] the target represented by this xcconfig.
#
attr_reader :target
# @param [Target] target @see target
#
def initialize(target)
@target = target
end
# @return [Xcodeproj::Config] The generated xcconfig.
#
attr_reader :xcconfig
# Generates and saves the xcconfig to the given path.
#
......@@ -27,8 +42,14 @@ module Pod
#
def generate
@xcconfig = Xcodeproj::Config.new
target.spec_consumers.each do |consumer|
add_spec_build_settings_to_xcconfig(consumer, @xcconfig)
target.file_accessors.each do |file_accessor|
XCConfigHelper.add_spec_build_settings_to_xcconfig(file_accessor.spec_consumer, @xcconfig)
file_accessor.vendored_frameworks.each do |vendored_framework|
XCConfigHelper.add_framework_build_settings(vendored_framework, @xcconfig, target.sandbox.root)
end
file_accessor.vendored_libraries.each do |vendored_library|
XCConfigHelper.add_library_build_settings(vendored_library, @xcconfig, target.sandbox.root)
end
end
@xcconfig
end
......@@ -38,3 +59,4 @@ module Pod
end
end
end
end
module Pod
module Generator
module XCConfig
# Stores the shared logic of the classes of the XCConfig module.
#
module XCConfigHelper
# Converts an array of strings to a single string where the each string
# is surrounded by double quotes and separated by a space. Used to
# represent strings in a xcconfig file.
#
# @param [Array<String>] strings
# a list of strings.
#
# @return [String] the resulting string.
#
def self.quote(strings)
strings.sort.map { |s| %W|"#{s}"| }.join(" ")
end
# @return [String] the default linker flags. `-ObjC` is always included
# while `-fobjc-arc` is included only if requested in the
# Podfile.
#
def self.default_ld_flags(target)
ld_flags = '-ObjC'
if target.target_definition.podfile.set_arc_compatibility_flag? and
target.spec_consumers.any? { |consumer| consumer.requires_arc? }
ld_flags << ' -fobjc-arc'
end
ld_flags
end
# Configures the given Xcconfig according to the build settings of the
# given Specification.
#
# @param [Specification::Consumer] consumer
# The consumer of the specification.
#
# @param [Xcodeproj::Config] xcconfig
# The xcconfig to edit.
#
def self.add_spec_build_settings_to_xcconfig(consumer, xcconfig)
xcconfig.merge!(consumer.xcconfig)
xcconfig.libraries.merge(consumer.libraries)
xcconfig.frameworks.merge(consumer.frameworks)
xcconfig.weak_frameworks.merge(consumer.weak_frameworks)
add_developers_frameworks_if_needed(xcconfig)
end
# Configures the given Xcconfig with the the build settings for the given
# framework path.
#
# @param [Pathanme] framework_path
# The path of the framework.
#
# @param [Xcodeproj::Config] xcconfig
# The xcconfig to edit.
#
def self.add_framework_build_settings(framework_path, xcconfig, sandbox_root)
name = File.basename(framework_path, ".framework")
dirname = File.dirname(framework_path).sub(sandbox_root.to_s, '$(PODS_ROOT)')
build_settings = {
'OTHER_LDFLAGS' => "-framework #{name}",
'FRAMEWORK_SEARCH_PATHS' => quote([dirname])
}
xcconfig.merge!(build_settings)
end
# Configures the given Xcconfig with the the build settings for the given
# framework path.
#
# @param [Pathanme] framework_path
# The path of the framework.
#
# @param [Xcodeproj::Config] xcconfig
# The xcconfig to edit.
#
def self.add_library_build_settings(library_path, xcconfig, sandbox_root)
name = File.basename(library_path, ".a").sub(/\Alib/, '')
dirname = File.dirname(library_path).sub(sandbox_root.to_s, '$(PODS_ROOT)')
build_settings = {
'OTHER_LDFLAGS' => "-l#{name}",
'LIBRARY_SEARCH_PATHS' => quote([dirname])
}
xcconfig.merge!(build_settings)
end
# @return [Array<String>] The search paths for the developer frameworks.
#
DEVELOPER_FRAMEWORKS_SEARCH_PATHS = [
'$(inherited)',
'"$(SDKROOT)/Developer/Library/Frameworks"',
'"$(DEVELOPER_LIBRARY_DIR)/Frameworks"'
]
# Adds the search paths of the developer frameworks to the specification
# if needed. This is done because the `SenTestingKit` requires them and
# adding them to each specification which requires it is repetitive and
# error prone.
#
# @param [Xcodeproj::Config] xcconfig
# The xcconfig to edit.
#
# @return [void]
#
def self.add_developers_frameworks_if_needed(xcconfig)
if xcconfig.frameworks.include?('SenTestingKit')
search_paths = xcconfig.attributes['FRAMEWORK_SEARCH_PATHS'] ||= ''
DEVELOPER_FRAMEWORKS_SEARCH_PATHS.each do |search_path|
unless search_paths.include?(search_path)
search_paths << ' ' unless search_paths.empty?
search_paths << search_path
end
end
end
end
#---------------------------------------------------------------------#
end
end
end
end
......@@ -285,7 +285,7 @@ module Pod
#
def prepare_pods_project
UI.message "- Creating Pods project" do
@pods_project = Pod::Project.new(sandbox.project_path)
@pods_project = Pod::Project.new(sandbox)
if config.podfile_path
@pods_project.add_podfile(config.podfile_path)
end
......@@ -337,7 +337,7 @@ module Pod
def set_target_dependencies
aggregate_targets.each do |aggregate_target|
aggregate_target.pod_targets.each do |pod_target|
add_dependency(aggregate_target, pod_target)
aggregate_target.target.add_dependency(pod_target.target)
pod_target.dependencies.each do |dep|
unless dep == pod_target.pod_name
......@@ -346,30 +346,13 @@ module Pod
unless pod_dependency_target
puts "[BUG] DEP: #{dep}"
end
add_dependency(pod_target, pod_dependency_target)
pod_target.target.add_dependency(pod_dependency_target.target)
end
end
end
end
end
# TODO: tmp - move
#
def add_dependency(dependent_target, dependency_target)
container_proxy = pods_project.new(Xcodeproj::Project::PBXContainerItemProxy)
container_proxy.container_portal = pods_project.root_object.uuid
container_proxy.proxy_type = '1'
container_proxy.remote_global_id_string = dependency_target.target.uuid
container_proxy.remote_info = dependency_target.target.name
dependency = pods_project.new(Xcodeproj::Project::PBXTargetDependency)
dependency.target = dependency_target.target
dependency.targetProxy = container_proxy
dependent_target.target.dependencies << dependency
end
# Links the aggregate targets with all the dependent libraries.
#
# @note This is run in the integration step to ensure that targets
......
......@@ -35,7 +35,9 @@ module Pod
def install!
refresh_file_accessors
add_source_files_references
add_resources_references
add_frameworks_bundles
add_vendored_libraries
add_resources
link_headers
end
......@@ -71,13 +73,27 @@ module Pod
#
def add_source_files_references
UI.message "- Adding source files to Pods project" do
file_accessors.each do |file_accessor|
files = file_accessor.source_files
spec_name = file_accessor.spec.name
local = sandbox.local?(file_accessor.spec.root.name)
parent_group = local ? pods_project.local_pods : pods_project.pods
pods_project.add_file_references(files, spec_name, parent_group)
end
add_file_acessors_paths_to_pods_group(:source_files, :source_files)
end
end
# Adds the bundled frameworks to the Pods project
#
# @return [void]
#
def add_frameworks_bundles
UI.message "- Adding frameworks to Pods project" do
add_file_acessors_paths_to_pods_group(:vendored_frameworks, :frameworks_and_libraries)
end
end
# Adds the bundled libraries to the Pods project
#
# @return [void]
#
def add_vendored_libraries
UI.message "- Adding frameworks to Pods project" do
add_file_acessors_paths_to_pods_group(:vendored_libraries, :frameworks_and_libraries)
end
end
......@@ -88,16 +104,10 @@ module Pod
#
# @return [void]
#
def add_resources_references
def add_resources
UI.message "- Adding resources to Pods project" do
file_accessors.each do |file_accessor|
file_accessor.resources.each do |resources|
files = file_accessor.resources
spec_name = file_accessor.spec.name
parent_group = pods_project.resources
pods_project.add_file_references(files, spec_name, parent_group)
end
end
add_file_acessors_paths_to_pods_group(:resources, :resources)
add_file_acessors_paths_to_pods_group(:resource_bundle_files, :resources)
end
end
......@@ -138,6 +148,28 @@ module Pod
@file_accessors ||= libraries.map(&:file_accessors).flatten.compact
end
# Adds file references to the list of the paths returned by the file
# accessor with the given key to the given group of the Pods project.
#
# @param [Symbol] file_accessor_key
# The method of the file accessor which would return the list of
# the paths.
#
# @param [Symbol] group_key
# The key of the group of the Pods project.
#
# @return [void]
#
def add_file_acessors_paths_to_pods_group(file_accessor_key, group_key)
file_accessors.each do |file_accessor|
paths = file_accessor.send(file_accessor_key)
paths.each do |path|
group = pods_project.group_for_spec(file_accessor.spec.name, group_key)
pods_project.add_file_reference(path, group)
end
end
end
# Computes the destination sub-directory in the sandbox
#
# @param [Pathname] headers_sandbox
......
......@@ -229,12 +229,15 @@ module Pod
#
def used_files
files = [
file_accessors.map(&:source_files),
file_accessors.map(&:resources),
file_accessors.map(&:preserve_paths),
file_accessors.map(&:vendored_frameworks),
file_accessors.map(&:vendored_libraries),
file_accessors.map(&:resource_bundle_files),
file_accessors.map(&:license),
file_accessors.map(&:prefix_header),
file_accessors.map(&:preserve_paths),
file_accessors.map(&:readme),
file_accessors.map(&:license),
file_accessors.map(&:resources),
file_accessors.map(&:source_files),
]
files.flatten.compact.map{ |path| path.to_s }.uniq
......
......@@ -34,7 +34,7 @@ module Pod
def create_xcconfig_file
path = library.xcconfig_path
UI.message "- Generating xcconfig file at #{UI.path(path)}" do
gen = Generator::AggregateXCConfig.new(library)
gen = Generator::XCConfig::AggregateXCConfig.new(library)
gen.save_as(path)
library.xcconfig = gen.xcconfig
xcconfig_file_ref = add_file_to_support_group(path)
......@@ -90,7 +90,11 @@ module Pod
path = library.copy_resources_script_path
UI.message "- Generating copy resources script at #{UI.path(path)}" do
file_accessors = library.pod_targets.map(&:file_accessors).flatten
resources = file_accessors.map { |accessor| accessor.resources.flatten.map {|res| project.relativize(res)} }.flatten
resource_paths = file_accessors.map { |accessor| accessor.resources.flatten.map {|res| project.relativize(res)} }.flatten
resource_bundles = file_accessors.map { |accessor| accessor.resource_bundles.keys.map {|name| "${BUILD_DIR}/${CONFIGURATION}${EFFECTIVE_PLATFORM_NAME}/#{name}.bundle" } }.flatten
resources = []
resources.concat(resource_paths)
resources.concat(resource_bundles)
resources << bridge_support_file if bridge_support_file
generator = Generator::CopyResourcesScript.new(resources, library.platform)
generator.save_as(path)
......
......@@ -14,6 +14,7 @@ module Pod
UI.message "- Installing target `#{library.name}` #{library.platform}" do
add_target
add_files_to_build_phases
add_resources_bundle_targets
create_suport_files_group
create_xcconfig_file
create_prefix_header
......@@ -21,10 +22,10 @@ module Pod
end
end
#-----------------------------------------------------------------------#
private
#-----------------------------------------------------------------------#
# Adds the build files of the pods to the target and adds a reference to
# the frameworks of the Pods.
#
......@@ -49,20 +50,48 @@ module Pod
end
end
# Adds the resources of the Pods to the Pods project.
#
# @note The source files are grouped by Pod and in turn by subspec
# (recursively) in the resources group.
#
# @return [void]
#
def add_resources_bundle_targets
UI.message "- Adding resource bundles to Pods project" do
library.file_accessors.each do |file_accessor|
file_accessor.resource_bundles.each do |bundle_name, paths|
file_references = paths.map { |sf| project.file_reference(sf) }
group = project.group_for_spec(file_accessor.spec.name, :resources)
product_group = project.group_for_spec(file_accessor.spec.name, :resources)
bundle_target = project.new_resources_bundle(bundle_name, file_accessor.spec_consumer.platform_name, product_group)
bundle_target.add_resources(file_references)
target.add_dependency(bundle_target)
end
end
end
end
# Generates the contents of the xcconfig file and saves it to disk.
#
# @return [void]
#
def create_xcconfig_file
path = library.xcconfig_path
public_gen = Generator::PublicPodXCConfig.new(library)
public_gen = Generator::XCConfig::PublicPodXCConfig.new(library)
UI.message "- Generating public xcconfig file at #{UI.path(path)}" do
public_gen.save_as(path)
#
# TODO
add_file_to_support_group(path)
# relative_path = path.relative_path_from(sandbox.root)
# group = project.group_for_spec(library.root_spec.name, :support_files)
# group.new_file(relative_path)
end
path = library.xcconfig_private_path
private_gen = Generator::PrivatePodXCConfig.new(library, public_gen.xcconfig)
private_gen = Generator::XCConfig::PrivatePodXCConfig.new(library, public_gen.xcconfig)
UI.message "- Generating private xcconfig file at #{UI.path(path)}" do
private_gen.save_as(path)
xcconfig_file_ref = add_file_to_support_group(path)
......
......@@ -9,16 +9,20 @@ module Pod
#
class Project < Xcodeproj::Project
# @return [Pathname] the path of the xcodeproj file which stores the
# project.
# @return [Sandbox] the sandbox which returns the information about which
# Pods are local.
#
attr_reader :path
attr_reader :sandbox
# @param [Sandbox] sandbox @see #sandbox
#
def initialize(path = nil)
def initialize(sandbox)
super(nil) # Recreate the project from scratch for now.
@path = path
# TODO
raise unless sandbox.is_a?(Sandbox)
@sandbox = sandbox
@path = sandbox.project_path
@support_files_group = new_group('Targets Support Files')
@refs_by_absolute_path = {}
......@@ -107,25 +111,25 @@ module Pod
@resources ||= new_group('Resources')
end
# Adds a group as child to the `Pods` group namespacing subspecs.
#
# @param [String] spec_name
# The full name of the specification.
#
# @param [PBXGroup] root_group
# The group where to add the specification. Either `Pods` or `Local
# Pods`.
#
# @return [PBXGroup] the group for the spec with the given name.
#
def add_spec_group(spec_name, root_group)
current_group = root_group
group = nil
spec_name.split('/').each do |name|
group = current_group[name] || current_group.new_group(name)
current_group = group
def group_for_spec(spec_name, type = nil)
local = sandbox.local?(spec_name)
parent_group = local ? local_pods : pods
spec_group = add_spec_group(spec_name, parent_group)
if type
case type
when :source_files then sub_group = 'Source Files'
when :resources then sub_group = 'Resources'
when :frameworks_and_libraries then sub_group = 'Frameworks & Libraries'
when :support_files then sub_group = 'Support Files'
else raise "[BUG]"
end
spec_group.find_subpath(sub_group, true)
else
spec_group
end
group
end
#-------------------------------------------------------------------------#
......@@ -154,7 +158,7 @@ module Pod
# @return [void]
#
def add_file_references(absolute_path, spec_name, parent_group)
group = add_spec_group(spec_name, parent_group)
group = group_for_spec(spec_name, :source_files)
absolute_path.each do |file|
existing = file_reference(file)
unless existing
......@@ -165,6 +169,13 @@ module Pod
end
end
# TODO: missing customization for file reference
#
def add_file_reference(absolute_path, group)
ref = group.new_file(relativize(absolute_path))
@refs_by_absolute_path[absolute_path] = ref
end
# Returns the file reference for the given absolute file path.
#
# @param [Pathname,String] absolute_path
......@@ -204,6 +215,28 @@ module Pod
#
attr_reader :refs_by_absolute_path
# Returns a subgroup of the give group for the given spec creating it if
# needed.
#
# @param [String] spec_name
# The full name of the specification.
#
# @param [PBXGroup] root_group
# The group where to add the specification. Either `Pods` or `Local
# Pods`.
#
# @return [PBXGroup] the group for the spec with the given name.
#
def add_spec_group(spec_name, root_group)
current_group = root_group
group = nil
spec_name.split('/').each do |name|
group = current_group[name] || current_group.new_group(name)
current_group = group
end
group
end
#-------------------------------------------------------------------------#
end
......
......@@ -21,11 +21,15 @@ module Pod
#
attr_reader :spec_consumer
# @param [Sandbox::PathList] path_list @see path_list
# @param [Sandbox::PathList, Pathname] path_list @see path_list
# @param [Specification::Consumer] spec_consumer @see spec_consumer
#
def initialize(path_list, spec_consumer)
@path_list = path_list
if path_list.is_a?(PathList)
@path_list = path_list
else
@path_list = PathList.new(path_list)
end
@spec_consumer = spec_consumer
unless @spec_consumer
......@@ -36,7 +40,7 @@ module Pod
# @return [Pathname] the directory which contains the files of the Pod.
#
def root
path_list.root
path_list.root if path_list
end
# @return [Specification] the specification.
......@@ -54,7 +58,7 @@ module Pod
# @return [String] A string suitable for debugging.
#
def inspect
"<#{self.class} spec=#{spec.name} platform=#{platform_name} root=#{path_list.root}>"
"<#{self.class} spec=#{spec.name} platform=#{platform_name} root=#{root}>"
end
#-----------------------------------------------------------------------#
......@@ -102,6 +106,40 @@ module Pod
paths_for_attribute(:preserve_paths, true)
end
# @return [Array<Pathname>] The paths of the framework bundles that come
# shipped with the Pod.
#
def vendored_frameworks
paths_for_attribute(:vendored_frameworks, true)
end
# @return [Array<Pathname>] The paths of the library bundles that come
# shipped with the Pod.
#
def vendored_libraries
paths_for_attribute(:vendored_libraries)
end
# @return [Hash{String => Array<Pathname>}] A hash that describes the
# resource bundles of the Pod. The keys reppresent the name of
# the bundle while the values the path of the resources.
#
def resource_bundles
result = {}
spec_consumer.resource_bundles.each do |name, file_patterns|
paths = expanded_paths(file_patterns, :include_dirs => true)
result[name] = paths
end
result
end
# @return [Array<Pathname>] The paths of the files which should be
# included in resources bundles by the Pod.
#
def resource_bundle_files
resource_bundles.values.flatten
end
# @return [Pathname] The of the prefix header file of the specification.
#
def prefix_header
......@@ -159,8 +197,6 @@ module Pod
#
# @return [String] the glob pattern.
#
# @todo Move to the cocoapods-core so it appears in the docs?
#
def glob_for_attribute(attrbute)
globs = {
:source_files => '*.{h,hpp,hh,m,mm,c,cpp}'.freeze,
......@@ -185,8 +221,6 @@ module Pod
#
# @return [Array<Pathname>] A list of the paths.
#
# @todo Implement case insensitive search
#
def expanded_paths(patterns, options = {})
return [] if patterns.empty?
result = []
......
......@@ -29,6 +29,10 @@ install_resource()
echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\""
xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd"
;;
/*)
echo "$1"
echo "$1" >> "$RESOURCES_TO_COPY"
;;
*)
echo "${PODS_ROOT}/$1"
echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY"
......
......@@ -5,11 +5,13 @@ File References:
- SystemConfiguration.framework
- Pods:
- JSONKit:
- JSONKit.h
- JSONKit.m
- Source Files:
- JSONKit.h
- JSONKit.m
- Reachability:
- Reachability.h
- Reachability.m
- Source Files:
- Reachability.h
- Reachability.m
- Products:
- libPods-JSONKit.a
- libPods-Reachability.a
......
......@@ -37,17 +37,21 @@ Downloading dependencies
Generating Pods project
- Creating Pods project
- Adding source files to Pods project
- Adding frameworks to Pods project
- Adding frameworks to Pods project
- Adding resources to Pods project
- Linking headers
- Installing libraries
- Installing target `Pods-JSONKit` iOS 6.0
- Adding Build files
- Adding resource bundles to Pods project
- Generating public xcconfig file at `Pods/Pods-JSONKit.xcconfig`
- Generating private xcconfig file at `Pods/Pods-JSONKit-Private.xcconfig`
- Generating prefix header at `Pods/Pods-JSONKit-prefix.pch`
- Generating dummy source file at `Pods/Pods-JSONKit-dummy.m`
- Installing target `Pods-Reachability` iOS 6.0
- Adding Build files
- Adding resource bundles to Pods project
- Generating public xcconfig file at `Pods/Pods-Reachability.xcconfig`
- Generating private xcconfig file at `Pods/Pods-Reachability-Private.xcconfig`
- Generating prefix header at `Pods/Pods-Reachability-prefix.pch`
......
......@@ -29,6 +29,10 @@ install_resource()
echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\""
xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd"
;;
/*)
echo "$1"
echo "$1" >> "$RESOURCES_TO_COPY"
;;
*)
echo "${PODS_ROOT}/$1"
echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY"
......
......@@ -29,6 +29,10 @@ install_resource()
echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\""
xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd"
;;
/*)
echo "$1"
echo "$1" >> "$RESOURCES_TO_COPY"
;;
*)
echo "${PODS_ROOT}/$1"
echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY"
......
......@@ -5,8 +5,11 @@ File References:
- SystemConfiguration.framework
- Pods:
- Reachability:
- Reachability.h
- Reachability.m
- Source Files:
- Reachability.h
- Reachability.m
- Reachability.h
- Reachability.m
- Products:
- libPods-SampleApp_1-Reachability.a
- libPods-SampleApp_2-Reachability.a
......
......@@ -21,9 +21,9 @@ Downloading dependencies
true
$ /usr/bin/git rev-list --max-count=1 v3.1.0
f7176f4798d068d233dca5223ae4bd9c8059e830
$ /usr/bin/git init
Initialized empty Git repository in ROOT/tmp/install_custom_workspace/Pods/Reachability/.git/
$ /usr/bin/git remote add origin 'CACHES_DIR/GitHub/48f11286750afa2e2eb80564e288f42eed7cbab6'
$ /usr/bin/git clone 'CACHES_DIR/GitHub/48f11286750afa2e2eb80564e288f42eed7cbab6' 'ROOT/tmp/install_custom_workspace/Pods/Reachability'
Cloning into 'ROOT/tmp/install_custom_workspace/Pods/Reachability'...
done.
$ /usr/bin/git fetch origin tags/v3.1.0 2>&1
From CACHES_DIR/GitHub/48f11286750afa2e2eb80564e288f42eed7cbab6
* tag v3.1.0 -> FETCH_HEAD
......@@ -36,17 +36,21 @@ Downloading dependencies
Generating Pods project
- Creating Pods project
- Adding source files to Pods project
- Adding frameworks to Pods project
- Adding frameworks to Pods project
- Adding resources to Pods project
- Linking headers
- Installing libraries
- Installing target `Pods-SampleApp_1-Reachability` iOS 6.0
- Adding Build files
- Adding resource bundles to Pods project
- Generating public xcconfig file at `Pods/Pods-SampleApp_1-Reachability.xcconfig`
- Generating private xcconfig file at `Pods/Pods-SampleApp_1-Reachability-Private.xcconfig`
- Generating prefix header at `Pods/Pods-SampleApp_1-Reachability-prefix.pch`
- Generating dummy source file at `Pods/Pods-SampleApp_1-Reachability-dummy.m`
- Installing target `Pods-SampleApp_2-Reachability` iOS 6.0
- Adding Build files
- Adding resource bundles to Pods project
- Generating public xcconfig file at `Pods/Pods-SampleApp_2-Reachability.xcconfig`
- Generating private xcconfig file at `Pods/Pods-SampleApp_2-Reachability-Private.xcconfig`
- Generating prefix header at `Pods/Pods-SampleApp_2-Reachability-prefix.pch`
......
......@@ -29,6 +29,10 @@ install_resource()
echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\""
xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd"
;;
/*)
echo "$1"
echo "$1" >> "$RESOURCES_TO_COPY"
;;
*)
echo "${PODS_ROOT}/$1"
echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY"
......
......@@ -5,11 +5,13 @@ File References:
- Pods:
- PodTest:
- subspec_1:
- subspec_1.h
- subspec_1.m
- Source Files:
- subspec_1.h
- subspec_1.m
- subspec_2:
- subspec_2.h
- subspec_2.m
- Source Files:
- subspec_2.h
- subspec_2.m
- Products:
- libPods-PodTest.a
- libPods.a
......
......@@ -25,11 +25,14 @@ Downloading dependencies
Generating Pods project
- Creating Pods project
- Adding source files to Pods project
- Adding frameworks to Pods project
- Adding frameworks to Pods project
- Adding resources to Pods project
- Linking headers
- Installing libraries
- Installing target `Pods-PodTest` iOS 4.3
- Adding Build files
- Adding resource bundles to Pods project
- Generating public xcconfig file at `Pods/Pods-PodTest.xcconfig`
- Generating private xcconfig file at `Pods/Pods-PodTest-Private.xcconfig`
- Generating prefix header at `Pods/Pods-PodTest-prefix.pch`
......
......@@ -29,6 +29,10 @@ install_resource()
echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\""
xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd"
;;
/*)
echo "$1"
echo "$1" >> "$RESOURCES_TO_COPY"
;;
*)
echo "${PODS_ROOT}/$1"
echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY"
......
......@@ -5,8 +5,9 @@ File References:
- SystemConfiguration.framework
- Local Pods:
- Reachability:
- Reachability.h
- Reachability.m
- Source Files:
- Reachability.h
- Reachability.m
- Products:
- libPods-Reachability.a
- libPods.a
......
......@@ -19,11 +19,14 @@ Downloading dependencies
Generating Pods project
- Creating Pods project
- Adding source files to Pods project
- Adding frameworks to Pods project
- Adding frameworks to Pods project
- Adding resources to Pods project
- Linking headers
- Installing libraries
- Installing target `Pods-Reachability` iOS 4.3
- Adding Build files
- Adding resource bundles to Pods project
- Generating public xcconfig file at `Pods/Pods-Reachability.xcconfig`
- Generating private xcconfig file at `Pods/Pods-Reachability-Private.xcconfig`
- Generating prefix header at `Pods/Pods-Reachability-prefix.pch`
......
......@@ -29,6 +29,10 @@ install_resource()
echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\""
xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd"
;;
/*)
echo "$1"
echo "$1" >> "$RESOURCES_TO_COPY"
;;
*)
echo "${PODS_ROOT}/$1"
echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY"
......
......@@ -29,6 +29,10 @@ install_resource()
echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\""
xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd"
;;
/*)
echo "$1"
echo "$1" >> "$RESOURCES_TO_COPY"
;;
*)
echo "${PODS_ROOT}/$1"
echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY"
......
......@@ -29,6 +29,10 @@ install_resource()
echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\""
xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd"
;;
/*)
echo "$1"
echo "$1" >> "$RESOURCES_TO_COPY"
;;
*)
echo "${PODS_ROOT}/$1"
echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY"
......
......@@ -5,11 +5,17 @@ File References:
- SystemConfiguration.framework
- Pods:
- Reachability:
- Reachability.h
- Reachability.m
- Source Files:
- Reachability.h
- Reachability.m
- Reachability.h
- Reachability.m
- JSONKit:
- JSONKit.h
- JSONKit.m
- Source Files:
- JSONKit.h
- JSONKit.m
- JSONKit.h
- JSONKit.m
- Products:
- libPods-Reachability.a
- libPods-SampleApp_2-JSONKit.a
......
......@@ -39,9 +39,9 @@ Downloading dependencies
true
$ /usr/bin/git rev-list --max-count=1 v3.1.0
f7176f4798d068d233dca5223ae4bd9c8059e830
$ /usr/bin/git init
Initialized empty Git repository in ROOT/tmp/install_multiple_targets/Pods/Reachability/.git/
$ /usr/bin/git remote add origin 'CACHES_DIR/GitHub/48f11286750afa2e2eb80564e288f42eed7cbab6'
$ /usr/bin/git clone 'CACHES_DIR/GitHub/48f11286750afa2e2eb80564e288f42eed7cbab6' 'ROOT/tmp/install_multiple_targets/Pods/Reachability'
Cloning into 'ROOT/tmp/install_multiple_targets/Pods/Reachability'...
done.
$ /usr/bin/git fetch origin tags/v3.1.0 2>&1
From CACHES_DIR/GitHub/48f11286750afa2e2eb80564e288f42eed7cbab6
* tag v3.1.0 -> FETCH_HEAD
......@@ -54,29 +54,35 @@ Downloading dependencies
Generating Pods project
- Creating Pods project
- Adding source files to Pods project
- Adding frameworks to Pods project
- Adding frameworks to Pods project
- Adding resources to Pods project
- Linking headers
- Installing libraries
- Installing target `Pods-Reachability` iOS 6.0
- Adding Build files
- Adding resource bundles to Pods project
- Generating public xcconfig file at `Pods/Pods-Reachability.xcconfig`
- Generating private xcconfig file at `Pods/Pods-Reachability-Private.xcconfig`
- Generating prefix header at `Pods/Pods-Reachability-prefix.pch`
- Generating dummy source file at `Pods/Pods-Reachability-dummy.m`
- Installing target `Pods-SampleApp_2-JSONKit` iOS 6.0
- Adding Build files
- Adding resource bundles to Pods project
- Generating public xcconfig file at `Pods/Pods-SampleApp_2-JSONKit.xcconfig`
- Generating private xcconfig file at `Pods/Pods-SampleApp_2-JSONKit-Private.xcconfig`
- Generating prefix header at `Pods/Pods-SampleApp_2-JSONKit-prefix.pch`
- Generating dummy source file at `Pods/Pods-SampleApp_2-JSONKit-dummy.m`
- Installing target `Pods-SampleApp_2-Reachability` iOS 6.0
- Adding Build files
- Adding resource bundles to Pods project
- Generating public xcconfig file at `Pods/Pods-SampleApp_2-Reachability.xcconfig`
- Generating private xcconfig file at `Pods/Pods-SampleApp_2-Reachability-Private.xcconfig`
- Generating prefix header at `Pods/Pods-SampleApp_2-Reachability-prefix.pch`
- Generating dummy source file at `Pods/Pods-SampleApp_2-Reachability-dummy.m`
- Installing target `Pods-test-JSONKit` iOS 6.0
- Adding Build files
- Adding resource bundles to Pods project
- Generating public xcconfig file at `Pods/Pods-test-JSONKit.xcconfig`
- Generating private xcconfig file at `Pods/Pods-test-JSONKit-Private.xcconfig`
- Generating prefix header at `Pods/Pods-test-JSONKit-prefix.pch`
......
......@@ -29,6 +29,10 @@ install_resource()
echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\""
xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd"
;;
/*)
echo "$1"
echo "$1" >> "$RESOURCES_TO_COPY"
;;
*)
echo "${PODS_ROOT}/$1"
echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY"
......
......@@ -5,8 +5,9 @@ File References:
- SystemConfiguration.framework
- Pods:
- Reachability:
- Reachability.h
- Reachability.m
- Source Files:
- Reachability.h
- Reachability.m
- Products:
- libPods-Reachability.a
- libPods.a
......
......@@ -18,9 +18,9 @@ Downloading dependencies
true
$ /usr/bin/git rev-list --max-count=1 v3.1.0
f7176f4798d068d233dca5223ae4bd9c8059e830
$ /usr/bin/git init
Initialized empty Git repository in ROOT/tmp/install_new/Pods/Reachability/.git/
$ /usr/bin/git remote add origin 'CACHES_DIR/GitHub/48f11286750afa2e2eb80564e288f42eed7cbab6'
$ /usr/bin/git clone 'CACHES_DIR/GitHub/48f11286750afa2e2eb80564e288f42eed7cbab6' 'ROOT/tmp/install_new/Pods/Reachability'
Cloning into 'ROOT/tmp/install_new/Pods/Reachability'...
done.
$ /usr/bin/git fetch origin tags/v3.1.0 2>&1
From CACHES_DIR/GitHub/48f11286750afa2e2eb80564e288f42eed7cbab6
* tag v3.1.0 -> FETCH_HEAD
......@@ -33,11 +33,14 @@ Downloading dependencies
Generating Pods project
- Creating Pods project
- Adding source files to Pods project
- Adding frameworks to Pods project
- Adding frameworks to Pods project
- Adding resources to Pods project
- Linking headers
- Installing libraries
- Installing target `Pods-Reachability` iOS 6.0
- Adding Build files
- Adding resource bundles to Pods project
- Generating public xcconfig file at `Pods/Pods-Reachability.xcconfig`
- Generating private xcconfig file at `Pods/Pods-Reachability-Private.xcconfig`
- Generating prefix header at `Pods/Pods-Reachability-prefix.pch`
......
......@@ -29,6 +29,10 @@ install_resource()
echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\""
xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd"
;;
/*)
echo "$1"
echo "$1" >> "$RESOURCES_TO_COPY"
;;
*)
echo "${PODS_ROOT}/$1"
echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY"
......
......@@ -5,8 +5,9 @@ File References:
- SystemConfiguration.framework
- Pods:
- Reachability:
- Reachability.h
- Reachability.m
- Source Files:
- Reachability.h
- Reachability.m
- Products:
- libPods-Reachability.a
- libPods.a
......
......@@ -18,9 +18,9 @@ Downloading dependencies
true
$ /usr/bin/git rev-list --max-count=1 v3.1.0
f7176f4798d068d233dca5223ae4bd9c8059e830
$ /usr/bin/git init
Initialized empty Git repository in ROOT/tmp/install_podfile_callbacks/Pods/Reachability/.git/
$ /usr/bin/git remote add origin 'CACHES_DIR/GitHub/48f11286750afa2e2eb80564e288f42eed7cbab6'
$ /usr/bin/git clone 'CACHES_DIR/GitHub/48f11286750afa2e2eb80564e288f42eed7cbab6' 'ROOT/tmp/install_podfile_callbacks/Pods/Reachability'
Cloning into 'ROOT/tmp/install_podfile_callbacks/Pods/Reachability'...
done.
$ /usr/bin/git fetch origin tags/v3.1.0 2>&1
From CACHES_DIR/GitHub/48f11286750afa2e2eb80564e288f42eed7cbab6
* tag v3.1.0 -> FETCH_HEAD
......@@ -34,11 +34,14 @@ Downloading dependencies
Generating Pods project
- Creating Pods project
- Adding source files to Pods project
- Adding frameworks to Pods project
- Adding frameworks to Pods project
- Adding resources to Pods project
- Linking headers
- Installing libraries
- Installing target `Pods-Reachability` iOS 6.0
- Adding Build files
- Adding resource bundles to Pods project
- Generating public xcconfig file at `Pods/Pods-Reachability.xcconfig`
- Generating private xcconfig file at `Pods/Pods-Reachability-Private.xcconfig`
- Generating prefix header at `Pods/Pods-Reachability-prefix.pch`
......
......@@ -29,6 +29,10 @@ install_resource()
echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\""
xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd"
;;
/*)
echo "$1"
echo "$1" >> "$RESOURCES_TO_COPY"
;;
*)
echo "${PODS_ROOT}/$1"
echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY"
......
......@@ -5,8 +5,9 @@ File References:
- SystemConfiguration.framework
- Pods:
- Reachability:
- Reachability.h
- Reachability.m
- Source Files:
- Reachability.h
- Reachability.m
- Products:
- libPods-Reachability.a
- libPods.a
......
......@@ -21,9 +21,9 @@ Downloading dependencies
true
$ /usr/bin/git rev-list --max-count=1 v3.1.0
f7176f4798d068d233dca5223ae4bd9c8059e830
$ /usr/bin/git init
Initialized empty Git repository in ROOT/tmp/install_podspec/Pods/Reachability/.git/
$ /usr/bin/git remote add origin 'CACHES_DIR/GitHub/48f11286750afa2e2eb80564e288f42eed7cbab6'
$ /usr/bin/git clone 'CACHES_DIR/GitHub/48f11286750afa2e2eb80564e288f42eed7cbab6' 'ROOT/tmp/install_podspec/Pods/Reachability'
Cloning into 'ROOT/tmp/install_podspec/Pods/Reachability'...
done.
$ /usr/bin/git fetch origin tags/v3.1.0 2>&1
From CACHES_DIR/GitHub/48f11286750afa2e2eb80564e288f42eed7cbab6
* tag v3.1.0 -> FETCH_HEAD
......@@ -36,11 +36,14 @@ Downloading dependencies
Generating Pods project
- Creating Pods project
- Adding source files to Pods project
- Adding frameworks to Pods project
- Adding frameworks to Pods project
- Adding resources to Pods project
- Linking headers
- Installing libraries
- Installing target `Pods-Reachability` iOS 6.0
- Adding Build files
- Adding resource bundles to Pods project
- Generating public xcconfig file at `Pods/Pods-Reachability.xcconfig`
- Generating private xcconfig file at `Pods/Pods-Reachability-Private.xcconfig`
- Generating prefix header at `Pods/Pods-Reachability-prefix.pch`
......
......@@ -29,6 +29,10 @@ install_resource()
echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\""
xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd"
;;
/*)
echo "$1"
echo "$1" >> "$RESOURCES_TO_COPY"
;;
*)
echo "${PODS_ROOT}/$1"
echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY"
......
......@@ -5,8 +5,9 @@ File References:
- SystemConfiguration.framework
- Pods:
- Reachability:
- Reachability.h
- Reachability.m
- Source Files:
- Reachability.h
- Reachability.m
- Products:
- libPods-Reachability.a
- libPods.a
......
......@@ -23,11 +23,14 @@ Downloading dependencies
Generating Pods project
- Creating Pods project
- Adding source files to Pods project
- Adding frameworks to Pods project
- Adding frameworks to Pods project
- Adding resources to Pods project
- Linking headers
- Installing libraries
- Installing target `Pods-Reachability` iOS 6.0
- Adding Build files
- Adding resource bundles to Pods project
- Generating public xcconfig file at `Pods/Pods-Reachability.xcconfig`
- Generating private xcconfig file at `Pods/Pods-Reachability-Private.xcconfig`
- Generating prefix header at `Pods/Pods-Reachability-prefix.pch`
......
......@@ -29,6 +29,10 @@ install_resource()
echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\""
xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd"
;;
/*)
echo "$1"
echo "$1" >> "$RESOURCES_TO_COPY"
;;
*)
echo "${PODS_ROOT}/$1"
echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY"
......
......@@ -5,10 +5,11 @@ File References:
- SystemConfiguration.framework
- Pods:
- Reachability:
- Reachability.h
- Reachability.m
- TestClass.h
- TestClass.m
- Source Files:
- Reachability.h
- Reachability.m
- TestClass.h
- TestClass.m
- Products:
- libPods-Reachability.a
- libPods.a
......
......@@ -21,9 +21,9 @@ Downloading dependencies
true
$ /usr/bin/git rev-list --max-count=1 v3.1.0
f7176f4798d068d233dca5223ae4bd9c8059e830
$ /usr/bin/git init
Initialized empty Git repository in ROOT/tmp/install_spec_callbacks/Pods/Reachability/.git/
$ /usr/bin/git remote add origin 'CACHES_DIR/GitHub/48f11286750afa2e2eb80564e288f42eed7cbab6'
$ /usr/bin/git clone 'CACHES_DIR/GitHub/48f11286750afa2e2eb80564e288f42eed7cbab6' 'ROOT/tmp/install_spec_callbacks/Pods/Reachability'
Cloning into 'ROOT/tmp/install_spec_callbacks/Pods/Reachability'...
done.
$ /usr/bin/git fetch origin tags/v3.1.0 2>&1
From CACHES_DIR/GitHub/48f11286750afa2e2eb80564e288f42eed7cbab6
* tag v3.1.0 -> FETCH_HEAD
......@@ -37,11 +37,14 @@ Downloading dependencies
Generating Pods project
- Creating Pods project
- Adding source files to Pods project
- Adding frameworks to Pods project
- Adding frameworks to Pods project
- Adding resources to Pods project
- Linking headers
- Installing libraries
- Installing target `Pods-Reachability` iOS 6.0
- Adding Build files
- Adding resource bundles to Pods project
- Generating public xcconfig file at `Pods/Pods-Reachability.xcconfig`
- Generating private xcconfig file at `Pods/Pods-Reachability-Private.xcconfig`
- Generating prefix header at `Pods/Pods-Reachability-prefix.pch`
......
......@@ -29,6 +29,10 @@ install_resource()
echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\""
xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd"
;;
/*)
echo "$1"
echo "$1" >> "$RESOURCES_TO_COPY"
;;
*)
echo "${PODS_ROOT}/$1"
echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY"
......
......@@ -29,6 +29,10 @@ install_resource()
echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\""
xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd"
;;
/*)
echo "$1"
echo "$1" >> "$RESOURCES_TO_COPY"
;;
*)
echo "${PODS_ROOT}/$1"
echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY"
......
......@@ -6,11 +6,13 @@ File References:
- Pods:
- PodTest:
- subspec_1:
- subspec_1.h
- subspec_1.m
- Source Files:
- subspec_1.h
- subspec_1.m
- subspec_2:
- subspec_2.h
- subspec_2.m
- Source Files:
- subspec_2.h
- subspec_2.m
- Products:
- libPods-OS X App-PodTest.a
- libPods-iOS App-PodTest.a
......
......@@ -31,17 +31,21 @@ Downloading dependencies
Generating Pods project
- Creating Pods project
- Adding source files to Pods project
- Adding frameworks to Pods project
- Adding frameworks to Pods project
- Adding resources to Pods project
- Linking headers
- Installing libraries
- Installing target `Pods-OS X App-PodTest` OS X 10.6
- Adding Build files
- Adding resource bundles to Pods project
- Generating public xcconfig file at `Pods/Pods-OS X App-PodTest.xcconfig`
- Generating private xcconfig file at `Pods/Pods-OS X App-PodTest-Private.xcconfig`
- Generating prefix header at `Pods/Pods-OS X App-PodTest-prefix.pch`
- Generating dummy source file at `Pods/Pods-OS X App-PodTest-dummy.m`
- Installing target `Pods-iOS App-PodTest` iOS 4.3
- Adding Build files
- Adding resource bundles to Pods project
- Generating public xcconfig file at `Pods/Pods-iOS App-PodTest.xcconfig`
- Generating private xcconfig file at `Pods/Pods-iOS App-PodTest-Private.xcconfig`
- Generating prefix header at `Pods/Pods-iOS App-PodTest-prefix.pch`
......
......@@ -29,6 +29,10 @@ install_resource()
echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\""
xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd"
;;
/*)
echo "$1"
echo "$1" >> "$RESOURCES_TO_COPY"
;;
*)
echo "${PODS_ROOT}/$1"
echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY"
......
......@@ -5,8 +5,9 @@ File References:
- SystemConfiguration.framework
- Pods:
- Reachability:
- Reachability.h
- Reachability.m
- Source Files:
- Reachability.h
- Reachability.m
- Products:
- libPods-Reachability.a
- libPods.a
......
......@@ -21,9 +21,9 @@ Downloading dependencies
true
$ /usr/bin/git rev-list --max-count=1 v3.1.0
f7176f4798d068d233dca5223ae4bd9c8059e830
$ /usr/bin/git init
Initialized empty Git repository in ROOT/tmp/update/Pods/Reachability/.git/
$ /usr/bin/git remote add origin 'CACHES_DIR/GitHub/48f11286750afa2e2eb80564e288f42eed7cbab6'
$ /usr/bin/git clone 'CACHES_DIR/GitHub/48f11286750afa2e2eb80564e288f42eed7cbab6' 'ROOT/tmp/update/Pods/Reachability'
Cloning into 'ROOT/tmp/update/Pods/Reachability'...
done.
$ /usr/bin/git fetch origin tags/v3.1.0 2>&1
From CACHES_DIR/GitHub/48f11286750afa2e2eb80564e288f42eed7cbab6
* tag v3.1.0 -> FETCH_HEAD
......@@ -36,11 +36,14 @@ Downloading dependencies
Generating Pods project
- Creating Pods project
- Adding source files to Pods project
- Adding frameworks to Pods project
- Adding frameworks to Pods project
- Adding resources to Pods project
- Linking headers
- Installing libraries
- Installing target `Pods-Reachability` iOS 6.0
- Adding Build files
- Adding resource bundles to Pods project
- Generating public xcconfig file at `Pods/Pods-Reachability.xcconfig`
- Generating private xcconfig file at `Pods/Pods-Reachability-Private.xcconfig`
- Generating prefix header at `Pods/Pods-Reachability-prefix.pch`
......
require File.expand_path('../../../../spec_helper', __FILE__)
module Pod
describe Generator::AggregateXCConfig do
before do
@spec = fixture_spec('banana-lib/BananaLib.podspec')
@consumer = @spec.consumer(:ios)
target_definition = Podfile::TargetDefinition.new('Pods', nil)
@target = AggregateTarget.new(target_definition, config.sandbox)
@target.client_root = config.sandbox.root.dirname
@target.stubs(:platform).returns(:ios)
@pod_target = PodTarget.new([@spec], target_definition, config.sandbox)
@pod_target.stubs(:platform).returns(:ios)
@pod_target.stubs(:spec_consumers).returns([@consumer])
@target.pod_targets = [@pod_target]
@generator = Generator::AggregateXCConfig.new(@target)
module Generator
module XCConfig
describe AggregateXCConfig do
before do
@spec = fixture_spec('banana-lib/BananaLib.podspec')
@consumer = @spec.consumer(:ios)
target_definition = Podfile::TargetDefinition.new('Pods', nil)
@target = AggregateTarget.new(target_definition, config.sandbox)
@target.client_root = config.sandbox.root.dirname
@target.stubs(:platform).returns(:ios)
@pod_target = PodTarget.new([@spec], target_definition, config.sandbox)
@pod_target.stubs(:platform).returns(:ios)
@pod_target.stubs(:spec_consumers).returns([@consumer])
@target.pod_targets = [@pod_target]
@generator = AggregateXCConfig.new(@target)
end
it "returns the path of the pods root relative to the user project" do
@generator.target.relative_pods_root.should == '${SRCROOT}/Pods'
end
#-----------------------------------------------------------------------#
before do
@podfile = Podfile.new
@target.target_definition.stubs(:podfile).returns(@podfile)
@xcconfig = @generator.generate
end
it "generates the xcconfig" do
@xcconfig.class.should == Xcodeproj::Config
end
it "configures the project to load all members that implement Objective-c classes or categories from the static library" do
@xcconfig.to_hash['OTHER_LDFLAGS'].should.include '-ObjC'
end
it 'does not add the -fobjc-arc to OTHER_LDFLAGS by default as Xcode 4.3.2 does not support it' do
@consumer.stubs(:requires_arc?).returns(true)
@xcconfig.to_hash['OTHER_LDFLAGS'].should.not.include("-fobjc-arc")
end
it 'adds the -fobjc-arc to OTHER_LDFLAGS if any pods require arc and the podfile explicitly requires it' do
@podfile.stubs(:set_arc_compatibility_flag?).returns(true)
@consumer.stubs(:requires_arc?).returns(true)
@xcconfig = @generator.generate
@xcconfig.to_hash['OTHER_LDFLAGS'].split(" ").should.include("-fobjc-arc")
end
it "sets the PODS_ROOT build variable" do
@xcconfig.to_hash['PODS_ROOT'].should == '${SRCROOT}/Pods'
end
it 'adds the sandbox public headers search paths to the xcconfig, with quotes' do
expected = "\"#{config.sandbox.public_headers.search_paths.join('" "')}\""
@xcconfig.to_hash['HEADER_SEARCH_PATHS'].should == expected
end
it 'adds the COCOAPODS macro definition' do
@xcconfig.to_hash['GCC_PREPROCESSOR_DEFINITIONS'].should.include 'COCOAPODS=1'
end
it 'inherits the parent GCC_PREPROCESSOR_DEFINITIONS value' do
@xcconfig.to_hash['GCC_PREPROCESSOR_DEFINITIONS'].should.include '$(inherited)'
end
#-----------------------------------------------------------------------#
before do
@path = temporary_directory + 'sample.xcconfig'
@generator.save_as(@path)
end
it "saves the xcconfig" do
generated = Xcodeproj::Config.new(@path)
generated.class.should == Xcodeproj::Config
end
end
end
it "returns the sandbox" do
@generator.sandbox.class.should == Sandbox
end
it "returns the path of the pods root relative to the user project" do
@generator.target.relative_pods_root.should == '${SRCROOT}/Pods'
end
#-----------------------------------------------------------------------#
before do
@podfile = Podfile.new
@target.target_definition.stubs(:podfile).returns(@podfile)
@xcconfig = @generator.generate
end
it "generates the xcconfig" do
@xcconfig.class.should == Xcodeproj::Config
end
it "configures the project to load all members that implement Objective-c classes or categories from the static library" do
@xcconfig.to_hash['OTHER_LDFLAGS'].should.include '-ObjC'
end
it 'does not add the -fobjc-arc to OTHER_LDFLAGS by default as Xcode 4.3.2 does not support it' do
@consumer.stubs(:requires_arc?).returns(true)
@xcconfig.to_hash['OTHER_LDFLAGS'].should.not.include("-fobjc-arc")
end
it 'adds the -fobjc-arc to OTHER_LDFLAGS if any pods require arc and the podfile explicitly requires it' do
@podfile.stubs(:set_arc_compatibility_flag?).returns(true)
@consumer.stubs(:requires_arc?).returns(true)
@xcconfig = @generator.generate
@xcconfig.to_hash['OTHER_LDFLAGS'].split(" ").should.include("-fobjc-arc")
end
it "sets the PODS_ROOT build variable" do
@xcconfig.to_hash['PODS_ROOT'].should == '${SRCROOT}/Pods'
end
it 'adds the sandbox public headers search paths to the xcconfig, with quotes' do
expected = "\"#{config.sandbox.public_headers.search_paths.join('" "')}\""
@xcconfig.to_hash['HEADER_SEARCH_PATHS'].should == expected
end
it 'adds the COCOAPODS macro definition' do
@xcconfig.to_hash['GCC_PREPROCESSOR_DEFINITIONS'].should.include 'COCOAPODS=1'
end
it 'inherits the parent GCC_PREPROCESSOR_DEFINITIONS value' do
@xcconfig.to_hash['GCC_PREPROCESSOR_DEFINITIONS'].should.include '$(inherited)'
end
#-----------------------------------------------------------------------#
before do
@path = temporary_directory + 'sample.xcconfig'
@generator.save_as(@path)
end
it "saves the xcconfig" do
generated = Xcodeproj::Config.new(@path)
generated.class.should == Xcodeproj::Config
end
end
end
require File.expand_path('../../../../spec_helper', __FILE__)
module Pod
describe Generator::PrivatePodXCConfig do
describe "in general" do
before do
@spec = fixture_spec('banana-lib/BananaLib.podspec')
@consumer = @spec.consumer(:ios)
target_definition = Podfile::TargetDefinition.new('Pods', nil)
@pod_target = PodTarget.new([@spec], target_definition, config.sandbox)
@pod_target.stubs(:platform).returns(:ios)
public_xcconfig = Xcodeproj::Config.new({"OTHER_LDFLAGS"=>"-framework SystemConfiguration"})
@generator = Generator::PrivatePodXCConfig.new(@pod_target, public_xcconfig)
end
it "returns the sandbox" do
@generator.sandbox.class.should == Sandbox
end
before do
@podfile = Podfile.new
@pod_target.target_definition.stubs(:podfile).returns(@podfile)
@xcconfig = @generator.generate
end
it "generates the xcconfig" do
@xcconfig.class.should == Xcodeproj::Config
end
it "configures the project to load all members that implement Objective-c classes or categories from the static library" do
@xcconfig.to_hash['OTHER_LDFLAGS'].should.include '-ObjC'
end
it 'does not add the -fobjc-arc to OTHER_LDFLAGS by default as Xcode 4.3.2 does not support it' do
@consumer.stubs(:requires_arc?).returns(true)
@xcconfig.to_hash['OTHER_LDFLAGS'].should.not.include("-fobjc-arc")
end
it 'adds the -fobjc-arc to OTHER_LDFLAGS if any pods require arc and the podfile explicitly requires it' do
@podfile.stubs(:set_arc_compatibility_flag?).returns(true)
@consumer.stubs(:requires_arc?).returns(true)
@xcconfig = @generator.generate
@xcconfig.to_hash['OTHER_LDFLAGS'].split(" ").should.include("-fobjc-arc")
end
it "sets the PODS_ROOT build variable" do
@xcconfig.to_hash['PODS_ROOT'].should.not == nil
end
it 'adds the library build headers and public headers search paths to the xcconfig, with quotes' do
private_headers = "\"#{@pod_target.build_headers.search_paths.join('" "')}\""
public_headers = "\"#{config.sandbox.public_headers.search_paths.join('" "')}\""
@xcconfig.to_hash['HEADER_SEARCH_PATHS'].should.include private_headers
@xcconfig.to_hash['HEADER_SEARCH_PATHS'].should.include public_headers
end
module Generator
module XCConfig
describe PrivatePodXCConfig do
describe "in general" do
before do
@spec = fixture_spec('banana-lib/BananaLib.podspec')
@consumer = @spec.consumer(:ios)
target_definition = Podfile::TargetDefinition.new('Pods', nil)
@pod_target = PodTarget.new([@spec], target_definition, config.sandbox)
@pod_target.stubs(:platform).returns(:ios)
public_xcconfig = Xcodeproj::Config.new({"OTHER_LDFLAGS"=>"-framework SystemConfiguration"})
@generator = PrivatePodXCConfig.new(@pod_target, public_xcconfig)
@podfile = Podfile.new
@pod_target.target_definition.stubs(:podfile).returns(@podfile)
@xcconfig = @generator.generate
end
it "generates the xcconfig" do
@xcconfig.class.should == Xcodeproj::Config
end
it "configures the project to load all members that implement Objective-c classes or categories from the static library" do
@xcconfig.to_hash['OTHER_LDFLAGS'].should.include '-ObjC'
end
it 'does not add the -fobjc-arc to OTHER_LDFLAGS by default as Xcode 4.3.2 does not support it' do
@consumer.stubs(:requires_arc?).returns(true)
@xcconfig.to_hash['OTHER_LDFLAGS'].should.not.include("-fobjc-arc")
end
it 'adds the -fobjc-arc to OTHER_LDFLAGS if any pods require arc and the podfile explicitly requires it' do
@podfile.stubs(:set_arc_compatibility_flag?).returns(true)
@consumer.stubs(:requires_arc?).returns(true)
@xcconfig = @generator.generate
@xcconfig.to_hash['OTHER_LDFLAGS'].split(" ").should.include("-fobjc-arc")
end
it "sets the PODS_ROOT build variable" do
@xcconfig.to_hash['PODS_ROOT'].should.not == nil
end
it 'adds the library build headers and public headers search paths to the xcconfig, with quotes' do
private_headers = "\"#{@pod_target.build_headers.search_paths.join('" "')}\""
public_headers = "\"#{config.sandbox.public_headers.search_paths.join('" "')}\""
@xcconfig.to_hash['HEADER_SEARCH_PATHS'].should.include private_headers
@xcconfig.to_hash['HEADER_SEARCH_PATHS'].should.include public_headers
end
it 'adds the COCOAPODS macro definition' do
@xcconfig.to_hash['GCC_PREPROCESSOR_DEFINITIONS'].should.include 'COCOAPODS=1'
end
it 'adds the pod namespaced configuration items' do
@xcconfig.to_hash['OTHER_LDFLAGS'].should.include("${#{@pod_target.xcconfig_prefix}OTHER_LDFLAGS}")
end
it 'sets the relative path of the pods root for spec libraries to ${SRCROOT}' do
@xcconfig.to_hash['PODS_ROOT'].should == '${SRCROOT}'
end
it "saves the xcconfig" do
path = temporary_directory + 'sample.xcconfig'
@generator.save_as(path)
generated = Xcodeproj::Config.new(path)
generated.class.should == Xcodeproj::Config
end
it 'adds the COCOAPODS macro definition' do
@xcconfig.to_hash['GCC_PREPROCESSOR_DEFINITIONS'].should.include 'COCOAPODS=1'
end
it 'adds the pod namespaced configuration items' do
@xcconfig.to_hash['OTHER_LDFLAGS'].should.include("${#{@pod_target.xcconfig_prefix}OTHER_LDFLAGS}")
end
end
it 'sets the relative path of the pods root for spec libraries to ${SRCROOT}' do
@xcconfig.to_hash['PODS_ROOT'].should == '${SRCROOT}'
end
#-------------------------------------------------------------------------#
it "saves the xcconfig" do
path = temporary_directory + 'sample.xcconfig'
@generator.save_as(path)
generated = Xcodeproj::Config.new(path)
generated.class.should == Xcodeproj::Config
end
describe "Private Helpers" do
end
before do
@sut = PrivatePodXCConfig.new(stub(), stub())
end
#-------------------------------------------------------------------------#
#----------------------------------------#
describe "Private Helpers" do
describe "#add_xcconfig_namespaced_keys" do
before do
@sut = Generator::PrivatePodXCConfig.new(stub(), stub())
end
it "appends to the values of the keys of the destination the value of the keys of the source" do
source_config = { 'HEADER_SEARCH_PATHS' => '${PODS_ROOT}/MyPod' }
destination_config = { 'HEADER_SEARCH_PATHS' => '${PODS_ROOT}/BuildHeaders' }
result = @sut.send(:add_xcconfig_namespaced_keys, source_config, destination_config, 'PREFIX_')
result.should == { 'HEADER_SEARCH_PATHS' => '${PODS_ROOT}/BuildHeaders ${PREFIX_HEADER_SEARCH_PATHS}' }
end
#----------------------------------------#
it "uses the key of the destination xcconfig if not present in the source" do
source_config = { }
destination_config = { 'HEADER_SEARCH_PATHS' => '${PODS_ROOT}/BuildHeaders' }
result = @sut.send(:add_xcconfig_namespaced_keys, source_config, destination_config, 'PREFIX_')
result.should == { 'HEADER_SEARCH_PATHS' => '${PODS_ROOT}/BuildHeaders' }
end
describe "#add_xcconfig_namespaced_keys" do
it "preserves any value of the source not present in the destination" do
source_config = { 'EXCLUDED_SOURCE_FILE_NAMES' => 'ZBarReaderViewImpl_Simulator.m' }
destination_config = { }
result = @sut.send(:add_xcconfig_namespaced_keys, source_config, destination_config, 'PREFIX_')
result.should == { 'EXCLUDED_SOURCE_FILE_NAMES' => '${PREFIX_EXCLUDED_SOURCE_FILE_NAMES}' }
end
it "appends to the values of the keys of the destination the value of the keys of the source" do
source_config = { 'HEADER_SEARCH_PATHS' => '${PODS_ROOT}/MyPod' }
destination_config = { 'HEADER_SEARCH_PATHS' => '${PODS_ROOT}/BuildHeaders' }
result = @sut.send(:add_xcconfig_namespaced_keys, source_config, destination_config, 'PREFIX_')
result.should == { 'HEADER_SEARCH_PATHS' => '${PODS_ROOT}/BuildHeaders ${PREFIX_HEADER_SEARCH_PATHS}' }
end
end
it "uses the key of the destination xcconfig if not present in the source" do
source_config = { }
destination_config = { 'HEADER_SEARCH_PATHS' => '${PODS_ROOT}/BuildHeaders' }
result = @sut.send(:add_xcconfig_namespaced_keys, source_config, destination_config, 'PREFIX_')
result.should == { 'HEADER_SEARCH_PATHS' => '${PODS_ROOT}/BuildHeaders' }
end
#----------------------------------------#
it "preserves any value of the source not present in the destination" do
source_config = { 'EXCLUDED_SOURCE_FILE_NAMES' => 'ZBarReaderViewImpl_Simulator.m' }
destination_config = { }
result = @sut.send(:add_xcconfig_namespaced_keys, source_config, destination_config, 'PREFIX_')
result.should == { 'EXCLUDED_SOURCE_FILE_NAMES' => '${PREFIX_EXCLUDED_SOURCE_FILE_NAMES}' }
end
describe "#conditional_less_key" do
end
it "returns the key without the xcconfig conditional syntax if present" do
result = @sut.send(:conditional_less_key, 'EXCLUDED_SOURCE_FILE_NAMES[sdk=iphoneos*][arch=*]')
result.should == 'EXCLUDED_SOURCE_FILE_NAMES'
end
#----------------------------------------#
it "returns the key as it is if no conditional syntax is present" do
result = @sut.send(:conditional_less_key, 'EXCLUDED_SOURCE_FILE_NAMES')
result.should == 'EXCLUDED_SOURCE_FILE_NAMES'
end
describe "#conditional_less_key" do
end
it "returns the key without the xcconfig conditional syntax if present" do
result = @sut.send(:conditional_less_key, 'EXCLUDED_SOURCE_FILE_NAMES[sdk=iphoneos*][arch=*]')
result.should == 'EXCLUDED_SOURCE_FILE_NAMES'
end
it "returns the key as it is if no conditional syntax is present" do
result = @sut.send(:conditional_less_key, 'EXCLUDED_SOURCE_FILE_NAMES')
result.should == 'EXCLUDED_SOURCE_FILE_NAMES'
end
#-------------------------------------------------------------------------#
end
end
#-------------------------------------------------------------------------#
end
end
require File.expand_path('../../../../spec_helper', __FILE__)
module Pod
describe Generator::PublicPodXCConfig do
before do
@spec = fixture_spec('banana-lib/BananaLib.podspec')
@target_definition = Podfile::TargetDefinition.new('Pods', nil)
@pod_target = PodTarget.new([@spec], @target_definition, config.sandbox)
@pod_target.stubs(:platform).returns(:ios)
@generator = Generator::PublicPodXCConfig.new(@pod_target)
module Generator
module XCConfig
describe PublicPodXCConfig do
before do
@spec = fixture_spec('banana-lib/BananaLib.podspec')
@target_definition = Podfile::TargetDefinition.new('Pods', nil)
@pod_target = PodTarget.new([@spec], @target_definition, config.sandbox)
@pod_target.stubs(:platform).returns(:ios)
@generator = PublicPodXCConfig.new(@pod_target)
@podfile = Podfile.new
@spec.xcconfig = { 'OTHER_LDFLAGS' => '-no_compact_unwind' }
@spec.frameworks = ['QuartzCore']
@spec.weak_frameworks = ['iAd']
@spec.libraries = ['xml2']
file_accessors = [Sandbox::FileAccessor.new(fixture('banana-lib'), @spec.consumer(:ios))]
# vendored_framework_paths = [config.sandbox.root + 'BananaLib/BananaLib.framework']
# Sandbox::FileAccessor.any_instance.stubs(:vendored_frameworks).returns(vendored_framework_paths)
@pod_target.target_definition.stubs(:podfile).returns(@podfile)
@pod_target.stubs(:file_accessors).returns(file_accessors)
@xcconfig = @generator.generate
end
it "generates the xcconfig" do
@xcconfig.class.should == Xcodeproj::Config
end
it "includes the xcconfig of the specifications" do
@xcconfig.to_hash["OTHER_LDFLAGS"].should.include('-no_compact_unwind')
end
it "includes the libraries for the specifications" do
@xcconfig.to_hash["OTHER_LDFLAGS"].should.include('-lxml2')
end
it "includes the frameworks of the specifications" do
@xcconfig.to_hash["OTHER_LDFLAGS"].should.include('-framework QuartzCore')
end
it "includes the weak-frameworks of the specifications" do
@xcconfig.to_hash["OTHER_LDFLAGS"].should.include('-weak_framework iAd')
end
it "includes the developer frameworks search paths when SenTestingKit is detected" do
@spec.xcconfig = { 'OTHER_LDFLAGS' => '-no_compact_unwind' }
@spec.frameworks = ['SenTestingKit']
xcconfig = @generator.generate
framework_search_paths = xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS']
framework_search_paths.should.include('$(SDKROOT)/Developer')
end
it "doesn't include the developer frameworks if already present" do
@spec.xcconfig = { 'FRAMEWORK_SEARCH_PATHS' => '"$(SDKROOT)/Developer/Library/Frameworks" "$(DEVELOPER_LIBRARY_DIR)/Frameworks"' }
@spec.frameworks = ['SenTestingKit']
xcconfig = @generator.generate
framework_search_paths = xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'].split(' ')
framework_search_paths.select { |path| path == '"$(SDKROOT)/Developer/Library/Frameworks"'}.count.should == 1
framework_search_paths.select { |path| path == '"$(DEVELOPER_LIBRARY_DIR)/Frameworks"'}.count.should == 1
end
it "includes the build settings of the frameworks bundles of the spec" do
config.sandbox.stubs(:root).returns(fixture(''))
xcconfig = @generator.generate
xcconfig.to_hash["FRAMEWORK_SEARCH_PATHS"].should.include?('"$(PODS_ROOT)/banana-lib"')
end
it "includes the build settings of the libraries shipped with the spec" do
config.sandbox.stubs(:root).returns(fixture(''))
xcconfig = @generator.generate
xcconfig.to_hash["LIBRARY_SEARCH_PATHS"].should.include?('"$(PODS_ROOT)/banana-lib"')
end
#-----------------------------------------------------------------------#
before do
@path = temporary_directory + 'sample.xcconfig'
@generator.save_as(@path)
end
it "saves the xcconfig" do
generated = Xcodeproj::Config.new(@path)
generated.class.should == Xcodeproj::Config
end
it "writes the xcconfig with a prefix computed from the target definition and root spec" do
generated = Xcodeproj::Config.new(@path)
generated.to_hash.each { |k, v| k.should.start_with(@pod_target.xcconfig_prefix) }
end
end
end
it "returns the sandbox" do
@generator.sandbox.class.should == Sandbox
end
#-----------------------------------------------------------------------#
before do
@podfile = Podfile.new
@pod_target.target_definition.stubs(:podfile).returns(@podfile)
@spec.xcconfig = { 'OTHER_LDFLAGS' => '-no_compact_unwind' }
@spec.frameworks = ['QuartzCore']
@spec.weak_frameworks = ['iAd']
@spec.libraries = ['xml2']
@xcconfig = @generator.generate
end
it "generates the xcconfig" do
@xcconfig.class.should == Xcodeproj::Config
end
it "includes the xcconfig of the specifications" do
@xcconfig.to_hash["OTHER_LDFLAGS"].should.include('-no_compact_unwind')
end
it "includes the libraries for the specifications" do
@xcconfig.to_hash["OTHER_LDFLAGS"].should.include('-lxml2')
end
it "includes the frameworks of the specifications" do
@xcconfig.to_hash["OTHER_LDFLAGS"].should.include('-framework QuartzCore')
end
it "includes the weak-frameworks of the specifications" do
@xcconfig.to_hash["OTHER_LDFLAGS"].should.include('-weak_framework iAd')
end
it "includes the developer frameworks search paths when SenTestingKit is detected" do
@spec.xcconfig = { 'OTHER_LDFLAGS' => '-no_compact_unwind' }
@spec.frameworks = ['SenTestingKit']
xcconfig = @generator.generate
xcconfig.to_hash["FRAMEWORK_SEARCH_PATHS"].should == '$(inherited) "$(SDKROOT)/Developer/Library/Frameworks" "$(DEVELOPER_LIBRARY_DIR)/Frameworks"'
end
it "doesn't include the developer frameworks if already present" do
spec = fixture_spec('banana-lib/BananaLib.podspec')
pod_target = PodTarget.new([@spec, spec], @target_definition, config.sandbox)
pod_target.stubs(:platform).returns(:ios)
generator = Generator::PublicPodXCConfig.new(pod_target)
@spec.frameworks = ['SenTestingKit']
spec.frameworks = ['SenTestingKit']
xcconfig = generator.generate
xcconfig.to_hash["FRAMEWORK_SEARCH_PATHS"].should == '$(inherited) "$(SDKROOT)/Developer/Library/Frameworks" "$(DEVELOPER_LIBRARY_DIR)/Frameworks"'
end
#-----------------------------------------------------------------------#
before do
@path = temporary_directory + 'sample.xcconfig'
@generator.save_as(@path)
end
it "saves the xcconfig" do
generated = Xcodeproj::Config.new(@path)
generated.class.should == Xcodeproj::Config
end
it "writes the xcconfig with a prefix computed from the target definition and root spec" do
generated = Xcodeproj::Config.new(@path)
generated.to_hash.each { |k, v| k.should.start_with(@pod_target.xcconfig_prefix) }
end
end
end
require File.expand_path('../../../../spec_helper', __FILE__)
module Pod
module Generator
module XCConfig
describe XCConfigHelper do
before do
@sut = XCConfigHelper
end
#---------------------------------------------------------------------#
describe "::default_ld_flags" do
it "returns the default linker flags" do
podfile = stub( :set_arc_compatibility_flag? => false )
target_definition = stub( :podfile => podfile )
target = stub( :target_definition => target_definition )
result = @sut.default_ld_flags(target)
result.should == '-ObjC'
end
it "includes the ARC compatibility flag if required by the Podfile" do
podfile = stub( :set_arc_compatibility_flag? => true )
target_definition = stub( :podfile => podfile )
spec_consumer = stub( :requires_arc? => true )
target = stub( :target_definition => target_definition, :spec_consumers => [spec_consumer] )
result = @sut.default_ld_flags(target)
result.should == '-ObjC -fobjc-arc'
end
end
#---------------------------------------------------------------------#
describe "::quote" do
it "quotes strings" do
result = @sut.quote(['string1', 'string2'])
result.should == '"string1" "string2"'
end
end
#---------------------------------------------------------------------#
describe "::add_spec_build_settings_to_xcconfig" do
it "adds the build settings of the consumer" do
xcconfig = Xcodeproj::Config.new
consumer = stub({
:xcconfig => { 'OTHER_LDFLAGS' => '-framework SenTestingKit' },
:libraries => [],
:frameworks => [],
:weak_frameworks => [],
})
@sut.add_spec_build_settings_to_xcconfig(consumer, xcconfig)
xcconfig.to_hash['OTHER_LDFLAGS'].should == '-framework SenTestingKit'
end
it "adds the libraries of the xcconfig" do
xcconfig = Xcodeproj::Config.new
consumer = stub({
:xcconfig => {},
:libraries => ['xml2'],
:frameworks => [],
:weak_frameworks => [],
})
@sut.add_spec_build_settings_to_xcconfig(consumer, xcconfig)
xcconfig.to_hash['OTHER_LDFLAGS'].should == '-lxml2'
end
it "adds the frameworks of the xcconfig" do
xcconfig = Xcodeproj::Config.new
consumer = stub({
:xcconfig => {},
:libraries => [],
:frameworks => ['CoreAnimation'],
:weak_frameworks => [],
})
@sut.add_spec_build_settings_to_xcconfig(consumer, xcconfig)
xcconfig.to_hash['OTHER_LDFLAGS'].should == '-framework CoreAnimation'
end
it "adds the weak frameworks of the xcconfig" do
xcconfig = Xcodeproj::Config.new
consumer = stub({
:xcconfig => {},
:libraries => [],
:frameworks => [],
:weak_frameworks => ['iAd'],
})
@sut.add_spec_build_settings_to_xcconfig(consumer, xcconfig)
xcconfig.to_hash['OTHER_LDFLAGS'].should == '-weak_framework iAd'
end
it "adds the developer frameworks search paths if needed" do
xcconfig = Xcodeproj::Config.new
consumer = stub({
:xcconfig => {},
:libraries => [],
:frameworks => ['SenTestingKit'],
:weak_frameworks => [],
})
@sut.add_spec_build_settings_to_xcconfig(consumer, xcconfig)
xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'].should.include('DEVELOPER_LIBRARY_DIR')
end
end
#---------------------------------------------------------------------#
describe "::add_framework_build_settings" do
it "adds the build settings of a framework to the given xcconfig" do
framework_path = config.sandbox.root + 'Parse/Parse.framework'
xcconfig = Xcodeproj::Config.new
@sut.add_framework_build_settings(framework_path, xcconfig, config.sandbox.root)
hash_config = xcconfig.to_hash
hash_config['OTHER_LDFLAGS'].should == "-framework Parse"
hash_config['FRAMEWORK_SEARCH_PATHS'].should == '"$(PODS_ROOT)/Parse"'
end
it "doesn't ovverides exiting linker flags" do
framework_path = config.sandbox.root + 'Parse/Parse.framework'
xcconfig = Xcodeproj::Config.new( { 'OTHER_LDFLAGS' => '-framework CoreAnimation' } )
@sut.add_framework_build_settings(framework_path, xcconfig, config.sandbox.root)
hash_config = xcconfig.to_hash
hash_config['OTHER_LDFLAGS'].should == "-framework CoreAnimation -framework Parse"
end
it "doesn't ovverides exiting frameworks search paths" do
framework_path = config.sandbox.root + 'Parse/Parse.framework'
xcconfig = Xcodeproj::Config.new( { 'FRAMEWORK_SEARCH_PATHS' => '"path/to/frameworks"' } )
@sut.add_framework_build_settings(framework_path, xcconfig, config.sandbox.root)
hash_config = xcconfig.to_hash
hash_config['FRAMEWORK_SEARCH_PATHS'].should == '"path/to/frameworks" "$(PODS_ROOT)/Parse"'
end
end
#---------------------------------------------------------------------#
describe "::add_library_build_settings" do
it "adds the build settings of a framework to the given xcconfig" do
path = config.sandbox.root + 'MapBox/Proj4/libProj4.a'
xcconfig = Xcodeproj::Config.new
@sut.add_library_build_settings(path, xcconfig, config.sandbox.root)
hash_config = xcconfig.to_hash
hash_config['OTHER_LDFLAGS'].should == "-lProj4"
hash_config['LIBRARY_SEARCH_PATHS'].should == '"$(PODS_ROOT)/MapBox/Proj4"'
end
end
#---------------------------------------------------------------------#
describe "::add_framework_build_settings" do
it "adds the developer frameworks search paths to the xcconfig if SenTestingKit has been detected" do
xcconfig = Xcodeproj::Config.new({'OTHER_LDFLAGS' => '-framework SenTestingKit'})
@sut.add_developers_frameworks_if_needed(xcconfig)
frameworks_search_paths = xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS']
frameworks_search_paths.should.include?('$(inherited)')
frameworks_search_paths.should.include?('"$(SDKROOT)/Developer/Library/Frameworks"')
frameworks_search_paths.should.include?('"$(DEVELOPER_LIBRARY_DIR)/Frameworks"')
end
end
#---------------------------------------------------------------------#
end
end
end
end
......@@ -7,7 +7,7 @@ module Pod
@file_accessor = fixture_file_accessor('banana-lib/BananaLib.podspec')
@pod_target = PodTarget.new([], nil, config.sandbox)
@pod_target.file_accessors = [@file_accessor]
@project = Project.new(config.sandbox.project_path)
@project = Project.new(config.sandbox)
@installer = Installer::FileReferencesInstaller.new(config.sandbox, [@pod_target], @project)
end
......@@ -23,9 +23,7 @@ module Pod
it "adds the files references of the source files the Pods project" do
@installer.install!
group_ref = @installer.pods_project['Pods/BananaLib']
group_ref.should.be.not.nil
file_ref = @installer.pods_project['Pods/BananaLib/Banana.m']
file_ref = @installer.pods_project['Pods/BananaLib/Source Files/Banana.m']
file_ref.should.be.not.nil
file_ref.path.should == "../../spec/fixtures/banana-lib/Classes/Banana.m"
end
......@@ -33,17 +31,21 @@ module Pod
it "adds the files references of the local Pods in a dedicated group" do
config.sandbox.store_local_path('BananaLib', 'Some Path')
@installer.install!
group_ref = @installer.pods_project['Local Pods/BananaLib']
group_ref.should.be.not.nil
file_ref = @installer.pods_project['Local Pods/BananaLib/Banana.m']
file_ref = @installer.pods_project['Local Pods/BananaLib/Source Files/Banana.m']
file_ref.should.be.not.nil
end
xit "adds the file references of the frameworks of the projet" do
end
xit "adds the file references of the libraries of the project" do
end
it "adds the files references of the resources the Pods project" do
@installer.install!
group_ref = @installer.pods_project['Resources/BananaLib']
group_ref.should.be.not.nil
file_ref = @installer.pods_project['Resources/BananaLib/logo-sidebar.png']
file_ref = @installer.pods_project['Pods/BananaLib/Resources/logo-sidebar.png']
file_ref.should.be.not.nil
file_ref.path.should == "../../spec/fixtures/banana-lib/Resources/logo-sidebar.png"
end
......@@ -72,53 +74,63 @@ module Pod
describe "Private Helpers" do
it "returns the file accessors" do
pod_target_1 = PodTarget.new([], nil, config.sandbox)
pod_target_1.file_accessors = [fixture_file_accessor('banana-lib/BananaLib.podspec')]
pod_target_2 = PodTarget.new([], nil, config.sandbox)
pod_target_2.file_accessors = [fixture_file_accessor('banana-lib/BananaLib.podspec')]
installer = Installer::FileReferencesInstaller.new(config.sandbox, [pod_target_1, pod_target_2], @project)
roots = installer.send(:file_accessors).map { |fa| fa.path_list.root }
roots.should == [fixture('banana-lib'), fixture('banana-lib')]
end
it "handles libraries empty libraries without file accessors" do
pod_target_1 = PodTarget.new([], nil, config.sandbox)
pod_target_1.file_accessors = []
installer = Installer::FileReferencesInstaller.new(config.sandbox, [pod_target_1], @project)
roots = installer.send(:file_accessors).should == []
describe "#file_accessors" do
it "returns the file accessors" do
pod_target_1 = PodTarget.new([], nil, config.sandbox)
pod_target_1.file_accessors = [fixture_file_accessor('banana-lib/BananaLib.podspec')]
pod_target_2 = PodTarget.new([], nil, config.sandbox)
pod_target_2.file_accessors = [fixture_file_accessor('banana-lib/BananaLib.podspec')]
installer = Installer::FileReferencesInstaller.new(config.sandbox, [pod_target_1, pod_target_2], @project)
roots = installer.send(:file_accessors).map { |fa| fa.path_list.root }
roots.should == [fixture('banana-lib'), fixture('banana-lib')]
end
it "handles libraries empty libraries without file accessors" do
pod_target_1 = PodTarget.new([], nil, config.sandbox)
pod_target_1.file_accessors = []
installer = Installer::FileReferencesInstaller.new(config.sandbox, [pod_target_1], @project)
roots = installer.send(:file_accessors).should == []
end
end
it "returns the header mappings" do
headers_sandbox = Pathname.new('BananaLib')
headers = [Pathname.new('BananaLib/Banana.h')]
mappings = @installer.send(:header_mappings, headers_sandbox, @file_accessor, headers)
mappings.should == {
headers_sandbox => [Pathname.new('BananaLib/Banana.h')]
}
end
describe "#add_file_acessors_paths_to_pods_group" do
xit "adds the paths of the paths of the file accessor corresponding to the given key to the Pods project" do
it "takes into account the header dir specified in the spec" do
headers_sandbox = Pathname.new('BananaLib')
headers = [Pathname.new('BananaLib/Banana.h')]
@file_accessor.spec_consumer.stubs(:header_dir).returns('Sub_dir')
mappings = @installer.send(:header_mappings, headers_sandbox, @file_accessor, headers)
mappings.should == {
(headers_sandbox + 'Sub_dir') => [Pathname.new('BananaLib/Banana.h')]
}
end
end
it "takes into account the header mappings dir specified in the spec" do
headers_sandbox = Pathname.new('BananaLib')
header_1 = @file_accessor.root + 'BananaLib/sub_dir/dir_1/banana_1.h'
header_2 = @file_accessor.root + 'BananaLib/sub_dir/dir_2/banana_2.h'
headers = [ header_1, header_2 ]
@file_accessor.spec_consumer.stubs(:header_mappings_dir).returns('BananaLib/sub_dir')
mappings = @installer.send(:header_mappings, headers_sandbox, @file_accessor, headers)
mappings.should == {
(headers_sandbox + 'dir_1') => [header_1],
(headers_sandbox + 'dir_2') => [header_2],
}
describe "#add_file_acessors_paths_to_pods_group" do
it "returns the header mappings" do
headers_sandbox = Pathname.new('BananaLib')
headers = [Pathname.new('BananaLib/Banana.h')]
mappings = @installer.send(:header_mappings, headers_sandbox, @file_accessor, headers)
mappings.should == {
headers_sandbox => [Pathname.new('BananaLib/Banana.h')]
}
end
it "takes into account the header dir specified in the spec" do
headers_sandbox = Pathname.new('BananaLib')
headers = [Pathname.new('BananaLib/Banana.h')]
@file_accessor.spec_consumer.stubs(:header_dir).returns('Sub_dir')
mappings = @installer.send(:header_mappings, headers_sandbox, @file_accessor, headers)
mappings.should == {
(headers_sandbox + 'Sub_dir') => [Pathname.new('BananaLib/Banana.h')]
}
end
it "takes into account the header mappings dir specified in the spec" do
headers_sandbox = Pathname.new('BananaLib')
header_1 = @file_accessor.root + 'BananaLib/sub_dir/dir_1/banana_1.h'
header_2 = @file_accessor.root + 'BananaLib/sub_dir/dir_2/banana_2.h'
headers = [ header_1, header_2 ]
@file_accessor.spec_consumer.stubs(:header_mappings_dir).returns('BananaLib/sub_dir')
mappings = @installer.send(:header_mappings, headers_sandbox, @file_accessor, headers)
mappings.should == {
(headers_sandbox + 'dir_1') => [header_1],
(headers_sandbox + 'dir_2') => [header_2],
}
end
end
end
......
......@@ -171,11 +171,13 @@ module Pod
it "compacts the used files as nil would be converted to the empty string" do
Sandbox::FileAccessor.any_instance.stubs(:source_files)
Sandbox::FileAccessor.any_instance.stubs(:vendored_libraries)
Sandbox::FileAccessor.any_instance.stubs(:resources).returns(nil)
Sandbox::FileAccessor.any_instance.stubs(:preserve_paths)
Sandbox::FileAccessor.any_instance.stubs(:prefix_header)
Sandbox::FileAccessor.any_instance.stubs(:readme)
Sandbox::FileAccessor.any_instance.stubs(:license)
Sandbox::FileAccessor.any_instance.stubs(:vendored_frameworks)
paths = @installer.send(:used_files)
paths.should == []
end
......
......@@ -9,7 +9,7 @@ module Pod
xcodeproj 'dummy'
end
@target_definition = @podfile.target_definitions['Pods']
@project = Project.new(config.sandbox.project_path)
@project = Project.new(config.sandbox)
config.sandbox.project = @project
path_list = Sandbox::PathList.new(fixture('banana-lib'))
......@@ -137,6 +137,14 @@ module Pod
script.read.should.include?('logo-sidebar.png')
end
xit "adds the resources bundles to the copy resources script" do
end
xit "adds the bridge support file to the copy resources script, if one was created" do
end
it "creates the acknowledgements files " do
@installer.install!
markdown = config.sandbox.root + 'Pods-acknowledgements.markdown'
......
......@@ -9,7 +9,7 @@ module Pod
xcodeproj 'dummy'
end
@target_definition = @podfile.target_definitions['Pods']
@project = Project.new(config.sandbox.project_path)
@project = Project.new(config.sandbox)
config.sandbox.project = @project
path_list = Sandbox::PathList.new(fixture('banana-lib'))
......@@ -114,6 +114,12 @@ module Pod
#--------------------------------------#
xit 'adds the resource bundle targets' do
end
#--------------------------------------#
it "creates the xcconfig file" do
@installer.install!
file = config.sandbox.root + @pod_target.xcconfig_private_path
......
......@@ -9,7 +9,7 @@ module Pod
xcodeproj 'dummy'
end
@target_definition = @podfile.target_definitions['Pods']
@project = Project.new(config.sandbox.project_path)
@project = Project.new(config.sandbox)
config.sandbox.project = @project
path_list = Sandbox::PathList.new(fixture('banana-lib'))
......
......@@ -16,7 +16,7 @@ module Pod
end
end
config.sandbox.project = Project.new()
config.sandbox.project = Project.new(config.sandbox)
Xcodeproj::Project.new.save_as(config.sandbox.project_path)
@library = AggregateTarget.new(@podfile.target_definitions['Pods'], config.sandbox)
@library.client_root = sample_project_path.dirname
......
......@@ -4,7 +4,7 @@ module Pod
describe Project do
before do
@project = Project.new(config.sandbox.project_path)
@project = Project.new(config.sandbox)
end
#-------------------------------------------------------------------------#
......@@ -50,22 +50,6 @@ module Pod
@project.resources.name.should == 'Resources'
end
it "adds a group for a specification" do
group = @project.add_spec_group('JSONKit', @project.pods)
@project.pods.children.should.include?(group)
g = @project['Pods/JSONKit']
g.name.should == 'JSONKit'
g.children.should.be.empty?
end
it "namespaces subspecs in groups" do
group = @project.add_spec_group('JSONKit/Subspec', @project.pods)
@project.pods.groups.find { |g| g.name == 'JSONKit' }.children.should.include?(group)
g = @project['Pods/JSONKit/Subspec']
g.name.should == 'Subspec'
g.children.should.be.empty?
end
end
#-------------------------------------------------------------------------#
......@@ -75,7 +59,7 @@ module Pod
it "adds the file references for the given source files" do
source_files = [ config.sandbox.root + "A_POD/some_file.m" ]
@project.add_file_references(source_files, 'BananaLib', @project.pods)
group = @project['Pods/BananaLib']
group = @project['Pods/BananaLib/Source Files']
group.should.not.be.nil
group.children.map(&:path).should == [ "A_POD/some_file.m" ]
end
......@@ -84,7 +68,7 @@ module Pod
source_files = [ config.sandbox.root + "A_POD/some_file.m" ]
@project.add_file_references(source_files, 'BananaLib', @project.pods)
@project.add_file_references(source_files, 'BananaLib', @project.pods)
group = @project['Pods/BananaLib']
group = @project['Pods/BananaLib/Source Files']
group.children.count.should == 1
group.children.first.path.should == "A_POD/some_file.m"
end
......@@ -108,15 +92,35 @@ module Pod
#-------------------------------------------------------------------------#
describe "File references" do
describe "Private helpers" do
describe "#refs_by_absolute_path" do
it "stores the references by absolute path" do
file = config.sandbox.root + "A_POD/some_file.m"
@project.add_file_references([file], 'BananaLib', @project.pods)
refs_by_absolute_path = @project.send(:refs_by_absolute_path)
refs_by_absolute_path.should == {
file => @project.file_reference(file)
}
end
end
it "stores the references by absolute path" do
file = config.sandbox.root + "A_POD/some_file.m"
@project.add_file_references([file], 'BananaLib', @project.pods)
refs_by_absolute_path = @project.send(:refs_by_absolute_path)
refs_by_absolute_path.should == {
file => @project.file_reference(file)
}
describe "#add_spec_group" do
it "adds a group for a specification" do
group = @project.send(:add_spec_group, 'JSONKit', @project.pods)
@project.pods.children.should.include?(group)
g = @project['Pods/JSONKit']
g.name.should == 'JSONKit'
g.children.should.be.empty?
end
it "namespaces subspecs in groups" do
group = @project.send(:add_spec_group, 'JSONKit/Subspec', @project.pods)
@project.pods.groups.find { |g| g.name == 'JSONKit' }.children.should.include?(group)
g = @project['Pods/JSONKit/Subspec']
g.name.should == 'Subspec'
g.children.should.be.empty?
end
end
end
......
......@@ -103,6 +103,32 @@ module Pod
@accessor.preserve_paths.should.include?(@root + "Resources")
end
it "returns the paths of the framework bundles" do
@accessor.vendored_frameworks.should.include?(@root + "Bananalib.framework")
end
it "returns the paths of the library files" do
@accessor.vendored_libraries.should.include?(@root + "libBananalib.a")
end
it "returns the resource bundles of the pod" do
@spec_consumer.stubs(:resource_bundles).returns({"BananaLib" => "Resources/*"})
resource_paths = [
@root + "Resources/logo-sidebar.png",
@root + "Resources/sub_dir",
]
@accessor.resource_bundles.should == { "BananaLib" => resource_paths }
end
it "returns the paths of the files of the resource bundles" do
@spec_consumer.stubs(:resource_bundles).returns({"BananaLib" => "Resources/*"})
resource_paths = [
@root + "Resources/logo-sidebar.png",
@root + "Resources/sub_dir",
]
@accessor.resource_bundle_files.should == resource_paths
end
it "returns the prefix header of the specification" do
@accessor.prefix_header.should == @root + 'Classes/BananaLib.pch'
end
......
......@@ -23,6 +23,7 @@ module Pod
README
Resources/logo-sidebar.png
Resources/sub_dir/logo-sidebar.png
libBananalib.a
preserve_me.txt
sub-dir/sub-dir-2/somefile.txt
]
......@@ -35,7 +36,7 @@ module Pod
dirs.reject! do |f|
f.include?('libPusher') || f.include?('.git')
end
dirs.sort.should == %w| Classes Resources Resources/sub_dir sub-dir sub-dir/sub-dir-2 |
dirs.sort.should == %w| Bananalib.framework Classes Resources Resources/sub_dir sub-dir sub-dir/sub-dir-2 |
end
it "handles directories with glob metacharacters" 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