Skip to content

Conversation

hanleylee
Copy link
Contributor

Sometimes we want to use xcodebuild build ... instead xcodebuild archive ..., because artifacts generated by xcodebuild build ... contain more debug information. For example: .swiftsourcefile will only be generated when invoked by the xcodebuild build ... command.

The xcframework of Alamofire generated by the swift-create-xcframework --platform ios --action build --xc-setting OTHER_SWIFT_FLAGS="-debug-prefix-map $PWD=." Alamofire command are as below:

Alamofire.xcframework
├── Info.plist
├── ios-arm64
│   ├── Alamofire.framework
│   │   ├── Alamofire
│   │   ├── Headers
│   │   │   └── Alamofire-Swift.h
│   │   ├── Info.plist
│   │   └── Modules
│   │       └── Alamofire.swiftmodule
│   │           ├── Project
│   │           │   └── arm64-apple-ios.swiftsourceinfo                  <============= Look here!!!
│   │           ├── arm64-apple-ios.abi.json
│   │           ├── arm64-apple-ios.private.swiftinterface
│   │           ├── arm64-apple-ios.swiftdoc
│   │           └── arm64-apple-ios.swiftinterface
│   └── dSYMs
│       └── Alamofire.framework.dSYM
│           └── Contents
│               ├── Info.plist
│               └── Resources
│                   ├── DWARF
│                   └── Relocations
└── ios-arm64_x86_64-simulator
    ├── Alamofire.framework
    │   ├── Alamofire
    │   ├── Headers
    │   │   └── Alamofire-Swift.h
    │   ├── Info.plist
    │   ├── Modules
    │   │   └── Alamofire.swiftmodule
    │   │       ├── Project
    │   │       │   ├── arm64-apple-ios-simulator.swiftsourceinfo
    │   │       │   └── x86_64-apple-ios-simulator.swiftsourceinfo
    │   │       ├── arm64-apple-ios-simulator.abi.json
    │   │       ├── arm64-apple-ios-simulator.private.swiftinterface
    │   │       ├── arm64-apple-ios-simulator.swiftdoc
    │   │       ├── arm64-apple-ios-simulator.swiftinterface
    │   │       ├── x86_64-apple-ios-simulator.abi.json
    │   │       ├── x86_64-apple-ios-simulator.private.swiftinterface
    │   │       ├── x86_64-apple-ios-simulator.swiftdoc
    │   │       └── x86_64-apple-ios-simulator.swiftinterface
    │   └── _CodeSignature
    │       └── CodeResources
    └── dSYMs
        └── Alamofire.framework.dSYM
            └── Contents
                ├── Info.plist
                └── Resources
                    ├── DWARF
                    └── Relocations

26 directories, 25 files

Output of swift-create-xcframework --platform ios --action archive --xc-setting OTHER_SWIFT_FLAGS="-debug-prefix-map $PWD=." Alamofire command are as below(no .swiftsourceinfo file):

Alamofire.xcframework
├── Info.plist
├── ios-arm64
│   ├── Alamofire.framework
│   │   ├── Alamofire
│   │   ├── Headers
│   │   │   └── Alamofire-Swift.h
│   │   ├── Info.plist
│   │   └── Modules
│   │       └── Alamofire.swiftmodule
│   │           ├── arm64-apple-ios.abi.json
│   │           ├── arm64-apple-ios.private.swiftinterface
│   │           ├── arm64-apple-ios.swiftdoc
│   │           └── arm64-apple-ios.swiftinterface
│   └── dSYMs
│       └── Alamofire.framework.dSYM
│           └── Contents
│               ├── Info.plist
│               └── Resources
│                   ├── DWARF
│                   └── Relocations
└── ios-arm64_x86_64-simulator
    ├── Alamofire.framework
    │   ├── Alamofire
    │   ├── Headers
    │   │   └── Alamofire-Swift.h
    │   ├── Info.plist
    │   ├── Modules
    │   │   └── Alamofire.swiftmodule
    │   │       ├── arm64-apple-ios-simulator.abi.json
    │   │       ├── arm64-apple-ios-simulator.private.swiftinterface
    │   │       ├── arm64-apple-ios-simulator.swiftdoc
    │   │       ├── arm64-apple-ios-simulator.swiftinterface
    │   │       ├── x86_64-apple-ios-simulator.abi.json
    │   │       ├── x86_64-apple-ios-simulator.private.swiftinterface
    │   │       ├── x86_64-apple-ios-simulator.swiftdoc
    │   │       └── x86_64-apple-ios-simulator.swiftinterface
    │   └── _CodeSignature
    │       └── CodeResources
    └── dSYMs
        └── Alamofire.framework.dSYM
            └── Contents
                ├── Info.plist
                └── Resources
                    ├── DWARF
                    └── Relocations

24 directories, 22 files

The .swiftsourceinfo file can be used to jump to the definition in the source code. Our team usually compiles third-party modules from source code to XCFramework to reduce compile time, and we also want to retain the ability to jump source code by clicking a property or class. Therefore we implemented --action option to configure the action used by xcodebuild inside swift-create-xcframework

@bsneed
Copy link
Collaborator

bsneed commented Jul 7, 2024

Thanks @hanleylee ! Sorry I didn't see this sooner. I'll make sure I turn on notifications for this repo.

@bsneed bsneed merged commit d042322 into segment-integrations:master Jul 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants