blob: 9a4cb7251439a49d5b4e705eaff7ad08af1be497 [file] [log] [blame]
srawlins585ea9b2021-06-08 23:14:10 -04001# Copyright 2016 Dart Mockito authors
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15#!/bin/bash
16
17if [ "$#" == "0" ]; then
18 echo -e '\033[31mAt least one task argument must be provided!\033[0m'
19 exit 1
20fi
21
22EXIT_CODE=0
23
24while (( "$#" )); do
25 TASK=$1
26 case $TASK in
27 dartfmt) echo
28 echo -e '\033[1mTASK: dartfmt\033[22m'
29 echo -e 'dartfmt -n --set-exit-if-changed .'
30 dartfmt -n --set-exit-if-changed . || EXIT_CODE=$?
31 ;;
32 dartanalyzer) echo
33 echo -e '\033[1mTASK: dartanalyzer\033[22m'
34 echo -e 'dartanalyzer --fatal-warnings lib'
35 dartanalyzer --fatal-warnings lib || EXIT_CODE=$?
36 ;;
37 vm_test) echo
38 echo -e '\033[1mTASK: vm_test\033[22m'
39 echo -e 'pub run build_runner test -- -p vm'
40 pub run build_runner test -- -p vm || EXIT_CODE=$?
41 ;;
42 dartdevc_build) echo
43 echo -e '\033[1mTASK: build\033[22m'
44 echo -e 'pub run build_runner build --fail-on-severe'
45 pub run build_runner build --fail-on-severe || EXIT_CODE=$?
46 ;;
47 dartdevc_test) echo
48 echo -e '\033[1mTASK: dartdevc_test\033[22m'
49 echo -e 'pub run build_runner test -- -p chrome'
50 xvfb-run pub run build_runner test -- -p chrome || EXIT_CODE=$?
51 ;;
52 coverage) echo
53 echo -e '\033[1mTASK: coverage\033[22m'
54 if [ "$REPO_TOKEN" ]; then
55 echo -e 'pub run dart_coveralls report test/all.dart'
56 pub global activate dart_coveralls
57 pub global run dart_coveralls report \
58 --token $REPO_TOKEN \
59 --retry 2 \
60 --exclude-test-files \
61 test/all.dart
62 else
63 echo -e "\033[33mNo token for coveralls. Skipping.\033[0m"
64 fi
65 ;;
66 *) echo -e "\033[31mNot expecting TASK '${TASK}'. Error!\033[0m"
67 EXIT_CODE=1
68 ;;
69 esac
70
71 shift
72done
73
74exit $EXIT_CODE