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
62ede719
Commit
62ede719
authored
Apr 20, 2018
by
Dimitris Koutsogiorgas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Skip test file accessors for `uses_swift?` and `should_build?` methods
parent
781d5047
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
67 additions
and
34 deletions
+67
-34
CHANGELOG.md
CHANGELOG.md
+4
-0
pod_target_installer.rb
...ller/xcode/pods_project_generator/pod_target_installer.rb
+1
-1
pod_target.rb
lib/cocoapods/target/pod_target.rb
+21
-5
validator.rb
lib/cocoapods/validator.rb
+2
-2
pod_target_spec.rb
spec/unit/target/pod_target_spec.rb
+25
-22
validator_spec.rb
spec/unit/validator_spec.rb
+14
-4
No files found.
CHANGELOG.md
View file @
62ede719
...
@@ -27,6 +27,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
...
@@ -27,6 +27,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[
Dimitris Koutsogiorgas
](
https://github.com/dnkoutso
)
[
Dimitris Koutsogiorgas
](
https://github.com/dnkoutso
)
[
#7688
](
https://github.com/CocoaPods/CocoaPods/pull/7688
)
[
#7688
](
https://github.com/CocoaPods/CocoaPods/pull/7688
)
*
Skip test file accessors for
`uses_swift?`
and
`should_build?`
methods
[
Dimitris Koutsogiorgas
](
https://github.com/dnkoutso
)
[
#7671
](
https://github.com/CocoaPods/CocoaPods/pull/7671
)
*
Remove
[
system
]
declaration attribute from generated module maps
*
Remove
[
system
]
declaration attribute from generated module maps
[
Dimitris Koutsogiorgas
](
https://github.com/dnkoutso
)
[
Dimitris Koutsogiorgas
](
https://github.com/dnkoutso
)
[
#7589
](
https://github.com/CocoaPods/CocoaPods/issues/7589
)
[
#7589
](
https://github.com/CocoaPods/CocoaPods/issues/7589
)
...
...
lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb
View file @
62ede719
...
@@ -284,7 +284,7 @@ module Pod
...
@@ -284,7 +284,7 @@ module Pod
product_type
=
target
.
product_type_for_test_type
(
test_type
)
product_type
=
target
.
product_type_for_test_type
(
test_type
)
name
=
target
.
test_target_label
(
test_type
)
name
=
target
.
test_target_label
(
test_type
)
platform_name
=
target
.
platform
.
name
platform_name
=
target
.
platform
.
name
language
=
target
.
all_dependent_targets
.
any?
(
&
:uses_swift?
)
?
:
swift
:
:objc
language
=
target
.
uses_swift_for_test_type?
(
test_type
)
?
:
swift
:
:objc
test_native_target
=
project
.
new_target
(
product_type
,
name
,
platform_name
,
deployment_target
,
nil
,
language
)
test_native_target
=
project
.
new_target
(
product_type
,
name
,
platform_name
,
deployment_target
,
nil
,
language
)
test_native_target
.
product_reference
.
name
=
name
test_native_target
.
product_reference
.
name
=
name
...
...
lib/cocoapods/target/pod_target.rb
View file @
62ede719
...
@@ -146,11 +146,10 @@ module Pod
...
@@ -146,11 +146,10 @@ module Pod
#
#
def
should_build?
def
should_build?
return
@should_build
if
defined?
@should_build
return
@should_build
if
defined?
@should_build
return
@should_build
=
true
if
contains_script_phases?
return
@should_build
=
true
if
contains_script_phases?
accessors
=
file_accessors
.
reject
{
|
fa
|
fa
.
spec
.
test_specification?
}
source_files
=
file_
accessors
.
flat_map
(
&
:source_files
)
source_files
=
accessors
.
flat_map
(
&
:source_files
)
source_files
-=
file_
accessors
.
flat_map
(
&
:headers
)
source_files
-=
accessors
.
flat_map
(
&
:headers
)
@should_build
=
!
source_files
.
empty?
@should_build
=
!
source_files
.
empty?
end
end
...
@@ -166,7 +165,24 @@ module Pod
...
@@ -166,7 +165,24 @@ module Pod
def
uses_swift?
def
uses_swift?
return
@uses_swift
if
defined?
@uses_swift
return
@uses_swift
if
defined?
@uses_swift
@uses_swift
=
begin
@uses_swift
=
begin
file_accessors
.
any?
do
|
file_accessor
|
file_accessors
.
reject
{
|
a
|
a
.
spec
.
test_specification?
}.
any?
do
|
file_accessor
|
file_accessor
.
source_files
.
any?
{
|
sf
|
sf
.
extname
==
'.swift'
}
end
end
end
# Checks whether a particular test type uses Swift or not.
#
# @param [Symbol] test_type
# The test type to check whether it uses Swift or not.
#
# @return [Boolean] Whether the target uses Swift code in the specified test type.
#
def
uses_swift_for_test_type?
(
test_type
)
@uses_swift_for_test_type
||=
{}
return
@uses_swift_for_test_type
[
test_type
]
if
@uses_swift_for_test_type
.
key?
(
test_type
)
@uses_swift_for_test_type
[
test_type
]
=
begin
file_accessors
.
select
{
|
a
|
a
.
spec
.
test_specification?
&&
a
.
spec
.
test_type
==
test_type
}.
any?
do
|
file_accessor
|
file_accessor
.
source_files
.
any?
{
|
sf
|
sf
.
extname
==
'.swift'
}
file_accessor
.
source_files
.
any?
{
|
sf
|
sf
.
extname
==
'.swift'
}
end
end
end
end
...
...
lib/cocoapods/validator.rb
View file @
62ede719
...
@@ -513,8 +513,8 @@ module Pod
...
@@ -513,8 +513,8 @@ module Pod
(
build_configuration
.
build_settings
[
'OTHER_CFLAGS'
]
||=
'$(inherited)'
)
<<
' -Wincomplete-umbrella'
(
build_configuration
.
build_settings
[
'OTHER_CFLAGS'
]
||=
'$(inherited)'
)
<<
' -Wincomplete-umbrella'
build_configuration
.
build_settings
[
'SWIFT_VERSION'
]
=
(
pod_target
.
swift_version
||
swift_version
)
if
pod_target
.
uses_swift?
build_configuration
.
build_settings
[
'SWIFT_VERSION'
]
=
(
pod_target
.
swift_version
||
swift_version
)
if
pod_target
.
uses_swift?
end
end
if
pod_target
.
uses_swift?
pod_target_installation_result
.
test_specs_by_native_target
.
each
do
|
test_native_target
,
test_specs
|
pod_target_installation_result
.
test_native_targets
.
each
do
|
test_native_target
|
if
pod_target
.
uses_swift_for_test_type?
(
test_specs
.
first
.
test_type
)
test_native_target
.
build_configuration_list
.
build_configurations
.
each
do
|
build_configuration
|
test_native_target
.
build_configuration_list
.
build_configurations
.
each
do
|
build_configuration
|
build_configuration
.
build_settings
[
'SWIFT_VERSION'
]
=
swift_version
build_configuration
.
build_settings
[
'SWIFT_VERSION'
]
=
swift_version
end
end
...
...
spec/unit/target/pod_target_spec.rb
View file @
62ede719
...
@@ -3,10 +3,11 @@ require File.expand_path('../../../spec_helper', __FILE__)
...
@@ -3,10 +3,11 @@ require File.expand_path('../../../spec_helper', __FILE__)
module
Pod
module
Pod
describe
PodTarget
do
describe
PodTarget
do
before
do
before
do
spec
=
fixture_spec
(
'banana-lib/BananaLib.podspec'
)
@banana_
spec
=
fixture_spec
(
'banana-lib/BananaLib.podspec'
)
@target_definition
=
Podfile
::
TargetDefinition
.
new
(
'Pods'
,
nil
)
@target_definition
=
Podfile
::
TargetDefinition
.
new
(
'Pods'
,
nil
)
@target_definition
.
abstract
=
false
@target_definition
.
abstract
=
false
@pod_target
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
Platform
.
ios
,
[
spec
],
[
@target_definition
])
@pod_target
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
Platform
.
ios
,
[
@banana_spec
],
[
@target_definition
])
end
end
describe
'Meta'
do
describe
'Meta'
do
...
@@ -94,7 +95,7 @@ module Pod
...
@@ -94,7 +95,7 @@ module Pod
end
end
it
'builds a pod target if there are actual source files'
do
it
'builds a pod target if there are actual source files'
do
fa
=
Sandbox
::
FileAccessor
.
new
(
nil
,
@
pod_target
)
fa
=
Sandbox
::
FileAccessor
.
new
(
nil
,
@
banana_spec
.
consumer
(
Platform
.
ios
)
)
fa
.
stubs
(
:source_files
).
returns
([
Pathname
.
new
(
'foo.m'
)])
fa
.
stubs
(
:source_files
).
returns
([
Pathname
.
new
(
'foo.m'
)])
@pod_target
.
stubs
(
:file_accessors
).
returns
([
fa
])
@pod_target
.
stubs
(
:file_accessors
).
returns
([
fa
])
...
@@ -102,7 +103,7 @@ module Pod
...
@@ -102,7 +103,7 @@ module Pod
end
end
it
'does not build a pod target if there are only header files'
do
it
'does not build a pod target if there are only header files'
do
fa
=
Sandbox
::
FileAccessor
.
new
(
nil
,
@
pod_target
)
fa
=
Sandbox
::
FileAccessor
.
new
(
nil
,
@
banana_spec
.
consumer
(
Platform
.
ios
)
)
fa
.
stubs
(
:source_files
).
returns
([
Pathname
.
new
(
'foo.h'
)])
fa
.
stubs
(
:source_files
).
returns
([
Pathname
.
new
(
'foo.h'
)])
@pod_target
.
stubs
(
:file_accessors
).
returns
([
fa
])
@pod_target
.
stubs
(
:file_accessors
).
returns
([
fa
])
...
@@ -110,7 +111,7 @@ module Pod
...
@@ -110,7 +111,7 @@ module Pod
end
end
it
'builds a pod target if there are no actual source files but there are script phases'
do
it
'builds a pod target if there are no actual source files but there are script phases'
do
fa
=
Sandbox
::
FileAccessor
.
new
(
nil
,
@
pod_target
)
fa
=
Sandbox
::
FileAccessor
.
new
(
nil
,
@
banana_spec
.
consumer
(
Platform
.
ios
)
)
fa
.
stubs
(
:source_files
).
returns
([
Pathname
.
new
(
'foo.h'
)])
fa
.
stubs
(
:source_files
).
returns
([
Pathname
.
new
(
'foo.h'
)])
@pod_target
.
stubs
(
:file_accessors
).
returns
([
fa
])
@pod_target
.
stubs
(
:file_accessors
).
returns
([
fa
])
@pod_target
.
root_spec
.
script_phase
=
{
:name
=>
'Hello World'
,
:script
=>
'echo "Hello World"'
}
@pod_target
.
root_spec
.
script_phase
=
{
:name
=>
'Hello World'
,
:script
=>
'echo "Hello World"'
}
...
@@ -251,8 +252,8 @@ module Pod
...
@@ -251,8 +252,8 @@ module Pod
@pod_target
.
sandbox
.
public_headers
.
add_search_path
(
'BananaLib'
,
Platform
.
ios
)
@pod_target
.
sandbox
.
public_headers
.
add_search_path
(
'BananaLib'
,
Platform
.
ios
)
@pod_target
.
sandbox
.
public_headers
.
add_search_path
(
'monkey'
,
Platform
.
ios
)
@pod_target
.
sandbox
.
public_headers
.
add_search_path
(
'monkey'
,
Platform
.
ios
)
monkey_spec
=
fixture_spec
(
'monkey/monkey.podspec'
)
monkey_spec
=
fixture_spec
(
'monkey/monkey.podspec'
)
monkey_pod_target
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
Platform
.
ios
,
[
monkey_spec
],
[
@target_definition
])
monkey_pod_target
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
monkey_pod_target
.
stubs
(
:platform
).
returns
(
Platform
.
ios
)
Platform
.
ios
,
[
monkey_spec
],
[
@target_definition
]
)
@pod_target
.
stubs
(
:dependent_targets
).
returns
([
monkey_pod_target
])
@pod_target
.
stubs
(
:dependent_targets
).
returns
([
monkey_pod_target
])
header_search_paths
=
@pod_target
.
header_search_paths
header_search_paths
=
@pod_target
.
header_search_paths
header_search_paths
.
sort
.
should
==
[
header_search_paths
.
sort
.
should
==
[
...
@@ -269,8 +270,8 @@ module Pod
...
@@ -269,8 +270,8 @@ module Pod
@pod_target
.
sandbox
.
public_headers
.
add_search_path
(
'BananaLib'
,
Platform
.
ios
)
@pod_target
.
sandbox
.
public_headers
.
add_search_path
(
'BananaLib'
,
Platform
.
ios
)
@pod_target
.
sandbox
.
public_headers
.
add_search_path
(
'monkey'
,
Platform
.
osx
)
@pod_target
.
sandbox
.
public_headers
.
add_search_path
(
'monkey'
,
Platform
.
osx
)
monkey_spec
=
fixture_spec
(
'monkey/monkey.podspec'
)
monkey_spec
=
fixture_spec
(
'monkey/monkey.podspec'
)
monkey_pod_target
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
Platform
.
ios
,
[
monkey_spec
],
[
@target_definition
])
monkey_pod_target
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
monkey_pod_target
.
stubs
(
:platform
).
returns
(
Platform
.
ios
)
Platform
.
ios
,
[
monkey_spec
],
[
@target_definition
]
)
@pod_target
.
stubs
(
:dependent_targets
).
returns
([
monkey_pod_target
])
@pod_target
.
stubs
(
:dependent_targets
).
returns
([
monkey_pod_target
])
header_search_paths
=
@pod_target
.
header_search_paths
header_search_paths
=
@pod_target
.
header_search_paths
# The monkey lib header search paths should not be present since they are only present in OSX.
# The monkey lib header search paths should not be present since they are only present in OSX.
...
@@ -291,7 +292,6 @@ module Pod
...
@@ -291,7 +292,6 @@ module Pod
it
'uses modular header search paths when specified in the podfile'
do
it
'uses modular header search paths when specified in the podfile'
do
@pod_target
.
unstub
(
:defines_module?
)
@pod_target
.
unstub
(
:defines_module?
)
@pod_target
.
target_definitions
.
first
.
stubs
(
:build_pod_as_module?
).
with
(
'BananaLib'
).
returns
(
true
)
@pod_target
.
target_definitions
.
first
.
stubs
(
:build_pod_as_module?
).
with
(
'BananaLib'
).
returns
(
true
)
@pod_target
.
build_headers
.
add_search_path
(
'BananaLib'
,
Platform
.
ios
)
@pod_target
.
build_headers
.
add_search_path
(
'BananaLib'
,
Platform
.
ios
)
@pod_target
.
sandbox
.
public_headers
.
add_search_path
(
'BananaLib'
,
Platform
.
ios
)
@pod_target
.
sandbox
.
public_headers
.
add_search_path
(
'BananaLib'
,
Platform
.
ios
)
header_search_paths
=
@pod_target
.
header_search_paths
header_search_paths
=
@pod_target
.
header_search_paths
...
@@ -352,7 +352,8 @@ module Pod
...
@@ -352,7 +352,8 @@ module Pod
@pod_target
.
sandbox
.
public_headers
.
add_search_path
(
'BananaLib'
,
Platform
.
ios
)
@pod_target
.
sandbox
.
public_headers
.
add_search_path
(
'BananaLib'
,
Platform
.
ios
)
@pod_target
.
sandbox
.
public_headers
.
add_search_path
(
'monkey'
,
Platform
.
osx
)
@pod_target
.
sandbox
.
public_headers
.
add_search_path
(
'monkey'
,
Platform
.
osx
)
monkey_spec
=
fixture_spec
(
'monkey/monkey.podspec'
)
monkey_spec
=
fixture_spec
(
'monkey/monkey.podspec'
)
monkey_pod_target
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
Platform
.
ios
,
[
monkey_spec
],
[
@target_definition
])
monkey_pod_target
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
Platform
.
ios
,
[
monkey_spec
],
[
@target_definition
])
monkey_pod_target
.
stubs
(
:platform
).
returns
(
Platform
.
ios
)
monkey_pod_target
.
stubs
(
:platform
).
returns
(
Platform
.
ios
)
@pod_target
.
stubs
(
:dependent_targets
).
returns
([
monkey_pod_target
])
@pod_target
.
stubs
(
:dependent_targets
).
returns
([
monkey_pod_target
])
header_search_paths
=
@pod_target
.
header_search_paths
header_search_paths
=
@pod_target
.
header_search_paths
...
@@ -520,8 +521,10 @@ module Pod
...
@@ -520,8 +521,10 @@ module Pod
@coconut_spec
=
fixture_spec
(
'coconut-lib/CoconutLib.podspec'
)
@coconut_spec
=
fixture_spec
(
'coconut-lib/CoconutLib.podspec'
)
@test_spec_target_definition
=
Podfile
::
TargetDefinition
.
new
(
'Pods'
,
nil
)
@test_spec_target_definition
=
Podfile
::
TargetDefinition
.
new
(
'Pods'
,
nil
)
@test_spec_target_definition
.
abstract
=
false
@test_spec_target_definition
.
abstract
=
false
@test_pod_target
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
Platform
.
ios
,
[
@coconut_spec
,
*
@coconut_spec
.
recursive_subspecs
],
[
@test_spec_target_definition
])
@platform
=
Platform
.
new
(
:ios
,
'6.0'
)
@test_pod_target
.
stubs
(
:platform
).
returns
(
Platform
.
new
(
:ios
,
'6.0'
))
@test_pod_target
=
PodTarget
.
new
(
config
.
sandbox
,
false
,
{},
[],
@platform
,
[
@coconut_spec
,
*
@coconut_spec
.
recursive_subspecs
],
[
@test_spec_target_definition
])
end
end
it
'returns that it has test specifications'
do
it
'returns that it has test specifications'
do
...
@@ -579,7 +582,7 @@ module Pod
...
@@ -579,7 +582,7 @@ module Pod
end
end
it
'returns the correct resource path for test resource bundles'
do
it
'returns the correct resource path for test resource bundles'
do
fa
=
Sandbox
::
FileAccessor
.
new
(
nil
,
@
test_pod_target
)
fa
=
Sandbox
::
FileAccessor
.
new
(
nil
,
@
coconut_spec
.
test_specs
.
first
.
consumer
(
@platform
)
)
fa
.
stubs
(
:resource_bundles
).
returns
(
'TestResourceBundle'
=>
[
Pathname
.
new
(
'Model.xcdatamodeld'
)])
fa
.
stubs
(
:resource_bundles
).
returns
(
'TestResourceBundle'
=>
[
Pathname
.
new
(
'Model.xcdatamodeld'
)])
fa
.
stubs
(
:resources
).
returns
([])
fa
.
stubs
(
:resources
).
returns
([])
fa
.
stubs
(
:spec
).
returns
(
stub
(
:test_specification?
=>
true
))
fa
.
stubs
(
:spec
).
returns
(
stub
(
:test_specification?
=>
true
))
...
@@ -588,10 +591,10 @@ module Pod
...
@@ -588,10 +591,10 @@ module Pod
end
end
it
'includes framework paths from test specifications'
do
it
'includes framework paths from test specifications'
do
fa
=
Sandbox
::
FileAccessor
.
new
(
nil
,
@
test_pod_target
)
fa
=
Sandbox
::
FileAccessor
.
new
(
nil
,
@
coconut_spec
.
test_specs
.
first
.
consumer
(
@platform
)
)
fa
.
stubs
(
:vendored_dynamic_artifacts
).
returns
([
config
.
sandbox
.
root
+
Pathname
.
new
(
'Vendored/Vendored.framework'
)])
fa
.
stubs
(
:vendored_dynamic_artifacts
).
returns
([
config
.
sandbox
.
root
+
Pathname
.
new
(
'Vendored/Vendored.framework'
)])
fa
.
stubs
(
:spec
).
returns
(
stub
(
:test_specification?
=>
false
))
fa
.
stubs
(
:spec
).
returns
(
stub
(
:test_specification?
=>
false
))
test_fa
=
Sandbox
::
FileAccessor
.
new
(
nil
,
@
test_pod_target
)
test_fa
=
Sandbox
::
FileAccessor
.
new
(
nil
,
@
coconut_spec
.
test_specs
.
first
.
consumer
(
@platform
)
)
test_fa
.
stubs
(
:vendored_dynamic_artifacts
).
returns
([
config
.
sandbox
.
root
+
Pathname
.
new
(
'Vendored/TestVendored.framework'
)])
test_fa
.
stubs
(
:vendored_dynamic_artifacts
).
returns
([
config
.
sandbox
.
root
+
Pathname
.
new
(
'Vendored/TestVendored.framework'
)])
test_fa
.
stubs
(
:spec
).
returns
(
stub
(
:test_specification?
=>
true
))
test_fa
.
stubs
(
:spec
).
returns
(
stub
(
:test_specification?
=>
true
))
@test_pod_target
.
stubs
(
:file_accessors
).
returns
([
fa
,
test_fa
])
@test_pod_target
.
stubs
(
:file_accessors
).
returns
([
fa
,
test_fa
])
...
@@ -607,10 +610,10 @@ module Pod
...
@@ -607,10 +610,10 @@ module Pod
end
end
it
'excludes framework paths from test specifications when not requested'
do
it
'excludes framework paths from test specifications when not requested'
do
fa
=
Sandbox
::
FileAccessor
.
new
(
nil
,
@
test_pod_target
)
fa
=
Sandbox
::
FileAccessor
.
new
(
nil
,
@
coconut_spec
.
consumer
(
@platform
)
)
fa
.
stubs
(
:vendored_dynamic_artifacts
).
returns
([
config
.
sandbox
.
root
+
Pathname
.
new
(
'Vendored/Vendored.framework'
)])
fa
.
stubs
(
:vendored_dynamic_artifacts
).
returns
([
config
.
sandbox
.
root
+
Pathname
.
new
(
'Vendored/Vendored.framework'
)])
fa
.
stubs
(
:spec
).
returns
(
stub
(
:test_specification?
=>
false
))
fa
.
stubs
(
:spec
).
returns
(
stub
(
:test_specification?
=>
false
))
test_fa
=
Sandbox
::
FileAccessor
.
new
(
nil
,
@
test_pod_target
)
test_fa
=
Sandbox
::
FileAccessor
.
new
(
nil
,
@
coconut_spec
.
test_specs
.
first
.
consumer
(
@platform
)
)
test_fa
.
stubs
(
:vendored_dynamic_artifacts
).
returns
([
config
.
sandbox
.
root
+
Pathname
.
new
(
'Vendored/TestVendored.framework'
)])
test_fa
.
stubs
(
:vendored_dynamic_artifacts
).
returns
([
config
.
sandbox
.
root
+
Pathname
.
new
(
'Vendored/TestVendored.framework'
)])
test_fa
.
stubs
(
:spec
).
returns
(
stub
(
:test_specification?
=>
true
))
test_fa
.
stubs
(
:spec
).
returns
(
stub
(
:test_specification?
=>
true
))
@test_pod_target
.
stubs
(
:file_accessors
).
returns
([
fa
,
test_fa
])
@test_pod_target
.
stubs
(
:file_accessors
).
returns
([
fa
,
test_fa
])
...
@@ -624,11 +627,11 @@ module Pod
...
@@ -624,11 +627,11 @@ module Pod
it
'includes resource paths from test specifications'
do
it
'includes resource paths from test specifications'
do
config
.
sandbox
.
stubs
(
:project
=>
stub
(
:path
=>
Pathname
.
new
(
'ProjectPath'
)))
config
.
sandbox
.
stubs
(
:project
=>
stub
(
:path
=>
Pathname
.
new
(
'ProjectPath'
)))
fa
=
Sandbox
::
FileAccessor
.
new
(
nil
,
@
test_pod_target
)
fa
=
Sandbox
::
FileAccessor
.
new
(
nil
,
@
coconut_spec
.
consumer
(
@platform
)
)
fa
.
stubs
(
:resource_bundles
).
returns
({})
fa
.
stubs
(
:resource_bundles
).
returns
({})
fa
.
stubs
(
:resources
).
returns
([
Pathname
.
new
(
'Model.xcdatamodeld'
)])
fa
.
stubs
(
:resources
).
returns
([
Pathname
.
new
(
'Model.xcdatamodeld'
)])
fa
.
stubs
(
:spec
).
returns
(
stub
(
:test_specification?
=>
false
))
fa
.
stubs
(
:spec
).
returns
(
stub
(
:test_specification?
=>
false
))
test_fa
=
Sandbox
::
FileAccessor
.
new
(
nil
,
@
test_pod_target
)
test_fa
=
Sandbox
::
FileAccessor
.
new
(
nil
,
@
coconut_spec
.
test_specs
.
first
.
consumer
(
@platform
)
)
test_fa
.
stubs
(
:resource_bundles
).
returns
({})
test_fa
.
stubs
(
:resource_bundles
).
returns
({})
test_fa
.
stubs
(
:resources
).
returns
([
Pathname
.
new
(
'TestModel.xcdatamodeld'
)])
test_fa
.
stubs
(
:resources
).
returns
([
Pathname
.
new
(
'TestModel.xcdatamodeld'
)])
test_fa
.
stubs
(
:spec
).
returns
(
stub
(
:test_specification?
=>
true
))
test_fa
.
stubs
(
:spec
).
returns
(
stub
(
:test_specification?
=>
true
))
...
@@ -638,11 +641,11 @@ module Pod
...
@@ -638,11 +641,11 @@ module Pod
it
'excludes resource paths from test specifications when not requested'
do
it
'excludes resource paths from test specifications when not requested'
do
config
.
sandbox
.
stubs
(
:project
=>
stub
(
:path
=>
Pathname
.
new
(
'ProjectPath'
)))
config
.
sandbox
.
stubs
(
:project
=>
stub
(
:path
=>
Pathname
.
new
(
'ProjectPath'
)))
fa
=
Sandbox
::
FileAccessor
.
new
(
nil
,
@
test_pod_target
)
fa
=
Sandbox
::
FileAccessor
.
new
(
nil
,
@
coconut_spec
.
consumer
(
@platform
)
)
fa
.
stubs
(
:resource_bundles
).
returns
({})
fa
.
stubs
(
:resource_bundles
).
returns
({})
fa
.
stubs
(
:resources
).
returns
([
Pathname
.
new
(
'Model.xcdatamodeld'
)])
fa
.
stubs
(
:resources
).
returns
([
Pathname
.
new
(
'Model.xcdatamodeld'
)])
fa
.
stubs
(
:spec
).
returns
(
stub
(
:test_specification?
=>
false
))
fa
.
stubs
(
:spec
).
returns
(
stub
(
:test_specification?
=>
false
))
test_fa
=
Sandbox
::
FileAccessor
.
new
(
nil
,
@
test_pod_target
)
test_fa
=
Sandbox
::
FileAccessor
.
new
(
nil
,
@
coconut_spec
.
test_specs
.
first
.
consumer
(
@platform
)
)
test_fa
.
stubs
(
:resource_bundles
).
returns
({})
test_fa
.
stubs
(
:resource_bundles
).
returns
({})
test_fa
.
stubs
(
:resources
).
returns
([
Pathname
.
new
(
'TestModel.xcdatamodeld'
)])
test_fa
.
stubs
(
:resources
).
returns
([
Pathname
.
new
(
'TestModel.xcdatamodeld'
)])
test_fa
.
stubs
(
:spec
).
returns
(
stub
(
:test_specification?
=>
true
))
test_fa
.
stubs
(
:spec
).
returns
(
stub
(
:test_specification?
=>
true
))
...
...
spec/unit/validator_spec.rb
View file @
62ede719
...
@@ -1080,9 +1080,15 @@ module Pod
...
@@ -1080,9 +1080,15 @@ module Pod
native_target_one
=
stub
(
:build_configuration_list
=>
stub
(
:build_configurations
=>
[
debug_configuration_one
]))
native_target_one
=
stub
(
:build_configuration_list
=>
stub
(
:build_configurations
=>
[
debug_configuration_one
]))
native_target_two
=
stub
(
:build_configuration_list
=>
stub
(
:build_configurations
=>
[
debug_configuration_two
]))
native_target_two
=
stub
(
:build_configuration_list
=>
stub
(
:build_configurations
=>
[
debug_configuration_two
]))
pod_target_one
=
stub
(
:name
=>
'PodTarget1'
,
:uses_swift?
=>
true
,
:swift_version
=>
'4.0'
)
pod_target_one
=
stub
(
:name
=>
'PodTarget1'
,
:uses_swift?
=>
true
,
:swift_version
=>
'4.0'
)
pod_target_one
.
stubs
(
:uses_swift_for_test_type?
).
with
(
:unit
).
returns
(
true
)
pod_target_two
=
stub
(
:name
=>
'PodTarget2'
,
:uses_swift?
=>
true
,
:swift_version
=>
'3.2'
)
pod_target_two
=
stub
(
:name
=>
'PodTarget2'
,
:uses_swift?
=>
true
,
:swift_version
=>
'3.2'
)
pod_target_installation_one
=
stub
(
:target
=>
pod_target_one
,
:native_target
=>
native_target_one
,
:test_native_targets
=>
[])
pod_target_two
.
stubs
(
:uses_swift_for_test_type?
).
with
(
:unit
).
returns
(
true
)
pod_target_installation_two
=
stub
(
:target
=>
pod_target_two
,
:native_target
=>
native_target_two
,
:test_native_targets
=>
[])
pod_target_installation_one
=
stub
(
:target
=>
pod_target_one
,
:native_target
=>
native_target_one
,
:test_native_targets
=>
[],
:test_specs_by_native_target
=>
{})
pod_target_installation_two
=
stub
(
:target
=>
pod_target_two
,
:native_target
=>
native_target_two
,
:test_native_targets
=>
[],
:test_specs_by_native_target
=>
{})
pod_target_installation_results
=
{
'PodTarget1'
=>
pod_target_installation_one
,
'PodTarget2'
=>
pod_target_installation_two
}
pod_target_installation_results
=
{
'PodTarget1'
=>
pod_target_installation_one
,
'PodTarget2'
=>
pod_target_installation_two
}
aggregate_target
=
stub
(
:pod_targets
=>
[
pod_target_one
,
pod_target_two
])
aggregate_target
=
stub
(
:pod_targets
=>
[
pod_target_one
,
pod_target_two
])
installer
=
stub
(
:pod_targets
=>
[
pod_target_one
,
pod_target_two
])
installer
=
stub
(
:pod_targets
=>
[
pod_target_one
,
pod_target_two
])
...
@@ -1102,8 +1108,12 @@ module Pod
...
@@ -1102,8 +1108,12 @@ module Pod
native_target_two
=
stub
(
:build_configuration_list
=>
stub
(
:build_configurations
=>
[
debug_configuration_two
]))
native_target_two
=
stub
(
:build_configuration_list
=>
stub
(
:build_configurations
=>
[
debug_configuration_two
]))
pod_target_one
=
stub
(
:name
=>
'PodTarget1'
,
:uses_swift?
=>
true
,
:swift_version
=>
'4.0'
)
pod_target_one
=
stub
(
:name
=>
'PodTarget1'
,
:uses_swift?
=>
true
,
:swift_version
=>
'4.0'
)
pod_target_two
=
stub
(
:name
=>
'PodTarget2'
,
:uses_swift?
=>
true
,
:swift_version
=>
'3.2'
)
pod_target_two
=
stub
(
:name
=>
'PodTarget2'
,
:uses_swift?
=>
true
,
:swift_version
=>
'3.2'
)
pod_target_installation_one
=
stub
(
:target
=>
pod_target_one
,
:native_target
=>
native_target_one
,
:test_native_targets
=>
[])
pod_target_installation_one
=
stub
(
:target
=>
pod_target_one
,
:native_target
=>
native_target_one
,
pod_target_installation_two
=
stub
(
:target
=>
pod_target_two
,
:native_target
=>
native_target_two
,
:test_native_targets
=>
[])
:test_native_targets
=>
[],
:test_specs_by_native_target
=>
{})
pod_target_installation_two
=
stub
(
:target
=>
pod_target_two
,
:native_target
=>
native_target_two
,
:test_native_targets
=>
[],
:test_specs_by_native_target
=>
{})
pod_target_installation_results
=
{
'PodTarget1'
=>
pod_target_installation_one
,
'PodTarget2'
=>
pod_target_installation_two
}
pod_target_installation_results
=
{
'PodTarget1'
=>
pod_target_installation_one
,
'PodTarget2'
=>
pod_target_installation_two
}
aggregate_target
=
stub
(
:pod_targets
=>
[
pod_target_one
])
aggregate_target
=
stub
(
:pod_targets
=>
[
pod_target_one
])
installer
=
stub
(
:pod_targets
=>
[
pod_target_one
,
pod_target_two
])
installer
=
stub
(
:pod_targets
=>
[
pod_target_one
,
pod_target_two
])
...
...
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