timoninas
(Anton Timonin)
1
Hi All,
Since Apple presenter on WWDC23 a new type of linking libraries - mergeable (a combined type of static and dynamic library), and this type appeared as a flag in xcframework settings section
However there are still 2 types of libraries in SPM: static and dynamic, hence I want to propose to add a third type of linking library - mergeable, that will allow us to flexible configure our packages.
Package.swift
let package = Package(
name: "SomePkg",
platforms: [
.iOS(.v15)
],
products: [
.library(
name: "SomePkg",
type: .mergeable, // Here
targets: ["SomePkg"])
],
targets: [
.target(
name: "SomePkg",
resources: [.process("Resources/")]),
.testTarget(
name: "SomePkgTests",
dependencies: [
.target(
name: "SomePkg")
])
]
)
2 Likes
NeoNacho
(Boris Buegling)
2
Mergeable are specific to Apple's linker, so I don't think they should be promoted to a first-class concept in a package manager that works across platforms.
4 Likes
The practical crux of that concern is packages carelessly or unwittingly making themselves Apple-platform-specific, right?
In which case, it's not so much the presence of an Apple-platform-specific feature that's the issue, it's just whether it has an implicit fallback for other platforms. If a 'mergeable' linking mode meant e.g. 'static' on non-Apple platforms, might that be passable?
2 Likes
timoninas
(Anton Timonin)
4
Yes, that would be acceptable. They can even do this with a separate flag in the SPM package configuration. But at the moment there are no such flags, and in fact you can only use mergeable libraries in xcframework
NeoNacho
(Boris Buegling)
5
I have a few concerns, one is the one you're alluding to, but there are a couple others:
- is it the correct design that
PackageDescription would be a superset of all the platform specific options or do we need a different design to scale to potentially many different platforms having opinions? For example, we're already getting a lot of confusion from having the platforms API which ends up being a way to express the Apple platform specific concept of minimum deployment targets.
- is
mergeable really something the package author should choose or is it something that needs to be chosen by clients? We have this problem currently with dynamic which typically ends up being something the client wants to pick, not the package author.
3 Likes