File tree 1 file changed +21
-9
lines changed 1 file changed +21
-9
lines changed Original file line number Diff line number Diff line change @@ -138,15 +138,27 @@ create_xcframework() {
138
138
echo " No .swiftmodule file found in ${module_source_dir} "
139
139
exit 1
140
140
fi
141
-
142
- local dir_suffix
143
- dir_suffix=$( echo " $dir " | cut -d' /' -f1 | tr ' [:upper:]' ' [:lower:]' | sed ' s/[\/\.~]/_/g' )
144
- for slice_path in " ${xcframework} /${dir_suffix} -" * ; do
145
- if [ -d " ${slice_path} /Headers" ]; then
146
- echo " - Copying ${swiftmodule_file##*/ } to ${slice_path} /Headers/${swift_module} .swiftmodule"
147
- cp " ${swiftmodule_file} " " ${slice_path} /Headers/${swift_module} .swiftmodule"
148
- fi
149
- done
141
+ local base=$( basename " $swiftmodule_file " .swiftmodule)
142
+ local arch=" ${base%% -* } "
143
+ local rest=" ${base#* -apple-} "
144
+ local platform_tag
145
+ local variant
146
+ if [[ " $rest " == * -simulator ]]; then
147
+ platform_tag=" ${rest% -simulator} "
148
+ variant=" -simulator"
149
+ else
150
+ platform_tag=" $rest "
151
+ variant=" "
152
+ fi
153
+ local slice_name=" ${platform_tag} -${arch}${variant} "
154
+ local slice_path=" ${xcframework} /${slice_name} "
155
+ if [ ! -d " $slice_path " ]; then
156
+ echo " Warning: slice '${slice_name} ' not found in ${xcframework} , skipping"
157
+ continue
158
+ 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"
150
162
done
151
163
fi
152
164
You can’t perform that action at this time.
0 commit comments