#!/bin/sh

cd publish 

set -e

node build_check.js

set +e

cd ../form 

npm install

npm run publish 

cd ../publish 

node build_step_0.js

cd ../play

/Applications/CocosCreator/Creator/2.4.0/CocosCreator.app/Contents/MacOS/CocosCreator --path "./" --build "platform=web-desktop;debug=true" --force

echo "生成 web desktop 完成~！"

cd ../publish 

node build_step_1.js

echo "build_step_1 完成~！"

cd ../play

/Applications/CocosCreator/Creator/2.4.4/CocosCreator.app/Contents/MacOS/CocosCreator --path "./" --build "platform=ios;debug=false;md5Cache=true;buildPath=build_ios;encryptJs=true;xxteaKey=6bbfce23-28b4-4a;zipCompressJs=true" --force

echo "生成 ios 完成~！"

cd ../publish 

node build_step_2.js

echo "build_step_2 完成~！"

cd ../play

/Applications/CocosCreator/Creator/2.4.4/CocosCreator.app/Contents/MacOS/CocosCreator --path "./" --build "platform=ios;debug=false;md5Cache=true;buildPath=build_android;appABIs=['armeabi-v7a','x86','x86_64','arm64-v8a'];encryptJs=true;xxteaKey=6bbfce23-28b4-4a;zipCompressJs=true" --force

echo "生成 android 完成~！"

cd ../publish 

node build_step_3.js

echo "build_step_3 完成~！"

cd ../play

/Applications/CocosCreator/Creator/2.4.4/CocosCreator.app/Contents/MacOS/CocosCreator --path "./" --build "platform=web-desktop;debug=false;buildPath=build_web_desktop" --force

echo "生成 web-desktop 完成~！"

cd ../publish 

node build_step_4.js

echo "build_step_4 完成~！"