Skip to content

Commit 4a1a533

Browse files
authored
latest mono_repo (#737)
1 parent f6fc5d3 commit 4a1a533

File tree

4 files changed

+84
-73
lines changed

4 files changed

+84
-73
lines changed

.travis.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Created with package:mono_repo v2.5.0
1+
# Created with package:mono_repo v3.0.0
22
language: dart
33

44
# Custom configuration
@@ -8,10 +8,10 @@ branches:
88

99
jobs:
1010
include:
11-
- stage: mono_repo_self_validate
11+
- stage: analyzer_and_format
1212
name: mono_repo self validate
1313
os: linux
14-
script: tool/mono_repo_self_validate.sh
14+
script: "pub global activate mono_repo 3.0.0 && pub global run mono_repo travis --validate"
1515
- stage: analyzer_and_format
1616
name: "SDK: 2.7.0; PKGS: _test_yaml, checked_yaml, example, json_annotation, json_serializable; TASKS: `dartanalyzer --fatal-warnings .`"
1717
dart: "2.7.0"
@@ -62,7 +62,6 @@ jobs:
6262
script: tool/travis.sh test_1
6363

6464
stages:
65-
- mono_repo_self_validate
6665
- analyzer_and_format
6766
- unit_test
6867
- ensure_build

mono_repo.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# See https://github.com/google/mono_repo.dart for details on this file
2-
self_validate: true
2+
self_validate: analyzer_and_format
33
travis:
44
branches:
55
only:

tool/mono_repo_self_validate.sh

Lines changed: 0 additions & 15 deletions
This file was deleted.

tool/travis.sh

Lines changed: 80 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
#!/bin/bash
2-
# Created with package:mono_repo v2.5.0
2+
# Created with package:mono_repo v3.0.0
33

44
# Support built in commands on windows out of the box.
5-
function pub {
5+
function pub() {
66
if [[ $TRAVIS_OS_NAME == "windows" ]]; then
77
command pub.bat "$@"
88
else
99
command pub "$@"
1010
fi
1111
}
12-
function dartfmt {
12+
function dartfmt() {
1313
if [[ $TRAVIS_OS_NAME == "windows" ]]; then
1414
command dartfmt.bat "$@"
1515
else
1616
command dartfmt "$@"
1717
fi
1818
}
19-
function dartanalyzer {
19+
function dartanalyzer() {
2020
if [[ $TRAVIS_OS_NAME == "windows" ]]; then
2121
command dartanalyzer.bat "$@"
2222
else
@@ -25,67 +25,94 @@ function dartanalyzer {
2525
}
2626

2727
if [[ -z ${PKGS} ]]; then
28-
echo -e '\033[31mPKGS environment variable must be set!\033[0m'
29-
exit 1
28+
echo -e '\033[31mPKGS environment variable must be set! - TERMINATING JOB\033[0m'
29+
exit 64
3030
fi
3131

3232
if [[ "$#" == "0" ]]; then
33-
echo -e '\033[31mAt least one task argument must be provided!\033[0m'
34-
exit 1
33+
echo -e '\033[31mAt least one task argument must be provided! - TERMINATING JOB\033[0m'
34+
exit 64
3535
fi
3636

37-
EXIT_CODE=0
37+
SUCCESS_COUNT=0
38+
declare -a FAILURES
3839

3940
for PKG in ${PKGS}; do
4041
echo -e "\033[1mPKG: ${PKG}\033[22m"
41-
pushd "${PKG}" || exit $?
42+
EXIT_CODE=0
43+
pushd "${PKG}" >/dev/null || EXIT_CODE=$?
44+
45+
if [[ ${EXIT_CODE} -ne 0 ]]; then
46+
echo -e "\033[31mPKG: '${PKG}' does not exist - TERMINATING JOB\033[0m"
47+
exit 64
48+
fi
49+
50+
pub upgrade --no-precompile || EXIT_CODE=$?
4251

43-
PUB_EXIT_CODE=0
44-
pub upgrade --no-precompile || PUB_EXIT_CODE=$?
52+
if [[ ${EXIT_CODE} -ne 0 ]]; then
53+
echo -e "\033[31mPKG: ${PKG}; 'pub upgrade' - FAILED (${EXIT_CODE})\033[0m"
54+
FAILURES+=("${PKG}; 'pub upgrade'")
55+
else
56+
for TASK in "$@"; do
57+
EXIT_CODE=0
58+
echo
59+
echo -e "\033[1mPKG: ${PKG}; TASK: ${TASK}\033[22m"
60+
case ${TASK} in
61+
command)
62+
echo 'pub run build_runner test --delete-conflicting-outputs -- -p chrome'
63+
pub run build_runner test --delete-conflicting-outputs -- -p chrome || EXIT_CODE=$?
64+
;;
65+
dartanalyzer_0)
66+
echo 'dartanalyzer --fatal-warnings --fatal-infos .'
67+
dartanalyzer --fatal-warnings --fatal-infos . || EXIT_CODE=$?
68+
;;
69+
dartanalyzer_1)
70+
echo 'dartanalyzer --fatal-warnings .'
71+
dartanalyzer --fatal-warnings . || EXIT_CODE=$?
72+
;;
73+
dartfmt)
74+
echo 'dartfmt -n --set-exit-if-changed .'
75+
dartfmt -n --set-exit-if-changed . || EXIT_CODE=$?
76+
;;
77+
test_0)
78+
echo 'pub run test'
79+
pub run test || EXIT_CODE=$?
80+
;;
81+
test_1)
82+
echo 'pub run test --run-skipped -t presubmit-only test/ensure_build_test.dart'
83+
pub run test --run-skipped -t presubmit-only test/ensure_build_test.dart || EXIT_CODE=$?
84+
;;
85+
*)
86+
echo -e "\033[31mUnknown TASK '${TASK}' - TERMINATING JOB\033[0m"
87+
exit 64
88+
;;
89+
esac
4590

46-
if [[ ${PUB_EXIT_CODE} -ne 0 ]]; then
47-
EXIT_CODE=1
48-
echo -e '\033[31mpub upgrade failed\033[0m'
49-
popd
50-
continue
91+
if [[ ${EXIT_CODE} -ne 0 ]]; then
92+
echo -e "\033[31mPKG: ${PKG}; TASK: ${TASK} - FAILED (${EXIT_CODE})\033[0m"
93+
FAILURES+=("${PKG}; TASK: ${TASK}")
94+
else
95+
echo -e "\033[32mPKG: ${PKG}; TASK: ${TASK} - SUCCEEDED\033[0m"
96+
SUCCESS_COUNT=$((SUCCESS_COUNT + 1))
97+
fi
98+
99+
done
51100
fi
52101

53-
for TASK in "$@"; do
54-
echo
55-
echo -e "\033[1mPKG: ${PKG}; TASK: ${TASK}\033[22m"
56-
case ${TASK} in
57-
command)
58-
echo 'pub run build_runner test --delete-conflicting-outputs -- -p chrome'
59-
pub run build_runner test --delete-conflicting-outputs -- -p chrome || EXIT_CODE=$?
60-
;;
61-
dartanalyzer_0)
62-
echo 'dartanalyzer --fatal-warnings --fatal-infos .'
63-
dartanalyzer --fatal-warnings --fatal-infos . || EXIT_CODE=$?
64-
;;
65-
dartanalyzer_1)
66-
echo 'dartanalyzer --fatal-warnings .'
67-
dartanalyzer --fatal-warnings . || EXIT_CODE=$?
68-
;;
69-
dartfmt)
70-
echo 'dartfmt -n --set-exit-if-changed .'
71-
dartfmt -n --set-exit-if-changed . || EXIT_CODE=$?
72-
;;
73-
test_0)
74-
echo 'pub run test'
75-
pub run test || EXIT_CODE=$?
76-
;;
77-
test_1)
78-
echo 'pub run test --run-skipped -t presubmit-only test/ensure_build_test.dart'
79-
pub run test --run-skipped -t presubmit-only test/ensure_build_test.dart || EXIT_CODE=$?
80-
;;
81-
*)
82-
echo -e "\033[31mNot expecting TASK '${TASK}'. Error!\033[0m"
83-
EXIT_CODE=1
84-
;;
85-
esac
86-
done
102+
echo
103+
echo -e "\033[32mSUCCESS COUNT: ${SUCCESS_COUNT}\033[0m"
104+
105+
if [ ${#FAILURES[@]} -ne 0 ]; then
106+
echo -e "\033[31mFAILURES: ${#FAILURES[@]}\033[0m"
107+
for i in "${FAILURES[@]}"; do
108+
echo -e "\033[31m $i\033[0m"
109+
done
110+
fi
87111

88-
popd
112+
popd >/dev/null || exit 70
113+
echo
89114
done
90115

91-
exit ${EXIT_CODE}
116+
if [ ${#FAILURES[@]} -ne 0 ]; then
117+
exit 1
118+
fi

0 commit comments

Comments
 (0)