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
109af82e
Commit
109af82e
authored
Feb 07, 2013
by
Eloy Durán
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Never consider aggregate targets for integration. Fixes #729 & 784.
parent
a5d0bb76
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
95 additions
and
18 deletions
+95
-18
user_project_integrator.rb
lib/cocoapods/installer/user_project_integrator.rb
+38
-18
project.pbxproj
...res/SampleProject/SampleProject.xcodeproj/project.pbxproj
+52
-0
user_project_integrator_spec.rb
spec/unit/installer/user_project_integrator_spec.rb
+5
-0
No files found.
lib/cocoapods/installer/user_project_integrator.rb
View file @
109af82e
...
@@ -112,6 +112,14 @@ module Pod
...
@@ -112,6 +112,14 @@ module Pod
@user_project
||=
Xcodeproj
::
Project
.
new
(
user_project_path
)
@user_project
||=
Xcodeproj
::
Project
.
new
(
user_project_path
)
end
end
# @return [Array<PBXNativeTarget>] Returns the user’s targets,
# excluding aggregate targets.
def
native_targets
user_project
.
targets
.
reject
do
|
target
|
target
.
is_a?
Xcodeproj
::
Project
::
Object
::
PBXAggregateTarget
end
end
# This returns a list of the targets from the user’s project to which
# This returns a list of the targets from the user’s project to which
# this Pods static library should be linked. If no explicit target was
# this Pods static library should be linked. If no explicit target was
# specified, then the first encountered target is assumed.
# specified, then the first encountered target is assumed.
...
@@ -122,28 +130,40 @@ module Pod
...
@@ -122,28 +130,40 @@ module Pod
# @return [Array<PBXNativeTarget>] Returns the list of targets that
# @return [Array<PBXNativeTarget>] Returns the list of targets that
# the Pods lib should be linked with.
# the Pods lib should be linked with.
def
targets
def
targets
@targets
||=
begin
if
@targets
.
nil?
if
link_with
=
@target_definition
.
link_with
targets
=
nil
# Find explicitly linked targets.
# Find explicitly linked targets.
user_project
.
targets
.
select
do
|
target
|
if
link_with
=
@target_definition
.
link_with
link_with
.
include?
target
.
name
targets
=
native_targets
.
select
do
|
target
|
link_with
.
include?
target
.
name
end
# Otherwise try to find a target matching the name.
elsif
@target_definition
.
name
!=
:default
target
=
native_targets
.
find
do
|
target
|
target
.
name
==
@target_definition
.
name
.
to_s
end
unless
target
raise
Informative
,
"Unable to find a target named `
#{
@target_definition
.
name
.
to_s
}
'"
end
targets
=
[
target
]
# Default to the first target, which in a simple project is
# probably an app target.
else
targets
=
[
native_targets
.
first
]
end
end
elsif
@target_definition
.
name
!=
:default
# Find the target with the matching name.
# Reject any target that already has this Pods library in one of
target
=
user_project
.
targets
.
find
{
|
target
|
target
.
name
==
@target_definition
.
name
.
to_s
}
# its frameworks build phases
raise
Informative
,
"Unable to find a target named `
#{
@target_definition
.
name
.
to_s
}
'"
unless
target
@targets
=
targets
.
reject
do
|
target
|
[
target
]
target
.
frameworks_build_phase
.
files
.
any?
do
|
build_file
|
else
file_ref
=
build_file
.
file_ref
# Default to the first, which in a simple project is probably an app target.
!
file_ref
.
proxy?
&&
file_ref
.
display_name
==
@target_definition
.
lib_name
[
user_project
.
targets
.
first
]
end
end
.
reject
do
|
target
|
# Reject any target that already has this Pods library in one of its frameworks build phases
target
.
frameworks_build_phase
.
files
.
any?
do
|
build_file
|
file_ref
=
build_file
.
file_ref
!
file_ref
.
proxy?
&&
file_ref
.
display_name
==
@target_definition
.
lib_name
end
end
end
end
end
@targets
end
end
def
add_xcconfig_base_configuration
def
add_xcconfig_base_configuration
...
...
spec/fixtures/SampleProject/SampleProject.xcodeproj/project.pbxproj
View file @
109af82e
...
@@ -6,6 +6,19 @@
...
@@ -6,6 +6,19 @@
objectVersion
=
46
;
objectVersion
=
46
;
objects
=
{
objects
=
{
/* Begin PBXAggregateTarget section */
51D6A8AB16C445B800E174E1
/* AggregateTarget */
=
{
isa
=
PBXAggregateTarget
;
buildConfigurationList
=
51D6A8B116C445B800E174E1
/* Build configuration list for PBXAggregateTarget "AggregateTarget" */
;
buildPhases
=
(
);
dependencies
=
(
);
name
=
AggregateTarget
;
productName
=
AggregateTarget
;
};
/* End PBXAggregateTarget section */
/* Begin PBXBuildFile section */
/* Begin PBXBuildFile section */
51075D4C1521D0C100E39B41
/* UIKit.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A346497114F9BE9A0080D870
/* UIKit.framework */
;
};
51075D4C1521D0C100E39B41
/* UIKit.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A346497114F9BE9A0080D870
/* UIKit.framework */
;
};
51075D4D1521D0C100E39B41
/* Foundation.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A346497314F9BE9A0080D870
/* Foundation.framework */
;
};
51075D4D1521D0C100E39B41
/* Foundation.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A346497314F9BE9A0080D870
/* Foundation.framework */
;
};
...
@@ -224,6 +237,7 @@
...
@@ -224,6 +237,7 @@
targets
=
(
targets
=
(
A346496C14F9BE9A0080D870
/* SampleProject */
,
A346496C14F9BE9A0080D870
/* SampleProject */
,
51075D491521D0C100E39B41
/* TestRunner */
,
51075D491521D0C100E39B41
/* TestRunner */
,
51D6A8AB16C445B800E174E1
/* AggregateTarget */
,
);
);
};
};
/* End PBXProject section */
/* End PBXProject section */
...
@@ -421,6 +435,34 @@
...
@@ -421,6 +435,34 @@
};
};
name
=
"App Store"
;
name
=
"App Store"
;
};
};
51D6A8AC16C445B800E174E1
/* Debug */
=
{
isa
=
XCBuildConfiguration
;
buildSettings
=
{
PRODUCT_NAME
=
"$(TARGET_NAME)"
;
};
name
=
Debug
;
};
51D6A8AD16C445B800E174E1
/* Test */
=
{
isa
=
XCBuildConfiguration
;
buildSettings
=
{
PRODUCT_NAME
=
"$(TARGET_NAME)"
;
};
name
=
Test
;
};
51D6A8AE16C445B800E174E1
/* Release */
=
{
isa
=
XCBuildConfiguration
;
buildSettings
=
{
PRODUCT_NAME
=
"$(TARGET_NAME)"
;
};
name
=
Release
;
};
51D6A8AF16C445B800E174E1
/* App Store */
=
{
isa
=
XCBuildConfiguration
;
buildSettings
=
{
PRODUCT_NAME
=
"$(TARGET_NAME)"
;
};
name
=
"App Store"
;
};
A346498314F9BE9A0080D870
/* Debug */
=
{
A346498314F9BE9A0080D870
/* Debug */
=
{
isa
=
XCBuildConfiguration
;
isa
=
XCBuildConfiguration
;
buildSettings
=
{
buildSettings
=
{
...
@@ -502,6 +544,16 @@
...
@@ -502,6 +544,16 @@
defaultConfigurationIsVisible
=
0
;
defaultConfigurationIsVisible
=
0
;
defaultConfigurationName
=
Release
;
defaultConfigurationName
=
Release
;
};
};
51D6A8B116C445B800E174E1
/* Build configuration list for PBXAggregateTarget "AggregateTarget" */
=
{
isa
=
XCConfigurationList
;
buildConfigurations
=
(
51D6A8AC16C445B800E174E1
/* Debug */
,
51D6A8AD16C445B800E174E1
/* Test */
,
51D6A8AE16C445B800E174E1
/* Release */
,
51D6A8AF16C445B800E174E1
/* App Store */
,
);
defaultConfigurationIsVisible
=
0
;
};
A346496714F9BE990080D870
/* Build configuration list for PBXProject "SampleProject" */
=
{
A346496714F9BE990080D870
/* Build configuration list for PBXProject "SampleProject" */
=
{
isa
=
XCConfigurationList
;
isa
=
XCConfigurationList
;
buildConfigurations
=
(
buildConfigurations
=
(
...
...
spec/unit/installer/user_project_integrator_spec.rb
View file @
109af82e
...
@@ -57,6 +57,11 @@ describe Pod::Installer::UserProjectIntegrator do
...
@@ -57,6 +57,11 @@ describe Pod::Installer::UserProjectIntegrator do
lambda
{
@target_integrator
.
user_project_path
}.
should
.
raise
Pod
::
Informative
lambda
{
@target_integrator
.
user_project_path
}.
should
.
raise
Pod
::
Informative
end
end
it
"does not take aggregate targets into consideration"
do
aggregate
=
Xcodeproj
::
Project
::
Object
::
PBXAggregateTarget
@target_integrator
.
native_targets
.
map
(
&
:class
).
should
.
not
.
include
aggregate
end
it
"uses the target with the same name if the name is different from `:default'"
do
it
"uses the target with the same name if the name is different from `:default'"
do
target_integrator
=
@integrator
.
target_integrators
[
1
]
target_integrator
=
@integrator
.
target_integrators
[
1
]
target_integrator
.
target_definition
.
stubs
(
:name
).
returns
(
'TestRunner'
)
target_integrator
.
target_definition
.
stubs
(
:name
).
returns
(
'TestRunner'
)
...
...
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