美文网首页
M1电脑Dev打包脚本

M1电脑Dev打包脚本

作者: CodingTom | 来源:发表于2022-08-20 14:49 被阅读0次

    打Dev包出现了BUG

    https://blog.csdn.net/YLGWHYH/article/details/119038159

    -destination 'generic/platform=iOS'
    

    示例代码

    #!/bin/bash
    export LANG=en_US.UTF-8
    #参考自 https://github.com/qindeli/WorksapceShell
    #注意:脚本和WorkSpace必须在同一个目录
    #工程名字(Target名字) 2021-04-30 21:10:48
    Project_Name="name"
    IPA_Name="ipa_name"
    
    #workspace的名字
    Workspace_Name="workspacename"
    #配置环境,Release或者Debug,默认release
    Configuration="Release"
    #IPA存放的地址
    IPA_Save_Path="/Users/${USER}/Desktop/${Project_Name}"_$(date +%m%d_%H%M%S)
    
    #导出IPA需要的配置文件plist
    PlistPath=./DevExportOptions.plist
    PlistPath=${PlistPath}
    
    if [ -n "$1" ]; then
        echo "更新了:$1"
    else
        echo "请输入更新日志"
        exit;
    fi
    
    # 打包
    xcodebuild -workspace $Workspace_Name.xcworkspace -scheme $Project_Name -configuration $Configuration -archivePath build/$Project_Name-build.xcarchive clean archive -destination 'generic/platform=iOS'
    # 导出IPA
    xcodebuild -exportArchive -archivePath build/$Project_Name-build.xcarchive -exportOptionsPlist ${PlistPath} -exportPath $IPA_Save_Path -allowProvisioningUpdates YES
    
    # 获取更新日志
    # git log -2 --pretty=format:"%H %s" > build/log.log
    
    # 复制 dSYMs 文件
    cp -R build/$Project_Name-build.xcarchive/dSYMs $IPA_Save_Path
    # 删除build目录
    rm -rf build
    

    DevExportOptions.plist

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>compileBitcode</key>
        <false/>
        <key>destination</key>
        <string>export</string>
        <key>method</key>
        <string>development</string>
        <key>provisioningProfiles</key>
        <dict>
            <key>package.name</key>
            <string>provisioningProfiles UUID</string>
        </dict>
        <key>signingCertificate</key>
        <string>Apple Development</string>
        <key>signingStyle</key>
        <string>manual</string>
        <key>stripSwiftSymbols</key>
        <true/>
        <key>teamID</key>
        <string>teamID_Value</string>
        <key>thinning</key>
        <string>&lt;none&gt;</string>
    </dict>
    </plist>
    

    导出编译时间文件

    #!/bin/bash
    export LANG=en_US.UTF-8
    
    Project_Name="BreathLive"
    #workspace的名字
    Workspace_Name="BreathLive"
    # 打包
    xcodebuild -workspace $Workspace_Name.xcworkspace -scheme $Project_Name -destination 'generic/platform=iOS' clean build OTHER_SWIFT_FLAGS="-Xfrontend -debug-time-function-bodies" > build_log.txt
    
    grep '^\d*\.\d*ms' build_log.txt > build_time.log
    

    相关文章

      网友评论

          本文标题:M1电脑Dev打包脚本

          本文链接:https://www.haomeiwen.com/subject/oytmgrtx.html