7253f6198d
The previous three scripts had some redundancies: * Both the flutter/flutter analyzing script and the flutter/packages analyzing script checked out flutter/flutter. Combining them saves several minutes. * The script that analyzed flutter/engine was pointing to the old engine repo, which was archived months ago. In pointing the script to the new sources at flutter/flutter, this would introduce another instance of cloning flutter/flutter. Combining this with the other scripts saves several minutes. The only other little changes to the code are the introduction of more echo commands, more `pushd`/`popd` vs `cd`, and isolating the three tasks into functions for readability. Change-Id: I08414d824c25075a8810b1aa0cc299c64328abbf Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432881 Auto-Submit: Samuel Rawlins <srawlins@google.com> Commit-Queue: Alexander Thomas <athom@google.com> Reviewed-by: Alexander Thomas <athom@google.com> Reviewed-by: Ryan Macnak <rmacnak@google.com>
90 lines
2.4 KiB
Bash
Executable File
90 lines
2.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
|
|
# for details. All rights reserved. Use of this source code is governed by a
|
|
# BSD-style license that can be found in the LICENSE file.
|
|
|
|
# Analyze Dart code in various Flutter repos.
|
|
|
|
set -ex
|
|
|
|
checkout=$(pwd)
|
|
dart=$checkout/out/ReleaseX64/dart-sdk/bin/dart
|
|
sdk=$checkout/out/ReleaseX64/dart-sdk
|
|
tmpdir=$(mktemp -d)
|
|
|
|
cleanup() {
|
|
rm -rf "$tmpdir"
|
|
}
|
|
|
|
trap cleanup EXIT HUP INT QUIT TERM PIPE
|
|
cd "$tmpdir"
|
|
|
|
analyze_engine() {
|
|
echo Analyzing Flutter engine lib/web_ui...
|
|
pushd flutter/engine/src/flutter/lib/web_ui
|
|
|
|
$dart pub get
|
|
$dart analyze --suppress-analytics --fatal-infos
|
|
|
|
popd
|
|
}
|
|
|
|
analyze_flutter_sdk() {
|
|
echo Configuring Flutter SDK and updating packages...
|
|
pushd flutter
|
|
bin/flutter config --no-analytics
|
|
bin/flutter update-packages
|
|
|
|
# Run a subset of the tests run by [flutter]/dev/bots/analyze.dart.
|
|
# Run only the tests that use the built dart analyzer.
|
|
echo Analyzing Flutter SDK...
|
|
bin/flutter analyze --flutter-repo --dart-sdk $sdk
|
|
bin/flutter analyze --flutter-repo --watch --benchmark --dart-sdk $sdk
|
|
|
|
echo Analyzing mega gallery...
|
|
mkdir gallery
|
|
$dart dev/tools/mega_gallery.dart --out gallery
|
|
pushd gallery
|
|
../bin/flutter analyze --watch --benchmark --dart-sdk $sdk
|
|
popd
|
|
|
|
echo Testing data-driven fixes...
|
|
$dart fix --suppress-analytics packages/flutter/test_fixes --compare-to-golden
|
|
|
|
popd
|
|
}
|
|
|
|
analyze_flutter_packages() {
|
|
export PATH="$PATH":"$tmpdir/flutter/bin"
|
|
flutter --version
|
|
|
|
echo Cloning flutter/packages/...
|
|
git clone --single-branch -vv https://github.com/flutter/packages
|
|
pushd packages
|
|
|
|
echo "Validating the tool's source"
|
|
(cd script/tool; dart pub --suppress-analytics get)
|
|
(cd script/tool; dart analyze --suppress-analytics --fatal-infos)
|
|
|
|
echo Analyzing flutter/packages...
|
|
# Invoke the repo's analysis script.
|
|
# Use --downgrade to avoid potential breakage from transitive
|
|
# dependency publishing. See
|
|
# https://github.com/flutter/flutter/issues/129633
|
|
dart run script/tool/bin/flutter_plugin_tools.dart analyze \
|
|
--downgrade \
|
|
--analysis-sdk $sdk \
|
|
--custom-analysis=script/configs/custom_analysis.yaml \
|
|
--base-branch=main
|
|
|
|
popd
|
|
}
|
|
|
|
echo Cloning flutter/flutter...
|
|
git clone --single-branch -vv \
|
|
https://dart.googlesource.com/external/github.com/flutter/flutter
|
|
|
|
analyze_engine
|
|
analyze_flutter_sdk
|
|
analyze_flutter_packages
|