云构建构建Flutter_iOS项目

问题描述

云构建构建Flutter_iOS项目。

解决方案

主要步骤截图如下:

 

bash脚本如下:

# 设置镜像源
export FLUTTER_STORAGE_BASE_URL="https://mirrors.tuna.tsinghua.edu.cn/flutter"
export PUB_HOSTED_URL="https://mirrors.tuna.tsinghua.edu.cn/dart-pub"
git config --add --global url."https://gitee.com/mirrors/CocoaPods-Specs.git".insteadOf "https://github.com/CocoaPods/Specs.git"

# 如果本地没有flutter-sdk文件夹,则克隆
if [ ! -d "flutter-sdk" ]; then
#clone最新稳定版的flutter
  git clone -b stable --depth 1 https://mirrors.tuna.tsinghua.edu.cn/git/flutter-sdk.git
#或者clone指定版本的flutter,例如:git clone -b 3.7.12 --depth 1 https://mirrors.tuna.tsinghua.edu.cn/git/flutter-sdk.git
  #git clone -b ${flutter版本号} --depth 1 https://mirrors.tuna.tsinghua.edu.cn/git/flutter-sdk.git
fi

# 设置环境变量
export PATH=$PATH:$(pwd)/flutter-sdk/bin

pod --version
# 更新CocoaPods仓库
pod repo update --verbose

# 构建ipa文件
flutter clean
flutter  pub get
flutter precache --ios

适用于

  • 云构建