Skip to content

XcodeGraph fails to parse Xcode projects with static linked library targets #466

@HeEAaD

Description

@HeEAaD

The XcodeGraph library fails to parse Xcode projects that contain statically linked library targets.

Steps to reproduce

  1. Have a Xcode project (e.g. iOS app). Example project: Example.zip
  2. Add a static library target
  3. Link this static library target to the main project target (e.g. app)
  4. Run tuist graph in the project root.

Expected result: A graph image file gets created in the project root.
Actual result: An error is thrown:



✖ Error 
  Missing or invalid file path for 'PBXBuildFile': Unknown. 

  Sorry this didn’t work. Here’s what to try next: 
   ▸ If the error is actionable, address it
   ▸ If the error is not actionable, let's discuss it in the Troubleshooting & how to
   ▸ If you are very certain it's a bug, file an issue
   ▸ Check out the logs at /Users/steffen/.local/state/tuist/logs/DC67880D-FF7A-42ED-9600-18A5273B981B.log

DC67880D-FF7A-42ED-9600-18A5273B981B.log

$ tuist version  
4.119.1

Probable Root Cause

PBXFrameworksBuildPhaseMapper.mapFrameworkDependency(:xcodeProj:projectNativeTargets:) tries to find project targets based on framework / library names.
For this, it replaces ".framework" from file refs:

let name = path.replacingOccurrences(of: ".framework", with: "")

It doesn't do the same for static library product file refs (e.g. libFoo.a). Thats why it tries to search for a target libFoo.a instead of Foo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions