Skip to content

Commit d9a1ccb

Browse files
authored
Merge pull request #751 from byohay/add-info-to-target-dependency
target_dependency: Add target proxy to `to_tree_hash`.
2 parents d1283c5 + 8722e99 commit d9a1ccb

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
##### Enhancements
66

7-
* None.
7+
* target_dependency: Add target proxy to `to_tree_hash`.
8+
[Ben Yohay](https://github.com/byohay)
89

910
##### Bug Fixes
1011

lib/xcodeproj/project/object/target_dependency.rb

+1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ def to_tree_hash
7373
hash = {}
7474
hash['displayName'] = display_name
7575
hash['isa'] = isa
76+
hash['targetProxy'] = target_proxy.to_tree_hash
7677
hash
7778
end
7879

spec/project/object/target_dependency_spec.rb

+26
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,32 @@ module ProjectSpecs
4040
lambda { @target_dependency.sort_recursively }.should.not.raise
4141
end
4242

43+
it 'tree hash does not contain target' do
44+
target = @project.new_target(:static, 'Pods', :ios)
45+
@target_dependency.target = target
46+
target.dependencies << @target_dependency
47+
48+
proxy = @project.new(PBXContainerItemProxy)
49+
proxy.container_portal = @project.root_object.uuid
50+
proxy.remote_info = 'Pods'
51+
proxy.proxy_type = '1'
52+
proxy.remote_global_id_string = target.uuid
53+
@target_dependency.target_proxy = proxy
54+
55+
@target_dependency.to_tree_hash.should == {
56+
'displayName' => 'Pods',
57+
'isa' => 'PBXTargetDependency',
58+
'targetProxy' => {
59+
'displayName' => 'ContainerItemProxy',
60+
'isa' => 'PBXContainerItemProxy',
61+
'containerPortal' => @project.root_object.uuid,
62+
'proxyType' => '1',
63+
'remoteGlobalIDString' => target.uuid,
64+
'remoteInfo' => 'Pods',
65+
},
66+
}
67+
end
68+
4369
#----------------------------------------#
4470

4571
describe '#display_name' do

0 commit comments

Comments
 (0)