#!/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 the flutter/flutter repo.

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"

git clone --single-branch -vv \
  https://dart.googlesource.com/external/github.com/flutter/flutter

cd flutter

bin/flutter config --no-analytics

pinned_dart_sdk=$(cat bin/cache/dart-sdk/revision)
patch=$checkout/tools/patches/flutter-engine/${pinned_dart_sdk}.flutter.patch
if [ -e "$patch" ]; then
  git apply $patch
fi

bin/flutter update-packages

# Analyze the flutter/flutter source code.
$dart --enable-asserts dev/bots/analyze.dart --dart-sdk $sdk

# Test flutter's use of data-driven fixes.
pushd packages/flutter/test_fixes
../../../bin/dart fix --compare-to-golden
popd

# Analyze the sample code in dartdoc snippets.
./bin/dart dev/bots/analyze_sample_code.dart

#!/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 the flutter/flutter repo.

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"

git clone --single-branch -vv \
  https://dart.googlesource.com/external/github.com/flutter/flutter

cd flutter

bin/flutter config --no-analytics

pinned_dart_sdk=$(cat bin/cache/dart-sdk/revision)
patch=$checkout/tools/patches/flutter-engine/${pinned_dart_sdk}.flutter.patch
if [ -e "$patch" ]; then
  git apply $patch
fi

bin/flutter update-packages

# Analyze the flutter/flutter source code.
$dart --enable-asserts dev/bots/analyze.dart --dart-sdk $sdk

# Test flutter's use of data-driven fixes.
$dart fix packages/flutter/test_fixes --compare-to-golden

# Analyze the sample code in dartdoc snippets.
$dart dev/bots/analyze_sample_code.dart

Use just-built dart in `dart fix` test
Use just-built dart in `dart fix` test

Fixes https://github.com/dart-lang/sdk/issues/47678
Change-Id: I1dbd9927f5a19f19777b468cce8e4812b35d45eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220783
Commit-Queue: Samuel Rawlins <5cf2cac5eec2ad6d0eb2b0f4ff6af9a590ce2bf6@google.com>
Reviewed-by: Alexander Thomas <29642742b6693024c89de8232f2e2542cf7eedf7@google.com>
Reviewed-by: Brian Wilkerson <1f7641b6b14c52b9163524ab8d9aabff80176f21@google.com>
