Skip to content

Commit

Permalink
target_dependency: Add target proxy to to_tree_hash.
Browse files Browse the repository at this point in the history
The added information helps identifying the correct dependency.
  • Loading branch information
byohay committed Apr 13, 2020
1 parent ed0558e commit 8722e99
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

##### Enhancements

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

##### Bug Fixes

Expand Down
1 change: 1 addition & 0 deletions lib/xcodeproj/project/object/target_dependency.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def to_tree_hash
hash = {}
hash['displayName'] = display_name
hash['isa'] = isa
hash['targetProxy'] = target_proxy.to_tree_hash
hash
end

Expand Down
26 changes: 26 additions & 0 deletions spec/project/object/target_dependency_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,32 @@ module ProjectSpecs
lambda { @target_dependency.sort_recursively }.should.not.raise
end

it 'tree hash does not contain target' do
target = @project.new_target(:static, 'Pods', :ios)
@target_dependency.target = target
target.dependencies << @target_dependency

proxy = @project.new(PBXContainerItemProxy)
proxy.container_portal = @project.root_object.uuid
proxy.remote_info = 'Pods'
proxy.proxy_type = '1'
proxy.remote_global_id_string = target.uuid
@target_dependency.target_proxy = proxy

@target_dependency.to_tree_hash.should == {
'displayName' => 'Pods',
'isa' => 'PBXTargetDependency',
'targetProxy' => {
'displayName' => 'ContainerItemProxy',
'isa' => 'PBXContainerItemProxy',
'containerPortal' => @project.root_object.uuid,
'proxyType' => '1',
'remoteGlobalIDString' => target.uuid,
'remoteInfo' => 'Pods',
},
}
end

#----------------------------------------#

describe '#display_name' do
Expand Down

0 comments on commit 8722e99

Please sign in to comment.