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
431f2b21
Commit
431f2b21
authored
Jul 03, 2013
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Installer] Add target dependencies explicitely [WIP]
See #1165
parent
452d4040
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
61 additions
and
7 deletions
+61
-7
Gemfile.lock
Gemfile.lock
+1
-1
installer.rb
lib/cocoapods/installer.rb
+38
-0
pod_target.rb
lib/cocoapods/target/pod_target.rb
+9
-0
aggregate_target_installer_spec.rb
...aller/target_installer/aggregate_target_installer_spec.rb
+1
-1
pod_target_installer_spec.rb
...t/installer/target_installer/pod_target_installer_spec.rb
+2
-2
installer_spec.rb
spec/unit/installer_spec.rb
+2
-2
project_spec.rb
spec/unit/project_spec.rb
+0
-1
pod_target_spec.rb
spec/unit/target/pod_target_spec.rb
+8
-0
No files found.
Gemfile.lock
View file @
431f2b21
...
@@ -17,7 +17,7 @@ GIT
...
@@ -17,7 +17,7 @@ GIT
GIT
GIT
remote: https://github.com/CocoaPods/Xcodeproj.git
remote: https://github.com/CocoaPods/Xcodeproj.git
revision:
5a729b8c406bae502cb942e31738467a00191776
revision:
a5dd638c3da221871269199abc214f9216b9bdbf
branch: master
branch: master
specs:
specs:
xcodeproj (0.7.1)
xcodeproj (0.7.1)
...
...
lib/cocoapods/installer.rb
View file @
431f2b21
...
@@ -111,6 +111,7 @@ module Pod
...
@@ -111,6 +111,7 @@ module Pod
prepare_pods_project
prepare_pods_project
install_file_references
install_file_references
install_libraries
install_libraries
set_target_dependencies
link_aggregate_target
link_aggregate_target
run_post_install_hooks
run_post_install_hooks
write_pod_project
write_pod_project
...
@@ -332,6 +333,43 @@ module Pod
...
@@ -332,6 +333,43 @@ module Pod
end
end
end
end
def
set_target_dependencies
aggregate_targets
.
each
do
|
aggregate_target
|
aggregate_target
.
pod_targets
.
each
do
|
pod_target
|
add_dependency
(
aggregate_target
,
pod_target
)
pod_target
.
dependencies
.
each
do
|
dep
|
pod_dependency_target
=
aggregate_target
.
pod_targets
.
find
{
|
target
|
target
.
root_spec
.
name
==
dep
}
add_dependency
(
pod_target
,
pod_dependency_target
)
end
end
end
end
# TODO: tmp - move
#
def
add_dependency
(
dependent_target
,
dependency_target
)
container_proxy
=
pods_project
.
new
(
Xcodeproj
::
Project
::
PBXContainerItemProxy
)
# container_proxy.container_portal = '224D2C1BCDE44D8F9B674AD5'
container_proxy
.
proxy_type
=
'1'
# container_proxy.remote_global_id_string = 'F8D3306CA0564CA3861B2D4E'
# container_proxy.remote_info = 'Pods-AFHTTPRequestOperationLogger'
# reference_proxy = pods_project.new(Xcodeproj::Project::PBXReferenceProxy)
# reference_proxy.path =
# reference_proxy.file_type =
# reference_proxy.remote_ref = container_proxy
# reference_proxy.source_tree = BUILT_PRODUCTS_DIR
dependency
=
pods_project
.
new
(
Xcodeproj
::
Project
::
PBXTargetDependency
)
dependency
.
target
=
dependency_target
.
target
# dependency.targetProxy = container_proxy
dependent_target
.
target
.
dependencies
<<
dependency
end
# Links the aggregate targets with all the dependent libraries.
# Links the aggregate targets with all the dependent libraries.
#
#
# @note This is run in the integration step to ensure that targets
# @note This is run in the integration step to ensure that targets
...
...
lib/cocoapods/target/pod_target.rb
View file @
431f2b21
...
@@ -49,5 +49,14 @@ module Pod
...
@@ -49,5 +49,14 @@ module Pod
specs
.
first
.
root
specs
.
first
.
root
end
end
# @return [Array<String>] The names of the Pods on which this target
# depends.
#
def
dependencies
specs
.
map
do
|
spec
|
spec
.
consumer
(
platform
).
dependencies
.
map
{
|
dep
|
dep
.
name
}
end
.
flatten
end
end
end
end
end
spec/unit/installer/target_installer/aggregate_target_installer_spec.rb
View file @
431f2b21
...
@@ -163,7 +163,7 @@ module Pod
...
@@ -163,7 +163,7 @@ module Pod
it
"creates a dummy source to ensure the creation of a single base library"
do
it
"creates a dummy source to ensure the creation of a single base library"
do
@installer
.
install!
@installer
.
install!
build_files
=
@installer
.
library
.
target
.
source_build_phase
.
files
build_files
=
@installer
.
library
.
target
.
source_build_phase
.
files
build_file
=
build_files
.
find
{
|
bf
|
bf
.
file_ref
.
name
==
'Pods-dummy.m'
}
build_file
=
build_files
.
find
{
|
bf
|
bf
.
file_ref
.
path
.
include?
(
'Pods-dummy.m'
)
}
build_file
.
should
.
be
.
not
.
nil
build_file
.
should
.
be
.
not
.
nil
build_file
.
file_ref
.
path
.
should
==
'Pods-dummy.m'
build_file
.
file_ref
.
path
.
should
==
'Pods-dummy.m'
dummy
=
config
.
sandbox
.
root
+
'Pods-dummy.m'
dummy
=
config
.
sandbox
.
root
+
'Pods-dummy.m'
...
...
spec/unit/installer/target_installer/pod_target_installer_spec.rb
View file @
431f2b21
...
@@ -116,7 +116,7 @@ module Pod
...
@@ -116,7 +116,7 @@ module Pod
it
'adds the source files of each pod to the target of the Pod library'
do
it
'adds the source files of each pod to the target of the Pod library'
do
@installer
.
install!
@installer
.
install!
names
=
@installer
.
library
.
target
.
source_build_phase
.
files
.
map
{
|
bf
|
bf
.
file_ref
.
name
}
names
=
@installer
.
library
.
target
.
source_build_phase
.
files
.
map
{
|
bf
|
bf
.
file_ref
.
display_
name
}
names
.
should
.
include
(
"Banana.m"
)
names
.
should
.
include
(
"Banana.m"
)
end
end
...
@@ -156,7 +156,7 @@ module Pod
...
@@ -156,7 +156,7 @@ module Pod
it
"creates a dummy source to ensure the compilation of libraries with only categories"
do
it
"creates a dummy source to ensure the compilation of libraries with only categories"
do
@installer
.
install!
@installer
.
install!
build_files
=
@installer
.
library
.
target
.
source_build_phase
.
files
build_files
=
@installer
.
library
.
target
.
source_build_phase
.
files
build_file
=
build_files
.
find
{
|
bf
|
bf
.
file_ref
.
name
==
'Pods-BananaLib-dummy.m'
}
build_file
=
build_files
.
find
{
|
bf
|
bf
.
file_ref
.
display_
name
==
'Pods-BananaLib-dummy.m'
}
build_file
.
should
.
be
.
not
.
nil
build_file
.
should
.
be
.
not
.
nil
build_file
.
file_ref
.
path
.
should
==
'Pods-BananaLib-dummy.m'
build_file
.
file_ref
.
path
.
should
==
'Pods-BananaLib-dummy.m'
dummy
=
config
.
sandbox
.
root
+
'Pods-BananaLib-dummy.m'
dummy
=
config
.
sandbox
.
root
+
'Pods-BananaLib-dummy.m'
...
...
spec/unit/installer_spec.rb
View file @
431f2b21
...
@@ -64,6 +64,7 @@ module Pod
...
@@ -64,6 +64,7 @@ module Pod
@installer
.
stubs
(
:install_libraries
)
@installer
.
stubs
(
:install_libraries
)
@installer
.
stubs
(
:link_aggregate_target
)
@installer
.
stubs
(
:link_aggregate_target
)
@installer
.
stubs
(
:write_lockfiles
)
@installer
.
stubs
(
:write_lockfiles
)
@installer
.
stubs
(
:aggregate_targets
).
returns
([])
@installer
.
unstub
(
:generate_pods_project
)
@installer
.
unstub
(
:generate_pods_project
)
def
@installer
.
run_post_install_hooks
def
@installer
.
run_post_install_hooks
@hook_called
=
true
@hook_called
=
true
...
@@ -226,8 +227,7 @@ module Pod
...
@@ -226,8 +227,7 @@ module Pod
@installer
.
stubs
(
:aggregate_targets
).
returns
([])
@installer
.
stubs
(
:aggregate_targets
).
returns
([])
config
.
stubs
(
:podfile_path
).
returns
(
Pathname
.
new
(
'/Podfile'
))
config
.
stubs
(
:podfile_path
).
returns
(
Pathname
.
new
(
'/Podfile'
))
@installer
.
send
(
:prepare_pods_project
)
@installer
.
send
(
:prepare_pods_project
)
f
=
@installer
.
pods_project
[
'Podfile'
]
@installer
.
pods_project
[
'Podfile'
].
should
.
be
.
not
.
nil
f
.
name
.
should
==
'Podfile'
end
end
it
"sets the deployment target for the whole project"
do
it
"sets the deployment target for the whole project"
do
...
...
spec/unit/project_spec.rb
View file @
431f2b21
...
@@ -99,7 +99,6 @@ module Pod
...
@@ -99,7 +99,6 @@ module Pod
it
"adds the Podfile configured as a Ruby file"
do
it
"adds the Podfile configured as a Ruby file"
do
@project
.
add_podfile
(
config
.
sandbox
.
root
+
'../Podfile'
)
@project
.
add_podfile
(
config
.
sandbox
.
root
+
'../Podfile'
)
f
=
@project
[
'Podfile'
]
f
=
@project
[
'Podfile'
]
f
.
name
.
should
==
'Podfile'
f
.
source_tree
.
should
==
'SOURCE_ROOT'
f
.
source_tree
.
should
==
'SOURCE_ROOT'
f
.
xc_language_specification_identifier
.
should
==
'xcode.lang.ruby'
f
.
xc_language_specification_identifier
.
should
==
'xcode.lang.ruby'
f
.
path
.
should
==
'../Podfile'
f
.
path
.
should
==
'../Podfile'
...
...
spec/unit/target/pod_target_spec.rb
View file @
431f2b21
...
@@ -25,6 +25,14 @@ module Pod
...
@@ -25,6 +25,14 @@ module Pod
it
"returns the spec consumers for the pod targets"
do
it
"returns the spec consumers for the pod targets"
do
@pod_target
.
spec_consumers
.
should
.
not
==
nil
@pod_target
.
spec_consumers
.
should
.
not
==
nil
end
end
it
"returns the root spec"
do
@pod_target
.
root_spec
.
name
.
should
==
'BananaLib'
end
it
"returns the name of the Pods on which this target depends"
do
@pod_target
.
dependencies
.
should
==
[
"monkey"
]
end
end
end
describe
"Support files"
do
describe
"Support files"
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