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
b8f4d6a3
Commit
b8f4d6a3
authored
Oct 12, 2017
by
Dimitris Koutsogiorgas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better warning message for which Swift version was used during validation
parent
8b75633c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
21 deletions
+50
-21
CHANGELOG.md
CHANGELOG.md
+5
-1
app_target_helper.rb
lib/cocoapods/generator/app_target_helper.rb
+1
-0
validator.rb
lib/cocoapods/validator.rb
+19
-13
validator_spec.rb
spec/unit/validator_spec.rb
+25
-7
No files found.
CHANGELOG.md
View file @
b8f4d6a3
...
@@ -30,6 +30,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
...
@@ -30,6 +30,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Bug Fixes
##### Bug Fixes
*
Better warning message for which Swift version was used during validation
[
Dimitris Koutsogiorgas
](
https://github.com/dnkoutso
)
[
#7121
](
https://github.com/CocoaPods/CocoaPods/issues/7121
)
*
Strip vendored dSYMs during embed script phase
*
Strip vendored dSYMs during embed script phase
[
Dimitris Koutsogiorgas
](
https://github.com/dnkoutso
)
[
Dimitris Koutsogiorgas
](
https://github.com/dnkoutso
)
[
#7111
](
https://github.com/CocoaPods/CocoaPods/issues/7111
)
[
#7111
](
https://github.com/CocoaPods/CocoaPods/issues/7111
)
...
@@ -139,7 +143,7 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
...
@@ -139,7 +143,7 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
*
Fix validation warnings when using --swift-version
*
Fix validation warnings when using --swift-version
[
Danielle Tomlinson
](
https://github.com/dantoml
)
[
Danielle Tomlinson
](
https://github.com/dantoml
)
[
#6971
](
https://github.com/CocoaPods/CocoaPods/
issue
/6971
)
[
#6971
](
https://github.com/CocoaPods/CocoaPods/
pull
/6971
)
*
Fix xcconfig boolean merging when substrings include yes or no
*
Fix xcconfig boolean merging when substrings include yes or no
[
Paul Beusterien
](
https://github.com/paulb777
)
[
Paul Beusterien
](
https://github.com/paulb777
)
...
...
lib/cocoapods/generator/app_target_helper.rb
View file @
b8f4d6a3
...
@@ -99,6 +99,7 @@ module Pod
...
@@ -99,6 +99,7 @@ module Pod
# @return [void]
# @return [void]
#
#
def
self
.
add_swift_version
(
target
,
swift_version
)
def
self
.
add_swift_version
(
target
,
swift_version
)
raise
'Cannot set empty Swift version to target.'
if
swift_version
.
blank?
target
.
build_configurations
.
each
do
|
configuration
|
target
.
build_configurations
.
each
do
|
configuration
|
configuration
.
build_settings
[
'SWIFT_VERSION'
]
=
swift_version
configuration
.
build_settings
[
'SWIFT_VERSION'
]
=
swift_version
end
end
...
...
lib/cocoapods/validator.rb
View file @
b8f4d6a3
...
@@ -256,7 +256,7 @@ module Pod
...
@@ -256,7 +256,7 @@ module Pod
# @return [String] the SWIFT_VERSION to use for validation.
# @return [String] the SWIFT_VERSION to use for validation.
#
#
def
swift_version
def
swift_version
return
@swift_version
if
defined?
(
@swift_version
)
return
@swift_version
unless
@swift_version
.
nil?
if
version
=
dot_swift_version
if
version
=
dot_swift_version
@swift_version
=
version
@swift_version
=
version
else
else
...
@@ -277,11 +277,10 @@ module Pod
...
@@ -277,11 +277,10 @@ module Pod
swift_version_path
.
read
.
strip
swift_version_path
.
read
.
strip
end
end
# @return [String] A string representing the Swift version used during linting
# @return [Boolean] Whether any of the pod targets part of this validator use Swift or not.
# or nil, if Swift was not used.
#
#
def
use
d_swift_version
def
use
s_swift?
swift_version
if
@installer
.
pod_targets
.
any?
(
&
:uses_swift?
)
@installer
.
pod_targets
.
any?
(
&
:uses_swift?
)
end
end
#-------------------------------------------------------------------------#
#-------------------------------------------------------------------------#
...
@@ -318,7 +317,7 @@ module Pod
...
@@ -318,7 +317,7 @@ module Pod
download_pod
download_pod
check_file_patterns
check_file_patterns
install_pod
install_pod
validate_
dot_
swift_version
validate_swift_version
add_app_project_import
add_app_project_import
validate_vendored_dynamic_frameworks
validate_vendored_dynamic_frameworks
build_pod
build_pod
...
@@ -394,14 +393,21 @@ module Pod
...
@@ -394,14 +393,21 @@ module Pod
validate_url
(
spec
.
documentation_url
)
if
spec
.
documentation_url
validate_url
(
spec
.
documentation_url
)
if
spec
.
documentation_url
end
end
def
validate_dot_swift_version
# Performs validation for which version of Swift is used during validation.
if
!
used_swift_version
.
nil?
&&
@swift_version
.
nil?
#
# The user will be warned that the default version of Swift was used if the following things are true:
# - The project uses Swift at all
# - The user did not supply a Swift version via a parameter
# - There is no `.swift-version` file present either.
#
def
validate_swift_version
if
uses_swift?
&&
@swift_version
.
nil?
&&
dot_swift_version
.
nil?
warning
(
:swift_version
,
warning
(
:swift_version
,
'The validator
for Swift projects uses
'
\
'The validator
used
'
\
'Swift 3.0 by default, if you are using a different version of '
\
"Swift
#{
DEFAULT_SWIFT_VERSION
}
by default because no Swift version was specified. "
\
'
swift you can use a `.swift-version` file to set the version fo
r '
\
'
If you want to use a different version of Swift during validation, then either use the `--swift-version` paramete
r '
\
"your Pod. For example to use Swift 2.3, run:
\n
"
\
'or use a `.swift-version` file to set the version of Swift to use for '
\
'
`echo "2.3" > .swift-version`
'
)
'
your Pod. For example to use Swift 2.3, run: `echo "2.3" > .swift-version`.
'
)
end
end
end
end
...
...
spec/unit/validator_spec.rb
View file @
b8f4d6a3
...
@@ -885,11 +885,29 @@ module Pod
...
@@ -885,11 +885,29 @@ module Pod
result
=
validator
.
results
.
first
result
=
validator
.
results
.
first
result
.
type
.
should
==
:warning
result
.
type
.
should
==
:warning
result
.
message
.
should
==
'The validator for '
\
result
.
message
.
should
==
'The validator used '
\
'Swift projects uses Swift 3.0 by default, if you are using a '
\
'Swift 3.0 by default because no Swift version was specified. '
\
'different version of swift you can use a `.swift-version` file '
\
'If you want to use a different version of Swift during validation, then either use the `--swift-version` parameter '
\
'to set the version for your Pod. For example to use Swift 2.3, '
\
'or use a `.swift-version` file to set the version of Swift to use for '
\
"run:
\n
`echo
\"
2.3
\"
> .swift-version`"
'your Pod. For example to use Swift 2.3, run: `echo "2.3" > .swift-version`.'
end
it
'does not warn for Swift if version was set by a dot swift version file'
do
Specification
.
any_instance
.
stubs
(
:deployment_target
).
returns
(
'9.0'
)
validator
=
test_swiftpod_with_dot_swift_version
validator
.
validate
validator
.
results
.
count
.
should
==
0
end
it
'does not warn for Swift if version was set as a parameter'
do
Specification
.
any_instance
.
stubs
(
:deployment_target
).
returns
(
'9.0'
)
validator
=
test_swiftpod
validator
.
stubs
(
:dot_swift_version
).
returns
(
nil
)
validator
.
swift_version
=
'3.1.0'
validator
.
validate
validator
.
results
.
count
.
should
==
0
end
end
end
end
...
@@ -950,7 +968,7 @@ module Pod
...
@@ -950,7 +968,7 @@ module Pod
validator
.
instance_variable_set
(
:@installer
,
installer
)
validator
.
instance_variable_set
(
:@installer
,
installer
)
validator
.
stubs
(
:dot_swift_version
).
returns
(
'1.2.3'
)
validator
.
stubs
(
:dot_swift_version
).
returns
(
'1.2.3'
)
validator
.
use
d_swift_version
.
should
==
'1.2.3'
validator
.
use
s_swift?
.
should
.
be
.
true
end
end
it
'returns the swift_version when a target has used Swift'
do
it
'returns the swift_version when a target has used Swift'
do
...
@@ -959,7 +977,7 @@ module Pod
...
@@ -959,7 +977,7 @@ module Pod
installer
=
stub
(
:pod_targets
=>
[
pod_target
])
installer
=
stub
(
:pod_targets
=>
[
pod_target
])
validator
.
instance_variable_set
(
:@installer
,
installer
)
validator
.
instance_variable_set
(
:@installer
,
installer
)
validator
.
use
d_swift_version
.
should
.
nil?
validator
.
use
s_swift?
.
should
.
be
.
false
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