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
e04d1529
Commit
e04d1529
authored
Sep 30, 2011
by
Eloy Duran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only add $(BUILT_PRODUCTS_DIR)/Pods and $(BUILT_PRODUCTS_DIR)/Pods/PodName to the search paths.
parent
32ce2fea
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
63 additions
and
51 deletions
+63
-51
installer.rb
lib/cocoapods/installer.rb
+7
-20
project.rb
lib/cocoapods/xcode/project.rb
+15
-8
installer_spec.rb
spec/unit/installer_spec.rb
+28
-22
project_spec.rb
spec/unit/xcode/project_spec.rb
+13
-1
No files found.
lib/cocoapods/installer.rb
View file @
e04d1529
...
...
@@ -38,18 +38,8 @@ module Pod
pattern
=
spec
.
pod_destroot
+
pattern
pattern
=
pattern
+
'*.{h,m,mm,c,cpp}'
if
pattern
.
directory?
pattern
.
glob
.
each
do
|
file
|
dir
,
_
=
file
.
relative_path_from
(
spec
.
pod_destroot
).
split
dir
=
dir
.
to_s
if
dir
==
"."
dir
=
spec
.
name
else
if
dir
.
split
(
'/'
)[
0
]
!=
spec
.
name
dir
=
spec
.
name
+
'/'
+
dir
end
end
grouped_files
[
dir
.
to_s
]
||=
[]
grouped_files
[
dir
.
to_s
]
<<
file
.
relative_path_from
(
config
.
project_pods_root
)
file
=
file
.
relative_path_from
(
config
.
project_pods_root
)
(
grouped_files
[
file
.
dirname
.
to_s
]
||=
[])
<<
file
end
end
grouped_files
...
...
@@ -71,17 +61,14 @@ module Pod
def
generate_project
build_specification_sets
.
each
do
|
set
|
xcodeproj
.
add_group
(
set
.
specification
.
name
)
xcconfig
<<
{
'USER_HEADER_SEARCH_PATHS'
=>
"
\"
$(BUILT_PRODUCTS_DIR)/Pods/
#{
set
.
specification
.
name
}
\"
"
}
grouped_source_files_for_spec
(
set
.
specification
).
each
do
|
path
,
files
|
phase_uuid
=
xcodeproj
.
add_copy_header_build_phase
(
set
.
specification
.
name
,
path
)
xcconfig
<<
{
'USER_HEADER_SEARCH_PATHS'
=>
"
\"
$(BUILT_PRODUCTS_DIR)/Pods/
#{
path
}
\"
"
}
xcconfig
<<
{
'USER_HEADER_SEARCH_PATHS'
=>
%{"$(BUILT_PRODUCTS_DIR)/Pods/#{set.name}"}
}
xcodeproj
.
add_group
(
set
.
name
)
grouped_source_files_for_spec
(
set
.
specification
).
each
do
|
dir
,
files
|
copy_phase_uuid
=
xcodeproj
.
add_copy_header_build_phase
(
set
.
name
,
dir
)
files
.
each
do
|
file
|
xcodeproj
.
add_source_file
(
file
,
set
.
specification
.
name
,
phase_uuid
)
xcodeproj
.
add_source_file
(
file
,
set
.
name
,
copy_
phase_uuid
)
end
end
#puts "#{grouped_source_files_for_spec(set.specification)}"
xcconfig
<<
set
.
specification
.
xcconfig
end
end
...
...
lib/cocoapods/xcode/project.rb
View file @
e04d1529
...
...
@@ -61,7 +61,7 @@ module Pod
# Working around a bug in Xcode 4.2 betas, remove this once the Xcode bug is fixed:
# https://github.com/alloy/cocoapods/issues/13
#add_file_to_list('PBXHeadersBuildPhase', build_file_uuid)
add_file_to_list
(
'PBXCopyFilesBuildPhase'
,
build_file_uuid
)
{
|
uuid
,
_
|
uuid
==
phase_uuid
}
add_file_to_list
(
'PBXCopyFilesBuildPhase'
,
build_file_uuid
,
phase_uuid
)
else
extra
=
compiler_flags
?
{
"settings"
=>
{
"COMPILER_FLAGS"
=>
compiler_flags
}}
:
{}
build_file_uuid
=
add_build_file
(
file_ref_uuid
,
extra
)
...
...
@@ -89,6 +89,7 @@ module Pod
@template
.
writeToFile
(
pbxproj
.
to_s
,
atomically
:true
)
end
# TODO add comments, or even constants, describing what these magic numbers are.
def
add_copy_header_build_phase
(
name
,
path
)
phase_uuid
=
add_object
({
"isa"
=>
"PBXCopyFilesBuildPhase"
,
...
...
@@ -105,6 +106,10 @@ module Pod
phase_uuid
end
def
objects_by_isa
(
isa
)
objects
.
select
{
|
_
,
object
|
object
[
'isa'
]
==
isa
}
end
private
def
add_object
(
object
)
...
...
@@ -129,9 +134,15 @@ module Pod
}))
end
def
add_file_to_list
(
isa
,
build_file_uuid
,
&
condition
)
isa_objects
=
objects_by_isa
(
isa
)
object_uuid
,
object
=
(
condition
.
nil?
?
isa_objects
.
first
:
isa_objects
.
find
(
&
condition
))
# TODO refactor to create PBX object classes and make this take aither a uuid or a class instead of both.
def
add_file_to_list
(
isa
,
build_file_uuid
,
phase_uuid
=
nil
)
objects
=
objects_by_isa
(
isa
)
_
=
object
=
nil
if
phase_uuid
.
nil?
_
,
object
=
objects
.
first
else
object
=
objects
[
phase_uuid
]
end
object
[
'files'
]
<<
build_file_uuid
end
...
...
@@ -146,10 +157,6 @@ module Pod
@template
[
'objects'
]
end
def
objects_by_isa
(
isa
)
objects
.
select
{
|
_
,
object
|
object
[
'isa'
]
==
isa
}
end
def
generate_uuid
_uuid
=
CFUUIDCreate
(
nil
)
uuid
=
CFUUIDCreateString
(
nil
,
_uuid
)
...
...
spec/unit/installer_spec.rb
View file @
e04d1529
...
...
@@ -19,33 +19,39 @@ describe "Pod::Installer" do
[
'Classes'
],
{
'ASIHTTPRequest'
=>
"Classes/*.{h,m}"
,
'Reachability'
=>
"External/Reachability/*.{h,m}"
},
{
"USER_HEADER_SEARCH_PATHS"
=>
"$(BUILT_PRODUCTS_DIR)/Pods"
,
"USER_HEADER_SEARCH_PATHS"
=>
'"$(BUILT_PRODUCTS_DIR)/Pods" '
\
'"$(BUILT_PRODUCTS_DIR)/Pods/ASIHTTPRequest" '
\
'"$(BUILT_PRODUCTS_DIR)/Pods/Reachability"'
,
"ALWAYS_SEARCH_USER_PATHS"
=>
"YES"
,
"OTHER_LDFLAGS"
=>
"-framework SystemConfiguration -framework CFNetwork "
\
"-framework MobileCoreServices -l z.1"
}
],
#[
#'Reachability',
#["External/Reachability/*.h", "External/Reachability/*.m"],
#{ 'Reachability' => "External/Reachability/*.{h,m}", },
#{
#"USER_HEADER_SEARCH_PATHS" => "$(BUILT_PRODUCTS_DIR)/Pods",
#"ALWAYS_SEARCH_USER_PATHS" => "YES"
#}
#],
#[
#'ASIWebPageRequest',
#['**/ASIWebPageRequest.*'],
#{ 'ASIHTTPRequest' => "Classes/*.{h,m}", 'ASIWebPageRequest' => "Classes/ASIWebPageRequest/*.{h,m}", 'Reachability' => "External/Reachability/*.{h,m}" },
#{
#"USER_HEADER_SEARCH_PATHS" => "$(BUILT_PRODUCTS_DIR)/Pods",
#"ALWAYS_SEARCH_USER_PATHS" => "YES",
#"HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2",
#"OTHER_LDFLAGS" => "-l xml2.2.7.3 -framework SystemConfiguration " \
#"-framework CFNetwork -framework MobileCoreServices -l z.1"
#}
#],
[
'Reachability'
,
[
"External/Reachability/*.h"
,
"External/Reachability/*.m"
],
{
'Reachability'
=>
"External/Reachability/*.{h,m}"
,
},
{
"USER_HEADER_SEARCH_PATHS"
=>
'"$(BUILT_PRODUCTS_DIR)/Pods" '
\
'"$(BUILT_PRODUCTS_DIR)/Pods/Reachability"'
,
"ALWAYS_SEARCH_USER_PATHS"
=>
"YES"
}
],
[
'ASIWebPageRequest'
,
[
'**/ASIWebPageRequest.*'
],
{
'ASIHTTPRequest'
=>
"Classes/*.{h,m}"
,
'ASIWebPageRequest'
=>
"Classes/ASIWebPageRequest/*.{h,m}"
,
'Reachability'
=>
"External/Reachability/*.{h,m}"
},
{
"USER_HEADER_SEARCH_PATHS"
=>
'"$(BUILT_PRODUCTS_DIR)/Pods" '
\
'"$(BUILT_PRODUCTS_DIR)/Pods/ASIWebPageRequest" '
\
'"$(BUILT_PRODUCTS_DIR)/Pods/ASIHTTPRequest" '
\
'"$(BUILT_PRODUCTS_DIR)/Pods/Reachability"'
,
"ALWAYS_SEARCH_USER_PATHS"
=>
"YES"
,
"HEADER_SEARCH_PATHS"
=>
"$(SDKROOT)/usr/include/libxml2"
,
"OTHER_LDFLAGS"
=>
"-l xml2.2.7.3 -framework SystemConfiguration "
\
"-framework CFNetwork -framework MobileCoreServices -l z.1"
}
],
].
each
do
|
name
,
patterns
,
expected_patterns
,
xcconfig
|
Pod
::
Source
.
reset!
Pod
::
Spec
::
Set
.
reset!
...
...
spec/unit/xcode/project_spec.rb
View file @
e04d1529
...
...
@@ -59,7 +59,7 @@ describe "Pod::Xcode::Project" do
build_file_uuids
=
[]
%w{ m mm c cpp }
.
each
do
|
ext
|
path
=
Pathname
.
new
(
"path/to/file.
#{
ext
}
"
)
file_ref_uuid
=
@project
.
add_source_file
(
path
,
'Pods'
,
'-fno-obj-arc'
)
file_ref_uuid
=
@project
.
add_source_file
(
path
,
'Pods'
,
nil
,
'-fno-obj-arc'
)
@project
.
find_object
({
'isa'
=>
'PBXBuildFile'
,
'fileRef'
=>
file_ref_uuid
,
...
...
@@ -68,6 +68,18 @@ describe "Pod::Xcode::Project" do
end
end
it
"creates a copy build header phase which will copy headers to a specified path"
do
phase_uuid
=
@project
.
add_copy_header_build_phase
(
"SomePod"
,
"Path/To/Source"
)
@project
.
find_object
({
'isa'
=>
'PBXCopyFilesBuildPhase'
,
'dstPath'
=>
'$(PUBLIC_HEADERS_FOLDER_PATH)/Path/To/Source'
,
'name'
=>
'Copy SomePod Public Headers'
}).
should
.
not
==
nil
_
,
target
=
@project
.
objects_by_isa
(
'PBXNativeTarget'
).
first
target
[
'buildPhases'
].
should
.
include
phase_uuid
end
it
"adds a `h' file as a build file and adds it to the `headers build' phase list"
do
@project
.
add_group
(
'SomeGroup'
)
path
=
Pathname
.
new
(
"path/to/file.h"
)
...
...
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