Skip to content

Commit a379451

Browse files
committed
Merge #36: fix: swift script unique subdir
2a67970 fix: swift script unique subdir (Matthew) Pull request description: <!-- You can erase any parts of this template not applicable to your Pull Request. --> ### Description Builds on #34 architecture, and #35 Satscard status command. Before this fix, a user might get this error when trying to use 2 swift frameworks created like we do on bdk-ffi bindings. bitcoindevkit/bdk-ffi#621 Example: would prevent a user from using both bdk-swift and cktap-swift in their iOS app potentially. ### Notes to the reviewers <!-- In this section you can include notes directed to the reviewers, like explaining why some parts of the PR were done in a specific way --> ### Changelog notice <!-- Notice the release manager should include in the release tag message changelog --> <!-- See https://keepachangelog.com/en/1.0.0/ for examples --> ### Checklists #### All Submissions: * [x] I've signed all my commits * [x] I followed the [contribution guidelines](https://github.com/notmandatory/rust-cktap/blob/master/CONTRIBUTING.md) * [ ] I ran `cargo fmt` and `cargo clippy` before committing #### New Features: * [ ] I've added tests for the new feature * [ ] I've added docs for the new feature #### Bugfixes: * [ ] This pull request breaks the existing API * [ ] I've added tests to reproduce the issue which are now passing * [ ] I'm linking the issue being fixed by this PR ACKs for top commit: notmandatory: ACK 2a67970 Tree-SHA512: 9dce93e3e803c18a5fd7b20f5cbe9b8b5b22715c46a7f01bd11a78407bba65c57bb8483431ed4a9ce1c72992b8d1e42685128963a2443913d4e61139c46eb9cb
2 parents 7171fe3 + 2a67970 commit a379451

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

cktap-swift/build-xcframework.sh

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,21 +67,30 @@ lipo target/aarch64-apple-darwin/${RELDIR}/${STATIC_LIB_FILENAME} \
6767

6868
cd cktap-swift || exit
6969

70-
# move cktap-ffi static lib header files to temporary directory
70+
# Unique subdir to prevent collisions
71+
UNIQUE_HEADER_SUBDIR="${NEW_HEADER_DIR}/${HEADER_BASENAME}"
72+
73+
# Remove any previously generated headers to avoid duplicate module.modulemap files
74+
rm -rf "${NEW_HEADER_DIR:?}"/*
75+
76+
mkdir -p "${UNIQUE_HEADER_SUBDIR}"
77+
78+
# Move the header file into the unique subdirectory
7179
if [ -f "Sources/CKTap/${HEADER_FILENAME}" ]; then
72-
mv "Sources/CKTap/${HEADER_FILENAME}" "${NEW_HEADER_DIR}/"
80+
mv "Sources/CKTap/${HEADER_FILENAME}" "${UNIQUE_HEADER_SUBDIR}/"
7381
else
7482
echo "Warning: Could not find header file Sources/CKTap/${HEADER_FILENAME}"
7583
fi
7684

77-
# Handle modulemap using the correct filename pattern
85+
# Handle modulemap using the correct filename pattern, placed inside unique subdirectory
7886
if [ -f "Sources/CKTap/${GENERATED_MODULEMAP}" ]; then
79-
mv "Sources/CKTap/${GENERATED_MODULEMAP}" "${NEW_HEADER_DIR}/${MODULEMAP_FILENAME}"
87+
mv "Sources/CKTap/${GENERATED_MODULEMAP}" "${UNIQUE_HEADER_SUBDIR}/${MODULEMAP_FILENAME}"
8088
else
8189
echo "Creating a standard module map."
82-
echo "framework module ${NAME} { umbrella header \"${HEADER_FILENAME}\" export * }" > "${NEW_HEADER_DIR}/${MODULEMAP_FILENAME}"
90+
echo "framework module ${NAME} { umbrella header \"${HEADER_FILENAME}\" export * }" > "${UNIQUE_HEADER_SUBDIR}/${MODULEMAP_FILENAME}"
8391
fi
8492

93+
8594
# remove old xcframework directory
8695
rm -rf "${OUTDIR}/${NAME}.xcframework"
8796

0 commit comments

Comments
 (0)