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
f1b2521b
Commit
f1b2521b
authored
Jan 27, 2016
by
Samuel E. Giddins
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4824 from CocoaPods/seg-no-import-not-should-build
[Validator] Only import if the pod target is being built
parents
451e5eaa
1ae2f51f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
10 deletions
+23
-10
CHANGELOG.md
CHANGELOG.md
+5
-0
Gemfile.lock
Gemfile.lock
+3
-3
validator.rb
lib/cocoapods/validator.rb
+2
-2
validator_spec.rb
spec/unit/validator_spec.rb
+13
-5
No files found.
CHANGELOG.md
View file @
f1b2521b
...
...
@@ -40,6 +40,11 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
*
Share user schemes of
`Pods.xcodeproj`
after generating deterministic UUIDS.
[
Samuel Giddins
](
https://github.com/segiddins
)
*
Only attempt to
`import`
a framework during linting if the pod has source
files, and is thus being built by CocoaPods.
[
Samuel Giddins
](
https://github.com/segiddins
)
[
#4823
](
https://github.com/CocoaPods/CocoaPods/issues/4823
)
## 1.0.0.beta.2 (2016-01-05)
...
...
Gemfile.lock
View file @
f1b2521b
...
...
@@ -122,7 +122,7 @@ GEM
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.3.6)
ast (2.
1
.0)
ast (2.
2
.0)
astrolabe (1.3.1)
parser (~> 2.2)
awesome_print (1.6.1)
...
...
@@ -167,8 +167,8 @@ GEM
nap (1.0.0)
netrc (0.7.8)
notify (0.5.2)
parser (2.
2.2.6
)
ast (
>= 1.1, < 3.0
)
parser (2.
3.0.2
)
ast (
~> 2.2
)
powerpack (0.1.1)
prettybacon (0.0.2)
bacon (~> 1.2)
...
...
lib/cocoapods/validator.rb
View file @
f1b2521b
...
...
@@ -399,12 +399,12 @@ module Pod
if
language
==
:swift
source_file
=
validation_dir
.
+
(
'App/main.swift'
)
source_file
.
parent
.
mkpath
import_statement
=
use_frameworks
?
"import
#{
pod_target
.
product_module_name
}
\n
"
:
''
import_statement
=
use_frameworks
&&
pod_target
.
should_build?
?
"import
#{
pod_target
.
product_module_name
}
\n
"
:
''
source_file
.
open
(
'w'
)
{
|
f
|
f
<<
import_statement
}
else
source_file
=
validation_dir
.
+
(
'App/main.m'
)
source_file
.
parent
.
mkpath
import_statement
=
if
use_frameworks
import_statement
=
if
use_frameworks
&&
pod_target
.
should_build?
"@import
#{
pod_target
.
product_module_name
}
;
\n
"
else
header_name
=
"
#{
pod_target
.
product_module_name
}
/
#{
pod_target
.
product_module_name
}
.h"
...
...
spec/unit/validator_spec.rb
View file @
f1b2521b
...
...
@@ -496,7 +496,7 @@ module Pod
end
it
'creates a swift import'
do
pod_target
=
stub
(
:uses_swift?
=>
true
,
:product_module_name
=>
'ModuleName'
)
pod_target
=
stub
(
:uses_swift?
=>
true
,
:
should_build?
=>
true
,
:
product_module_name
=>
'ModuleName'
)
file
=
@validator
.
send
(
:write_app_import_source_file
,
pod_target
)
file
.
basename
.
to_s
.
should
==
'main.swift'
...
...
@@ -506,7 +506,7 @@ module Pod
end
it
'creates an objective-c import'
do
pod_target
=
stub
(
:uses_swift?
=>
false
,
:product_module_name
=>
'ModuleName'
)
pod_target
=
stub
(
:uses_swift?
=>
false
,
:
should_build?
=>
true
,
:
product_module_name
=>
'ModuleName'
)
file
=
@validator
.
send
(
:write_app_import_source_file
,
pod_target
)
file
.
basename
.
to_s
.
should
==
'main.m'
...
...
@@ -517,6 +517,14 @@ module Pod
int main() {}
OBJC
end
it
'creates no import when the pod target has no source files'
do
pod_target
=
stub
(
:uses_swift?
=>
true
,
:should_build?
=>
false
)
file
=
@validator
.
send
(
:write_app_import_source_file
,
pod_target
)
file
.
basename
.
to_s
.
should
==
'main.swift'
file
.
read
.
should
==
''
end
end
describe
'when linting as a static lib'
do
...
...
@@ -526,7 +534,7 @@ module Pod
end
it
'creates an objective-c import when a plausible umbrella header is found'
do
pod_target
=
stub
(
:uses_swift?
=>
false
,
:product_module_name
=>
'ModuleName'
,
:sandbox
=>
@sandbox
)
pod_target
=
stub
(
:uses_swift?
=>
false
,
:
should_build?
=>
true
,
:
product_module_name
=>
'ModuleName'
,
:sandbox
=>
@sandbox
)
header_name
=
"
#{
pod_target
.
product_module_name
}
/
#{
pod_target
.
product_module_name
}
.h"
umbrella
=
pod_target
.
sandbox
.
public_headers
.
root
.
+
(
header_name
)
umbrella
.
dirname
.
mkpath
...
...
@@ -543,7 +551,7 @@ module Pod
end
it
'does not create an objective-c import when no umbrella header is found'
do
pod_target
=
stub
(
:uses_swift?
=>
false
,
:product_module_name
=>
'ModuleName'
,
:sandbox
=>
@sandbox
)
pod_target
=
stub
(
:uses_swift?
=>
false
,
:
should_build?
=>
true
,
:
product_module_name
=>
'ModuleName'
,
:sandbox
=>
@sandbox
)
file
=
@validator
.
send
(
:write_app_import_source_file
,
pod_target
)
file
.
basename
.
to_s
.
should
==
'main.m'
...
...
@@ -559,7 +567,7 @@ module Pod
it
'adds the importing file to the app target'
do
@validator
.
stubs
(
:use_frameworks
).
returns
(
true
)
@validator
.
send
(
:create_app_project
)
pod_target
=
stub
(
:uses_swift?
=>
true
,
:pod_name
=>
'JSONKit'
,
:product_module_name
=>
'ModuleName'
)
pod_target
=
stub
(
:uses_swift?
=>
true
,
:
should_build?
=>
true
,
:
pod_name
=>
'JSONKit'
,
:product_module_name
=>
'ModuleName'
)
installer
=
stub
(
:pod_targets
=>
[
pod_target
])
@validator
.
instance_variable_set
(
:@installer
,
installer
)
@validator
.
send
(
:add_app_project_import
)
...
...
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