Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
cocoapods
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
cocoapods
Commits
0c81d6ff
Commit
0c81d6ff
authored
Jun 29, 2014
by
Marius Rackwitz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate from static library to framework
parent
37ebd5af
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
81 additions
and
8 deletions
+81
-8
target_integrator.rb
...ds/installer/user_project_integrator/target_integrator.rb
+19
-6
target.rb
lib/cocoapods/target.rb
+14
-2
aggregate_target_spec.rb
spec/unit/target/aggregate_target_spec.rb
+24
-0
pod_target_spec.rb
spec/unit/target/pod_target_spec.rb
+24
-0
No files found.
lib/cocoapods/installer/user_project_integrator/target_integrator.rb
View file @
0c81d6ff
...
...
@@ -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
...
...
lib/cocoapods/target.rb
View file @
0c81d6ff
...
...
@@ -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?.
#
...
...
spec/unit/target/aggregate_target_spec.rb
View file @
0c81d6ff
...
...
@@ -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
...
...
spec/unit/target/pod_target_spec.rb
View file @
0c81d6ff
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment