tuist / XcodeProj

📝 Read, update and write your Xcode projects
https://xcodeproj.tuist.io
MIT License
2.03k stars 309 forks source link

Incorrect name of the target product returned from `productNameWithExtension()` #820

Closed mikeger closed 4 months ago

mikeger commented 6 months ago

Context 🕵️‍♀️

As an author of XcodeSelectiveTesting I've been trying to integrate it for fun with Wire-iOS project.

This project has several libraries, amongst those you can find WireCanvas project. This project has a target called WireCanvas that emits a framework.

What 🌱

When parsing WireCanvas project, XcodeProj is returning Canvas.framework from productNameWithExtension(). Correct name of the product is WireCanvas.framework

Proposal 🎉

I tried to fix the issue but was not sure what was causing this behavior. There must be some misconfiguration in the WireCanvas project, but from Xcode side I only see WireCanvas.framework in other project linked frameworks phase and as a product name

kwridan commented 6 months ago

Thanks for raising this @mikeger

Taking a look at the Wire-iOS project it seems the product name is set via build settings in the xcconfig files.

https://github.com/wireapp/wire-ios/blob/62fb71d1d648689b3cfbab4af8db730ddb3e2bf2/wire-ios-canvas/Resources/Configurations/WireCanvas.xcconfig#L22

XcodeProj only parses the xcodeproj / pbxpoj files and allows reading and setting the values there (e.g. https://github.com/wireapp/wire-ios/blob/62fb71d1d648689b3cfbab4af8db730ddb3e2bf2/wire-ios-canvas/WireCanvas.xcodeproj/project.pbxproj#L268).

Resolving build settings is a slightly more involved process and can can differ by configuration which is slightly outside the scope of the XcodeProj library :/

xcrun xcodebuild -showBuildSettings \
  -scheme SchemeName
  -workspace WorkspaceName.xcworkspace \
  -config Debug | grep PRODUCT_NAME
mikeger commented 6 months ago

@kwridan thanks so much for the reply. This sounds reasonable, adding support for xcconfig resolution might be too big of a feature for a GitHub issue :)

Would it make sense to enhance the documentation for productNameWithExtension() (any other?) method so people using it would have reasonable expectations? I can propose a small change for this if you think this is appropriate.

kwridan commented 6 months ago

Sure that sounds like a reasonable change, this contribution would be welcome! thanks @mikeger

mikeger commented 5 months ago

@kwridan I created the PR, thanks for your support.

github-actions[bot] commented 4 months ago

Hola 👋,

We want to inform you that the issue has been marked as stale. This means that there hasn't been any activity or updates on it for quite some time, and it's possible that it may no longer be relevant or actionable. If you still believe that this issue is valid and requires attention, please provide an update or any additional information that can help us address it. Otherwise, we may consider closing it in the near future. Thank you for your understanding.

github-actions[bot] commented 4 months ago

Hola 👋,

We want to inform you that we have decided to close this stale issue as there hasn't been any activity or response regarding it after marking it as stale.

We understand that circumstances may have changed or priorities may have shifted, and that's completely understandable. If you still believe that this issue needs to be addressed, please feel free to reopen it and provide any necessary updates or additional information.

We appreciate your understanding and look forward to your continued contributions to the project.

Thank you.