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
cf12c1cc
Commit
cf12c1cc
authored
Sep 11, 2016
by
Danielle Tomlinson
Committed by
GitHub
Sep 11, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5841 from CocoaPods/dani_xcode_8_linting
Fix linting on Xcode 8
parents
3d45d35b
66f25a0b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
62 additions
and
2 deletions
+62
-2
CHANGELOG.md
CHANGELOG.md
+3
-1
validator.rb
lib/cocoapods/validator.rb
+21
-0
validator_spec.rb
spec/unit/validator_spec.rb
+38
-1
No files found.
CHANGELOG.md
View file @
cf12c1cc
...
...
@@ -19,7 +19,9 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Enhancements
*
None.
*
Use the SWIFT_VERSION when linting pods.
[
Danielle Tomlinson
](
https://github.com/dantoml
)
[
#5841
](
https://github.com/CocoaPods/CocoaPods/issues/5841
)
##### Bug Fixes
...
...
lib/cocoapods/validator.rb
View file @
cf12c1cc
...
...
@@ -237,6 +237,19 @@ module Pod
Pathname
(
Dir
.
tmpdir
)
+
'CocoaPods/Lint'
end
# @return [String] the SWIFT_VERSION to use for validation.
#
def
swift_version
@swift_version
||=
dot_swift_version
||
'2.3'
end
# @return [String] the SWIFT_VERSION in the .swift-version file or nil.
#
def
dot_swift_version
swift_version_path
=
file
.
dirname
+
'.swift-version'
swift_version_path
.
read
if
swift_version_path
.
exist?
end
#-------------------------------------------------------------------------#
private
...
...
@@ -388,10 +401,17 @@ module Pod
source_file_ref
=
app_project
.
new_group
(
'App'
,
'App'
).
new_file
(
source_file
)
app_target
=
app_project
.
targets
.
first
app_target
.
add_file_references
([
source_file_ref
])
add_swift_version
(
app_target
)
add_xctest
(
app_target
)
if
@installer
.
pod_targets
.
any?
{
|
pt
|
pt
.
spec_consumers
.
any?
{
|
c
|
c
.
frameworks
.
include?
(
'XCTest'
)
}
}
app_project
.
save
end
def
add_swift_version
(
app_target
)
app_target
.
build_configurations
.
each
do
|
configuration
|
configuration
.
build_settings
[
'SWIFT_VERSION'
]
=
swift_version
end
end
def
add_xctest
(
app_target
)
app_target
.
build_configurations
.
each
do
|
configuration
|
search_paths
=
configuration
.
build_settings
[
'FRAMEWORK_SEARCH_PATHS'
]
||=
'$(inherited)'
...
...
@@ -445,6 +465,7 @@ module Pod
next
unless
native_target
=
pod_target
.
native_target
native_target
.
build_configuration_list
.
build_configurations
.
each
do
|
build_configuration
|
(
build_configuration
.
build_settings
[
'OTHER_CFLAGS'
]
||=
'$(inherited)'
)
<<
' -Wincomplete-umbrella'
build_configuration
.
build_settings
[
'SWIFT_VERSION'
]
=
swift_version
if
pod_target
.
uses_swift?
end
end
if
target
.
pod_targets
.
any?
(
&
:uses_swift?
)
&&
consumer
.
platform_name
==
:ios
&&
...
...
spec/unit/validator_spec.rb
View file @
cf12c1cc
...
...
@@ -784,12 +784,12 @@ module Pod
validator
=
Validator
.
new
(
file
,
config
.
sources_manager
.
master
.
map
(
&
:url
))
validator
.
stubs
(
:build_pod
)
validator
.
stubs
(
:validate_url
)
validator
.
validate
validator
end
it
'fails on deployment target < iOS 8 for Swift Pods'
do
validator
=
test_swiftpod
validator
.
validate
validator
.
results
.
map
(
&
:to_s
).
first
.
should
.
match
/dynamic frameworks.*iOS > 8/
validator
.
result_type
.
should
==
:error
...
...
@@ -799,6 +799,7 @@ module Pod
Specification
::
Consumer
.
any_instance
.
stubs
(
:frameworks
).
returns
(
%w(XCTest)
)
validator
=
test_swiftpod
validator
.
validate
validator
.
results
.
count
.
should
==
0
end
...
...
@@ -806,9 +807,45 @@ module Pod
Specification
.
any_instance
.
stubs
(
:deployment_target
).
returns
(
'9.0'
)
validator
=
test_swiftpod
validator
.
validate
validator
.
results
.
count
.
should
==
0
end
describe
'#swift_version'
do
it
'defaults to Swift 2.3'
do
validator
=
test_swiftpod
validator
.
stubs
(
:dot_swift_version
).
returns
(
nil
)
validator
.
swift_version
.
should
==
'2.3'
end
it
'checks for dot_swift_version'
do
validator
=
test_swiftpod
validator
.
expects
(
:dot_swift_version
)
validator
.
swift_version
end
it
'uses the result of dot_swift_version if not nil'
do
validator
=
test_swiftpod
validator
.
stubs
(
:dot_swift_version
).
returns
(
'1.0'
)
validator
.
swift_version
.
should
==
'1.0'
end
end
describe
'#dot_swift_version'
do
it
'looks for a .swift-version file'
do
validator
=
test_swiftpod
Pathname
.
any_instance
.
expects
(
:exist?
)
validator
.
dot_swift_version
end
it
'uses the .swift-version file if present'
do
validator
=
test_swiftpod
Pathname
.
any_instance
.
stubs
(
:exist?
).
returns
(
true
)
Pathname
.
any_instance
.
expects
(
:read
).
returns
(
'1.0'
)
validator
.
dot_swift_version
.
should
==
'1.0'
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