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
56d0b4b1
Commit
56d0b4b1
authored
Apr 01, 2012
by
Eloy Duran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
And successfully build a OS X static library from a mixed platform Podfile.
parent
4a709b87
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
18 deletions
+47
-18
installer.rb
lib/cocoapods/installer.rb
+45
-17
integration_spec.rb
spec/integration_spec.rb
+2
-1
No files found.
lib/cocoapods/installer.rb
View file @
56d0b4b1
...
@@ -7,7 +7,7 @@ module Pod
...
@@ -7,7 +7,7 @@ module Pod
include
Config
::
Mixin
include
Config
::
Mixin
attr_reader
:sandbox
attr_reader
:sandbox
def
initialize
(
podfile
,
user_project_path
=
nil
)
def
initialize
(
podfile
,
user_project_path
=
nil
)
@podfile
,
@user_project_path
=
podfile
,
user_project_path
@podfile
,
@user_project_path
=
podfile
,
user_project_path
...
@@ -22,7 +22,6 @@ module Pod
...
@@ -22,7 +22,6 @@ module Pod
def
project
def
project
return
@project
if
@project
return
@project
if
@project
# TODO this should not init with platform
@project
=
Pod
::
Project
.
new
@project
=
Pod
::
Project
.
new
activated_pods
.
each
do
|
pod
|
activated_pods
.
each
do
|
pod
|
# Add all source files to the project grouped by pod
# Add all source files to the project grouped by pod
...
@@ -79,9 +78,8 @@ module Pod
...
@@ -79,9 +78,8 @@ module Pod
pods
=
activated_pods
pods
=
activated_pods
puts_title
(
"Generating support files
\n
"
,
false
)
puts_title
(
"Generating support files
\n
"
,
false
)
target_installers
.
each
do
|
target_installer
|
target_installers
.
each
do
|
target_installer
|
target_specs
=
activated_specifications_for_target
(
target_installer
.
target_definition
)
pods_for_target
=
activated_pods_by_target
[
target_installer
.
target_definition
]
pods_for_target
=
pods
.
select
{
|
pod
|
target_specs
.
include?
(
pod
.
specification
)
}
target_installer
.
install!
(
pods_for_target
,
@sandbox
)
target_installer
.
install!
(
pods_for_target
,
sandbox
)
end
end
generate_lock_file!
(
pods
)
generate_lock_file!
(
pods
)
...
@@ -111,10 +109,25 @@ module Pod
...
@@ -111,10 +109,25 @@ module Pod
def
generate_lock_file!
(
pods
)
def
generate_lock_file!
(
pods
)
lock_file
.
open
(
'w'
)
do
|
file
|
lock_file
.
open
(
'w'
)
do
|
file
|
file
.
puts
"PODS:"
file
.
puts
"PODS:"
pods
.
map
do
|
pod
|
# TODO this should list _all_ the pods, so merge the platforms
# Get list of [name, dependencies] pairs.
activated_pods
=
pods
.
map
do
|
pod
|
[
pod
.
specification
.
to_s
,
pod
.
dependencies
.
map
(
&
:to_s
).
sort
]
[
pod
.
specification
.
to_s
,
pod
.
dependencies
.
map
(
&
:to_s
).
sort
]
end
.
uniq
.
sort_by
(
&
:first
).
each
do
|
name
,
deps
|
end
.
uniq
# Merge dependencies of ios and osx version of the same pod.
tmp
=
{}
activated_pods
.
each
do
|
name
,
deps
|
if
tmp
[
name
]
tmp
[
name
].
concat
(
deps
).
uniq!
else
tmp
[
name
]
=
deps
end
end
activated_pods
=
tmp
# Sort by name and print
activated_pods
.
sort_by
(
&
:first
).
each
do
|
name
,
deps
|
if
deps
.
empty?
if
deps
.
empty?
file
.
puts
" -
#{
name
}
"
file
.
puts
" -
#{
name
}
"
else
else
...
@@ -143,27 +156,36 @@ module Pod
...
@@ -143,27 +156,36 @@ module Pod
@specs_by_target
||=
@resolver
.
resolve
@specs_by_target
||=
@resolver
.
resolve
end
end
# @return [Array<Specification>] All dependencies that have been resolved.
def
dependency_specifications
def
dependency_specifications
specs_by_target
.
values
.
flatten
specs_by_target
.
values
.
flatten
end
end
# @return [Array<LocalPod>] A list of LocalPod instances for each
# dependency that is not a download-only one.
def
activated_pods
def
activated_pods
activated_specifications
.
map
do
|
spec
|
activated_pods_by_target
.
values
.
flatten
# TODO @podfile.platform will change to target_definition.platform
end
LocalPod
.
new
(
spec
,
sandbox
,
@podfile
.
target_definitions
[
:default
].
platform
)
def
activated_pods_by_target
result
=
{}
specs_by_target
.
each
do
|
target_definition
,
specs
|
result
[
target_definition
]
=
specs
.
map
do
|
spec
|
LocalPod
.
new
(
spec
,
@sandbox
,
target_definition
.
platform
)
if
activated_spec?
(
spec
)
end
.
compact
end
end
result
end
end
# @return [Array<Specification>] A list of specifications for each
# dependency that is not a download-only
# one.
def
activated_specifications
def
activated_specifications
dependency_specifications
.
reject
do
|
spec
|
dependency_specifications
.
select
{
|
spec
|
activated_spec?
(
spec
)
}
# Don't activate specs which are only wrappers of subspecs, or share
# source with another pod but aren't activated themselves.
spec
.
wrapper?
||
@resolver
.
cached_sets
[
spec
.
name
].
only_part_of_other_pod?
end
end
end
def
activated_specifications_for_target
(
target_definition
)
def
activated_specifications_for_target
(
target_definition
)
specs_by_target
[
target_definition
]
specs_by_target
[
target_definition
]
.
select
{
|
spec
|
activated_spec?
(
spec
)
}
end
end
def
download_only_specifications
def
download_only_specifications
...
@@ -172,6 +194,12 @@ module Pod
...
@@ -172,6 +194,12 @@ module Pod
private
private
def
activated_spec?
(
spec
)
# Don't activate specs which are only wrappers of subspecs, or share
# source with another pod but aren't activated themselves.
!
spec
.
wrapper?
&&
!
@resolver
.
cached_sets
[
spec
.
name
].
only_part_of_other_pod?
end
def
puts_title
(
title
,
only_verbose
=
true
)
def
puts_title
(
title
,
only_verbose
=
true
)
if
(
config
.
verbose?
)
if
(
config
.
verbose?
)
puts
"
\n
"
+
title
.
yellow
puts
"
\n
"
+
title
.
yellow
...
...
spec/integration_spec.rb
View file @
56d0b4b1
...
@@ -167,7 +167,8 @@ else
...
@@ -167,7 +167,8 @@ else
puts
"
\n
[!] Compiling OS X static library..."
puts
"
\n
[!] Compiling OS X static library..."
target_definition
=
podfile
.
target_definitions
[
:osx_target
]
target_definition
=
podfile
.
target_definitions
[
:osx_target
]
should_successfully_perform
"xcodebuild -target '
#{
target_definition
.
label
}
'"
should_successfully_perform
"xcodebuild -target '
#{
target_definition
.
label
}
'"
exec
'ls'
lib_path
=
config
.
project_pods_root
+
'build/Release'
+
target_definition
.
lib_name
`lipo -info '
#{
lib_path
}
'`
.
should
.
include
'architecture: x86_64'
end
end
end
end
end
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