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
cae98c53
Commit
cae98c53
authored
Jan 29, 2017
by
Dimitris Koutsogiorgas
Committed by
GitHub
Jan 29, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6420 from dnkoutso/dimitris/finish_validator
[Validator] Allow skipping import validation (complete)
parents
06d629bc
204ab608
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
64 additions
and
7 deletions
+64
-7
CHANGELOG.md
CHANGELOG.md
+4
-1
lint.rb
lib/cocoapods/command/lib/lint.rb
+4
-1
push.rb
lib/cocoapods/command/repo/push.rb
+3
-0
lint.rb
lib/cocoapods/command/spec/lint.rb
+4
-1
validator.rb
lib/cocoapods/validator.rb
+11
-2
validator_spec.rb
spec/unit/validator_spec.rb
+38
-2
No files found.
CHANGELOG.md
View file @
cae98c53
...
@@ -12,7 +12,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
...
@@ -12,7 +12,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Bug Fixes
##### Bug Fixes
*
None.
*
Add
`--skip-import-validation`
to skip linking a pod during lint.
[
Samuel Giddins
](
https://github.com/segiddins
)
[
Dimitris Koutsogiorgas
](
https://github.com/dnkoutso
)
[
#5670
](
https://github.com/CocoaPods/CocoaPods/issues/5670
)
## 1.2.0 (2017-01-28)
## 1.2.0 (2017-01-28)
...
...
lib/cocoapods/command/lib/lint.rb
View file @
cae98c53
...
@@ -23,6 +23,7 @@ module Pod
...
@@ -23,6 +23,7 @@ module Pod
[
'--private'
,
'Lint skips checks that apply only to public specs'
],
[
'--private'
,
'Lint skips checks that apply only to public specs'
],
[
'--swift-version=VERSION'
,
'The SWIFT_VERSION that should be used to lint the spec. '
\
[
'--swift-version=VERSION'
,
'The SWIFT_VERSION that should be used to lint the spec. '
\
'This takes precedence over a .swift-version file.'
],
'This takes precedence over a .swift-version file.'
],
[
'--skip-import-validation'
,
'Lint skips validating that the pod can be imported'
],
].
concat
(
super
)
].
concat
(
super
)
end
end
...
@@ -37,7 +38,8 @@ module Pod
...
@@ -37,7 +38,8 @@ module Pod
@source_urls
=
argv
.
option
(
'sources'
,
'https://github.com/CocoaPods/Specs.git'
).
split
(
','
)
@source_urls
=
argv
.
option
(
'sources'
,
'https://github.com/CocoaPods/Specs.git'
).
split
(
','
)
@private
=
argv
.
flag?
(
'private'
,
false
)
@private
=
argv
.
flag?
(
'private'
,
false
)
@swift_version
=
argv
.
option
(
'swift-version'
,
nil
)
@swift_version
=
argv
.
option
(
'swift-version'
,
nil
)
@podspecs_paths
=
argv
.
arguments!
@skip_import_validation
=
argv
.
flag?
(
'skip-import-validation'
,
false
)
@podspecs_paths
=
argv
.
arguments!
super
super
end
end
...
@@ -59,6 +61,7 @@ module Pod
...
@@ -59,6 +61,7 @@ module Pod
validator
.
use_frameworks
=
@use_frameworks
validator
.
use_frameworks
=
@use_frameworks
validator
.
ignore_public_only_results
=
@private
validator
.
ignore_public_only_results
=
@private
validator
.
swift_version
=
@swift_version
validator
.
swift_version
=
@swift_version
validator
.
skip_import_validation
=
@skip_import_validation
validator
.
validate
validator
.
validate
unless
@clean
unless
@clean
...
...
lib/cocoapods/command/repo/push.rb
View file @
cae98c53
...
@@ -29,6 +29,7 @@ module Pod
...
@@ -29,6 +29,7 @@ module Pod
'Multiple sources must be comma-delimited.'
],
'Multiple sources must be comma-delimited.'
],
[
'--local-only'
,
'Does not perform the step of pushing REPO to its remote'
],
[
'--local-only'
,
'Does not perform the step of pushing REPO to its remote'
],
[
'--no-private'
,
'Lint includes checks that apply only to public repos'
],
[
'--no-private'
,
'Lint includes checks that apply only to public repos'
],
[
'--skip-import-validation'
,
'Lint skips validating that the pod can be imported'
],
[
'--commit-message="Fix bug in pod"'
,
'Add custom commit message. '
\
[
'--commit-message="Fix bug in pod"'
,
'Add custom commit message. '
\
'Opens default editor if no commit message is specified.'
],
'Opens default editor if no commit message is specified.'
],
[
'--use-json'
,
'Push JSON spec to repo'
],
[
'--use-json'
,
'Push JSON spec to repo'
],
...
@@ -50,6 +51,7 @@ module Pod
...
@@ -50,6 +51,7 @@ module Pod
@commit_message
=
argv
.
flag?
(
'commit-message'
,
false
)
@commit_message
=
argv
.
flag?
(
'commit-message'
,
false
)
@use_json
=
argv
.
flag?
(
'use-json'
)
@use_json
=
argv
.
flag?
(
'use-json'
)
@swift_version
=
argv
.
option
(
'swift-version'
,
nil
)
@swift_version
=
argv
.
option
(
'swift-version'
,
nil
)
@skip_import_validation
=
argv
.
flag?
(
'skip-import-validation'
,
false
)
super
super
end
end
...
@@ -127,6 +129,7 @@ module Pod
...
@@ -127,6 +129,7 @@ module Pod
validator
.
use_frameworks
=
@use_frameworks
validator
.
use_frameworks
=
@use_frameworks
validator
.
ignore_public_only_results
=
@private
validator
.
ignore_public_only_results
=
@private
validator
.
swift_version
=
@swift_version
validator
.
swift_version
=
@swift_version
validator
.
skip_import_validation
=
@skip_import_validation
begin
begin
validator
.
validate
validator
.
validate
rescue
=>
e
rescue
=>
e
...
...
lib/cocoapods/command/spec/lint.rb
View file @
cae98c53
...
@@ -29,6 +29,7 @@ module Pod
...
@@ -29,6 +29,7 @@ module Pod
[
'--private'
,
'Lint skips checks that apply only to public specs'
],
[
'--private'
,
'Lint skips checks that apply only to public specs'
],
[
'--swift-version=VERSION'
,
'The SWIFT_VERSION that should be used to lint the spec. '
\
[
'--swift-version=VERSION'
,
'The SWIFT_VERSION that should be used to lint the spec. '
\
'This takes precedence over a .swift-version file.'
],
'This takes precedence over a .swift-version file.'
],
[
'--skip-import-validation'
,
'Lint skips validating that the pod can be imported'
],
].
concat
(
super
)
].
concat
(
super
)
end
end
...
@@ -43,7 +44,8 @@ module Pod
...
@@ -43,7 +44,8 @@ module Pod
@source_urls
=
argv
.
option
(
'sources'
,
'https://github.com/CocoaPods/Specs.git'
).
split
(
','
)
@source_urls
=
argv
.
option
(
'sources'
,
'https://github.com/CocoaPods/Specs.git'
).
split
(
','
)
@private
=
argv
.
flag?
(
'private'
,
false
)
@private
=
argv
.
flag?
(
'private'
,
false
)
@swift_version
=
argv
.
option
(
'swift-version'
,
nil
)
@swift_version
=
argv
.
option
(
'swift-version'
,
nil
)
@podspecs_paths
=
argv
.
arguments!
@skip_import_validation
=
argv
.
flag?
(
'skip-import-validation'
,
false
)
@podspecs_paths
=
argv
.
arguments!
super
super
end
end
...
@@ -61,6 +63,7 @@ module Pod
...
@@ -61,6 +63,7 @@ module Pod
validator
.
use_frameworks
=
@use_frameworks
validator
.
use_frameworks
=
@use_frameworks
validator
.
ignore_public_only_results
=
@private
validator
.
ignore_public_only_results
=
@private
validator
.
swift_version
=
@swift_version
validator
.
swift_version
=
@swift_version
validator
.
skip_import_validation
=
@skip_import_validation
validator
.
validate
validator
.
validate
failure_reasons
<<
validator
.
failure_reason
failure_reasons
<<
validator
.
failure_reason
...
...
lib/cocoapods/validator.rb
View file @
cae98c53
...
@@ -202,6 +202,9 @@ module Pod
...
@@ -202,6 +202,9 @@ module Pod
#
#
attr_accessor
:ignore_public_only_results
attr_accessor
:ignore_public_only_results
attr_accessor
:skip_import_validation
alias_method
:skip_import_validation?
,
:skip_import_validation
#-------------------------------------------------------------------------#
#-------------------------------------------------------------------------#
# !@group Lint results
# !@group Lint results
...
@@ -411,7 +414,6 @@ module Pod
...
@@ -411,7 +414,6 @@ module Pod
app_project
.
new_target
(
:application
,
'App'
,
consumer
.
platform_name
,
deployment_target
)
app_project
.
new_target
(
:application
,
'App'
,
consumer
.
platform_name
,
deployment_target
)
app_project
.
save
app_project
.
save
app_project
.
recreate_user_schemes
app_project
.
recreate_user_schemes
Xcodeproj
::
XCScheme
.
share_scheme
(
app_project
.
path
,
'App'
)
end
end
def
add_app_project_import
def
add_app_project_import
...
@@ -425,6 +427,8 @@ module Pod
...
@@ -425,6 +427,8 @@ module Pod
add_swift_version
(
app_target
)
add_swift_version
(
app_target
)
add_xctest
(
app_target
)
if
@installer
.
pod_targets
.
any?
{
|
pt
|
pt
.
spec_consumers
.
any?
{
|
c
|
c
.
frameworks
.
include?
(
'XCTest'
)
}
}
add_xctest
(
app_target
)
if
@installer
.
pod_targets
.
any?
{
|
pt
|
pt
.
spec_consumers
.
any?
{
|
c
|
c
.
frameworks
.
include?
(
'XCTest'
)
}
}
app_project
.
save
app_project
.
save
Xcodeproj
::
XCScheme
.
share_scheme
(
app_project
.
path
,
'App'
)
Xcodeproj
::
XCScheme
.
share_scheme
(
@installer
.
pods_project
.
path
,
pod_target
.
label
)
end
end
def
add_swift_version
(
app_target
)
def
add_swift_version
(
app_target
)
...
@@ -764,7 +768,12 @@ module Pod
...
@@ -764,7 +768,12 @@ module Pod
#
#
def
xcodebuild
def
xcodebuild
require
'fourflusher'
require
'fourflusher'
command
=
[
'clean'
,
'build'
,
'-workspace'
,
File
.
join
(
validation_dir
,
'App.xcworkspace'
),
'-scheme'
,
'App'
,
'-configuration'
,
'Release'
]
scheme
=
if
skip_import_validation?
@installer
.
pod_targets
.
find
{
|
pt
|
pt
.
pod_name
==
spec
.
root
.
name
}.
label
else
'App'
end
command
=
%W(clean build -workspace
#{
File
.
join
(
validation_dir
,
'App.xcworkspace'
)
}
-scheme
#{
scheme
}
-configuration Release)
case
consumer
.
platform_name
case
consumer
.
platform_name
when
:osx
,
:macos
when
:osx
,
:macos
command
+=
%w(CODE_SIGN_IDENTITY=)
command
+=
%w(CODE_SIGN_IDENTITY=)
...
...
spec/unit/validator_spec.rb
View file @
cae98c53
...
@@ -293,6 +293,7 @@ module Pod
...
@@ -293,6 +293,7 @@ module Pod
validator
.
stubs
(
:validate_url
)
validator
.
stubs
(
:validate_url
)
validator
.
expects
(
:install_pod
).
times
(
4
)
validator
.
expects
(
:install_pod
).
times
(
4
)
validator
.
expects
(
:build_pod
).
times
(
4
)
validator
.
expects
(
:build_pod
).
times
(
4
)
validator
.
expects
(
:add_app_project_import
).
times
(
4
)
validator
.
expects
(
:check_file_patterns
).
times
(
4
)
validator
.
expects
(
:check_file_patterns
).
times
(
4
)
validator
.
validate
validator
.
validate
end
end
...
@@ -421,6 +422,31 @@ module Pod
...
@@ -421,6 +422,31 @@ module Pod
validator
.
result_type
.
should
==
:error
validator
.
result_type
.
should
==
:error
end
end
it
'runs xcodebuild with correct arguments when skipping import validation'
do
require
'fourflusher'
Fourflusher
::
SimControl
.
any_instance
.
stubs
(
:destination
).
returns
([
'-destination'
,
'id=XXX'
])
Validator
.
any_instance
.
unstub
(
:xcodebuild
)
validator
=
Validator
.
new
(
podspec_path
,
config
.
sources_manager
.
master
.
map
(
&
:url
))
validator
.
stubs
(
:check_file_patterns
)
validator
.
stubs
(
:validate_url
)
validator
.
skip_import_validation
=
true
git
=
Executable
.
which
(
:git
)
Executable
.
stubs
(
:which
).
with
(
'git'
).
returns
(
git
)
Executable
.
stubs
(
:capture_command
).
with
(
'git'
,
[
'config'
,
'--get'
,
'remote.origin.url'
],
:capture
=>
:out
).
returns
([
'https://github.com/CocoaPods/Specs.git'
])
Executable
.
stubs
(
:which
).
with
(
:xcrun
)
# Command should include the pod target 'JSONKit' instead of the 'App' target.
command
=
[
'clean'
,
'build'
,
'-workspace'
,
File
.
join
(
validator
.
validation_dir
,
'App.xcworkspace'
),
'-scheme'
,
'JSONKit'
,
'-configuration'
,
'Release'
]
args
=
%w(CODE_SIGN_IDENTITY=)
Executable
.
expects
(
:capture_command
).
with
(
'xcodebuild'
,
command
+
args
,
:capture
=>
:merge
).
once
.
returns
([
''
,
stub
(
:success?
=>
true
)])
args
=
%w(CODE_SIGN_IDENTITY=- -sdk appletvsimulator)
+
Fourflusher
::
SimControl
.
new
.
destination
(
'Apple TV 1080p'
)
Executable
.
expects
(
:capture_command
).
with
(
'xcodebuild'
,
command
+
args
,
:capture
=>
:merge
).
once
.
returns
([
''
,
stub
(
:success?
=>
true
)])
args
=
%w(CODE_SIGN_IDENTITY=- -sdk iphonesimulator)
+
Fourflusher
::
SimControl
.
new
.
destination
(
'iPhone 4s'
)
Executable
.
expects
(
:capture_command
).
with
(
'xcodebuild'
,
command
+
args
,
:capture
=>
:merge
).
once
.
returns
([
''
,
stub
(
:success?
=>
true
)])
args
=
%w(CODE_SIGN_IDENTITY=- -sdk watchsimulator)
+
Fourflusher
::
SimControl
.
new
.
destination
(
'Apple Watch - 38mm'
)
Executable
.
expects
(
:capture_command
).
with
(
'xcodebuild'
,
command
+
args
,
:capture
=>
:merge
).
once
.
returns
([
''
,
stub
(
:success?
=>
true
)])
validator
.
validate
end
it
'runs xcodebuild with correct arguments for code signing'
do
it
'runs xcodebuild with correct arguments for code signing'
do
require
'fourflusher'
require
'fourflusher'
Fourflusher
::
SimControl
.
any_instance
.
stubs
(
:destination
).
returns
([
'-destination'
,
'id=XXX'
])
Fourflusher
::
SimControl
.
any_instance
.
stubs
(
:destination
).
returns
([
'-destination'
,
'id=XXX'
])
...
@@ -580,9 +606,14 @@ module Pod
...
@@ -580,9 +606,14 @@ module Pod
it
'adds the importing file to the app target'
do
it
'adds the importing file to the app target'
do
@validator
.
stubs
(
:use_frameworks
).
returns
(
true
)
@validator
.
stubs
(
:use_frameworks
).
returns
(
true
)
@validator
.
send
(
:create_app_project
)
@validator
.
send
(
:create_app_project
)
pods_project
=
Xcodeproj
::
Project
.
new
(
@validator
.
validation_dir
+
'Pods/Pods.xcodeproj'
)
app_project_path
=
@validator
.
validation_dir
+
'App.xcodeproj'
pod_target
=
fixture_pod_target
(
'banana-lib/BananaLib.podspec'
)
pod_target
=
fixture_pod_target
(
'banana-lib/BananaLib.podspec'
)
pod_target
.
stubs
(
:uses_swift?
=>
true
,
:pod_name
=>
'JSONKit'
)
pod_target
.
stubs
(
:uses_swift?
=>
true
,
:pod_name
=>
'JSONKit'
)
installer
=
stub
(
:pod_targets
=>
[
pod_target
])
installer
=
stub
(
:pod_targets
=>
[
pod_target
])
installer
.
stubs
(
:pods_project
).
returns
(
pods_project
)
Xcodeproj
::
XCScheme
.
expects
(
:share_scheme
).
with
(
app_project_path
,
'App'
).
once
Xcodeproj
::
XCScheme
.
expects
(
:share_scheme
).
with
(
pods_project
.
path
,
'BananaLib'
).
once
@validator
.
instance_variable_set
(
:@installer
,
installer
)
@validator
.
instance_variable_set
(
:@installer
,
installer
)
@validator
.
send
(
:add_app_project_import
)
@validator
.
send
(
:add_app_project_import
)
...
@@ -596,15 +627,20 @@ module Pod
...
@@ -596,15 +627,20 @@ module Pod
it
'adds developer framework paths when the pod depends on XCTest'
do
it
'adds developer framework paths when the pod depends on XCTest'
do
@validator
.
send
(
:create_app_project
)
@validator
.
send
(
:create_app_project
)
pods_project
=
Xcodeproj
::
Project
.
new
(
@validator
.
validation_dir
+
'Pods/Pods.xcodeproj'
)
app_project_path
=
@validator
.
validation_dir
+
'App.xcodeproj'
pod_target
=
fixture_pod_target
(
'banana-lib/BananaLib.podspec'
)
pod_target
=
fixture_pod_target
(
'banana-lib/BananaLib.podspec'
)
pod_target
.
stubs
(
:uses_swift?
=>
true
,
:pod_name
=>
'JSONKit'
)
pod_target
.
stubs
(
:uses_swift?
=>
true
,
:pod_name
=>
'JSONKit'
)
pod_target
.
spec_consumers
.
first
.
stubs
(
:frameworks
).
returns
(
%w(XCTest)
)
pod_target
.
spec_consumers
.
first
.
stubs
(
:frameworks
).
returns
(
%w(XCTest)
)
installer
=
stub
(
:pod_targets
=>
[
pod_target
])
installer
=
stub
(
:pod_targets
=>
[
pod_target
])
installer
.
stubs
(
:pods_project
).
returns
(
pods_project
)
Xcodeproj
::
XCScheme
.
expects
(
:share_scheme
).
with
(
app_project_path
,
'App'
).
once
Xcodeproj
::
XCScheme
.
expects
(
:share_scheme
).
with
(
pods_project
.
path
,
'BananaLib'
).
once
@validator
.
instance_variable_set
(
:@installer
,
installer
)
@validator
.
instance_variable_set
(
:@installer
,
installer
)
@validator
.
send
(
:add_app_project_import
)
@validator
.
send
(
:add_app_project_import
)
project
=
Xcodeproj
::
Project
.
open
(
@validator
.
validation_dir
+
'App.xcodeproj'
)
app_project
=
Xcodeproj
::
Project
.
open
(
app_project_path
)
project
.
native_targets
.
first
.
build_configurations
.
map
do
|
bc
|
app_
project
.
native_targets
.
first
.
build_configurations
.
map
do
|
bc
|
bc
.
build_settings
[
'FRAMEWORK_SEARCH_PATHS'
]
bc
.
build_settings
[
'FRAMEWORK_SEARCH_PATHS'
]
end
.
uniq
.
should
==
[
%w($(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks")
]
end
.
uniq
.
should
==
[
%w($(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks")
]
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