Skip to content

Instantly share code, notes, and snippets.

@jpsim
Created Jul 24, 2019
Embed
What would you like to do?
FB6395442: Running 'xcodebuild archive' on a SwiftPM product produces different results than an equivalent .xcodeproj

An Xcode project generates the following archive:

$ tree Yams-macosx.xcarchive
Yams-macosx.xcarchive
├── Info.plist
├── Products
│   └── Library
│       └── Frameworks
│           └── Yams.framework
│               ├── Headers -> Versions/Current/Headers
│               ├── Modules -> Versions/Current/Modules
│               ├── Resources -> Versions/Current/Resources
│               ├── Versions
│               │   ├── A
│               │   │   ├── Headers
│               │   │   │   ├── Yams-Swift.h
│               │   │   │   ├── Yams.h
│               │   │   │   └── yaml.h
│               │   │   ├── Modules
│               │   │   │   ├── Yams.swiftmodule
│               │   │   │   │   ├── x86_64-apple-macos.swiftdoc
│               │   │   │   │   ├── x86_64-apple-macos.swiftinterface
│               │   │   │   │   ├── x86_64-apple-macos.swiftmodule
│               │   │   │   │   ├── x86_64.swiftdoc
│               │   │   │   │   ├── x86_64.swiftinterface
│               │   │   │   │   └── x86_64.swiftmodule
│               │   │   │   └── module.modulemap
│               │   │   ├── Resources
│               │   │   │   └── Info.plist
│               │   │   ├── Yams
│               │   │   └── _CodeSignature
│               │   │       └── CodeResources
│               │   └── Current -> A
│               └── Yams -> Versions/Current/Yams
└── dSYMs
    └── Yams.framework.dSYM
        └── Contents
            ├── Info.plist
            └── Resources
                └── DWARF
                    └── Yams

20 directories, 17 files

Whereas a SwiftPM-based project generates this archive:

$ tree Yams-macosx-swiftpm.xcarchive 
Yams-macosx-swiftpm.xcarchive
├── Info.plist
├── Products
│   └── Users
│       └── jsimard
│           └── Objects
│               ├── CYaml.o
│               └── Yams.o
└── dSYMs

5 directories, 3 files

Apple's Response

After reviewing your feedback, we have some additional information for you. This is expected because of the build model used by Swift packages. It's not currently possible to produce frameworks in an archive but you can produce dylibs by changing the product type to .dynamic.

My Follow-up

Thank you for the clarifying information. It is unfortunate however, mostly because it would be nice to avoid needing to maintain the xcodeproj-related configuration files while still maintaining the ability to produce XCFrameworks.

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