Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions Binaries/harmony_uniffiFFI.xcframework/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,36 @@
<key>BinaryPath</key>
<string>harmony_uniffiFFI.framework/harmony_uniffiFFI</string>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>harmony_uniffiFFI.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>harmony_uniffiFFI.framework/harmony_uniffiFFI</string>
<string>harmony_uniffiFFI.framework/Versions/A/harmony_uniffiFFI</string>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<string>macos-arm64_x86_64</string>
<key>LibraryPath</key>
<string>harmony_uniffiFFI.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<string>macos</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>harmony_uniffiFFI.framework/harmony_uniffiFFI</string>
<key>LibraryIdentifier</key>
<string>macos-arm64_x86_64</string>
<string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>harmony_uniffiFFI.framework</string>
<key>SupportedArchitectures</key>
Expand All @@ -48,7 +46,9 @@
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>macos</string>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
</array>
<key>CFBundlePackageType</key>
Expand Down
Binary file not shown.
Binary file not shown.
44 changes: 38 additions & 6 deletions scripts/build_uniffi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -124,19 +124,40 @@ make_framework() {

local fw="$slice_dir/${FRAMEWORK_NAME}.framework"
rm -rf "$fw"
mkdir -p "$fw/Headers" "$fw/Modules"

cp "$lib_path" "$fw/${FRAMEWORK_NAME}"
cp build/uniffi/Headers/* "$fw/Headers/"

cat > "$fw/Modules/module.modulemap" <<EOF
# macOS frameworks require the versioned ("deep") bundle layout: the binary,
# Headers, Modules and Resources/Info.plist live under Versions/A, with
# top-level symlinks into Versions/Current (added after the files are written,
# below). iOS and the simulator use the flat ("shallow") layout. Shipping the
# shallow layout for macOS makes an embedding app fail to build with "contains
# Info.plist, expected Versions/Current/Resources/Info.plist since the platform
# does not use shallow bundles".
local hdr_dir mod_dir plist_path bin_path
if [ "$platform" = "MacOSX" ]; then
mkdir -p "$fw/Versions/A/Headers" "$fw/Versions/A/Modules" "$fw/Versions/A/Resources"
hdr_dir="$fw/Versions/A/Headers"
mod_dir="$fw/Versions/A/Modules"
plist_path="$fw/Versions/A/Resources/Info.plist"
bin_path="$fw/Versions/A/${FRAMEWORK_NAME}"
else
mkdir -p "$fw/Headers" "$fw/Modules"
hdr_dir="$fw/Headers"
mod_dir="$fw/Modules"
plist_path="$fw/Info.plist"
bin_path="$fw/${FRAMEWORK_NAME}"
fi

cp "$lib_path" "$bin_path"
cp build/uniffi/Headers/* "$hdr_dir/"

cat > "$mod_dir/module.modulemap" <<EOF
framework module ${FRAMEWORK_NAME} {
umbrella header "${FRAMEWORK_NAME}.h"
export *
}
EOF

cat > "$fw/Info.plist" <<EOF
cat > "$plist_path" <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
Expand All @@ -162,6 +183,17 @@ EOF
</dict>
</plist>
EOF

# macOS: create the version symlink (Current -> A) and the top-level symlinks
# into it that make this a valid versioned framework bundle. iOS/simulator
# slices are flat and need none of this.
if [ "$platform" = "MacOSX" ]; then
ln -s A "$fw/Versions/Current"
ln -s "Versions/Current/${FRAMEWORK_NAME}" "$fw/${FRAMEWORK_NAME}"
ln -s Versions/Current/Headers "$fw/Headers"
ln -s Versions/Current/Modules "$fw/Modules"
ln -s Versions/Current/Resources "$fw/Resources"
fi
}

make_framework "$IOS_LIB" build/frameworks/ios MinimumOSVersion "$IOS_DEPLOYMENT_TARGET" iPhoneOS
Expand Down