Commit 0c81d6ff authored by Marius Rackwitz's avatar Marius Rackwitz

Migrate from static library to framework

parent 37ebd5af
......@@ -91,9 +91,9 @@ module Pod
changes
end
# Adds spec libraries to the frameworks build phase of the
# Adds spec product reference to the frameworks build phase of the
# {TargetDefinition} integration libraries. Adds a file reference to
# the library of the {TargetDefinition} and adds it to the frameworks
# the frameworks group of the project and adds it to the frameworks
# build phase of the targets.
#
# @return [void]
......@@ -101,10 +101,23 @@ module Pod
def add_pods_library
frameworks = user_project.frameworks_group
native_targets_to_integrate.each do |native_target|
library = frameworks.files.select { |f| f.path == target.product_name }.first ||
frameworks.new_product_ref_for_target(target.name, target.product_type)
unless native_target.frameworks_build_phase.files_references.include?(library)
native_target.frameworks_build_phase.add_file_reference(library)
build_phase = native_target.frameworks_build_phase
# Find and delete possible reference for the other product type
old_product_name = target.requires_framework? ? target.static_library_name : target.framework_name
old_product_ref = frameworks.files.find { |f| f.path == old_product_name }
if old_product_ref.present?
UI.message("Remove old Pod product reference #{old_product_name} from project.")
build_phase.remove_file_reference(old_product_ref)
frameworks.remove_reference(old_product_ref)
end
# Find or create and add a reference for the current product type
target_basename = target.label
new_product_ref = frameworks.files.find { |f| f.path == target.product_name } ||
frameworks.new_product_ref_for_target(target_basename, target.product_type)
unless build_phase.files_references.include?(new_product_ref)
build_phase.add_file_reference(new_product_ref)
end
end
end
......
......@@ -31,12 +31,24 @@ module Pod
#
def product_name
if requires_framework?
"#{label}.framework"
framework_name
else
"lib#{label}.a"
static_library_name
end
end
# @return [String] the name of the framework.
#
def framework_name
"#{label}.framework"
end
# @return [String] the name of the library.
#
def static_library_name
"lib#{label}.a"
end
# @return [Symbol] either :framework or :static_library, depends on
# #requires_framework?.
#
......
......@@ -137,6 +137,14 @@ module Pod
@target.product_name.should == 'Pods.framework'
end
it 'returns the framework name' do
@target.framework_name.should == 'Pods.framework'
end
it 'returns the library name' do
@target.static_library_name.should == 'libPods.a'
end
it 'returns :framework as product type' do
@target.product_type.should == :framework
end
......@@ -151,6 +159,14 @@ module Pod
@target.product_name.should == 'libPods.a'
end
it 'returns the framework name' do
@target.framework_name.should == 'Pods.framework'
end
it 'returns the library name' do
@target.static_library_name.should == 'libPods.a'
end
it 'returns :static_library as product type' do
@target.product_type.should == :static_library
end
......@@ -176,6 +192,14 @@ module Pod
@target.product_name.should == 'Pods.framework'
end
it 'returns the framework name' do
@target.framework_name.should == 'Pods.framework'
end
it 'returns the library name' do
@target.static_library_name.should == 'libPods.a'
end
it 'returns :framework as product type' do
@target.product_type.should == :framework
end
......
......@@ -121,6 +121,14 @@ module Pod
@pod_target.product_name.should == 'Pods-BananaLib.framework'
end
it 'returns the framework name' do
@pod_target.framework_name.should == 'Pods-BananaLib.framework'
end
it 'returns the library name' do
@pod_target.static_library_name.should == 'libPods-BananaLib.a'
end
it 'returns :framework as product type' do
@pod_target.product_type.should == :framework
end
......@@ -135,6 +143,14 @@ module Pod
@pod_target.product_name.should == 'libPods-BananaLib.a'
end
it 'returns the framework name' do
@pod_target.framework_name.should == 'Pods-BananaLib.framework'
end
it 'returns the library name' do
@pod_target.static_library_name.should == 'libPods-BananaLib.a'
end
it 'returns :static_library as product type' do
@pod_target.product_type.should == :static_library
end
......@@ -158,6 +174,14 @@ module Pod
@pod_target.product_name.should == 'Pods-OrangeFramework.framework'
end
it 'returns the framework name' do
@pod_target.framework_name.should == 'Pods-OrangeFramework.framework'
end
it 'returns the library name' do
@pod_target.static_library_name.should == 'libPods-OrangeFramework.a'
end
it 'returns :framework as product type' do
@pod_target.product_type.should == :framework
end
......
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