iOS—生成framework的shell脚本,生成的SDK可以嵌到项目里运行,编译发布

set -e

pod install
pod update

rm -fr build
mkdir -p build/Output

xcodebuild \
  -workspace “xxxx(替换SDK的名字).xcworkspace” \
  -scheme “xxxx(替换SDK的名字)” \
  -derivedDataPath build \
  -arch armv7 -arch armv7s -arch arm64 \
  -sdk iphoneos \
  ONLY_ACTIVE_ARCH=NO \
  -configuration Release \
  -IDEBuildOperationMaxNumberOfConcurrentCompileTasks=4 \
  OTHER_CFLAGS=”-fembed-bitcode” \
  build \
  CODE_SIGN_IDENTITY=”” \
  CODE_SIGNING_REQUIRED=NO

xcodebuild \
  -workspace “xxxx(替换SDK的名字).xcworkspace” \
  -scheme “xxxx(替换SDK的名字)” \
  -derivedDataPath build \
  -sdk iphonesimulator \
  -destination ‘platform=iOS Simulator,name=iPhone 6’ \
  ONLY_ACTIVE_ARCH=NO \
  -configuration Release \
  -IDEBuildOperationMaxNumberOfConcurrentCompileTasks=4 \
  OTHER_CFLAGS=”-fembed-bitcode” \
  build \
  CODE_SIGN_IDENTITY=”” \
  CODE_SIGNING_REQUIRED=NO

rm -f build/Output/libactor.so

lipo -create “build/Build/Intermediates/xxxx(替换SDK的名字).build/Release-iphoneos/j2objc/Objects/libactor.so” “build/Build/Intermediates/xxxx(替换SDK的名字).build/Release-iphonesimulator/j2objc/Objects/libactor.so” -output build/Output/libactor.so

# Building Framework
# Copy base framework
rm -fr build/Output/xxxx(替换SDK的名字).framework
cp -a build/Build/Products/Release-iphoneos/xxxx(替换SDK的名字).framework build/Output/

# Merging binaries
lipo -create “build/Build/Products/Release-iphoneos/xxxx(替换SDK的名字).framework/xxxx(替换SDK的名字)” “build/Build/Products/Release-iphonesimulator/xxxx(替换SDK的名字).framework/xxxx(替换SDK的名字)” -output build/Output/xxxx(替换SDK的名字)_Lipo
rm -fr build/Output/xxxx(替换SDK的名字).framework/xxxx(替换SDK的名字)
mv build/Output/xxxx(替换SDK的名字)_Lipo build/Output/xxxx(替换SDK的名字).framework/xxxx(替换SDK的名字)
rm -fr build/Output/xxxx(替换SDK的名字).framework/Frameworks

# Merging swift docs
cp -a build/Build/Products/Release-iphonesimulator/xxxx(替换SDK的名字).framework/Modules/xxxx(替换SDK的名字).swiftmodule/* build/Output/xxxx(替换SDK的名字).framework/Modules/xxxx(替换SDK的名字).swiftmodule/

# Copying dSYM
cp -a build/Build/Products/Release-iphoneos/xxxx(替换SDK的名字).framework.dSYM/* build/Output/xxxx(替换SDK的名字).framework.dSYM/

# Compressing Framework
cd build/Output/
rm -f xxxx(替换SDK的名字).zip
zip -r xxxx(替换SDK的名字).zip xxxx(替换SDK的名字).framework xxxx(替换SDK的名字).framework.dSYM

    原文作者:移动开发
    原文地址: https://my.oschina.net/ArtemisFang/blog/1588607
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞