SupportedPlatform for Linux etc

I'm a bit confused about the support for non-Apple platforms in Package.swift/PackageDescription. The docs for SupportedPlatform mention Linux etc as members of the Platform struct, so there seems to be an intent to support Linux here, but in practice there is no support at the moment. The relationship between Platform and SupportedPlatform is undocumented and internal, so there doesn't seem to be a way to declare a SupportedPlatform for anything non-Apple to pass to the Package initializer.

I realise having a LinuxVersion that's meaningful in this context is near impossible, but that shouldn't be a problem for Windows, Android etc.

  • SupportedPlatform is used in the second argmuent of Package(name:platforms:...) to constrain deployment target versions on platforms which contain the Swift libraries as part of the operating system. Thus it carries version information, and only applies to certain platforms. More details in this post: How should SupportedPlatform work? - #2 by SDGGiesbrecht

  • Platform is used in .when(platform:) conditions attached to target dependencies and build settings. Here all platforms can be used as a condition, and no version is attached because deployment targets are irrelevant.

It isn’t meaningful (yet) on any of these platforms, because you have to ship the core libraries with your build product, and thus the deployment target is already fixed by the SDK you compiled against (or the toolchain you are using if the SDK isn’t separate from it).

Terms of Service

Privacy Policy

Cookie Policy