Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit a7b5522

Browse files
authored
refactor and simplify CI dart analysis (#27370)
1 parent 093c4ed commit a7b5522

File tree

4 files changed

+40
-109
lines changed

4 files changed

+40
-109
lines changed

analysis_options.yaml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,9 @@
1414
# - "public_member_api_docs" enabled.
1515

1616
analyzer:
17-
exclude: [
18-
# this test pretends to be part of dart:ui and results in lots of false
19-
# positives.
20-
testing/dart/window_hooks_integration_test.dart,
17+
exclude:
2118
# Fixture depends on dart:ui and raises false positives.
22-
flutter_frontend_server/test/fixtures/lib/main.dart
23-
]
19+
- flutter_frontend_server/test/fixtures/lib/main.dart
2420
strong-mode:
2521
implicit-casts: false
2622
implicit-dynamic: false

ci/analyze.sh

Lines changed: 32 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -33,110 +33,40 @@ FLUTTER_DIR="$SRC_DIR/flutter"
3333
DART_BIN="$SRC_DIR/third_party/dart/tools/sdks/dart-sdk/bin"
3434
PUB="$DART_BIN/pub"
3535
DART="$DART_BIN/dart"
36-
DART_ANALYZER="$DART_BIN/dartanalyzer"
37-
38-
echo "Using analyzer from $DART_ANALYZER"
39-
40-
"$DART_ANALYZER" --version
41-
42-
function analyze() (
43-
local last_arg="${!#}"
44-
local results
45-
# Grep sets its return status to non-zero if it doesn't find what it's
46-
# looking for.
47-
set +e
48-
results="$("$DART_ANALYZER" "$@" 2>&1 |
49-
grep -Ev "No issues found!" |
50-
grep -Ev "Analyzing.+$last_arg")"
51-
set -e
52-
echo "$results"
53-
if [ -n "$results" ]; then
54-
echo "Failed analysis of $last_arg"
55-
return 1
56-
else
57-
echo "Success: no issues found in $last_arg"
58-
fi
59-
return 0
60-
)
6136

62-
echo "Analyzing dart:ui library..."
63-
analyze \
64-
--options "$FLUTTER_DIR/analysis_options.yaml" \
65-
"$SRC_DIR/out/host_debug_unopt/gen/dart-pkg/sky_engine/lib/ui/ui.dart"
66-
67-
echo "Analyzing spirv library..."
68-
analyze \
69-
--packages="$FLUTTER_DIR/lib/spirv/.dart_tool/package_config.json" \
70-
--options "$FLUTTER_DIR/analysis_options.yaml" \
71-
"$FLUTTER_DIR/lib/spirv"
72-
73-
echo "Analyzing ci/"
74-
analyze \
75-
--packages="$FLUTTER_DIR/ci/.dart_tool/package_config.json" \
76-
--options "$FLUTTER_DIR/analysis_options.yaml" \
77-
"$FLUTTER_DIR/ci"
78-
79-
echo "Analyzing flutter_frontend_server..."
80-
analyze \
81-
--packages="$FLUTTER_DIR/flutter_frontend_server/.dart_tool/package_config.json" \
82-
--options "$FLUTTER_DIR/analysis_options.yaml" \
83-
"$FLUTTER_DIR/flutter_frontend_server"
84-
85-
echo "Analyzing tools/licenses..."
86-
analyze \
87-
--packages="$FLUTTER_DIR/tools/licenses/.dart_tool/package_config.json" \
88-
--options "$FLUTTER_DIR/tools/licenses/analysis_options.yaml" \
89-
"$FLUTTER_DIR/tools/licenses"
90-
91-
echo "Analyzing testing/litetest"
92-
analyze \
93-
--packages="$FLUTTER_DIR/testing/litetest/.dart_tool/package_config.json" \
94-
--options "$FLUTTER_DIR/analysis_options.yaml" \
95-
"$FLUTTER_DIR/testing/litetest"
96-
97-
echo "Analyzing testing/benchmark"
98-
analyze \
99-
--packages="$FLUTTER_DIR/testing/benchmark/.dart_tool/package_config.json" \
100-
--options "$FLUTTER_DIR/analysis_options.yaml" \
101-
"$FLUTTER_DIR/testing/benchmark"
102-
103-
echo "Analyzing testing/smoke_test_failure"
104-
analyze \
105-
--packages="$FLUTTER_DIR/testing/smoke_test_failure/.dart_tool/package_config.json" \
106-
--options "$FLUTTER_DIR/analysis_options.yaml" \
107-
"$FLUTTER_DIR/testing/smoke_test_failure"
108-
109-
echo "Analyzing testing/dart..."
110-
analyze \
111-
--packages="$FLUTTER_DIR/testing/dart/.dart_tool/package_config.json" \
112-
--options "$FLUTTER_DIR/analysis_options.yaml" \
113-
"$FLUTTER_DIR/testing/dart"
114-
115-
echo "Analyzing testing/scenario_app..."
116-
analyze \
117-
--packages="$FLUTTER_DIR/testing/scenario_app/.dart_tool/package_config.json" \
118-
--options "$FLUTTER_DIR/analysis_options.yaml" \
119-
"$FLUTTER_DIR/testing/scenario_app"
120-
121-
echo "Analyzing testing/symbols..."
122-
analyze \
123-
--packages="$FLUTTER_DIR/testing/symbols/.dart_tool/package_config.json" \
124-
--options "$FLUTTER_DIR/analysis_options.yaml" \
125-
"$FLUTTER_DIR/testing/symbols"
126-
127-
echo "Analyzing githooks..."
128-
analyze \
129-
--packages="$FLUTTER_DIR/tools/githooks/.dart_tool/package_config.json" \
130-
--options "$FLUTTER_DIR/analysis_options.yaml" \
131-
"$FLUTTER_DIR/tools/githooks"
132-
133-
echo "Analyzing tools/clang_tidy"
134-
analyze \
135-
--packages="$FLUTTER_DIR/tools/clang_tidy/.dart_tool/package_config.json" \
136-
--options "$FLUTTER_DIR/analysis_options.yaml" \
137-
"$FLUTTER_DIR/tools/clang_tidy"
37+
echo "Using dart from $DART_BIN"
38+
"$DART" --version
39+
echo ""
40+
41+
"$DART" analyze "$FLUTTER_DIR/lib/ui"
42+
43+
"$DART" analyze "$FLUTTER_DIR/lib/spirv"
44+
45+
"$DART" analyze "$FLUTTER_DIR/ci"
46+
47+
"$DART" analyze "$FLUTTER_DIR/flutter_frontend_server"
48+
49+
"$DART" analyze "$FLUTTER_DIR/tools/licenses"
50+
51+
"$DART" analyze "$FLUTTER_DIR/testing/litetest"
52+
53+
"$DART" analyze "$FLUTTER_DIR/testing/benchmark"
54+
55+
"$DART" analyze "$FLUTTER_DIR/testing/smoke_test_failure"
56+
57+
"$DART" analyze "$FLUTTER_DIR/testing/dart"
58+
59+
"$DART" analyze "$FLUTTER_DIR/testing/scenario_app"
60+
61+
"$DART" analyze "$FLUTTER_DIR/testing/symbols"
62+
63+
"$DART" analyze "$FLUTTER_DIR/tools/githooks"
64+
65+
"$DART" analyze "$FLUTTER_DIR/tools/clang_tidy"
66+
67+
echo ""
13868

13969
# Check that dart libraries conform.
14070
echo "Checking web_ui api conformance..."
141-
(cd "$FLUTTER_DIR/web_sdk"; "$PUB" get)
71+
(cd "$FLUTTER_DIR/web_sdk"; "$DART" pub get)
14272
(cd "$FLUTTER_DIR"; "$DART" "web_sdk/test/api_conform_test.dart")

flutter_frontend_server/pubspec.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ publish_to: none
77
version: 0.1.1-dev
88
description: Communication pipe to Dart Frontend
99
homepage: https://flutter.dev
10-
author: Flutter Authors <flutter-dev@googlegroups.com>
1110

1211
# Do not add any dependencies that require more than what is provided in
1312
# //third_party/pkg, //third_party/dart/pkg or

lib/ui/analysis_options.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
include: ../../analysis_options.yaml
2+
3+
analyzer:
4+
exclude:
5+
# fixtures/ depends on dart:ui and raises false positives.
6+
- fixtures/**

0 commit comments

Comments
 (0)