Skip to content

Migrate xcframework packaging from xcodebuild to SwiftPM #7035

@brianmichel

Description

@brianmichel

Description

Binary targets are a vital part of the SwiftPM ecosystem and currently any discussions about extending the format or expanding usage of this format (or xcframeworks) in general are limited due to the packaging tool being included as part of xcodebuild. Interestingly, computing the checksum for a binary target is included as part of the swift package suite of tools, but not the creation of said package.

I believe migrating this functionality from xcodebuild to SwiftPM would be advantageous as it could open up discussions to make SwiftPM even more useful on non-Darwin platforms that want to use Swift.

Expected behavior

I'd like to write something like the following:

swift package create-xcframework -framework <path> [-framework <path>...] -output <path>
or
swift package -create-xcframework -library <path> [-headers <path>] [-library <path> [-headers <path>]...] -output <path>

Which would create the framework similarly as it does when running the command from xcodebuild

Actual behavior

This command doesn't exist today and you're forced to run xcodebuild -create-xcframework on macOS.

Steps to reproduce

  1. Launch a Linux or Windows installation that has Swift installed
  2. Attempt to run either xcodebuild -create-xcframework ... or swift package create-xcframework ... and see that it doesn't work

Swift Package Manager version/commit hash

Swift Package Manager - Swift 5.9.0

Swift & OS version (output of swift --version && uname -a)

swift-driver version: 1.87.1 Apple Swift version 5.9 (swiftlang-5.9.0.128.108 clang-1500.0.40.1)
Target: arm64-apple-macosx14.0
Darwin zerocool.localdomain 23.0.0 Darwin Kernel Version 23.0.0: Fri Sep 15 14:41:43 PDT 2023; root:xnu-10002.1.13~1/RELEASE_ARM64_T6000 arm64

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions