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

Commit 31c598c

Browse files
[flutter_plugin_tools] Test and comment Dart analysis (#4194)
Adds a unit test and comments intended to avoid accidental breakage of the Dart repo's run of analysis against this repository. Addresses #4183 (comment)
1 parent 6960795 commit 31c598c

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

.cirrus.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ task:
7272
- cd script/tool
7373
- dart analyze --fatal-infos
7474
script:
75+
# DO NOT change the custom-analysis argument here without changing the Dart repo.
76+
# See the comment in script/configs/custom_analysis.yaml for details.
7577
- ./script/tool_runner.sh analyze --custom-analysis=script/configs/custom_analysis.yaml
7678
### Android tasks ###
7779
- name: build_all_plugins_apk

script/configs/custom_analysis.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
# from a top-level package into more specific packages in order to incrementally
99
# migrate a federated plugin.
1010
#
11+
# DO NOT move or delete this file without updating
12+
# https://github.com/dart-lang/sdk/blob/master/tools/bots/flutter/analyze_flutter_plugins.sh
13+
# which references this file from source, but out-of-repo.
14+
# Contact stuartmorgan or devoncarew for assistance if necessary.
15+
1116
# TODO(ecosystem): Remove everything from this list. See:
1217
# https://github.com/flutter/flutter/issues/76229
1318
- camera

script/tool/test/analyze_command_test.dart

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,4 +251,43 @@ void main() {
251251
]),
252252
);
253253
});
254+
255+
// Ensure that the command used to analyze flutter/plugins in the Dart repo:
256+
// https://github.com/dart-lang/sdk/blob/master/tools/bots/flutter/analyze_flutter_plugins.sh
257+
// continues to work.
258+
//
259+
// DO NOT remove or modify this test without a coordination plan in place to
260+
// modify the script above, as it is run from source, but out-of-repo.
261+
// Contact stuartmorgan or devoncarew for assistance.
262+
test('Dart repo analyze command works', () async {
263+
final Directory pluginDir = createFakePlugin('foo', packagesDir,
264+
extraFiles: <String>['analysis_options.yaml']);
265+
final File allowFile = packagesDir.childFile('custom.yaml');
266+
allowFile.writeAsStringSync('- foo');
267+
268+
await runCapturingPrint(runner, <String>[
269+
// DO NOT change this call; see comment above.
270+
'analyze',
271+
'--analysis-sdk',
272+
'foo/bar/baz',
273+
'--custom-analysis',
274+
allowFile.path
275+
]);
276+
277+
expect(
278+
processRunner.recordedCalls,
279+
orderedEquals(<ProcessCall>[
280+
ProcessCall(
281+
'flutter',
282+
const <String>['packages', 'get'],
283+
pluginDir.path,
284+
),
285+
ProcessCall(
286+
'foo/bar/baz/bin/dart',
287+
const <String>['analyze', '--fatal-infos'],
288+
pluginDir.path,
289+
),
290+
]),
291+
);
292+
});
254293
}

0 commit comments

Comments
 (0)