Skip to content

Commit 77e342d

Browse files
authored
Copy .swiftinterface instead of .swiftmodule (#11102)
1 parent ee52837 commit 77e342d

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

extension/apple/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ set_target_properties(extension_apple PROPERTIES
7575
Swift_MODULE_NAME "ExecuTorch"
7676
Swift_FLAGS "${SWIFT_CLANG_INTEROP_FLAGS}"
7777
XCODE_ATTRIBUTE_SWIFT_MODULE_NAME "ExecuTorch"
78-
XCODE_ATTRIBUTE_BUILD_LIBRARY_FOR_DISTRIBUTION YES
79-
XCODE_ATTRIBUTE_SWIFT_ENABLE_TESTABILITY YES
78+
XCODE_ATTRIBUTE_BUILD_LIBRARY_FOR_DISTRIBUTION "YES"
8079
XCODE_ATTRIBUTE_OTHER_SWIFT_FLAGS "${SWIFT_CLANG_INTEROP_FLAGS}"
8180
)
8281

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)