Fix symlinks in generated XCFramework #188
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The kmmbridge Gradle plugin uses a Gradle
Zip
task to create a.zip
archive of an XCFramework directory for the compiled Kotlin code.On macOS, the layout of an XCFramework typically looks like this:
However, the Gradle
Zip
task does not support preserving symlinks when creating zip files. Instead, these files are copied into the uploaded archive. It looks like XCode is not consistently fine with this, sometimes attempting toreadlink
theCurrent/
directory in the xcframework even when it is a regular directory. This fails, breaking macOS builds.This PR applies a hack to the publishing logic for the
:PowerSyncKotlin
project that will delete the archive created by Gradle only to re-create it with azip
invocation (we can't replace the task because it's created by the KMMBridge plugin). That allows using this project in macOS apps built with Swift.I've tested this by changing
Package.swift
here, replacing the path for the binary target with the created archive:(run
./gradlew PowerSyncKotlin:zipXCFramework
to create it). Pointing our Swift SDK at that package allows building macOS apps. See: powersync-ja/powersync-swift#44