Skip to content

Commit b0e5a7a

Browse files
committed
run submmodule update in the script
1 parent 7a97c02 commit b0e5a7a

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

tools/setup-vendor-flutter

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,25 @@ this_dir=${BASH_SOURCE[0]%/*}
66
# shellcheck source=tools/lib/git.sh
77
. "${this_dir}"/lib/git.sh
88

9+
divider_line='================================================================'
910

1011
# One-time setup to let git submodule + flutter SDK know that we're
1112
# using the main channel (main branch).
12-
# We should do a quick check that there's no changes.
13+
# Otherwise, `flutter doctor` complains about being on a user branch.
14+
# We do a quick check that there's no changes.
1315
if ! submodule_is_clean "vendor/flutter" ; then
14-
echo >&2 "There are changes in the 'vendor/flutter' tree or it is not initialized."
15-
echo >&2 "Please run 'git submodule update --init' then run this script again."
16-
exit 1
16+
echo "Initializing 'vendor/flutter' submodule:"
17+
echo "${divider_line}"
18+
if ! git submodule update --init ; then
19+
echo "${divider_line}"
20+
echo >&2 "Failed to initialize the 'vendor/flutter' submodule, please resolve the issues indicated above then run this script again."
21+
exit 1
22+
else
23+
echo "${divider_line}"
24+
fi
25+
fi
26+
# Check if current branch is main, if not, switch to main
27+
if [[ $(git -C vendor/flutter branch --show-current) == "main" ]]; then
28+
exit 0
1729
fi
18-
1930
git -C vendor/flutter checkout -B main HEAD

0 commit comments

Comments
 (0)