Skip to content

Commit

Permalink
Merge pull request #751 from byohay/add-info-to-target-dependency
Browse files Browse the repository at this point in the history
target_dependency: Add target proxy to `to_tree_hash`.
  • Loading branch information
amorde authored Jun 7, 2020
2 parents d1283c5 + 8722e99 commit d9a1ccb
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 d9a1ccb

Please sign in to comment.