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
2580df10
Commit
2580df10
authored
Nov 04, 2011
by
Eloy Duran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move the library file refs to the Products group.
parent
8a569ec5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
27 deletions
+58
-27
installer.rb
lib/cocoapods/installer.rb
+3
-2
project.rb
lib/cocoapods/xcode/project.rb
+51
-22
integration_spec.rb
spec/integration_spec.rb
+1
-1
project_spec.rb
spec/unit/xcode/project_spec.rb
+3
-2
No files found.
lib/cocoapods/installer.rb
View file @
2580df10
...
@@ -99,8 +99,9 @@ module Pod
...
@@ -99,8 +99,9 @@ module Pod
end
end
xcconfig
.
merge!
(
'USER_HEADER_SEARCH_PATHS'
=>
user_header_search_paths
.
sort
.
uniq
.
join
(
" "
))
xcconfig
.
merge!
(
'USER_HEADER_SEARCH_PATHS'
=>
user_header_search_paths
.
sort
.
uniq
.
join
(
" "
))
# Add the prefix header and xcconfig files to the project
prefix_file
=
@xcodeproj
.
files
.
new
(
'path'
=>
prefix_header_filename
)
@xcodeproj
.
files
.
new
(
'path'
=>
prefix_header_filename
)
prefix_file
.
group
=
@xcodeproj
.
pods
.
groups
.
find
{
|
child
|
child
.
name
==
"Supporting Files"
}
xcconfig_file
=
@xcodeproj
.
files
.
new
(
"path"
=>
xcconfig_filename
)
xcconfig_file
=
@xcodeproj
.
files
.
new
(
"path"
=>
xcconfig_filename
)
@target
.
buildConfigurations
.
each
do
|
config
|
@target
.
buildConfigurations
.
each
do
|
config
|
config
.
baseConfiguration
=
xcconfig_file
config
.
baseConfiguration
=
xcconfig_file
...
...
lib/cocoapods/xcode/project.rb
View file @
2580df10
...
@@ -48,14 +48,35 @@ module Pod
...
@@ -48,14 +48,35 @@ module Pod
end
end
def
self
.
belongs_to
(
singular_attr_name
,
options
=
{})
def
self
.
belongs_to
(
singular_attr_name
,
options
=
{})
uuid_name
=
options
[
:uuid
]
||
"
#{
singular_attr_name
}
Reference"
if
uuid_name
=
options
[
:uuids
]
attribute
(
options
[
:uuid
]
||
singular_attr_name
,
uuid_name
)
# part of another objects uuid list
define_method
(
singular_attr_name
)
do
klass
=
options
[
:class
]
uuid
=
send
(
uuid_name
)
define_method
(
singular_attr_name
)
do
@project
.
objects
[
uuid
]
# Loop over all objects of the class and find the one that includes
end
# this object in the specified uuid list.
define_method
(
"
#{
singular_attr_name
}
="
)
do
|
object
|
@project
.
objects
.
select_by_class
(
klass
).
find
do
|
object
|
send
(
"
#{
uuid_name
}
="
,
object
.
uuid
)
object
.
send
(
uuid_name
).
include?
(
self
.
uuid
)
end
end
define_method
(
"
#{
singular_attr_name
}
="
)
do
|
object
|
# Remove this object from the uuid list of the target
# that this object was associated to.
if
previous
=
send
(
singular_attr_name
)
previous
.
send
(
uuid_name
).
delete
(
self
.
uuid
)
end
# Now assign this object to the new object
object
.
send
(
uuid_name
)
<<
self
.
uuid
end
else
uuid_name
=
options
[
:uuid
]
||
"
#{
singular_attr_name
}
Reference"
attribute
(
options
[
:uuid
]
||
singular_attr_name
,
uuid_name
)
define_method
(
singular_attr_name
)
do
uuid
=
send
(
uuid_name
)
@project
.
objects
[
uuid
]
end
define_method
(
"
#{
singular_attr_name
}
="
)
do
|
object
|
send
(
"
#{
uuid_name
}
="
,
object
.
uuid
)
end
end
end
end
end
...
@@ -137,6 +158,7 @@ module Pod
...
@@ -137,6 +158,7 @@ module Pod
class
PBXFileReference
<
PBXObject
class
PBXFileReference
<
PBXObject
attributes
:path
,
:sourceTree
,
:explicitFileType
,
:includeInIndex
attributes
:path
,
:sourceTree
,
:explicitFileType
,
:includeInIndex
has_many
:buildFiles
,
:uuid
=>
:fileRef
,
:fkey_on_target
=>
true
,
:class
=>
Project
::
PBXBuildFile
has_many
:buildFiles
,
:uuid
=>
:fileRef
,
:fkey_on_target
=>
true
,
:class
=>
Project
::
PBXBuildFile
belongs_to
:group
,
:class
=>
Project
::
PBXGroup
,
:uuids
=>
:childReferences
def
initialize
(
project
,
uuid
,
attributes
)
def
initialize
(
project
,
uuid
,
attributes
)
is_new
=
uuid
.
nil?
is_new
=
uuid
.
nil?
...
@@ -164,16 +186,15 @@ module Pod
...
@@ -164,16 +186,15 @@ module Pod
attributes
:sourceTree
attributes
:sourceTree
has_many
:children
,
:singular
=>
:child
do
|
object
|
has_many
:children
,
:singular
=>
:child
do
|
object
|
if
object
.
is_a?
(
PBXFileReference
)
if
object
.
is_a?
(
P
od
::
Xcode
::
Project
::
P
BXFileReference
)
#
Remove from the group it was in
#
Associating the file to this group through the inverse
if
group
=
@project
.
groups
.
find
{
|
group
|
group
.
children
.
include?
(
object
)
}
# association will also remove it from the group it was in.
# TODO
object
.
group
=
self
# * group.children.delete(object)
else
# * object.group = nil
# TODO What objects can actually be in a group and don't they
group
.
childReferences
.
delete
(
object
.
uuid
)
# all need the above treatment.
en
d
childReferences
<<
object
.
uui
d
end
end
childReferences
<<
object
.
uuid
end
end
def
initialize
(
*
)
def
initialize
(
*
)
...
@@ -183,15 +204,15 @@ module Pod
...
@@ -183,15 +204,15 @@ module Pod
end
end
def
files
def
files
list_by_class
(
childReferences
,
PBXFileReference
)
list_by_class
(
childReferences
,
P
od
::
Xcode
::
Project
::
P
BXFileReference
)
end
end
def
source_files
def
source_files
list_by_class
(
childReferences
,
PBXFileReference
,
files
.
reject
{
|
file
|
file
.
buildFiles
.
empty?
})
list_by_class
(
childReferences
,
P
od
::
Xcode
::
Project
::
P
BXFileReference
,
files
.
reject
{
|
file
|
file
.
buildFiles
.
empty?
})
end
end
def
groups
def
groups
list_by_class
(
childReferences
,
PBXGroup
)
list_by_class
(
childReferences
,
P
od
::
Xcode
::
Project
::
P
BXGroup
)
end
end
def
<<
(
child
)
def
<<
(
child
)
...
@@ -274,6 +295,7 @@ module Pod
...
@@ -274,6 +295,7 @@ module Pod
self
.
name
||=
productName
self
.
name
||=
productName
self
.
buildRuleReferences
||=
[]
self
.
buildRuleReferences
||=
[]
self
.
dependencyReferences
||=
[]
self
.
dependencyReferences
||=
[]
self
.
buildPhaseReferences
||=
[]
unless
buildConfigurationList
unless
buildConfigurationList
self
.
buildConfigurationList
=
project
.
objects
.
add
(
XCConfigurationList
)
self
.
buildConfigurationList
=
project
.
objects
.
add
(
XCConfigurationList
)
...
@@ -282,8 +304,10 @@ module Pod
...
@@ -282,8 +304,10 @@ module Pod
buildConfigurationList
.
buildConfigurations
.
new
(
'name'
=>
'Release'
)
buildConfigurationList
.
buildConfigurations
.
new
(
'name'
=>
'Release'
)
end
end
self
.
product
||=
project
.
files
.
new
(
'sourceTree'
=>
'BUILT_PRODUCTS_DIR'
)
unless
product
self
.
buildPhaseReferences
||=
[]
self
.
product
=
project
.
files
.
new
(
'sourceTree'
=>
'BUILT_PRODUCTS_DIR'
)
product
.
group
=
project
.
products
end
end
end
def
buildConfigurations
def
buildConfigurations
...
@@ -352,6 +376,7 @@ module Pod
...
@@ -352,6 +376,7 @@ module Pod
class
PBXProject
<
PBXObject
class
PBXProject
<
PBXObject
has_many
:targets
,
:class
=>
PBXNativeTarget
has_many
:targets
,
:class
=>
PBXNativeTarget
belongs_to
:products
,
:uuid
=>
:productRefGroup
,
:class
=>
PBXGroup
end
end
class
PBXObjectList
class
PBXObjectList
...
@@ -487,6 +512,10 @@ module Pod
...
@@ -487,6 +512,10 @@ module Pod
project_object
.
targets
project_object
.
targets
end
end
def
products
project_object
.
products
end
IGNORE_GROUPS
=
[
'Pods'
,
'Frameworks'
,
'Products'
,
'Supporting Files'
]
IGNORE_GROUPS
=
[
'Pods'
,
'Frameworks'
,
'Products'
,
'Supporting Files'
]
def
source_files
def
source_files
source_files
=
{}
source_files
=
{}
...
...
spec/integration_spec.rb
View file @
2580df10
...
@@ -210,7 +210,7 @@ else
...
@@ -210,7 +210,7 @@ else
phase
.
files
.
map
{
|
buildFile
|
buildFile
.
file
}.
should
.
include
libPods
phase
.
files
.
map
{
|
buildFile
|
buildFile
.
file
}.
should
.
include
libPods
# should be the last phase
# should be the last phase
target
.
buildPhases
.
last
.
shellScript
.
should
==
"${SRCROOT}/Pods/Pods
R
esources.sh
\n
"
target
.
buildPhases
.
last
.
shellScript
.
should
==
"${SRCROOT}/Pods/Pods
-r
esources.sh
\n
"
end
end
end
end
...
...
spec/unit/xcode/project_spec.rb
View file @
2580df10
...
@@ -64,12 +64,12 @@ describe "Pod::Xcode::Project" do
...
@@ -64,12 +64,12 @@ describe "Pod::Xcode::Project" do
end
end
it
"is automatically added to the main group"
do
it
"is automatically added to the main group"
do
@
project
.
main_group
.
children
.
should
.
include
@file
@
file
.
group
.
should
==
@project
.
main_group
end
end
it
"is removed from the original group when added to another group"
do
it
"is removed from the original group when added to another group"
do
@project
.
pods
.
children
<<
@file
@project
.
pods
.
children
<<
@file
@
project
.
pods
.
children
.
should
.
include
@file
@
file
.
group
.
should
==
@project
.
pods
@project
.
main_group
.
children
.
should
.
not
.
include
@file
@project
.
main_group
.
children
.
should
.
not
.
include
@file
end
end
end
end
...
@@ -167,6 +167,7 @@ describe "Pod::Xcode::Project" do
...
@@ -167,6 +167,7 @@ describe "Pod::Xcode::Project" do
product
.
should
.
be
.
instance_of
Pod
::
Xcode
::
Project
::
PBXFileReference
product
.
should
.
be
.
instance_of
Pod
::
Xcode
::
Project
::
PBXFileReference
product
.
path
.
should
==
"libPods.a"
product
.
path
.
should
==
"libPods.a"
product
.
name
.
should
==
"libPods.a"
product
.
name
.
should
==
"libPods.a"
product
.
group
.
name
.
should
==
"Products"
product
.
sourceTree
.
should
==
"BUILT_PRODUCTS_DIR"
product
.
sourceTree
.
should
==
"BUILT_PRODUCTS_DIR"
product
.
explicitFileType
.
should
==
"archive.ar"
product
.
explicitFileType
.
should
==
"archive.ar"
product
.
includeInIndex
.
should
==
"0"
product
.
includeInIndex
.
should
==
"0"
...
...
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