Skip to content

Commit 72a6952

Browse files
authored
Generate Framework Symlinks (#436)
• We recently switched to using aggregate targets with build scripts to build our universal frameworks. However the script simply put all framework resources (the binary, headers folder, etc) into the root of the framework • Apple recommends that frameworks are structured using symlinks instead, with all actual framework content residing in /Versions/A and using symlinks to the root & /Versions/Current • This commit adds commands to the buildscript to generate these symlinks for both dynamic & static frameworks
1 parent 3ff21ec commit 72a6952

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

iOS_SDK/OneSignalSDK/build_fat_framework.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,35 @@ rm "${FINAL_FRAMEWORK_LOCATION}/${ONESIGNAL_OUTPUT_NAME}"
4242
# use lipo to combine device & simulator binaries into one
4343
lipo -create -output "${EXECUTABLE_DESTINATION}" "${CURRENTCONFIG_DEVICE_DIR}/${ONESIGNAL_OUTPUT_NAME}" "${CURRENTCONFIG_SIMULATOR_DIR}/${ONESIGNAL_OUTPUT_NAME}"
4444

45+
# Move framework files to the location Versions/A/* and create
46+
# symlinks at the root of the framework, and Versions/Current
47+
cd $FINAL_FRAMEWORK_LOCATION
48+
49+
declare -a files=("Headers" "Modules" "${ONESIGNAL_OUTPUT_NAME}")
50+
51+
# Create the Versions folders
52+
mkdir Versions
53+
mkdir Versions/A
54+
mkdir Versions/A/Resources
55+
56+
# Move the framework files/folders
57+
for name in "${files[@]}"; do
58+
mv ${name} Versions/A/${name}
59+
done
60+
61+
# Create symlinks at the root of the framework
62+
for name in "${files[@]}"; do
63+
ln -s Versions/A/${name} ${name}
64+
done
65+
66+
# move info.plist into Resources and create appropriate symlinks
67+
mv Info.plist Versions/A/Resources/Info.plist
68+
ln -s Versions/A/Resources Resources
69+
70+
# Create a symlink directory for 'Versions/A' called 'Current'
71+
cd Versions
72+
ln -s A Current
73+
74+
# Copy the built product to the final destination in {repo}/iOS_SDK/OneSignalSDK/Framework
4575
rm -rf "${ONESIGNAL_DESTINATION_PATH}/${ONESIGNAL_OUTPUT_NAME}.framework"
4676
cp -a "${FINAL_FRAMEWORK_LOCATION}" "${ONESIGNAL_DESTINATION_PATH}/${ONESIGNAL_OUTPUT_NAME}.framework"

0 commit comments

Comments
 (0)