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
20c47761
Commit
20c47761
authored
Feb 21, 2015
by
Kyle Fuller
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3167 from CocoaPods/swift-lint
[Frameworks] Fail lint for Swift on iOS < 8.
parents
2d457005
38c5c631
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
1 deletion
+40
-1
CHANGELOG.md
CHANGELOG.md
+4
-0
validator.rb
lib/cocoapods/validator.rb
+6
-1
validator_spec.rb
spec/unit/validator_spec.rb
+30
-0
No files found.
CHANGELOG.md
View file @
20c47761
...
@@ -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`
`/tmp`
.
`/tmp`
.
[
Samuel Giddins
](
https://github.com/segiddins
)
[
Samuel Giddins
](
https://github.com/segiddins
)
*
Let lint fail for Swift pods supporting deployment targets below iOS 8.0.
[
Boris Bügling
](
https://github.com/neonichu
)
[
#2963
](
https://github.com/CocoaPods/CocoaPods/issues/2963
)
##### Bug Fixes
##### Bug Fixes
*
Added support for .tpp C++ header files in specs (previously were getting
*
Added support for .tpp C++ header files in specs (previously were getting
...
...
lib/cocoapods/validator.rb
View file @
20c47761
...
@@ -310,6 +310,11 @@ module Pod
...
@@ -310,6 +310,11 @@ module Pod
installer
.
install!
installer
.
install!
file_accessors
=
installer
.
aggregate_targets
.
map
do
|
target
|
file_accessors
=
installer
.
aggregate_targets
.
map
do
|
target
|
if
target
.
pod_targets
.
any?
(
&
:uses_swift?
)
&&
consumer
.
platform_name
==
:ios
&&
(
deployment_target
.
nil?
||
Version
.
new
(
deployment_target
).
major
<
8
)
error
(
'swift'
,
'Swift support uses dynamic frameworks and is therefore only supported on iOS > 8.'
)
end
target
.
pod_targets
.
map
(
&
:file_accessors
)
target
.
pod_targets
.
map
(
&
:file_accessors
)
end
.
flatten
end
.
flatten
...
@@ -504,7 +509,7 @@ module Pod
...
@@ -504,7 +509,7 @@ module Pod
def
parse_xcodebuild_output
(
output
)
def
parse_xcodebuild_output
(
output
)
lines
=
output
.
split
(
"
\n
"
)
lines
=
output
.
split
(
"
\n
"
)
selected_lines
=
lines
.
select
do
|
l
|
selected_lines
=
lines
.
select
do
|
l
|
l
.
include?
(
'error: '
)
&&
l
.
include?
(
'error: '
)
&&
(
l
!~
/frameworks only run on iOS 8/
)
&&
(
l
!~
/errors? generated\./
)
&&
(
l
!~
/error: \(null\)/
)
||
(
l
!~
/errors? generated\./
)
&&
(
l
!~
/error: \(null\)/
)
||
l
.
include?
(
'warning: '
)
&&
(
l
!~
/warnings? generated\./
)
||
l
.
include?
(
'warning: '
)
&&
(
l
!~
/warnings? generated\./
)
||
l
.
include?
(
'note: '
)
&&
(
l
!~
/expanded from macro/
)
l
.
include?
(
'note: '
)
&&
(
l
!~
/expanded from macro/
)
...
...
spec/unit/validator_spec.rb
View file @
20c47761
...
@@ -440,6 +440,36 @@ module Pod
...
@@ -440,6 +440,36 @@ module Pod
validator
.
validated?
.
should
.
be
.
true
validator
.
validated?
.
should
.
be
.
true
end
end
end
end
describe
'swift validation'
do
def
test_swiftpod
podspec
=
stub_podspec
(
/.*source_files.*/
,
'"source_files": "*.swift",'
)
podspec
.
gsub!
(
/.*license.*$/
,
'"license": "Public Domain",'
)
file
=
write_podspec
(
podspec
)
Pod
::
Sandbox
::
FileAccessor
.
any_instance
.
stubs
(
:source_files
).
returns
([
Pathname
.
new
(
'/Foo.swift'
)])
validator
=
Validator
.
new
(
file
,
SourcesManager
.
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
.
results
.
map
(
&
:to_s
).
first
.
should
.
match
/dynamic frameworks.*iOS > 8/
validator
.
result_type
.
should
==
:error
end
it
'succeeds on deployment targets >= iOS 8 for Swift Pods'
do
Specification
.
any_instance
.
stubs
(
:deployment_target
).
returns
(
'9.0'
)
validator
=
test_swiftpod
validator
.
results
.
count
.
should
==
0
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