drift/tool/travis.sh

52 lines
1.3 KiB
Bash
Raw Normal View History

2019-02-03 04:56:31 -08:00
#!/bin/bash
# Created with package:mono_repo v1.2.1
2019-07-28 02:08:39 -07:00
# We don't use travis, but this let's us run mono_repo presubmit locally
2019-02-03 04:56:31 -08:00
if [ -z "$PKG" ]; then
echo -e '\033[31mPKG environment variable must be set!\033[0m'
exit 1
fi
if [ "$#" == "0" ]; then
echo -e '\033[31mAt least one task argument must be provided!\033[0m'
exit 1
fi
pushd $PKG
pub upgrade || exit $?
EXIT_CODE=0
while (( "$#" )); do
TASK=$1
case $TASK in
2019-02-14 08:55:31 -08:00
command) echo
echo -e '\033[1mTASK: command\033[22m'
2019-07-28 02:08:39 -07:00
echo -e 'pub run build_runner build -v --delete-conflicting-outputs'
pub run build_runner build -v --delete-conflicting-outputs || EXIT_CODE=$?
2019-02-14 08:55:31 -08:00
;;
2019-02-03 04:56:31 -08:00
dartanalyzer) echo
echo -e '\033[1mTASK: dartanalyzer\033[22m'
2019-03-19 05:36:43 -07:00
echo -e 'dartanalyzer --fatal-infos --fatal-warnings lib/ test/'
2019-03-19 05:48:33 -07:00
dartanalyzer --fatal-infos --fatal-warnings lib/ test/ || EXIT_CODE=$?
2019-02-03 04:56:31 -08:00
;;
dartfmt) echo
echo -e '\033[1mTASK: dartfmt\033[22m'
echo -e 'dartfmt -n --set-exit-if-changed .'
dartfmt -n --set-exit-if-changed . || EXIT_CODE=$?
;;
test) echo
echo -e '\033[1mTASK: test\033[22m'
echo -e 'pub run test'
pub run test || EXIT_CODE=$?
;;
*) echo -e "\033[31mNot expecting TASK '${TASK}'. Error!\033[0m"
EXIT_CODE=1
;;
esac
shift
done
exit $EXIT_CODE