前言:
由于flutter官方提供的混合方案,耦合性比较重,需要每个开发人员安装flutter才能启动项目,所以采用jenkins跑任务编译出flutter产物并上传至git仓库,iOS项目用pod依赖即可。
jenkins任务配置:
FLUTTER_PROJECT_Name:flutter项目仓库名称;FLUTTER_PRODUCT_GIT_REPO:flutter项目git地址;
FLUTTER_PRODUCT_Name:flutter编译产物仓库名称;FLUTTER_PRODUCT_GIT_REPO:flutter编译产物git地址
首先分别把2个项目clone到WORKSPACE下,并拉取最新代码,再执行flutter项目下面的build_ios.sh脚本,编译flutter项目得到参物后,copy至flutter编译产物仓库中,最后上传至git。
cd ${WORKSPACE}
if [[ ! -d "${FLUTTER_PROJECT_Name}" ]]; then
git clone ${FLUTTER_PROJECT_GIT_REPO} ${FLUTTER_PROJECT_Name} -b ${PROJECT_GIT_BRANCH}
fi
if [[ ! -d "${FLUTTER_PRODUCT_Name}" ]]; then
git clone ${FLUTTER_PRODUCT_GIT_REPO} ${FLUTTER_PRODUCT_Name} -b ${PROJECT_GIT_BRANCH}
fi
cd ${WORKSPACE}/${FLUTTER_PRODUCT_Name}
git fetch
git reset --hard
git checkout ${PROJECT_GIT_BRANCH}
git pull --no-commit --all
cd ${WORKSPACE}/${FLUTTER_PROJECT_Name}
git fetch
git reset --hard
git checkout ${PROJECT_GIT_BRANCH}
git pull --no-commit --all
sh build_ios.sh -m release