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
36fb8038
Commit
36fb8038
authored
Jan 27, 2015
by
Kyle Fuller
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3048 from CocoaPods/check-extension
Configure as extension only for app extensions
parents
3ff7d920
b549aef2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
10 deletions
+48
-10
CHANGELOG.md
CHANGELOG.md
+4
-0
installer.rb
lib/cocoapods/installer.rb
+15
-0
aggregate_target.rb
lib/cocoapods/target/aggregate_target.rb
+1
-0
installer_spec.rb
spec/unit/installer_spec.rb
+28
-10
No files found.
CHANGELOG.md
View file @
36fb8038
...
...
@@ -16,6 +16,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Enhancements
*
Set the APPLICATION_EXTENSION_API_ONLY build setting if integrating with an app extension target.
[
Boris Bügling
](
https://github.com/neonichu
)
[
#2980
](
https://github.com/CocoaPods/CocoaPods/issues/2980
)
*
Xcodebuild warnings will now be reported as
`warning`
during linting
instead of
`note`
.
[
Hugo Tunius
](
https://github.com/K0nserv
)
...
...
lib/cocoapods/installer.rb
View file @
36fb8038
...
...
@@ -467,6 +467,9 @@ module Pod
def
set_target_dependencies
frameworks_group
=
pods_project
.
frameworks_group
aggregate_targets
.
each
do
|
aggregate_target
|
is_app_extension
=
aggregate_target
.
user_targets
.
map
(
&
:symbol_type
).
include?
(
:app_extension
)
configure_app_extension_api_only_for_target
(
aggregate_target
)
if
is_app_extension
aggregate_target
.
pod_targets
.
each
do
|
pod_target
|
unless
pod_target
.
should_build?
pod_target
.
resource_bundle_targets
.
each
do
|
resource_bundle_target
|
...
...
@@ -477,6 +480,8 @@ module Pod
end
aggregate_target
.
native_target
.
add_dependency
(
pod_target
.
native_target
)
configure_app_extension_api_only_for_target
(
pod_target
)
if
is_app_extension
pod_target
.
dependencies
.
each
do
|
dep
|
unless
dep
==
pod_target
.
pod_name
pod_dependency_target
=
aggregate_target
.
pod_targets
.
find
{
|
target
|
target
.
pod_name
==
dep
}
...
...
@@ -487,6 +492,7 @@ module Pod
next
unless
pod_dependency_target
.
should_build?
pod_target
.
native_target
.
add_dependency
(
pod_dependency_target
.
native_target
)
configure_app_extension_api_only_for_target
(
pod_dependency_target
)
if
is_app_extension
if
pod_target
.
requires_frameworks?
product_ref
=
frameworks_group
.
files
.
find
{
|
f
|
f
.
path
==
pod_dependency_target
.
product_name
}
||
...
...
@@ -694,6 +700,15 @@ module Pod
analysis_result
.
sandbox_state
end
# Sets the APPLICATION_EXTENSION_API_ONLY build setting to YES for all
# configurations of the given target
#
def
configure_app_extension_api_only_for_target
(
target
)
target
.
native_target
.
build_configurations
.
each
do
|
config
|
config
.
build_settings
[
'APPLICATION_EXTENSION_API_ONLY'
]
=
'YES'
end
end
#-------------------------------------------------------------------------#
end
end
lib/cocoapods/target/aggregate_target.rb
View file @
36fb8038
...
...
@@ -55,6 +55,7 @@ module Pod
# will be integrated by this target.
#
def
user_targets
(
project
=
nil
)
return
[]
unless
user_project_path
project
||=
Xcodeproj
::
Project
.
open
(
user_project_path
)
user_target_uuids
.
map
do
|
uuid
|
native_target
=
project
.
objects_by_uuid
[
uuid
]
...
...
spec/unit/installer_spec.rb
View file @
36fb8038
...
...
@@ -418,26 +418,44 @@ module Pod
#--------------------------------------#
describe
'#set_target_dependencies'
do
it
'sets resource bundles for not build pods as target dependencies of the user target'
do
before
do
spec
=
fixture_spec
(
'banana-lib/BananaLib.podspec'
)
target_definition
=
Podfile
::
TargetDefinition
.
new
(
:default
,
@installer
.
podfile
)
pod_target
=
PodTarget
.
new
([
spec
],
target_definition
,
config
.
sandbox
)
pod_target
.
stubs
(
:resource_bundle_targets
).
returns
([
'dummy'
])
pod_target
.
stubs
(
:should_build?
=>
false
)
target
=
AggregateTarget
.
new
(
target_definition
,
config
.
sandbox
)
@pod_target
=
PodTarget
.
new
([
spec
],
target_definition
,
config
.
sandbox
)
@target
=
AggregateTarget
.
new
(
target_definition
,
config
.
sandbox
)
mock_target
=
mock
(
'PodNativeTarget'
)
mock_target
.
expects
(
:add_dependency
).
with
(
'dummy'
)
@mock_target
=
mock
(
'PodNativeTarget'
)
mock_project
=
mock
(
'PodsProject'
,
:frameworks_group
=>
mock
(
'FrameworksGroup'
))
@installer
.
stubs
(
:pods_project
).
returns
(
mock_project
)
target
.
stubs
(
:native_target
).
returns
(
mock_target
)
target
.
stubs
(
:pod_targets
).
returns
([
pod_target
])
@installer
.
stubs
(
:aggregate_targets
).
returns
([
target
])
@target
.
stubs
(
:native_target
).
returns
(
@mock_target
)
@target
.
stubs
(
:pod_targets
).
returns
([
@pod_target
])
@installer
.
stubs
(
:aggregate_targets
).
returns
([
@target
])
end
it
'sets resource bundles for not build pods as target dependencies of the user target'
do
@pod_target
.
stubs
(
:resource_bundle_targets
).
returns
([
'dummy'
])
@pod_target
.
stubs
(
:should_build?
=>
false
)
@mock_target
.
expects
(
:add_dependency
).
with
(
'dummy'
)
@installer
.
send
(
:set_target_dependencies
)
end
it
'configures APPLICATION_EXTENSION_API_ONLY for app extension targets'
do
mock_user_target
=
mock
(
'UserTarget'
,
:symbol_type
=>
:app_extension
)
@target
.
stubs
(
:user_targets
).
returns
([
mock_user_target
])
build_settings
=
{}
mock_configuration
=
mock
(
'BuildConfiguration'
,
:build_settings
=>
build_settings
)
@mock_target
.
stubs
(
:build_configurations
).
returns
([
mock_configuration
])
@installer
.
send
(
:set_target_dependencies
)
build_settings
.
should
==
{
'APPLICATION_EXTENSION_API_ONLY'
=>
'YES'
}
end
xit
'sets the pod targets as dependencies of the aggregate target'
do
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