2017-10-11 22:33:07 +08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
|
2018-12-13 02:46:58 +08:00
|
|
|
ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd ..; pwd )"
|
2018-12-10 22:17:36 +08:00
|
|
|
WORKINGCOPY=$ROOT/temp/workingcopy
|
2017-10-11 22:33:07 +08:00
|
|
|
CDV=$ROOT/node_modules/.bin/cordova
|
|
|
|
|
2018-03-02 06:45:54 +08:00
|
|
|
PLATFORM=ios
|
|
|
|
TARGET=emulator
|
|
|
|
|
|
|
|
while :; do
|
|
|
|
case $1 in
|
|
|
|
--android)
|
|
|
|
PLATFORM=android
|
|
|
|
;;
|
|
|
|
--browser)
|
|
|
|
PLATFORM=browser
|
|
|
|
;;
|
|
|
|
--ios)
|
|
|
|
PLATFORM=ios
|
|
|
|
;;
|
|
|
|
--device)
|
|
|
|
TARGET=device
|
|
|
|
;;
|
|
|
|
--emulator)
|
|
|
|
TARGET=emulator
|
|
|
|
;;
|
|
|
|
-?*)
|
|
|
|
printf 'WARN: Unknown option (ignored): %s\n' "$1" >&2
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
break
|
|
|
|
esac
|
|
|
|
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
2017-10-11 22:33:07 +08:00
|
|
|
rm -rf $ROOT/temp
|
|
|
|
mkdir $ROOT/temp
|
2018-12-13 02:46:58 +08:00
|
|
|
cp -r $ROOT/test/app-template/. $ROOT/temp/
|
2017-10-27 22:20:35 +08:00
|
|
|
cp $ROOT/test/app-test-definitions.js $ROOT/temp/www/
|
2018-12-13 02:46:58 +08:00
|
|
|
rsync -ax --exclude node_modules --exclude scripts --exclude temp --exclude test $ROOT/. $WORKINGCOPY
|
2017-10-11 22:33:07 +08:00
|
|
|
cd $ROOT/temp
|
|
|
|
$CDV prepare
|
2018-12-10 22:17:36 +08:00
|
|
|
$CDV plugins add $WORKINGCOPY
|
|
|
|
$CDV build $PLATFORM --$TARGET --buildConfig build.json
|