Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-14589] SPM doesn't support dynamic BinaryTargets #4426

Open
4brunu opened this issue May 4, 2021 · 12 comments
Open

[SR-14589] SPM doesn't support dynamic BinaryTargets #4426

4brunu opened this issue May 4, 2021 · 12 comments

Comments

@4brunu
Copy link

4brunu commented May 4, 2021

Previous ID SR-14589
Radar rdar://problem/77526328
Original Reporter @4brunu
Type New Feature

Attachment: Download

Additional Detail from JIRA
Votes 4
Component/s Package Manager
Labels New Feature
Assignee None
Priority Medium

md5: 47cf50081421cc5894af17449be47d24

Issue Description:

When I tried to create a dynamic SPM that uses a BinaryTarget (XCFramework), I tried to make it dynamic, but Xcode is throwing the following error:
`invalid type for binary product 'MyLibrary'; products referencing only binary targets must have a type of 'library'`

According to the two following code references, SPM doesn't support
After looking at the two code references, it seems that SPM doesn't support Swift Packages with dynamic BinaryTarget (XCFramework) .

// Check that products that reference only binary targets don't define a type.
let areTargetsBinary = product.targets.allSatisfy { manifest.targetMap[$0]?.type == .binary }
if areTargetsBinary && product.type != .library(.automatic) {
try diagnostics.emit(.invalidBinaryProductType(productName: product.name))
}
}

static func invalidBinaryProductType(productName: String) -> Self {
.error("invalid type for binary product '\(productName)'; products referencing only binary targets must have a type of 'library'")
}

But this a nice improvement to SPM and feature that I need.

@typesanitizer
Copy link

@swift-ci create

@neonichu
Copy link
Member

neonichu commented May 5, 2021

It does not make sense for a product to specify a type if the only content is a binary target because the binary has an inherent type.

See also https://github.com/apple/swift-evolution/blob/main/proposals/0272-swiftpm-binary-dependencies.md#exported-product-with-binary-dependency-that-specifies-a-type

@typesanitizer
Copy link

@neonichu Should this be marked Resolved / Won't Fix ?

@4brunu
Copy link
Author

4brunu commented Jun 18, 2021

Sorry for the late response, but I only got the email with the last comment of theindigamer (JIRA User).

Let me share my use case, to give more context.

I'm developing a closed source XCFramework that other companies integrate, let's call it MyXCFramework.

MyXCFramework has a closed source XCFramework dependency, [Twilio Video](https://github.com/twilio/twilio-video-ios).

Twilio Video XCFramework dependency supports SPM, and I want to integrate it into MyXCFramework via SPM.

The problem is that I don't want Twilio Video XCFramework dependency to be embedded in MyXCFramework, otherwise, MyXCFramework will end up becoming an umbrella framework, which is not is not recommended by Apple, nor supported in iOS, AFAIK.

To fix this I need set this dependency as `Do Not embed`.
But when consuming Twilio Video XCFramework via SPM, I can't find that option.

The workaround that I found was to manually manage this dependency.
I download it, and drag it to the Xcode project of MyXCFramework, and I got the option `Do Not embed`.

When integrating Twilio Video XCFramework manually, Xcode recognises it as an actual XCFramework, and allows me to choose the option `Do Not embed`.
When integrating Twilio Video XCFramework via SPM, it seems that it's recognized as a static framework, and I don't have the option option `Do Not embed`.

How can I consume a Twilio Video XCFramework via SPM and choose the option `Do Not embed`?

Thanks

@4brunu
Copy link
Author

4brunu commented Sep 7, 2021

Any news on this? 🙂

@swift-ci
Copy link
Contributor

Comment by Tadej (JIRA)

I would very much appreciate this! Is it going to be implemented in a near future?

@swift-ci
Copy link
Contributor

Comment by Antonio Jesús Pallares (JIRA)

I've also encountered this very issue. Is there any news about it?

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 4, 2022
@kyhlwa
Copy link

kyhlwa commented Jul 25, 2022

Any news about this issue ?

@shengchl
Copy link

Xcode 14 completely ignores the inherent mach-o type of the framework wrapped fro SPM and defaults to embedding behavior. This leads to a situation where static frameworks are embedded into a project, and Xcode fails to install an app bundle with a cryptic "The code signature version is no longer supported." message.

I don't don't know who is responsible for this. Looks like a poor work from the Xcode team integrating SPM.

@neonichu
Copy link
Member

@shengchalover Could you please share more information about this issue (ideally via Developer Feedback since this is an Xcode issue)? We are not aware of any issues here, static frameworks that are part of a binary target from a package should not be embedded into apps, only dynamic frameworks are.

@4brunu
Copy link
Author

4brunu commented Sep 20, 2022

@neonichu I opened a radar about this in 2021, but never got an answer.
The radar id is FB9089113.
It's still open.

@tzeejay
Copy link

tzeejay commented Mar 20, 2023

We develop a turn-key WireGuard package so that our partners do not need to include the Golang tooling to build WireGuard for the PacketTunnelProvider which we publish here https://github.com/GuardianFirewall/GuardianWireGuard

We are in the same situation now in which our partners are unable to mark the dependency as "Do Not Embed" in the app extension to avoid the warning about nested frameworks upon submitting the build to App Store Connect. I will have to ask them to manually manage it for the time being but any improvements on this matter would be very appreciated 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants