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
e5536f14
Commit
e5536f14
authored
Sep 09, 2013
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Further rationalize the Pods porject
parent
340492f0
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
133 additions
and
37 deletions
+133
-37
Gemfile.lock
Gemfile.lock
+2
-2
target_installer.rb
lib/cocoapods/installer/target_installer.rb
+1
-1
aggregate_target_installer.rb
.../installer/target_installer/aggregate_target_installer.rb
+1
-1
pod_target_installer.rb
...oapods/installer/target_installer/pod_target_installer.rb
+9
-9
project.rb
lib/cocoapods/project.rb
+80
-11
cocoapods-integration-specs
spec/cocoapods-integration-specs
+1
-1
file_references_installer_spec.rb
spec/unit/installer/file_references_installer_spec.rb
+1
-1
pod_target_installer_spec.rb
...t/installer/target_installer/pod_target_installer_spec.rb
+1
-1
installer_spec.rb
spec/unit/installer_spec.rb
+1
-1
project_spec.rb
spec/unit/project_spec.rb
+36
-9
No files found.
Gemfile.lock
View file @
e5536f14
...
...
@@ -17,7 +17,7 @@ GIT
GIT
remote: https://github.com/CocoaPods/Xcodeproj.git
revision:
c9c8fb4f5fc7f89ab86cde341c1bc584ace2217a
revision:
23d64ce79dd23e928dadac986a858a13c07ac988
branch: master
specs:
xcodeproj (0.10.1)
...
...
@@ -41,7 +41,7 @@ GIT
GIT
remote: https://github.com/irrationalfab/PrettyBacon.git
revision:
f9f711c5b95d9eee9a79a2a23e25bb3390f9cbcb
revision:
59cde2c52a3211c06f894e7324e5e4fac9d8476a
branch: master
specs:
prettybacon (0.0.1)
...
...
lib/cocoapods/installer/target_installer.rb
View file @
e5536f14
...
...
@@ -64,7 +64,7 @@ module Pod
# @return [void]
#
def
create_suport_files_group
@support_files_group
=
project
.
support_files_group
.
new_group
(
library
.
name
)
@support_files_group
=
project
.
add_aggregate_group
(
library
.
name
,
sandbox
.
root
)
end
# Generates a dummy source file for each target so libraries that contain
...
...
lib/cocoapods/installer/target_installer/aggregate_target_installer.rb
View file @
e5536f14
...
...
@@ -12,8 +12,8 @@ module Pod
#
def
install!
UI
.
message
"- Installing target `
#{
library
.
name
}
`
#{
library
.
platform
}
"
do
add_target
create_suport_files_group
add_target
create_xcconfig_file
create_target_environment_header
create_bridge_support_file
...
...
lib/cocoapods/installer/target_installer/pod_target_installer.rb
View file @
e5536f14
...
...
@@ -12,8 +12,11 @@ module Pod
#
def
install!
UI
.
message
"- Installing target `
#{
library
.
name
}
`
#{
library
.
platform
}
"
do
aggregate_name
=
library
.
target_definition
.
label
.
to_s
project
.
add_aggregate_group
(
aggregate_name
,
sandbox
.
root
)
pod_name
=
library
.
pod_name
@support_files_group
=
project
.
add_aggregate_pod_group
(
aggregate_name
,
pod_name
,
sandbox
.
root
)
add_target
move_target_product_file_reference
add_files_to_build_phases
add_resources_bundle_targets
# create_suport_files_group
...
...
@@ -48,12 +51,6 @@ module Pod
end
end
def
move_target_product_file_reference
pod_name
=
library
.
pod_name
group
=
project
.
group_for_spec
(
pod_name
,
:products
)
target
.
product_reference
.
move
(
group
)
end
# Adds the resources of the Pods to the Pods project.
#
# @note The source files are grouped by Pod and in turn by subspec
...
...
@@ -66,7 +63,9 @@ module Pod
library
.
file_accessors
.
each
do
|
file_accessor
|
file_accessor
.
resource_bundles
.
each
do
|
bundle_name
,
paths
|
file_references
=
paths
.
map
{
|
sf
|
project
.
reference_for_path
(
sf
)
}
group
=
project
.
group_for_spec
(
file_accessor
.
spec
.
name
,
:products
)
aggregate_name
=
library
.
target_definition
.
label
.
to_s
pod_name
=
library
.
pod_name
group
=
project
.
aggregate_pod_group
(
aggregate_name
,
pod_name
)
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
)
...
...
@@ -195,8 +194,9 @@ module Pod
# @return [PBXFileReference] the file reference of the added file.
#
def
add_file_to_support_group
(
path
)
aggregate_name
=
library
.
target_definition
.
label
.
to_s
pod_name
=
library
.
pod_name
group
=
project
.
group_for_spec
(
pod_name
,
:support_files
)
group
=
project
.
aggregate_pod_group
(
aggregate_name
,
pod_name
)
group
.
new_file
(
path
)
end
...
...
lib/cocoapods/project.rb
View file @
e5536f14
...
...
@@ -15,7 +15,7 @@ module Pod
#
def
initialize
(
path
,
skip_initialization
=
false
)
super
(
path
,
skip_initialization
)
@support_files_group
=
new_group
(
'Target
s Support
Files'
)
@support_files_group
=
new_group
(
'Target Files'
)
@refs_by_absolute_path
=
{}
@pods
=
new_group
(
'Pods'
)
@development_pods
=
new_group
(
'Development Pods'
)
...
...
@@ -37,11 +37,11 @@ module Pod
public
# @!group
Pod
Groups
# @!group Groups
#-------------------------------------------------------------------------#
# Creates a new group for the
Pod with the given name and configures its
# path.
# Creates a new group for the
sources of the Pod with the given name and
#
configures its
path.
#
# @param [String] pod_name
# The name of the Pod.
...
...
@@ -63,8 +63,6 @@ module Pod
parent_group
=
development
?
development_pods
:
pods
source_tree
=
absolute
?
:
absolute
:
:group
group
=
parent_group
.
new_group
(
pod_name
,
path
,
source_tree
)
support_files_group
=
group
.
new_group
(
SPEC_SUBGROUPS
[
:support_files
])
support_files_group
.
source_tree
=
'SOURCE_ROOT'
group
end
...
...
@@ -91,9 +89,7 @@ module Pod
:source_files
=>
'Source Files'
,
:resources
=>
'Resources'
,
:frameworks_and_libraries
=>
'Frameworks & Libraries'
,
:support_files
=>
'Support Files'
,
:subspecs
=>
'Subspecs'
,
:products
=>
'Products'
,
}
# Returns the group for the specification with the give name creating it if
...
...
@@ -110,14 +106,87 @@ module Pod
def
group_for_spec
(
spec_name
,
subgroup_key
=
nil
)
spec_group
=
spec_group
(
spec_name
)
if
subgroup_key
subgroup
=
SPEC_SUBGROUPS
[
subgroup_key
]
raise
ArgumentError
,
"Unrecognized subgroup `
#{
subgroup_key
}
`"
unless
subgroup
spec_group
.
find_subpath
(
subgroup
,
true
)
if
subgroup_key
==
:source_files
spec_group
else
subgroup
=
SPEC_SUBGROUPS
[
subgroup_key
]
raise
ArgumentError
,
"Unrecognized subgroup `
#{
subgroup_key
}
`"
unless
subgroup
spec_group
.
find_subpath
(
subgroup
,
true
)
end
else
spec_group
end
end
# Creates a new group for the aggregate target with the given name and
# path.
#
# @param [String] name
# The name of the target.
#
# @param [#to_s] path
# The path where the files of the target are stored.
#
# @return [PBXGroup] The new group.
#
def
add_aggregate_group
(
name
,
path
)
# TODO TMP
if
existing
=
support_files_group
[
name
]
existing
else
support_files_group
.
new_group
(
name
,
path
)
end
end
# Returns the group for the aggregate target with the given name.
#
# @param [String] pod_name
# The name of the Pod.
#
# @return [PBXGroup] The group.
#
def
aggregate_group
(
name
)
support_files_group
[
name
]
end
# @return [Array<PBXGroup>] Returns the list of the aggregate groups.
#
def
aggregate_groups
support_files_group
.
children
end
# Creates a new group for the pod target with the given name and aggregate.
#
# @param [String] aggregate_name
# The name of the target.
#
# @param [String] path
# The name of the Pod.
#
# @param [#to_s] path
# The path where the files of the target are stored.
#
# @return [PBXGroup] The new group.
#
def
add_aggregate_pod_group
(
aggregate_name
,
pod_name
,
path
)
group
=
aggregate_group
(
aggregate_name
).
new_group
(
pod_name
,
path
)
end
# Returns the group for the pod target with the given name and aggregate.
# path.
#
# @param [String] aggregate_name
# The name of the target.
#
# @param [String] path
# The name of the Pod.
#
# @return [PBXGroup] The group.
#
def
aggregate_pod_group
(
aggregate_name
,
pod_name
)
aggregate_group
(
aggregate_name
)[
pod_name
]
end
public
...
...
cocoapods-integration-specs
@
7d8fe481
Subproject commit
3b5a20dede40a3c55fbacb623254a4c3e06a51b3
Subproject commit
7d8fe481f635c00369636acd831ee466557055da
spec/unit/installer/file_references_installer_spec.rb
View file @
e5536f14
...
...
@@ -24,7 +24,7 @@ module Pod
it
"adds the files references of the source files the Pods project"
do
@installer
.
install!
file_ref
=
@installer
.
pods_project
[
'Pods/BananaLib/
Source Files/
Banana.m'
]
file_ref
=
@installer
.
pods_project
[
'Pods/BananaLib/Banana.m'
]
file_ref
.
should
.
be
.
not
.
nil
file_ref
.
path
.
should
==
"Classes/Banana.m"
end
...
...
spec/unit/installer/target_installer/pod_target_installer_spec.rb
View file @
e5536f14
...
...
@@ -33,7 +33,7 @@ module Pod
it
"adds file references for the support files of the target"
do
@installer
.
install!
@project
.
support_files_group
group
=
@project
[
'
Pods/BananaLib/Support Files
'
]
group
=
@project
[
'
Target Files/Pods/BananaLib
'
]
group
.
children
.
map
(
&
:display_name
).
sort
.
should
==
[
"Pods-BananaLib-Private.xcconfig"
,
"Pods-BananaLib-dummy.m"
,
...
...
spec/unit/installer_spec.rb
View file @
e5536f14
...
...
@@ -345,7 +345,7 @@ module Pod
end
it
"recursively sorts the project by type"
do
@installer
.
pods_project
.
main_group
.
expects
(
:
recursively_sort_by_type
)
@installer
.
pods_project
.
main_group
.
expects
(
:
sort
)
@installer
.
send
(
:write_pod_project
)
end
...
...
spec/unit/project_spec.rb
View file @
e5536f14
...
...
@@ -12,7 +12,7 @@ module Pod
describe
"In general"
do
it
"creates the support files group on initialization"
do
@project
.
support_files_group
.
name
.
should
==
'Target
s Support
Files'
@project
.
support_files_group
.
name
.
should
==
'Target Files'
end
it
"creates the Pods group on initialization"
do
...
...
@@ -64,11 +64,6 @@ module Pod
Pathname
.
new
(
group
.
path
).
should
.
be
.
absolute
end
it
"creates a support file group relative to the project"
do
group
=
@project
.
add_pod_group
(
'BananaLib'
,
@path
,
false
,
true
)
group
[
'Support Files'
].
source_tree
.
should
==
'SOURCE_ROOT'
group
[
'Support Files'
].
path
.
should
.
be
.
nil
end
end
#----------------------------------------#
...
...
@@ -113,7 +108,7 @@ module Pod
it
"returns the requested subgroup"
do
group
=
@project
.
group_for_spec
(
'BananaLib/Tree'
,
:source_files
)
group
.
hierarchy_path
.
should
==
'/Pods/BananaLib/Subspecs/Tree
/Source Files
'
group
.
hierarchy_path
.
should
==
'/Pods/BananaLib/Subspecs/Tree'
end
it
"raises if unable to recognize the subgroup key"
do
...
...
@@ -128,6 +123,38 @@ module Pod
group_1
.
uuid
.
should
==
group_2
.
uuid
end
end
it
"adds the group for the given aggregate target"
do
group
=
@project
.
add_aggregate_group
(
'Pods'
,
config
.
sandbox
.
root
+
'Aggregate/Pods'
)
group
.
parent
.
should
==
@project
.
support_files_group
group
.
name
.
should
==
'Pods'
group
.
path
.
should
==
'Aggregate/Pods'
end
it
"returns the group for the aggregate target with the given name"
do
group
=
@project
.
add_aggregate_group
(
'Pods'
,
config
.
sandbox
.
root
+
'Aggregate/Pods'
)
@project
.
aggregate_group
(
'Pods'
).
should
==
group
end
it
"returns the list of the aggregate groups"
do
group
=
@project
.
add_aggregate_group
(
'Pods'
,
config
.
sandbox
.
root
+
'Aggregate/Pods'
)
group
=
@project
.
add_aggregate_group
(
'Tests'
,
config
.
sandbox
.
root
+
'Aggregate/Tests'
)
@project
.
aggregate_groups
.
map
(
&
:name
).
should
==
[
"Pods"
,
"Tests"
]
end
it
"adds the group for the given aggregate target"
do
parent
=
@project
.
add_aggregate_group
(
'Pods'
,
config
.
sandbox
.
root
+
'Aggregate/Pods'
)
group
=
@project
.
add_aggregate_pod_group
(
'Pods'
,
'BananaLib'
,
config
.
sandbox
.
root
+
'Aggregate/Pods/BananaLib'
)
group
.
parent
.
should
==
parent
group
.
name
.
should
==
'BananaLib'
group
.
path
.
should
==
'BananaLib'
end
it
"returns the group for the aggregate target with the given name"
do
@project
.
add_aggregate_group
(
'Pods'
,
config
.
sandbox
.
root
+
'Aggregate/Pods'
)
group
=
@project
.
add_aggregate_pod_group
(
'Pods'
,
'BananaLib'
,
config
.
sandbox
.
root
+
'Aggregate/Pods/BananaLib'
)
@project
.
aggregate_pod_group
(
'Pods'
,
'BananaLib'
).
should
==
group
end
end
#-------------------------------------------------------------------------#
...
...
@@ -144,7 +171,7 @@ module Pod
it
"adds a file references to the given file"
do
ref
=
@project
.
add_file_reference
(
@file
,
@group
)
ref
.
hierarchy_path
.
should
==
'/Pods/BananaLib/
Source Files/
file.m'
ref
.
hierarchy_path
.
should
==
'/Pods/BananaLib/file.m'
end
it
"it doesn't duplicate file references for a single path"
do
...
...
@@ -175,7 +202,7 @@ module Pod
it
"returns the reference for the given path"
do
ref
=
@project
.
reference_for_path
(
@file
)
ref
.
hierarchy_path
.
should
==
'/Pods/BananaLib/
Source Files/
file.m'
ref
.
hierarchy_path
.
should
==
'/Pods/BananaLib/file.m'
end
it
"returns nil if no reference for the given path is available"
do
...
...
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