zoukankan      html  css  js  c++  java
  • ios shell打包脚本 xctool

    #! /bin/bash
    
    project_path=$(dirname $0)
    
    project_config=Release
    
    output_path=~/Desktop
    
    build_scheme=YKTicketsApp
    
    workspace_name=YKTicketsApp
    
    parameter=":p:c:o:s:w:h:"
    
    while getopts $parameter optname 
        do
            case "$optname" in
                "p" )
                    project_path=$OPTARG
                    ;;
                "c" )
                    project_config=$OPTARG
                    ;;    
                "o" )
                    output_path=$OPTARG
                    ;;    
                "s" )
                    build_scheme=$OPTARG
                    ;;
                "w" )
                    workspace_name=$OPTARG
                    ;;
                "h" )
                    echo " -p 项目路径,默认为当前路径"
                    echo " -c 定制版配置名称,默认为Release"
                    echo " -o 打包输出路径,默认为桌面"
                    echo " -s 打包使用策略,默认为YKTicketsApp"
                    echo " -w 打包workspace名,默认为YKTicketsApp"
                    exit 20
                    ;;
                *     )
                    echo " 无效参数"
                    echo " -p 项目路径,默认为当前路径"
                    echo " -c 定制版配置名称,默认为Release"
                    echo " -o 打包输出路径,默认为桌面"
                    echo " -s 打包使用策略,默认为YKTicketsApp"
                    echo " -w 打包workspace名,默认为YKTicketsApp"
                    exit 21
                    ;;
            esac
        done
    
    workspace_file="${project_path}/${workspace_name}.xcworkspace"
    
    date_time="$(date +"%Y%m%d_%H%M%S")"
    
    archive_file="${output_path}/${date_time}_${project_config}.xcarchive"
    
    ipa_file="${output_path}/${date_time}_${project_config}.ipa"
    
    #cd $project_path
    
    #pod_cmd='pod update --verbose --no-repo-update'
    
    #$pod_cmd
    
    clean_cmd="xctool clean"
    clean_cmd="${clean_cmd} -workspace ${workspace_file}"
    clean_cmd="${clean_cmd} -scheme ${build_scheme}"
    clean_cmd="${clean_cmd} -configuration ${project_config}"
    
    echo ${clean_cmd}
    
    $clean_cmd
    
    if [ $? -ne 0 ]; then
        echo "清理项目失败,请检查工程。" 
        exit 30
    fi
    
    
    build_cmd="xctool build"
    build_cmd="${build_cmd} -workspace ${workspace_file}"
    build_cmd="${build_cmd} -scheme ${build_scheme}"
    build_cmd="${build_cmd} -configuration ${project_config} archive"
    build_cmd="${build_cmd} -archivePath ${archive_file}"
    
    echo ${build_cmd}
    
    $build_cmd
    
    if [ $? -ne 0 ]; then
        echo "构建项目失败,请检查工程。" 
        exit 31
    fi
    
    xcodebuild -exportArchive -archivePath ${archive_path} -exportPath ${ipa_path} -exportFormat ipa
    
    run_cmd="xcrun -sdk iphoneos"
    run_cmd="${run_cmd} PackageApplication -v"
    run_cmd="${run_cmd} ${archive_file}/Products/Applications/YKTicketsApp.app"
    run_cmd="${run_cmd} -o ${ipa_file}"
    
    echo ${run_cmd}
    
    $run_cmd
    
    if [ $? -ne 0 ]; then
        echo "打包项目失败,请检查工程。" 
        exit 32
    fi
  • 相关阅读:
    Javascript Promise技术
    什么是CPS
    移动端input file 提示没有应用可执行此操作
    黄聪:wordpress+Windows下安装Memcached服务及安装PHP的Memcached扩展
    黄聪:Windows下安装Memcached服务及安装PHP的Memcached扩展
    用VScode配置Python开发环境
    在VSCode中使用码云(Gitee)进行代码管理
    网页链接分享到微信朋友圈带图标和摘要的完美解决方法
    解决百度统计被刷广告的办法,屏蔽非法广告
    Visual Studio代码PHP Intelephense继续显示不必要的错误
  • 原文地址:https://www.cnblogs.com/nmzd/p/5555799.html
Copyright © 2011-2022 走看看