blob: 44e1cde86b4ed9bc3fb8e65598b8a8abca455d76 [file] [log] [blame]
#!/bin/bash
# Copyright 2023 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Fast fail the script on failures.
set -ex
export SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
export DEVTOOLS_DIR=$SCRIPT_DIR/../..
# In GitBash on Windows, we have to call flutter.bat so we alias them in this
# script to call the correct one based on the OS.
function flutter {
# TODO: Also support windows on github actions.
if [[ $RUNNER_OS == "Windows" ]]; then
command flutter.bat "$@"
else
command flutter "$@"
fi
}
export -f flutter
# TODO: Also support windows on github actions.
if [[ $RUNNER_OS == "Windows" ]]; then
echo Installing Google Chrome Stable...
# Install Chrome via Chocolatey while `addons: chrome` doesn't seem to work on Windows yet
# https://travis-ci.community/t/installing-google-chrome-stable-but-i-cant-find-it-anywhere/2118
choco install googlechrome --acceptlicense --yes --no-progress --ignore-checksums
fi
# Make sure Flutter sdk has been provided
if [ ! -d "./tool/flutter-sdk" ]; then
echo "Expected ./tool/flutter-sdk to exist"
exit 1;
fi
# Look in the dart bin dir first, then the flutter one, then the one for the
# devtools repo. We don't use the dart script from flutter/bin as that script
# can and does print 'Waiting for another flutter command...' at inopportune
# times.
export PATH=`pwd`/tool/flutter-sdk/bin/cache/dart-sdk/bin:`pwd`/tool/flutter-sdk/bin:`pwd`/bin:$PATH
# Look up the latest flutter candidate (this is the latest flutter version in g3)
# TODO(https://github.com/flutter/devtools/issues/4591): re-write this script as a
# shell script so we won't have to incurr the cost of building flutter tool twice.
flutter config --no-analytics
flutter doctor
# We should be using dart from ../flutter-sdk/bin/cache/dart-sdk/dart.
echo "which flutter: " `which flutter`
echo "which dart: " `which dart`
# Disable analytics to ensure that the welcome message for the dart cli tooling
# doesn't interrupt the CI bots.
dart --disable-analytics
# Print out the versions and ensure we can call Dart, Pub, and Flutter.
flutter --version
dart --version
# Fetch dependencies for the tool/ directory
pushd $DEVTOOLS_DIR/tool
flutter pub get
popd
# Ensure the devtools_tool command is available
export PATH="$PATH":"$DEVTOOLS_DIR/tool/bin"
# Fetch dependencies
devtools_tool pub-get --only-main
# Generate code.
devtools_tool generate-code