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
end
xcconfig
.
merge!
(
'USER_HEADER_SEARCH_PATHS'
=>
user_header_search_paths
.
sort
.
uniq
.
join
(
" "
))
# Add the prefix header and xcconfig files to the project
@xcodeproj
.
files
.
new
(
'path'
=>
prefix_header_filename
)
prefix_file
=
@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
)
@target
.
buildConfigurations
.
each
do
|
config
|
config
.
baseConfiguration
=
xcconfig_file
...
...
lib/cocoapods/xcode/project.rb
View file @
2580df10
...
...
@@ -48,14 +48,35 @@ module Pod
end
def
self
.
belongs_to
(
singular_attr_name
,
options
=
{})
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
)
if
uuid_name
=
options
[
:uuids
]
# part of another objects uuid list
klass
=
options
[
:class
]
define_method
(
singular_attr_name
)
do
# Loop over all objects of the class and find the one that includes
# this object in the specified uuid list.
@project
.
objects
.
select_by_class
(
klass
).
find
do
|
object
|
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
...
...
@@ -137,6 +158,7 @@ module Pod
class
PBXFileReference
<
PBXObject
attributes
:path
,
:sourceTree
,
:explicitFileType
,
:includeInIndex
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
)
is_new
=
uuid
.
nil?
...
...
@@ -164,16 +186,15 @@ module Pod
attributes
:sourceTree
has_many
:children
,
:singular
=>
:child
do
|
object
|
if
object
.
is_a?
(
PBXFileReference
)
#
Remove from the group it was in
if
group
=
@project
.
groups
.
find
{
|
group
|
group
.
children
.
include?
(
object
)
}
# TODO
# * group.children.delete(object)
# * object.group = nil
group
.
childReferences
.
delete
(
object
.
uuid
)
en
d
if
object
.
is_a?
(
P
od
::
Xcode
::
Project
::
P
BXFileReference
)
#
Associating the file to this group through the inverse
# association will also remove it from the group it was in.
object
.
group
=
self
else
# TODO What objects can actually be in a group and don't they
# all need the above treatment.
childReferences
<<
object
.
uui
d
end
childReferences
<<
object
.
uuid
end
def
initialize
(
*
)
...
...
@@ -183,15 +204,15 @@ module Pod
end
def
files
list_by_class
(
childReferences
,
PBXFileReference
)
list_by_class
(
childReferences
,
P
od
::
Xcode
::
Project
::
P
BXFileReference
)
end
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
def
groups
list_by_class
(
childReferences
,
PBXGroup
)
list_by_class
(
childReferences
,
P
od
::
Xcode
::
Project
::
P
BXGroup
)
end
def
<<
(
child
)
...
...
@@ -274,6 +295,7 @@ module Pod
self
.
name
||=
productName
self
.
buildRuleReferences
||=
[]
self
.
dependencyReferences
||=
[]
self
.
buildPhaseReferences
||=
[]
unless
buildConfigurationList
self
.
buildConfigurationList
=
project
.
objects
.
add
(
XCConfigurationList
)
...
...
@@ -282,8 +304,10 @@ module Pod
buildConfigurationList
.
buildConfigurations
.
new
(
'name'
=>
'Release'
)
end
self
.
product
||=
project
.
files
.
new
(
'sourceTree'
=>
'BUILT_PRODUCTS_DIR'
)
self
.
buildPhaseReferences
||=
[]
unless
product
self
.
product
=
project
.
files
.
new
(
'sourceTree'
=>
'BUILT_PRODUCTS_DIR'
)
product
.
group
=
project
.
products
end
end
def
buildConfigurations
...
...
@@ -352,6 +376,7 @@ module Pod
class
PBXProject
<
PBXObject
has_many
:targets
,
:class
=>
PBXNativeTarget
belongs_to
:products
,
:uuid
=>
:productRefGroup
,
:class
=>
PBXGroup
end
class
PBXObjectList
...
...
@@ -487,6 +512,10 @@ module Pod
project_object
.
targets
end
def
products
project_object
.
products
end
IGNORE_GROUPS
=
[
'Pods'
,
'Frameworks'
,
'Products'
,
'Supporting Files'
]
def
source_files
source_files
=
{}
...
...
spec/integration_spec.rb
View file @
2580df10
...
...
@@ -210,7 +210,7 @@ else
phase
.
files
.
map
{
|
buildFile
|
buildFile
.
file
}.
should
.
include
libPods
# 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
...
...
spec/unit/xcode/project_spec.rb
View file @
2580df10
...
...
@@ -64,12 +64,12 @@ describe "Pod::Xcode::Project" do
end
it
"is automatically added to the main group"
do
@
project
.
main_group
.
children
.
should
.
include
@file
@
file
.
group
.
should
==
@project
.
main_group
end
it
"is removed from the original group when added to another group"
do
@project
.
pods
.
children
<<
@file
@
project
.
pods
.
children
.
should
.
include
@file
@
file
.
group
.
should
==
@project
.
pods
@project
.
main_group
.
children
.
should
.
not
.
include
@file
end
end
...
...
@@ -167,6 +167,7 @@ describe "Pod::Xcode::Project" do
product
.
should
.
be
.
instance_of
Pod
::
Xcode
::
Project
::
PBXFileReference
product
.
path
.
should
==
"libPods.a"
product
.
name
.
should
==
"libPods.a"
product
.
group
.
name
.
should
==
"Products"
product
.
sourceTree
.
should
==
"BUILT_PRODUCTS_DIR"
product
.
explicitFileType
.
should
==
"archive.ar"
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