zoukankan      html  css  js  c++  java
  • iOS开发系列-Shell脚本编译SDK

    Library静态库Shell脚本

    #!/bin/bash
    
    #要build的target名
    target_Name="IFlyMSC"
    
    #编译模式  Release、Debug
    build_model=Release
    
    #获取工程当前所在路径
    project_path=$(pwd)
    
    #编译文件路径
    buildPath=${project_path}/build
    
    #导出sdk地址
    exportSdkPath=~/Desktop/${target_Name}-SDK/${build_model}
    
    if [ ! -d $exportSdkPath ]; then
    mkdir -p $exportSdkPath;
    fi
    
    #真机sdk路径
    iphoneos_path=${buildPath}/${build_model}-iphoneos/lib${target_Name}.a
    #模拟器sdk路径
    simulator_path=${buildPath}/${build_model}-iphonesimulator/lib${target_Name}.a
    #合并后sdk路径
    merge_path=${exportSdkPath}/lib${target_Name}.a
    
    #build之前clean一下
    xcodebuild -target ${target_Name} clean
    
    #模拟器build
    xcodebuild -target ${target_Name} -configuration ${build_model} -sdk iphonesimulator ARCHS="i386 x86_64" VALID_ARCHS="i386 x86_64"
    
    #真机build
    xcodebuild -target ${target_Name} -configuration ${build_model} -sdk iphoneos "ARCHS=armv7 arm64" "VALID_ARCHS=armv7 armv7s arm64"
    
    #复制头文件到目标文件夹
    cp -R ${buildPath}/${build_model}-iphoneos/include/${target_Name} ${exportSdkPath}
    
    #合并模拟器和真机.a包
    lipo -create ${iphoneos_path} ${simulator_path} -output ${merge_path}
    
    #压缩合并后的文件
    
    #压缩后的文件名
    package_date=`date '+%Y-%m-%d日%X'`
    sdk_zip_name=lib${target_Name}_${build_model}_${package_date}.zip
    #跳转到sdk的输出路径
    cd ${exportSdkPath}
    #压缩sdk输出路径下的所有文件
    zip -r ~/Desktop/${target_Name}-SDK/${sdk_zip_name} ./*
    
    #打开合并后的sdk所在路径
    open ${exportSdkPath}
    
    #删除build文件
    if [ -d ${buildPath} ]; then
    rm -rf ${buildPath}
    fi
    

    Framework静态库Shell脚本编译

    #!/bin/bash
    
    #要build的target名
    target_Name="HTKit"
    
    #编译模式  Release、Debug
    build_model=Release
    
    #获取工程当前所在路径
    project_path=$(pwd)
    
    #编译文件路径
    buildPath=${project_path}/build
    
    #导出sdk地址
    exportSdkPath=~/Desktop/${target_Name}-SDK/${build_model}
    
    if [ ! -d $exportSdkPath ]; then
    mkdir -p $exportSdkPath;
    fi
    
    #真机sdk路径
    iphoneos_path=${buildPath}/${build_model}-iphoneos/${target_Name}.framework/${target_Name}
    #模拟器sdk路径
    simulator_path=${buildPath}/${build_model}-iphonesimulator/${target_Name}.framework/${target_Name}
    #合并后sdk路径
    merge_path=${exportSdkPath}/${target_Name}.framework/${target_Name}
    
    #build之前clean一下
    xcodebuild -target ${target_Name} clean
    
    #模拟器build
    xcodebuild -target ${target_Name} -configuration ${build_model} -sdk iphonesimulator ARCHS="i386 x86_64" VALID_ARCHS="i386 x86_64"
    
    #真机build
    xcodebuild -target ${target_Name} -configuration ${build_model} -sdk iphoneos "ARCHS=armv7 arm64" "VALID_ARCHS=armv7 armv7s arm64"
    
    #复制真机.framework到目标文件夹
    cp -R ${buildPath}/${build_model}-iphoneos/${target_Name}.framework ${exportSdkPath}
    
    #合并模拟器和真机.a包
    lipo -create ${iphoneos_path} ${simulator_path} -output ${merge_path}
    
    #删除framework下的Info.plist
    rm -r -f ${exportSdkPath}/${target_Name}.framework/Info.plist
    
    #删除framework下的Modules
    rm -r -f ${exportSdkPath}/${target_Name}.framework/Modules
    
    #压缩合并后的文件
    
    #压缩后的文件名
    package_date=`date '+%Y-%m-%d日%X'`
    sdk_zip_name=lib${target_Name}_${build_model}_${package_date}.zip
    #跳转到sdk的输出路径
    cd ${exportSdkPath}
    #压缩sdk输出路径下的所有文件
    zip -r ~/Desktop/${target_Name}-SDK/${sdk_zip_name} ./*
    
    #打开合并后的sdk所在路径
    open ${exportSdkPath}
    
    #删除build文件
    if [ -d ${buildPath} ]; then
    rm -rf ${buildPath}
    fi
    
  • 相关阅读:
    界面操作集锦
    测试系列之二如何进行单元测试
    网页右下角弹出广告窗口 超简洁
    如何使一个图片广告悬浮浏览器右下角 右下角图片广告
    zencart网店用的JS弹出广告代码
    zencart数据库清理 让你的网站跑的更快
    Ecrater操作技巧
    网页顶部或者底部广告代码 可定时关闭 可用于网站通知等
    国内出名的外贸B2C网站
    天空之城(献给我喜欢的女孩,杨)
  • 原文地址:https://www.cnblogs.com/CoderHong/p/9433710.html
Copyright © 2011-2022 走看看