ge-org / multiplatform-swiftpackage

Gradle plugin that generates a Swift Package Manager manifest and an XCFramework to distribute a Kotlin Multiplatform library for Apple platforms.
Apache License 2.0
333 stars 49 forks source link

Enabling Bitcode for archiving #38

Closed nicoonswift closed 2 years ago

nicoonswift commented 2 years ago

Hello, I'm seeing the following error on Xcode Archive:

ld: bitcode bundle could not be generated because '/xxxx/BuildProductsPath/Release-iphoneos/common.framework/common' was built without full bitcode. All frameworks and dylibs for bitcode must be generated from Xcode Archive or Install build file '/xxxx/BuildProductsPath/Release-iphoneos/common.framework/common' for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

AFAIK, SPM requires all frameworks to have bitcode enabled. Is there a way we could do so ? I couldn't find any info in the documentation or implementation (cf. https://github.com/ge-org/multiplatform-swiftpackage/blob/master/src/main/kotlin/com/chromaticnoise/multiplatformswiftpackage/task/CreateXCFrameworkTask.kt). I'm not sure if I'm missing something, I think we would need to add some bitcode related flags in the xcodebuild command.

nicoonswift commented 2 years ago

Answering myself, and for future readers, -TIL- setup is made in the KMM shared framework's build.gradle file. No action required in this plugin.

cf. https://stackoverflow.com/a/54339820