Skip to content

Update create_frameworks.sh to put each .swiftmodule into correspondi… #11088

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 23, 2025
Merged
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
30 changes: 21 additions & 9 deletions scripts/create_frameworks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,27 @@ create_xcframework() {
echo "No .swiftmodule file found in ${module_source_dir}"
exit 1
fi

local dir_suffix
dir_suffix=$(echo "$dir" | cut -d'/' -f1 | tr '[:upper:]' '[:lower:]' | sed 's/[\/\.~]/_/g')
for slice_path in "${xcframework}/${dir_suffix}-"*; do
if [ -d "${slice_path}/Headers" ]; then
echo " - Copying ${swiftmodule_file##*/} to ${slice_path}/Headers/${swift_module}.swiftmodule"
cp "${swiftmodule_file}" "${slice_path}/Headers/${swift_module}.swiftmodule"
fi
done
local base=$(basename "$swiftmodule_file" .swiftmodule)
local arch="${base%%-*}"
local rest="${base#*-apple-}"
local platform_tag
local variant
if [[ "$rest" == *-simulator ]]; then
platform_tag="${rest%-simulator}"
variant="-simulator"
else
platform_tag="$rest"
variant=""
fi
local slice_name="${platform_tag}-${arch}${variant}"
local slice_path="${xcframework}/${slice_name}"
if [ ! -d "$slice_path" ]; then
echo "Warning: slice '${slice_name}' not found in ${xcframework}, skipping"
continue
fi
echo " - Copying ${swift_module}.swiftmodule into slice ${slice_name}"
cp "$swiftmodule_file" "${slice_path}/${swift_module}.swiftmodule"
ln -sf "../${swift_module}.swiftmodule" "${slice_path}/Headers/${swift_module}.swiftmodule"
done
fi

Expand Down
Loading