Skip to content

Crash When Swift Package PBXTargetDependency has no target or targetProxy  #743

@jsorge

Description

@jsorge

When I have an Xcode project that has a SwiftPM package on it, and a target which depends on that project, I'm getting a crash in CocoaPods because the Xcodeproj gem is expecting a target or targetDependency value and SwiftPM target dependencies seem to use neither.

Stack trace:

RuntimeError - Expected target or target_proxy, from which to fetch a uuid for target ''.Find and clear the PBXTargetDependency entry with uuid 'D0380B7818F272B9D5595B72' in your .xcodeproj.
/Users/jsorge/Develop/marco/vendor/bundle/ruby/2.6.0/gems/xcodeproj-1.15.0/lib/xcodeproj/project/object/target_dependency.rb:62:in `native_target_uuid'
/Users/jsorge/Develop/marco/vendor/bundle/ruby/2.6.0/gems/xcodeproj-1.15.0/lib/xcodeproj/project.rb:609:in `map'
/Users/jsorge/Develop/marco/vendor/bundle/ruby/2.6.0/gems/xcodeproj-1.15.0/lib/xcodeproj/project.rb:609:in `block in host_targets_for_embedded_target'
/Users/jsorge/Develop/marco/vendor/bundle/ruby/2.6.0/gems/xcodeproj-1.15.0/lib/xcodeproj/project.rb:607:in `select'
/Users/jsorge/Develop/marco/vendor/bundle/ruby/2.6.0/gems/xcodeproj-1.15.0/lib/xcodeproj/project.rb:607:in `host_targets_for_embedded_target'
/Users/jsorge/Develop/marco/vendor/bundle/ruby/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer/analyzer.rb:355:in `block (2 levels) in analyze_host_targets_in_podfile'
/Users/jsorge/Develop/marco/vendor/bundle/ruby/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer/analyzer.rb:354:in `each'
/Users/jsorge/Develop/marco/vendor/bundle/ruby/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer/analyzer.rb:354:in `flat_map'
/Users/jsorge/Develop/marco/vendor/bundle/ruby/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer/analyzer.rb:354:in `block in analyze_host_targets_in_podfile'
/Users/jsorge/Develop/marco/vendor/bundle/ruby/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer/analyzer.rb:353:in `each'
/Users/jsorge/Develop/marco/vendor/bundle/ruby/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer/analyzer.rb:353:in `analyze_host_targets_in_podfile'
/Users/jsorge/Develop/marco/vendor/bundle/ruby/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer/analyzer.rb:457:in `generate_targets'
/Users/jsorge/Develop/marco/vendor/bundle/ruby/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer/analyzer.rb:127:in `analyze'
/Users/jsorge/Develop/marco/vendor/bundle/ruby/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:410:in `analyze'
/Users/jsorge/Develop/marco/vendor/bundle/ruby/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:234:in `block in resolve_dependencies'
/Users/jsorge/Develop/marco/vendor/bundle/ruby/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/user_interface.rb:64:in `section'
/Users/jsorge/Develop/marco/vendor/bundle/ruby/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:233:in `resolve_dependencies'
/Users/jsorge/Develop/marco/vendor/bundle/ruby/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:156:in `install!'
/Users/jsorge/Develop/marco/vendor/bundle/ruby/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/command/install.rb:52:in `run'
/Users/jsorge/Develop/marco/vendor/bundle/ruby/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Users/jsorge/Develop/marco/vendor/bundle/ruby/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/command.rb:52:in `run'
/Users/jsorge/Develop/marco/vendor/bundle/ruby/2.6.0/gems/cocoapods-1.8.4/bin/pod:55:in `<top (required)>'
/Users/jsorge/Develop/marco/vendor/bundle/ruby/2.6.0/bin/pod:23:in `load'
/Users/jsorge/Develop/marco/vendor/bundle/ruby/2.6.0/bin/pod:23:in `<top (required)>'
/Library/Ruby/Gems/2.6.0/gems/bundler-2.0.2/lib/bundler/cli/exec.rb:74:in `load'
/Library/Ruby/Gems/2.6.0/gems/bundler-2.0.2/lib/bundler/cli/exec.rb:74:in `kernel_load'
/Library/Ruby/Gems/2.6.0/gems/bundler-2.0.2/lib/bundler/cli/exec.rb:28:in `run'
/Library/Ruby/Gems/2.6.0/gems/bundler-2.0.2/lib/bundler/cli.rb:465:in `exec'
/Library/Ruby/Gems/2.6.0/gems/bundler-2.0.2/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/Library/Ruby/Gems/2.6.0/gems/bundler-2.0.2/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/Library/Ruby/Gems/2.6.0/gems/bundler-2.0.2/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
/Library/Ruby/Gems/2.6.0/gems/bundler-2.0.2/lib/bundler/cli.rb:27:in `dispatch'
/Library/Ruby/Gems/2.6.0/gems/bundler-2.0.2/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
/Library/Ruby/Gems/2.6.0/gems/bundler-2.0.2/lib/bundler/cli.rb:18:in `start'
/Library/Ruby/Gems/2.6.0/gems/bundler-2.0.2/exe/bundle:30:in `block in <top (required)>'
/Library/Ruby/Gems/2.6.0/gems/bundler-2.0.2/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors'
/Library/Ruby/Gems/2.6.0/gems/bundler-2.0.2/exe/bundle:22:in `<top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'

Here's what that UUID looks like in my project file:

D0380B7818F272B9D5595B72 /* PBXTargetDependency */ = {
	isa = PBXTargetDependency;
	productRef = 84C7AC2A79AFD93970D5BC0C /* Time */;
};

This doesn't seem like a CocoaPods bug to me. Please correct me if I'm wrong. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions