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
92a04dca
Commit
92a04dca
authored
Dec 25, 2015
by
Samuel Giddins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make empty target definitions integrate properly
parent
7a1b2ad6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
16 deletions
+28
-16
installer.rb
lib/cocoapods/installer.rb
+2
-2
user_project_integrator.rb
lib/cocoapods/installer/user_project_integrator.rb
+1
-1
user_project_integrator_spec.rb
spec/unit/installer/user_project_integrator_spec.rb
+23
-11
installer_spec.rb
spec/unit/installer_spec.rb
+2
-2
No files found.
lib/cocoapods/installer.rb
View file @
92a04dca
...
...
@@ -629,13 +629,13 @@ module Pod
def
install_libraries
UI
.
message
'- Installing targets'
do
pod_targets
.
sort_by
(
&
:name
).
each
do
|
pod_target
|
next
if
pod_target
.
target_definitions
.
flat_map
(
&
:dependencies
).
empty?
next
if
pod_target
.
target_definitions
.
all?
(
&
:abstract?
)
target_installer
=
PodTargetInstaller
.
new
(
sandbox
,
pod_target
)
target_installer
.
install!
end
aggregate_targets
.
sort_by
(
&
:name
).
each
do
|
target
|
next
if
target
.
target_definition
.
dependencies
.
empty
?
next
if
target
.
target_definition
.
abstract
?
target_installer
=
AggregateTargetInstaller
.
new
(
sandbox
,
target
)
target_installer
.
install!
end
...
...
lib/cocoapods/installer/user_project_integrator.rb
View file @
92a04dca
...
...
@@ -234,7 +234,7 @@ module Pod
end
def
targets_to_integrate
targets
.
reject
{
|
target
|
target
.
target_definition
.
empty
?
}
targets
.
reject
{
|
target
|
target
.
target_definition
.
abstract
?
}
end
# Prints a warning informing the user that a build configuration of
...
...
spec/unit/installer/user_project_integrator_spec.rb
View file @
92a04dca
...
...
@@ -9,18 +9,23 @@ module Pod
@podfile
=
Podfile
.
new
do
platform
:ios
xcodeproj
sample_project_path
pod
'JSONKit'
target
:empty
do
target
'SampleProject'
do
pod
'JSONKit'
target
:empty
do
end
end
end
config
.
sandbox
.
project
=
Project
.
new
(
config
.
sandbox
.
project_path
)
config
.
sandbox
.
project
.
save
@target
=
AggregateTarget
.
new
(
@podfile
.
target_definitions
[
'
Pods
'
],
config
.
sandbox
)
@target
=
AggregateTarget
.
new
(
@podfile
.
target_definitions
[
'
SampleProject
'
],
config
.
sandbox
)
@target
.
client_root
=
sample_project_path
.
dirname
@target
.
user_project
=
Xcodeproj
::
Project
.
open
(
@sample_project_path
)
@target
.
user_target_uuids
=
[
'A346496C14F9BE9A0080D870'
]
empty_library
=
AggregateTarget
.
new
(
@podfile
.
target_definitions
[
:empty
],
config
.
sandbox
)
@integrator
=
UserProjectIntegrator
.
new
(
@podfile
,
config
.
sandbox
,
temporary_directory
,
[
@target
,
empty_library
])
@empty_library
=
AggregateTarget
.
new
(
@podfile
.
target_definitions
[
:empty
],
config
.
sandbox
)
@empty_library
.
client_root
=
sample_project_path
.
dirname
@empty_library
.
user_project
=
@target
.
user_project
@empty_library
.
user_target_uuids
=
[
'C0C495321B9E5C47004F9854'
]
@integrator
=
UserProjectIntegrator
.
new
(
@podfile
,
config
.
sandbox
,
temporary_directory
,
[
@target
,
@empty_library
])
end
#-----------------------------------------------------------------------#
...
...
@@ -42,12 +47,13 @@ module Pod
end
it
'integrates the user targets'
do
UserProjectIntegrator
::
TargetIntegrator
.
any_instance
.
expects
(
:integrate!
)
UserProjectIntegrator
::
TargetIntegrator
.
any_instance
.
expects
(
:integrate!
)
.
twice
@integrator
.
integrate!
end
it
'warns if the podfile does not contain any dependency'
do
Podfile
::
TargetDefinition
.
any_instance
.
stubs
(
:empty?
).
returns
(
true
)
@podfile
=
Pod
::
Podfile
.
new
@integrator
.
stubs
(
:podfile
).
returns
(
@podfile
)
@integrator
.
integrate!
UI
.
warnings
.
should
.
include?
(
'The Podfile does not contain any dependencies'
)
end
...
...
@@ -57,7 +63,7 @@ module Pod
Deintegrator
.
any_instance
.
expects
(
:deintegrate_target
).
with
additional_project
.
new_target
(
:application
,
'Other App'
,
:ios
)
user_project
=
@target
.
user_project
user_project
.
native_targets
.
each
do
|
target
|
next
if
target
.
name
==
'SampleProject'
next
if
%w(SampleProject SampleProjectTests)
.
include?
(
target
.
name
)
Deintegrator
.
any_instance
.
expects
(
:deintegrate_target
).
with
(
target
)
end
@integrator
.
stubs
(
:user_projects
).
returns
([
additional_project
,
user_project
])
...
...
@@ -201,9 +207,15 @@ module Pod
@integrator
.
send
(
:user_project_paths
).
should
==
[
@sample_project_path
]
end
it
'skips libraries with empty target definitions'
do
@integrator
.
targets
.
map
(
&
:name
).
should
==
[
'Pods'
,
'Pods-empty'
]
@integrator
.
send
(
:targets_to_integrate
).
map
(
&
:name
).
should
==
[
'Pods'
]
it
'does not skip libraries with empty target definitions'
do
@integrator
.
targets
.
map
(
&
:name
).
should
==
[
'Pods-SampleProject'
,
'Pods-SampleProject-empty'
]
@integrator
.
send
(
:targets_to_integrate
).
map
(
&
:name
).
should
==
[
'Pods-SampleProject'
,
'Pods-SampleProject-empty'
]
end
it
'does skip libraries with only abstract target definitions'
do
@integrator
.
targets
.
map
(
&
:name
).
should
==
[
'Pods-SampleProject'
,
'Pods-SampleProject-empty'
]
@podfile
.
target_definition_list
.
each
{
|
td
|
td
.
abstract
=
true
}
@integrator
.
send
(
:targets_to_integrate
).
map
(
&
:name
).
should
==
[]
end
it
'skips saving projects that are not dirtied (but touches them instead)'
do
...
...
spec/unit/installer_spec.rb
View file @
92a04dca
...
...
@@ -646,13 +646,13 @@ module Pod
@installer
.
send
(
:install_libraries
)
end
it
'
skips
empty pod targets'
do
it
'
does not skip
empty pod targets'
do
spec
=
fixture_spec
(
'banana-lib/BananaLib.podspec'
)
target_definition
=
Podfile
::
TargetDefinition
.
new
(
:default
,
nil
)
pod_target
=
PodTarget
.
new
([
spec
],
[
target_definition
],
config
.
sandbox
)
@installer
.
stubs
(
:aggregate_targets
).
returns
([])
@installer
.
stubs
(
:pod_targets
).
returns
([
pod_target
])
Installer
::
PodTargetInstaller
.
any_instance
.
expects
(
:install!
).
never
Installer
::
PodTargetInstaller
.
any_instance
.
expects
(
:install!
).
once
@installer
.
send
(
:install_libraries
)
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