Last active
June 24, 2024 15:44
-
-
Save chanonly123/6e1e1fbe216feb2f67ae4ba68f9990bb to your computer and use it in GitHub Desktop.
Build XCFramework and documentation script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# put this file inside the root directory of the project | |
# update the framework name | |
frameworkName="MyFramework" | |
echo "⬛️ cleaning" | |
xcodebuild clean | |
rm -rf output | |
rm -rf build | |
# framework version | |
echo "⬛️ build for iphonesimulator" | |
xcodebuild \ | |
-verbose \ | |
-scheme $frameworkName \ | |
-configuration Release \ | |
-derivedDataPath output \ | |
-sdk iphonesimulator build \ | |
&& | |
echo "⬛️ build for iphoneos" | |
xcodebuild \ | |
-verbose \ | |
-scheme $frameworkName \ | |
-configuration Release \ | |
-derivedDataPath output \ | |
-sdk iphoneos build \ | |
&& | |
iphoneosDSYM=`readlink -f "output/Build/Products/Release-iphoneos/$frameworkName.framework.dSYM"` | |
iphonesimulatorDSYM=`readlink -f "output/Build/Products/Release-iphonesimulator/$frameworkName.framework.dSYM"` | |
echo ${iphoneosDSYM} | |
echo ${iphonesimulatorDSYM} | |
echo "⬛️ build xcframework" | |
xcodebuild -create-xcframework \ | |
-framework "output/Build/Products/Release-iphoneos/$frameworkName.framework" \ | |
-debug-symbols ${iphoneosDSYM} \ | |
-framework "output/Build/Products/Release-iphonesimulator/$frameworkName.framework" \ | |
-debug-symbols ${iphonesimulatorDSYM} \ | |
-output "build/$frameworkName.xcframework" \ | |
&& | |
echo "⬛️ build documentation" | |
xcodebuild docbuild \ | |
-scheme $frameworkName \ | |
-derivedDataPath output \ | |
-destination 'platform=iOS Simulator,name=iPhone 13' \ | |
&& | |
docPath=`find output -type d -name "*.doccarchive"` | |
echo "⬛️ building static documentation website" | |
$(xcrun --find docc) process-archive \ | |
transform-for-static-hosting $docPath \ | |
--output-path "build/doc" \ | |
--hosting-base-path "/" \ | |
&& | |
# output file location | |
echo "⬛️ open output folder" | |
open "build/" | |
# generated documents directory, localy viewable, requires `python3` | |
cd "build/doc" | |
open "http://localhost:3000/documentation/$frameworkName/" | |
python3 -m http.server 3000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment