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
e1f9b5d7
Commit
e1f9b5d7
authored
Mar 27, 2012
by
Eloy Duran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
If no explicit target to link with is specified, then use the first target from the user's project.
parent
02a52101
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
33 additions
and
11 deletions
+33
-11
target_installer.rb
lib/cocoapods/installer/target_installer.rb
+5
-4
podfile.rb
lib/cocoapods/podfile.rb
+4
-0
integrator.rb
lib/cocoapods/project/integrator.rb
+9
-1
integrator_spec.rb
spec/functional/project/integrator_spec.rb
+6
-0
integration_spec.rb
spec/integration_spec.rb
+2
-4
podfile_spec.rb
spec/unit/podfile_spec.rb
+5
-0
target_installer_spec.rb
spec/unit/target_installer_spec.rb
+2
-2
No files found.
lib/cocoapods/installer/target_installer.rb
View file @
e1f9b5d7
...
...
@@ -31,8 +31,9 @@ module Pod
end
.
flatten
)
end
def
bridge_support_filename
"
#{
@target_definition
.
label
}
.bridgesupport"
# TODO This has to be removed, but this means the specs have to be updated if they need a reference to the prefix header.
def
prefix_header_filename
@target_definition
.
prefix_header_name
end
# TODO move out to Generator::PrefixHeader
...
...
@@ -85,10 +86,10 @@ module Pod
def
create_files
(
pods
,
sandbox
)
if
@podfile
.
generate_bridge_support?
bridge_support_metadata_path
=
sandbox
.
root
+
bridge_support_file
name
bridge_support_metadata_path
=
sandbox
.
root
+
@target_definition
.
bridge_support_
name
puts
"* Generating BridgeSupport metadata file at `
#{
bridge_support_metadata_path
}
'"
if
config
.
verbose?
bridge_support_generator_for
(
pods
,
sandbox
).
save_as
(
bridge_support_metadata_path
)
copy_resources_script_for
(
pods
).
resources
<<
bridge_support_file
name
copy_resources_script_for
(
pods
).
resources
<<
@target_definition
.
bridge_support_
name
end
puts
"* Generating xcconfig file at `
#{
sandbox
.
root
+
@target_definition
.
xcconfig_name
}
'"
if
config
.
verbose?
xcconfig
.
save_as
(
sandbox
.
root
+
@target_definition
.
xcconfig_name
)
...
...
lib/cocoapods/podfile.rb
View file @
e1f9b5d7
...
...
@@ -40,6 +40,10 @@ module Pod
"
#{
label
}
-prefix.pch"
end
def
bridge_support_name
"
#{
label
}
.bridgesupport"
end
# Returns *all* dependencies of this target, not only the target specific
# ones in `target_dependencies`.
def
dependencies
...
...
lib/cocoapods/project/integrator.rb
View file @
e1f9b5d7
...
...
@@ -66,11 +66,19 @@ module Pod
add_copy_resources_script_phase
end
# 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
# specified, then the first encountered target is assumed.
#
# @return [Array<PBXNativeTarget>] Returns the list of targets that
# the Pods lib should be linked with.
def
targets
if
link_with
=
@target_definition
.
link_with
@integrator
.
user_project
.
targets
.
select
do
|
target
|
@target_definition
.
link_with
.
include?
target
.
name
link_with
.
include?
target
.
name
end
else
[
@integrator
.
user_project
.
targets
.
first
]
end
end
...
...
spec/functional/project/integrator_spec.rb
View file @
e1f9b5d7
...
...
@@ -33,6 +33,12 @@ describe Pod::Project::Integrator, 'TODO UNIT SPECS!' do
it
"returns a Pod::Project::Integrator::Target for each target definition in the Podfile"
do
@integrator
.
targets
.
map
(
&
:target_definition
).
should
==
@podfile
.
target_definitions
.
values
end
it
"uses the first target in the user's project if no explicit target is specified"
do
target_integrator
=
@integrator
.
targets
.
first
target_integrator
.
target_definition
.
stubs
(
:link_with
).
returns
(
nil
)
target_integrator
.
targets
.
should
==
[
Xcodeproj
::
Project
.
new
(
@sample_project_path
).
targets
.
first
]
end
end
describe
Pod
::
Project
::
Integrator
do
...
...
spec/integration_spec.rb
View file @
e1f9b5d7
...
...
@@ -371,18 +371,16 @@ else
project
=
Pod
::
Project
.
new
(
projpath
)
libPods
=
project
.
files
.
find
{
|
f
|
f
.
name
==
'libPods.a'
}
project
.
targets
.
each
do
|
target
|
target
=
project
.
targets
.
first
target
.
build_configurations
.
each
do
|
config
|
config
.
base_configuration
.
path
.
should
==
'Pods/Pods.xcconfig'
end
phase
=
target
.
frameworks_build_phases
.
first
phase
.
files
.
map
{
|
build_file
|
build_file
.
file
}.
should
.
include
libPods
# should be the last phase
target
.
build_phases
.
last
.
shell_script
.
should
==
%{"${SRCROOT}/Pods/Pods-resources.sh"\n}
end
end
it
"should prevent duplication cleaning headers symlinks with multiple targets"
do
podfile
=
Pod
::
Podfile
.
new
do
...
...
spec/unit/podfile_spec.rb
View file @
e1f9b5d7
...
...
@@ -145,6 +145,11 @@ describe "Pod::Podfile" do
@podfile
.
target_definitions
[
:default
].
prefix_header_name
.
should
==
'Pods-prefix.pch'
@podfile
.
target_definitions
[
:test
].
prefix_header_name
.
should
==
'Pods-test-prefix.pch'
end
it
"returns the name of the BridgeSupport file for the target"
do
@podfile
.
target_definitions
[
:default
].
bridge_support_name
.
should
==
'Pods.bridgesupport'
@podfile
.
target_definitions
[
:test
].
bridge_support_name
.
should
==
'Pods-test.bridgesupport'
end
end
describe
"concerning validations"
do
...
...
spec/unit/target_installer_spec.rb
View file @
e1f9b5d7
...
...
@@ -5,7 +5,7 @@ TMP_POD_ROOT = ROOT + "tmp" + "podroot"
describe
Pod
::
Installer
::
TargetInstaller
do
before
do
@target_definition
=
stub
(
'target'
,
:lib_name
=>
"FooLib"
)
@target_definition
=
Pod
::
Podfile
::
TargetDefinition
.
new
(
:foo
)
platform
=
Pod
::
Platform
.
new
(
:ios
)
@podfile
=
stub
(
'podfile'
,
:platform
=>
platform
,
:generate_bridge_support?
=>
false
)
...
...
@@ -27,7 +27,7 @@ describe Pod::Installer::TargetInstaller do
it
'adds a new static library target to the project'
do
do_install!
@project
.
targets
.
count
.
should
==
1
@project
.
targets
.
first
.
name
.
should
==
"FooLib"
@project
.
targets
.
first
.
name
.
should
==
@target_definition
.
label
end
it
'adds each pod to the static library target'
do
...
...
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