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
69ed45ab
Commit
69ed45ab
authored
Aug 03, 2016
by
Ben Asher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Collection host product type information during analysis
parent
0fec0e09
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
7 deletions
+34
-7
analyzer.rb
lib/cocoapods/installer/analyzer.rb
+12
-6
aggregate_target.rb
lib/cocoapods/target/aggregate_target.rb
+16
-1
aggregate_target_spec.rb
spec/unit/target/aggregate_target_spec.rb
+6
-0
No files found.
lib/cocoapods/installer/analyzer.rb
View file @
69ed45ab
...
...
@@ -257,7 +257,8 @@ module Pod
end
# Raises an error if there are embedded targets in the Podfile, but
# their host targets have not been declared in the Podfile
# their host targets have not been declared in the Podfile. As it
# finds host targets, it collection information on host target types.
#
# @param [Array<AggregateTarget>] aggregate_targets the generated
# aggregate targets
...
...
@@ -265,14 +266,19 @@ module Pod
# @param [Array<AggregateTarget>] embedded_aggregate_targets the aggregate targets
# representing the embedded targets to be integrated
#
def
verify
_host_targets_in_podfile
(
aggregate_targets
,
embedded_aggregate_targets
)
def
analyze
_host_targets_in_podfile
(
aggregate_targets
,
embedded_aggregate_targets
)
aggregate_target_uuids
=
Set
.
new
aggregate_targets
.
map
(
&
:user_targets
).
flatten
.
map
(
&
:uuid
)
aggregate_target_user_projects
=
aggregate_targets
.
map
(
&
:user_project
)
embedded_targets_missing_hosts
=
[]
embedded_aggregate_targets
.
each
do
|
target
|
host_uuids
=
aggregate_target_user_projects
.
product
(
target
.
user_targets
).
map
do
|
user_project
,
user_target
|
user_project
.
host_targets_for_embedded_target
(
user_target
).
map
(
&
:uuid
)
end
.
flatten
host_uuids
=
[]
aggregate_target_user_projects
.
product
(
target
.
user_targets
).
each
do
|
user_project
,
user_target
|
host_targets
=
user_project
.
host_targets_for_embedded_target
(
user_target
)
host_targets
.
map
(
&
:product_type
).
each
do
|
product_type
|
target
.
add_host_target_product_type
(
product_type
)
end
host_uuids
+=
host_targets
.
map
(
&
:uuid
)
end
embedded_targets_missing_hosts
<<
target
unless
host_uuids
.
any?
do
|
uuid
|
aggregate_target_uuids
.
include?
uuid
end
...
...
@@ -295,7 +301,7 @@ module Pod
if
installation_options
.
integrate_targets?
# Copy embedded target pods that cannot have their pods embedded as frameworks to their host targets
embedded_targets
=
aggregate_targets
.
select
(
&
:requires_host_target?
).
select
(
&
:requires_frameworks?
)
verify
_host_targets_in_podfile
(
aggregate_targets
,
embedded_targets
)
analyze
_host_targets_in_podfile
(
aggregate_targets
,
embedded_targets
)
aggregate_targets
.
each
do
|
target
|
copy_embedded_target_pod_targets_to_host
(
target
,
embedded_targets
)
end
...
...
lib/cocoapods/target/aggregate_target.rb
View file @
69ed45ab
...
...
@@ -24,6 +24,21 @@ module Pod
@search_paths_aggregate_targets
=
[]
@file_accessors
=
[]
@xcconfigs
=
{}
@host_target_types
=
[]
# Product types of the host target, if this target is embedded
end
# Adds product type to the list of product types for the host
# targets, in which this target will be embedded
#
# @param [Symbol] Product type of a host, in which this target
# will be embedded
#
# @note This is important for messages extensions, since a messages
# extension has its frameworks embedded in its host when
# its host is an app but not when it's a messages app
#
def
add_host_target_product_type
(
product_type
)
@host_target_types
<<
product_type
end
# @return [Boolean] True if the user_target's pods are
...
...
@@ -39,7 +54,7 @@ module Pod
return
false
if
user_project
.
nil?
symbol_types
=
user_targets
.
map
(
&
:symbol_type
).
uniq
raise
ArgumentError
,
"Expected single kind of user_target for
#{
name
}
. Found
#{
symbol_types
.
join
(
', '
)
}
."
unless
symbol_types
.
count
==
1
EMBED_FRAMEWORKS_IN_HOST_TARGET_TYPES
.
include?
symbol_types
[
0
]
EMBED_FRAMEWORKS_IN_HOST_TARGET_TYPES
.
include?
(
symbol_types
[
0
])
&&
!
@host_target_types
.
include?
(
:messages_application
)
end
# @return [String] the label for the target.
...
...
spec/unit/target/aggregate_target_spec.rb
View file @
69ed45ab
...
...
@@ -224,6 +224,12 @@ module Pod
@target
.
requires_host_target?
.
should
==
true
end
it
'does not require a host target for messages extension targets embedded in messages applications'
do
@target
.
add_host_target_product_type
(
:messages_application
)
@target
.
user_targets
.
first
.
stubs
(
:symbol_type
).
returns
(
:messages_extension
)
@target
.
requires_host_target?
.
should
==
false
end
it
'does not require a host target for watch 2 extension targets'
do
@target
.
user_targets
.
first
.
stubs
(
:symbol_type
).
returns
(
:watch2_extension
)
@target
.
requires_host_target?
.
should
==
false
...
...
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