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
16e5b431
Commit
16e5b431
authored
Feb 24, 2015
by
Kyle Fuller
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3178 from CocoaPods/explicit_use_frameworks
Require explicit use of `use_frameworks!`
parents
de7e16e2
681eb76a
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
51 additions
and
6 deletions
+51
-6
CHANGELOG.md
CHANGELOG.md
+4
-0
installer.rb
lib/cocoapods/installer.rb
+17
-0
target.rb
lib/cocoapods/target.rb
+1
-6
aggregate_xcconfig_spec.rb
spec/unit/generator/xcconfig/aggregate_xcconfig_spec.rb
+4
-0
installer_spec.rb
spec/unit/installer_spec.rb
+22
-0
aggregate_target_spec.rb
spec/unit/target/aggregate_target_spec.rb
+1
-0
pod_target_spec.rb
spec/unit/target/pod_target_spec.rb
+1
-0
validator_spec.rb
spec/unit/validator_spec.rb
+1
-0
No files found.
CHANGELOG.md
View file @
16e5b431
...
...
@@ -56,6 +56,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[
Samuel Giddins
](
https://github.com/segiddins
)
[
#2685
](
https://github.com/CocoaPods/CocoaPods/issues/2685
)
*
Require explicit use of
`use_frameworks!`
for Pods written in Swift.
[
Boris Bügling
](
https://github.com/neonichu
)
[
#3029
](
https://github.com/CocoaPods/CocoaPods/issues/3029
)
##### Bug Fixes
*
Added support for .tpp C++ header files in specs (previously were getting
...
...
lib/cocoapods/installer.rb
View file @
16e5b431
...
...
@@ -92,6 +92,7 @@ module Pod
determine_dependency_product_types
verify_no_duplicate_framework_names
verify_no_static_framework_transitive_dependencies
verify_framework_usage
generate_pods_project
integrate_user_project
if
config
.
integrate_targets?
perform_post_install_actions
...
...
@@ -369,6 +370,22 @@ module Pod
end
end
def
verify_framework_usage
aggregate_targets
.
each
do
|
aggregate_target
|
next
if
aggregate_target
.
requires_frameworks?
aggregate_target
.
user_build_configurations
.
keys
.
each
do
|
config
|
pod_targets
=
aggregate_target
.
pod_targets_for_build_configuration
(
config
)
if
pod_targets
.
any?
(
&
:uses_swift?
)
raise
Informative
,
'Pods written in Swift can only be integrated as frameworks; this '
\
'feature is still in beta. Add `use_frameworks!` to your Podfile or target to opt '
\
'into using it.'
end
end
end
end
# Performs any post-installation actions
#
# @return [void]
...
...
lib/cocoapods/target.rb
View file @
16e5b431
...
...
@@ -91,13 +91,8 @@ module Pod
# @return [Boolean] whether the generated target needs to be implemented
# as a framework
#
# @note This applies either if Swift was used by the host, which was checked
# eagerly by the analyzer before, or in the given target or its
# dependents, which can only be checked after the specs were been
# fetched.
#
def
requires_frameworks?
host_requires_frameworks?
||
uses_swift?
host_requires_frameworks?
||
false
end
#-------------------------------------------------------------------------#
...
...
spec/unit/generator/xcconfig/aggregate_xcconfig_spec.rb
View file @
16e5b431
...
...
@@ -123,6 +123,10 @@ module Pod
fixture_spec
(
'orange-framework/OrangeFramework.podspec'
)
end
before
do
Target
.
any_instance
.
stubs
(
:requires_frameworks?
).
returns
(
true
)
end
behaves_like
'AggregateXCConfig'
it
'sets the PODS_FRAMEWORK_BUILD_PATH build variable'
do
...
...
spec/unit/installer_spec.rb
View file @
16e5b431
...
...
@@ -51,6 +51,7 @@ module Pod
@installer
.
stubs
(
:determine_dependency_product_types
)
@installer
.
stubs
(
:verify_no_duplicate_framework_names
)
@installer
.
stubs
(
:verify_no_static_framework_transitive_dependencies
)
@installer
.
stubs
(
:verify_framework_usage
)
@installer
.
stubs
(
:generate_pods_project
)
@installer
.
stubs
(
:integrate_user_project
)
@installer
.
stubs
(
:run_plugins_post_install_hooks
)
...
...
@@ -125,6 +126,7 @@ module Pod
podfile
=
Pod
::
Podfile
.
new
do
platform
:ios
,
'8.0'
xcodeproj
'SampleProject/SampleProject'
use_frameworks!
pod
'BananaLib'
,
:path
=>
(
fixture_path
+
'banana-lib'
).
to_s
pod
'OrangeFramework'
,
:path
=>
(
fixture_path
+
'orange-framework'
).
to_s
pod
'monkey'
,
:path
=>
(
fixture_path
+
'monkey'
).
to_s
...
...
@@ -177,6 +179,7 @@ module Pod
podfile
=
Pod
::
Podfile
.
new
do
platform
:ios
,
'8.0'
xcodeproj
'SampleProject/SampleProject'
use_frameworks!
pod
'BananaLib'
,
:path
=>
(
fixture_path
+
'banana-lib'
).
to_s
pod
'OrangeFramework'
,
:path
=>
(
fixture_path
+
'orange-framework'
).
to_s
pod
'monkey'
,
:path
=>
(
fixture_path
+
'monkey'
).
to_s
...
...
@@ -191,6 +194,25 @@ module Pod
#-------------------------------------------------------------------------#
describe
'#verify_framework_usage'
do
it
'raises when Swift pods are used without explicit `use_frameworks!`'
do
fixture_path
=
ROOT
+
'spec/fixtures'
config
.
repos_dir
=
fixture_path
+
'spec-repos'
podfile
=
Pod
::
Podfile
.
new
do
platform
:ios
,
'8.0'
xcodeproj
'SampleProject/SampleProject'
pod
'OrangeFramework'
,
:path
=>
(
fixture_path
+
'orange-framework'
).
to_s
end
lockfile
=
generate_lockfile
config
.
integrate_targets
=
false
@installer
=
Installer
.
new
(
config
.
sandbox
,
podfile
,
lockfile
)
should
.
raise
(
Informative
)
{
@installer
.
install!
}.
message
.
should
.
match
/use_frameworks/
end
end
#-------------------------------------------------------------------------#
describe
'Dependencies Resolution'
do
describe
'#analyze'
do
it
'prints a warning if the version of the Lockfile is higher than the one of the executable'
do
...
...
spec/unit/target/aggregate_target_spec.rb
View file @
16e5b431
...
...
@@ -202,6 +202,7 @@ module Pod
before
do
@pod_target
=
fixture_pod_target
(
'orange-framework/OrangeFramework.podspec'
,
:ios
,
Podfile
::
TargetDefinition
.
new
(
'iOS Example'
,
nil
))
@target
=
AggregateTarget
.
new
(
@pod_target
.
target_definition
,
config
.
sandbox
)
@target
.
stubs
(
:requires_frameworks?
).
returns
(
true
)
@target
.
pod_targets
=
[
@pod_target
]
end
...
...
spec/unit/target/pod_target_spec.rb
View file @
16e5b431
...
...
@@ -178,6 +178,7 @@ module Pod
describe
'With frameworks'
do
before
do
@pod_target
=
fixture_pod_target
(
'orange-framework/OrangeFramework.podspec'
)
@pod_target
.
host_requires_frameworks
=
true
end
it
'returns that it uses swift'
do
...
...
spec/unit/validator_spec.rb
View file @
16e5b431
...
...
@@ -448,6 +448,7 @@ module Pod
podspec
.
gsub!
(
/.*license.*$/
,
'"license": "Public Domain",'
)
file
=
write_podspec
(
podspec
)
Podfile
::
TargetDefinition
.
any_instance
.
stubs
(
:uses_frameworks?
).
returns
(
true
)
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
)
...
...
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