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
dfbef046
Commit
dfbef046
authored
Aug 01, 2017
by
Dimitris Koutsogiorgas
Committed by
GitHub
Aug 01, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6917 from dnkoutso/transitive_linker_flags
Ensure transitive dependencies are linked to test targets
parents
81b6113b
5452f360
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
55 additions
and
14 deletions
+55
-14
CHANGELOG.md
CHANGELOG.md
+4
-0
pod_xcconfig.rb
lib/cocoapods/generator/xcconfig/pod_xcconfig.rb
+3
-3
analyzer.rb
lib/cocoapods/installer/analyzer.rb
+2
-0
pod_target_integrator.rb
...nstaller/pods_project_integrator/pod_target_integrator.rb
+2
-2
pods_project_generator.rb
lib/cocoapods/installer/xcode/pods_project_generator.rb
+1
-1
pod_target_installer.rb
...ller/xcode/pods_project_generator/pod_target_installer.rb
+2
-2
pod_target.rb
lib/cocoapods/target/pod_target.rb
+26
-0
pod_xcconfig_spec.rb
spec/unit/generator/xcconfig/pod_xcconfig_spec.rb
+7
-0
pods_project_generator_spec.rb
spec/unit/installer/xcode/pods_project_generator_spec.rb
+8
-6
No files found.
CHANGELOG.md
View file @
dfbef046
...
...
@@ -12,6 +12,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Bug Fixes
*
Ensure transitive dependencies are linked to test targets
[
Dimitris Koutsogiorgas
](
https://github.com/dnkoutso
)
[
#6917
](
https://github.com/CocoaPods/CocoaPods/pull/6917
)
*
Add
`--skip-tests`
support
`push`
to push command
[
Dimitris Koutsogiorgas
](
https://github.com/dnkoutso
)
[
#6893
](
https://github.com/CocoaPods/CocoaPods/pull/6893
)
...
...
lib/cocoapods/generator/xcconfig/pod_xcconfig.rb
View file @
dfbef046
...
...
@@ -72,10 +72,10 @@ module Pod
recursive_dependent_targets
=
target
.
recursive_dependent_targets
@xcconfig
.
merge!
XCConfigHelper
.
settings_for_dependent_targets
(
target
,
recursive_dependent_targets
,
@test_xcconfig
)
if
@test_xcconfig
test_dependent_targets
=
[
target
,
*
target
.
test_dependent_targets
]
test_dependent_targets
=
[
target
,
*
target
.
recursive_test_dependent_targets
].
uniq
@xcconfig
.
merge!
XCConfigHelper
.
settings_for_dependent_targets
(
target
,
test_dependent_targets
-
recursive_dependent_targets
,
@test_xcconfig
)
XCConfigHelper
.
generate_vendored_build_settings
(
nil
,
test_dependent_targets
,
@xcconfig
)
XCConfigHelper
.
generate_other_ld_flags
(
nil
,
test_dependent_targets
,
@xcconfig
)
XCConfigHelper
.
generate_vendored_build_settings
(
nil
,
t
arget
.
all_t
est_dependent_targets
,
@xcconfig
)
XCConfigHelper
.
generate_other_ld_flags
(
nil
,
t
arget
.
all_t
est_dependent_targets
,
@xcconfig
)
XCConfigHelper
.
generate_ld_runpath_search_paths
(
target
,
false
,
true
,
@xcconfig
)
end
@xcconfig
...
...
lib/cocoapods/installer/analyzer.rb
View file @
dfbef046
...
...
@@ -498,6 +498,7 @@ module Pod
pod_targets
.
each
do
|
target
|
dependencies
=
transitive_dependencies_for_specs
(
target
.
specs
.
reject
(
&
:test_specification?
),
target
.
platform
,
all_specs
).
group_by
(
&
:root
)
test_dependencies
=
transitive_dependencies_for_specs
(
target
.
specs
.
select
(
&
:test_specification?
),
target
.
platform
,
all_specs
).
group_by
(
&
:root
)
test_dependencies
.
delete_if
{
|
k
|
dependencies
.
key?
k
}
target
.
dependent_targets
=
filter_dependencies
(
dependencies
,
pod_targets_by_name
,
target
)
target
.
test_dependent_targets
=
filter_dependencies
(
test_dependencies
,
pod_targets_by_name
,
target
)
end
...
...
@@ -512,6 +513,7 @@ module Pod
pod_targets
.
each
do
|
target
|
dependencies
=
transitive_dependencies_for_specs
(
target
.
specs
,
target
.
platform
,
specs
).
group_by
(
&
:root
)
test_dependencies
=
transitive_dependencies_for_specs
(
target
.
specs
.
select
(
&
:test_specification?
),
target
.
platform
,
all_specs
).
group_by
(
&
:root
)
test_dependencies
.
delete_if
{
|
k
|
dependencies
.
key?
k
}
target
.
dependent_targets
=
pod_targets
.
reject
{
|
t
|
dependencies
[
t
.
root_spec
].
nil?
}
target
.
test_dependent_targets
=
pod_targets
.
reject
{
|
t
|
test_dependencies
[
t
.
root_spec
].
nil?
}
end
...
...
lib/cocoapods/installer/pods_project_integrator/pod_target_integrator.rb
View file @
dfbef046
...
...
@@ -47,7 +47,7 @@ module Pod
def
add_copy_resources_script_phase
(
native_target
)
test_type
=
target
.
test_type_for_product_type
(
native_target
.
symbol_type
)
script_path
=
"${PODS_ROOT}/
#{
target
.
copy_resources_script_path_for_test_type
(
test_type
).
relative_path_from
(
target
.
sandbox
.
root
)
}
"
resource_paths
=
[
target
,
*
target
.
test_dependent_targets
]
.
flat_map
(
&
:resource_paths
)
resource_paths
=
target
.
all_test_dependent_targets
.
flat_map
(
&
:resource_paths
)
input_paths
=
[]
output_paths
=
[]
unless
resource_paths
.
empty?
...
...
@@ -64,7 +64,7 @@ module Pod
def
add_embed_frameworks_script_phase
(
native_target
)
test_type
=
target
.
test_type_for_product_type
(
native_target
.
symbol_type
)
script_path
=
"${PODS_ROOT}/
#{
target
.
embed_frameworks_script_path_for_test_type
(
test_type
).
relative_path_from
(
target
.
sandbox
.
root
)
}
"
framework_paths
=
[
target
,
*
target
.
test_dependent_targets
]
.
flat_map
(
&
:framework_paths
)
framework_paths
=
target
.
all_test_dependent_targets
.
flat_map
(
&
:framework_paths
)
input_paths
=
[]
output_paths
=
[]
unless
framework_paths
.
empty?
...
...
lib/cocoapods/installer/xcode/pods_project_generator.rb
View file @
dfbef046
...
...
@@ -266,7 +266,7 @@ module Pod
private
def
add_pod_target_test_dependencies
(
pod_target
,
frameworks_group
)
test_dependent_targets
=
[
pod_target
,
*
pod_target
.
test_dependent_targets
]
test_dependent_targets
=
pod_target
.
all_test_dependent_targets
pod_target
.
test_native_targets
.
each
do
|
test_native_target
|
test_dependent_targets
.
reject
(
&
:should_build?
).
each
do
|
test_dependent_target
|
add_resource_bundles_to_native_target
(
test_dependent_target
,
test_native_target
)
...
...
lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb
View file @
dfbef046
...
...
@@ -333,7 +333,7 @@ module Pod
#
def
create_test_target_copy_resources_script
(
test_type
)
path
=
target
.
copy_resources_script_path_for_test_type
(
test_type
)
pod_targets
=
[
target
,
*
target
.
test_dependent_targets
]
pod_targets
=
target
.
all_test_dependent_targets
resource_paths_by_config
=
{
'Debug'
=>
pod_targets
.
flat_map
(
&
:resource_paths
)
}
generator
=
Generator
::
CopyResourcesScript
.
new
(
resource_paths_by_config
,
target
.
platform
)
update_changed_file
(
generator
,
path
)
...
...
@@ -349,7 +349,7 @@ module Pod
#
def
create_test_target_embed_frameworks_script
(
test_type
)
path
=
target
.
embed_frameworks_script_path_for_test_type
(
test_type
)
pod_targets
=
[
target
,
*
target
.
test_dependent_targets
]
pod_targets
=
target
.
all_test_dependent_targets
framework_paths_by_config
=
{
'Debug'
=>
pod_targets
.
flat_map
(
&
:framework_paths
)
}
generator
=
Generator
::
EmbedFrameworksScript
.
new
(
framework_paths_by_config
)
update_changed_file
(
generator
,
path
)
...
...
lib/cocoapods/target/pod_target.rb
View file @
dfbef046
...
...
@@ -355,6 +355,7 @@ module Pod
# dependency upon.
#
def
recursive_dependent_targets
@recursive_dependent_targets
||=
begin
targets
=
dependent_targets
.
clone
targets
.
each
do
|
target
|
...
...
@@ -365,6 +366,31 @@ module Pod
targets
end
end
# @return [Array<PodTarget>] the recursive targets that this target has a
# test dependency upon.
#
def
recursive_test_dependent_targets
@recursive_test_dependent_targets
||=
begin
targets
=
test_dependent_targets
.
clone
targets
.
each
do
|
target
|
target
.
test_dependent_targets
.
each
do
|
t
|
targets
.
push
(
t
)
unless
t
==
self
||
targets
.
include?
(
t
)
end
end
targets
end
end
# @return [Array<PodTarget>] the canonical list of test dependent targets this target has a dependency upon.
# This includes the parent target as well as its transitive dependencies.
#
def
all_test_dependent_targets
[
self
,
*
recursive_dependent_targets
,
*
recursive_test_dependent_targets
].
uniq
end
# Checks if the target should be included in the build configuration with
# the given name of a given target definition.
...
...
spec/unit/generator/xcconfig/pod_xcconfig_spec.rb
View file @
dfbef046
...
...
@@ -165,6 +165,13 @@ module Pod
xcconfig
.
to_hash
[
'OTHER_LDFLAGS'
].
should
==
'-ObjC -framework "CoconutLib"'
end
it
'includes other ld flags for transitive dependent targets'
do
@coconut_pod_target
.
dependent_targets
=
[
@monkey_pod_target
]
generator
=
PodXCConfig
.
new
(
@coconut_pod_target
,
true
)
xcconfig
=
generator
.
generate
xcconfig
.
to_hash
[
'OTHER_LDFLAGS'
].
should
==
'-ObjC -l"CoconutLib" -l"monkey" -framework "dynamic-monkey"'
end
it
'includes other ld flags for test dependent targets'
do
@coconut_pod_target
.
test_dependent_targets
=
[
@monkey_pod_target
]
generator
=
PodXCConfig
.
new
(
@coconut_pod_target
,
true
)
...
...
spec/unit/installer/xcode/pods_project_generator_spec.rb
View file @
dfbef046
...
...
@@ -260,16 +260,18 @@ module Pod
@generator
.
stubs
(
:aggregate_targets
).
returns
([
@target
])
end
it
'adds test dependent targets to test native targets'
do
it
'adds
all
test dependent targets to test native targets'
do
mock_native_target
=
mock
(
'CoconutLib'
)
mock_test_native_target
=
mock
(
'CoconutLib-Unit-Tests'
)
dependent_native_target
=
mock
(
'DependentNativeTarget'
)
test_dependent_native_target
=
mock
(
'TestDependentNativeTarget'
)
dependent_target
=
mock
(
'dependent-target'
,
:should_build?
=>
true
,
:native_target
=>
dependent_native_target
)
test_dependent_target
=
mock
(
'dependent-test-target'
,
:should_build?
=>
true
,
:native_target
=>
test_dependent_native_target
)
test_dependent_target
.
expects
(
:should_build?
).
returns
(
true
)
dependent_target
=
mock
(
'dependent-target'
,
:dependent_targets
=>
[])
dependent_target
.
stubs
(
:should_build?
).
returns
(
true
)
dependent_target
.
stubs
(
:native_target
).
returns
(
dependent_native_target
)
test_dependent_target
=
mock
(
'dependent-test-target'
,
:native_target
=>
test_dependent_native_target
,
:test_dependent_targets
=>
[])
test_dependent_target
.
stubs
(
:should_build?
).
returns
(
true
)
@pod_target
.
stubs
(
:native_target
).
returns
(
mock_native_target
)
@pod_target
.
stubs
(
:test_native_targets
).
returns
([
mock_test_native_target
])
...
...
@@ -282,7 +284,7 @@ module Pod
mock_native_target
.
expects
(
:add_dependency
).
with
(
test_dependent_native_target
).
never
mock_native_target
.
expects
(
:add_dependency
).
with
(
mock_native_target
).
never
mock_test_native_target
.
expects
(
:add_dependency
).
with
(
dependent_native_target
)
.
never
mock_test_native_target
.
expects
(
:add_dependency
).
with
(
dependent_native_target
)
mock_test_native_target
.
expects
(
:add_dependency
).
with
(
test_dependent_native_target
)
mock_test_native_target
.
expects
(
:add_dependency
).
with
(
mock_native_target
)
...
...
@@ -296,7 +298,7 @@ module Pod
test_dependent_target
.
expects
(
:should_build?
).
returns
(
true
)
@pod_target
.
stubs
(
:test_native_targets
).
returns
([
mock_test_native_target
])
@pod_target
.
stubs
(
:test_dependent_targets
).
returns
([
test_dependent_target
])
@pod_target
.
stubs
(
:
all_
test_dependent_targets
).
returns
([
test_dependent_target
])
@pod_target
.
stubs
(
:should_build?
=>
false
)
mock_test_native_target
.
expects
(
:add_dependency
).
with
(
test_dependent_native_target
)
...
...
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