XcodeProj icon indicating copy to clipboard operation
XcodeProj copied to clipboard

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

Open mikeger opened this issue 9 months ago • 5 comments

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

mikeger avatar May 05 '24 19:05 mikeger

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

kwridan avatar May 07 '24 12:05 kwridan

@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.

mikeger avatar May 08 '24 06:05 mikeger

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

kwridan avatar May 08 '24 07:05 kwridan

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

mikeger avatar May 28 '24 20:05 mikeger

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] avatar Jun 28 '24 01:06 github-actions[bot]

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.

github-actions[bot] avatar Jul 04 '24 01:07 github-actions[bot]