tuist icon indicating copy to clipboard operation
tuist copied to clipboard

Add support for XCFrameworks with .dylib libraries

Open eddieh opened this issue 2 years ago • 9 comments

Tuist should not error when an XCFramework contains .dylib libraries

Short description 📝

According to the XCFramework documentation "an XCFramework can include dynamic library files" for macOS. This indeed works without fail and should be allowed. However, the documentation is wrong or outdated for iOS and iOS Simulator. These platforms also allow .dylib libs in an XCFramework.

Tuist does not allow dynamic library files even for macOS. Using an XCFramework containing .dylib files, regardless of platform, throws a "XCFrameworkMetadataProviderError.supportedArchitectureReferencesNotFound" error and prints "couldn't find any supported architecture [...]" which, at the very least, is misleading.

How to test the changes locally 🧐

Include a set of steps for the reviewer to test the changes locally (see the documentation for reference).

Contributor checklist ✅

  • [ ] The code has been linted using run mise run lint:fix
  • [ ] The change is tested via unit testing or acceptance testing, or both
  • [x] The title of the PR is formulated in a way that is usable as a changelog entry
  • [ ] In case the PR introduces changes that affect users, the documentation has been updated

Reviewer checklist ✅

  • [ ] The code architecture and patterns are consistent with the rest of the codebase
  • [ ] Reviewer has checked that, if needed, the PR includes the label changelog:added, changelog:fixed, or changelog:changed, and the title is usable as a changelog entry

eddieh avatar Mar 29 '24 06:03 eddieh

Thanks a lot, for creating a PR for this one @eddieh. I noticed you marked it as "draft". Is there anything else that that should be added?

pepicrft avatar Mar 29 '24 15:03 pepicrft

I intended to add a little more to the description, but I now think it is sufficient. I'm using this change in several projects and it works great. This is ready for review.

eddieh avatar Mar 29 '24 22:03 eddieh

I think this is also missing https://github.com/tuist/tuist/pull/6153

apps4everyone avatar Apr 05 '24 21:04 apps4everyone

Good catch. I encountered the same issue when attempting to use tuist to migrate the cargo-xcframework's example for the macOS platform, which originally used an XCFramework containing .dylib files.

It's reasonable to avoid the misleading behavior, so we may consider moving this PR forward. However, except for macOS, the .dylib library is not allowed for other platforms, so we need to address this as well.

Binlogo avatar Jun 16 '24 09:06 Binlogo

@Binlogo would you want to take this PR forward and add the missing unit test? Otherwise, this PR should be good to merge. Since this is coming from a fork, we'd need to move to a different PR since the original author doesn't seem to be available anymore.

fortmarek avatar Jun 17 '24 07:06 fortmarek

@Binlogo would you want to take this PR forward and add the missing unit test? Otherwise, this PR should be good to merge. Since this is coming from a fork, we'd need to move to a different PR since the original author doesn't seem to be available anymore.

Yes, I'd like to, I'll try to add some unit test to make sure it won't break iOS platform and create a new PR.

Binlogo avatar Jun 17 '24 07:06 Binlogo

Yes, I'd like to, I'll try to add some unit test to make sure it won't break iOS platform and create a new PR.

Amazing, let us know if you need any support from us!

fortmarek avatar Jun 17 '24 09:06 fortmarek

It doesn’t break iOS, but there is some check in App Store Connect that rejects it (I believe erroneously). The rejection is "ITMS-90424: Invalid Swift Support” even if the app and .dylibs are completely C++ and ObjC++ with zero Swift anywhere.

Probably no way to get Apple to change this, even if it is erroneous.

The .dylibs work fine without error (x86 sims, ARM sims, iOS devices, and many versions of iOS) up until App Store Connect rejects them.

🤷‍♂️

On Jun 17, 2024, at 2:30 AM, Marek Fořt @.***> wrote:

Yes, I'd like to, I'll try to add some unit test to make sure it won't break iOS platform and create a new PR.

Amazing, let us know if you need any support from us!

— Reply to this email directly, view it on GitHub https://github.com/tuist/tuist/pull/6133#issuecomment-2172863813, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKQ76443XGP46TJLAPR6OTZH2UE3AVCNFSM6AAAAABFN75MCOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNZSHA3DGOBRGM. You are receiving this because you were mentioned.

eddieh avatar Jun 17 '24 23:06 eddieh

Agree, if we don't need to follow Apple's "outdated" or "wrong" document for iOS, we can just merge this PR and let .dylib works.

Binlogo avatar Jun 18 '24 02:06 Binlogo

I'm merging it and I'll open a PR adding the test.

pepicrft avatar Aug 08 '24 10:08 pepicrft

Tests are here: https://github.com/tuist/tuist/pull/6617

pepicrft avatar Aug 08 '24 10:08 pepicrft