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
7c344bdd
Commit
7c344bdd
authored
Sep 28, 2014
by
Marius Rackwitz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Refactor] Extract #generate_target from Analyzer#generate_targets
parent
ef070a7f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
39 deletions
+54
-39
analyzer.rb
lib/cocoapods/installer/analyzer.rb
+54
-39
No files found.
lib/cocoapods/installer/analyzer.rb
View file @
7c344bdd
...
...
@@ -180,52 +180,67 @@ module Pod
def
generate_targets
targets
=
[]
result
.
specs_by_target
.
each
do
|
target_definition
,
specs
|
# Setup the aggregate target
target
=
AggregateTarget
.
new
(
target_definition
,
sandbox
)
targets
<<
target
targets
<<
generate_target
(
target_definition
,
specs
)
end
targets
end
if
config
.
integrate_targets?
project_path
=
compute_user_project_path
(
target_definition
)
user_project
=
Xcodeproj
::
Project
.
open
(
project_path
)
native_targets
=
compute_user_project_targets
(
target_definition
,
user_project
)
target
.
host_requires_framework
|=
compute_user_project_targets_require_framework
(
native_targets
)
target
.
user_project_path
=
project_path
target
.
client_root
=
project_path
.
dirname
target
.
user_target_uuids
=
native_targets
.
map
(
&
:uuid
)
target
.
user_build_configurations
=
compute_user_build_configurations
(
target_definition
,
native_targets
)
target
.
archs
=
@archs_by_target_def
[
target_definition
]
else
target
.
client_root
=
config
.
installation_root
target
.
user_target_uuids
=
[]
target
.
user_build_configurations
=
target_definition
.
build_configurations
||
{
'Release'
=>
:release
,
'Debug'
=>
:debug
}
if
target_definition
.
platform
.
name
==
:osx
target
.
archs
=
'$(ARCHS_STANDARD_64_BIT)'
end
# Setup the aggregate target for a single user target
#
# @param [TargetDefinition] target_definition
# the target definition for the user target.
#
# @param [Array<Specification>] specs
# the specifications that need to be installed grouped by the
# given target definition.
#
# @return [AggregateTarget]
#
def
generate_target
(
target_definition
,
specs
)
target
=
AggregateTarget
.
new
(
target_definition
,
sandbox
)
if
config
.
integrate_targets?
project_path
=
compute_user_project_path
(
target_definition
)
user_project
=
Xcodeproj
::
Project
.
open
(
project_path
)
native_targets
=
compute_user_project_targets
(
target_definition
,
user_project
)
target
.
host_requires_framework
|=
compute_user_project_targets_require_framework
(
native_targets
)
target
.
user_project_path
=
project_path
target
.
client_root
=
project_path
.
dirname
target
.
user_target_uuids
=
native_targets
.
map
(
&
:uuid
)
target
.
user_build_configurations
=
compute_user_build_configurations
(
target_definition
,
native_targets
)
target
.
archs
=
@archs_by_target_def
[
target_definition
]
else
target
.
client_root
=
config
.
installation_root
target
.
user_target_uuids
=
[]
target
.
user_build_configurations
=
target_definition
.
build_configurations
||
{
'Release'
=>
:release
,
'Debug'
=>
:debug
}
if
target_definition
.
platform
.
name
==
:osx
target
.
archs
=
'$(ARCHS_STANDARD_64_BIT)'
end
end
# Group specs and subspecs by their root
grouped_specs
=
specs
.
map
do
|
spec
|
specs
.
select
{
|
s
|
s
.
root
==
spec
.
root
}
end
.
uniq
# Group specs and subspecs by their root
grouped_specs
=
specs
.
map
do
|
spec
|
specs
.
select
{
|
s
|
s
.
root
==
spec
.
root
}
end
.
uniq
# Create a target for each spec group and add it to the aggregate target
grouped_specs
.
each
do
|
pod_specs
|
pod_target
=
PodTarget
.
new
(
pod_specs
,
target_definition
,
sandbox
)
pod_target
.
host_requires_framework
|=
target
.
host_requires_framework
if
config
.
integrate_targets?
pod_target
.
user_build_configurations
=
target
.
user_build_configurations
pod_target
.
archs
=
@archs_by_target_def
[
target_definition
]
else
pod_target
.
user_build_configurations
=
{}
if
target_definition
.
platform
.
name
==
:osx
pod_target
.
archs
=
'$(ARCHS_STANDARD_64_BIT)'
end
# Create a target for each spec group and add it to the aggregate target
grouped_specs
.
each
do
|
pod_specs
|
pod_target
=
PodTarget
.
new
(
pod_specs
,
target_definition
,
sandbox
)
pod_target
.
host_requires_framework
|=
target
.
host_requires_framework
if
config
.
integrate_targets?
pod_target
.
user_build_configurations
=
target
.
user_build_configurations
pod_target
.
archs
=
@archs_by_target_def
[
target_definition
]
else
pod_target
.
user_build_configurations
=
{}
if
target_definition
.
platform
.
name
==
:osx
pod_target
.
archs
=
'$(ARCHS_STANDARD_64_BIT)'
end
target
.
pod_targets
<<
pod_target
end
target
.
pod_targets
<<
pod_target
end
targets
target
end
# Generates dependencies that require the specific version of the Pods
...
...
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