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
1ab7a6ff
Commit
1ab7a6ff
authored
Nov 07, 2013
by
Per Eckerdal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for multiple Xcode subprojects per spec
Because it makes sense.
parent
ce3b4a30
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
14 deletions
+48
-14
linked_dependencies_installer.rb
lib/cocoapods/installer/linked_dependencies_installer.rb
+33
-13
pod_source_installer.rb
lib/cocoapods/installer/pod_source_installer.rb
+1
-1
linked_dependencies_installer_spec.rb
spec/unit/installer/linked_dependencies_installer_spec.rb
+14
-0
No files found.
lib/cocoapods/installer/linked_dependencies_installer.rb
View file @
1ab7a6ff
...
...
@@ -63,11 +63,9 @@ module Pod
# @return [void]
#
def
add_libraries_to_target
pod_target
.
spec_consumers
.
each
do
|
consumer
|
xcodeproj
=
consumer
.
xcodeproj
next
unless
xcodeproj
[
'project'
]
pod_target
.
spec_consumers
.
map
do
|
consumer
|
xcodeprojs_from_consumer
(
consumer
)
end
.
flatten
.
each
do
|
xcodeproj
|
linked_project
=
open_linked_xcode_project
(
xcodeproj
[
'project'
])
# Hide the schemes that would be autogenerated for the subproject's targets.
...
...
@@ -142,15 +140,13 @@ module Pod
def
linked_project_specs
specs_by_path
=
{}
pod_target
.
spec_consumers
.
each
do
|
consumer
|
proj
=
consumer
.
xcodeproj
next
unless
proj
.
present?
absolute_path
=
pod_root
+
proj
[
'project'
]
pod_target
.
spec_consumers
.
map
do
|
consumer
|
xcodeprojs_from_consumer
(
consumer
).
each
do
|
proj
|
absolute_path
=
pod_root
+
proj
[
'project'
]
specs_by_path
[
absolute_path
]
||=
[]
specs_by_path
[
absolute_path
]
<<
consumer
.
spec
specs_by_path
[
absolute_path
]
||=
[]
specs_by_path
[
absolute_path
]
<<
consumer
.
spec
end
end
specs_by_path
...
...
@@ -177,6 +173,30 @@ module Pod
target
end
# Takes a Consumer and extracts an array of xcodeproj descriptors.
#
# @param [Specification::Consumer] consumer The consumer to take xcodeprojs from
#
# @return [Array<Hash>] A list of valid xcodeproj specifications
#
def
xcodeprojs_from_consumer
(
consumer
)
xcodeprojs
=
consumer
.
xcodeprojs
xcodeprojs
=
[]
if
xcodeprojs
.
nil?
xcodeprojs
=
[
xcodeprojs
]
if
xcodeprojs
.
kind_of?
(
Hash
)
xcodeprojs
=
xcodeprojs
.
map
do
|
xcodeproj
|
xcodeproj
.
inject
({})
{
|
memo
,
(
k
,
v
)
|
memo
[
k
.
to_s
]
=
v
;
memo
}
end
xcodeprojs
.
each
do
|
xcodeproj
|
unless
xcodeproj
.
has_key?
(
'project'
)
raise
Informative
,
"Missing project parameter to xcodeproj specification:
#{
xcodeproj
.
inspect
}
"
end
end
xcodeprojs
end
# @return [String] the path where the pod target's specification is
# defined, if loaded from a file. (May be nil)
#
...
...
lib/cocoapods/installer/pod_source_installer.rb
View file @
1ab7a6ff
...
...
@@ -232,7 +232,7 @@ module Pod
#
def
clean_paths
has_xcodeproj
=
specs_by_platform
.
any?
do
|
platform
,
specs
|
specs
.
any?
{
|
spec
|
spec
.
consumer
(
platform
).
xcodeproj
.
present?
}
specs
.
any?
{
|
spec
|
spec
.
consumer
(
platform
).
xcodeproj
s
.
present?
}
end
return
[]
if
has_xcodeproj
...
...
spec/unit/installer/linked_dependencies_installer_spec.rb
View file @
1ab7a6ff
...
...
@@ -145,6 +145,20 @@ module Pod
end
.
message
.
should
.
match
/Could not find native target/
end
it
"extracts a single xcodeproj from a consumer object"
do
spec
=
@file_accessor
.
spec
spec
.
xcodeproj
=
{
:project
=>
'hello'
}
@installer
.
send
(
:xcodeprojs_from_consumer
,
spec
.
consumer
(
:ios
)).
should
.
be
==
[{
"project"
=>
"hello"
}]
end
it
"extracts two xcodeprojs from a consumer object"
do
spec
=
@file_accessor
.
spec
spec
.
xcodeprojs
=
[{
:project
=>
'hello'
},
{
'project'
=>
'hello2'
}]
xcodeprojs
=
@installer
.
send
(
:xcodeprojs_from_consumer
,
spec
.
consumer
(
:ios
))
xcodeprojs
.
should
.
be
==
[{
"project"
=>
"hello"
},
{
"project"
=>
"hello2"
}]
end
it
"finds the spec file path correctly"
do
@installer
.
send
(
:spec_file
).
should
.
be
==
@file_accessor
.
spec
.
defined_in_file
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