Purpose of SupportedPlatform.custom(_:versionString:)

What is the purpose of SupportedPlatform.custom(_:versionString:)? Is there really an ability to define a custom platform?

I am asking because I am currently trying to problem solve a scenario where a swift library should be available on Ubuntu but not on base Debian. if os(Linux) is not a refined enough platform.

Regardless, what is the purpose of SupportedPlatform.custom(_:versionString:)? How is this actually used?

I have not used it, but yes, it appears to be there to create custom platforms in your SwiftPM package manifest. You cannot replace os(Linux) with it in your code, but you can probably set an Ubuntu definition, then check for that in your code.

SwiftPM internally has code to check for some linux distros, you could do something similar in your manifest.

1 Like

This is really only useful if you're making your own tool using libSwiftPM but are providing a custom build system. If that is the case, package authors can interact with any custom platform support the build system has without needing to change the PackageDescription library.

1 Like