Skip to content

Commit 103ebe8

Browse files
authored
Copy .swiftinterface instead of .swiftmodule
1 parent a6e2961 commit 103ebe8

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

scripts/create_frameworks.sh

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -123,22 +123,23 @@ create_xcframework() {
123123
# Create the new .xcframework.
124124
xcodebuild -create-xcframework "${libraries[@]}" -output "${xcframework}"
125125

126-
# Copy the .swiftmodule files into the .xcframework if applicable.
126+
# Copy the .swiftinterface files into the .xcframework if applicable.
127127
if [[ -n "$swift_module" ]]; then
128-
echo -e "\nCopying Swift module ${swift_module}.swiftmodule into ${xcframework}"
128+
echo -e "\nCopying Swift interface ${swift_module}.swiftinterface into ${xcframework}"
129129
for dir in "${directories[@]}"; do
130130
local module_source_dir="${dir}/${swift_module}.swiftmodule"
131131
if [ ! -d "$module_source_dir" ]; then
132132
echo "Swiftmodule directory ${module_source_dir} does not exist"
133133
exit 1
134134
fi
135-
local swiftmodule_file
136-
swiftmodule_file=$(find "$module_source_dir" -maxdepth 1 -type f -name '*.swiftmodule' | head -n1)
137-
if [[ -z "$swiftmodule_file" ]]; then
138-
echo "No .swiftmodule file found in ${module_source_dir}"
135+
local swiftinterface_file
136+
swiftinterface_file=$(find "$module_source_dir" -maxdepth 1 \
137+
-type f -name '*.swiftinterface' ! -name '*.private.swiftinterface' | head -n1)
138+
if [[ -z "$swiftinterface_file" ]]; then
139+
echo "No public .swiftinterface file found in ${module_source_dir}"
139140
exit 1
140141
fi
141-
local base=$(basename "$swiftmodule_file" .swiftmodule)
142+
local base=$(basename "$swiftinterface_file" .swiftinterface)
142143
local arch="${base%%-*}"
143144
local rest="${base#*-apple-}"
144145
local platform_tag
@@ -156,9 +157,9 @@ create_xcframework() {
156157
echo "Warning: slice '${slice_name}' not found in ${xcframework}, skipping"
157158
continue
158159
fi
159-
echo " - Copying ${swift_module}.swiftmodule into slice ${slice_name}"
160-
cp "$swiftmodule_file" "${slice_path}/${swift_module}.swiftmodule"
161-
ln -sf "../${swift_module}.swiftmodule" "${slice_path}/Headers/${swift_module}.swiftmodule"
160+
echo " - Copying ${swift_module}.swiftinterface into slice ${slice_name}"
161+
cp "$swiftinterface_file" "${slice_path}/${swift_module}.swiftinterface"
162+
ln -sf "../${swift_module}.swiftinterface" "${slice_path}/Headers/${swift_module}.swiftinterface"
162163
done
163164
fi
164165

0 commit comments

Comments
 (0)