From 177a891af5db54766d7375ed13b0ba5159e60c67 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Mon, 26 Jul 2021 15:23:27 -0400 Subject: [PATCH 1/2] [flutter_plugin_tools] Test and comment Dart analysis Adds a unit test and comments intended to avoid accidental breakage of the Dart repo's run of analysis against this repository. Addresses https://github.com/flutter/plugins/pull/4183#issuecomment-885767597 --- script/configs/custom_analysis.yaml | 5 +++ script/tool/test/analyze_command_test.dart | 39 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/script/configs/custom_analysis.yaml b/script/configs/custom_analysis.yaml index f6dc8e288b55..2b0f844de7e0 100644 --- a/script/configs/custom_analysis.yaml +++ b/script/configs/custom_analysis.yaml @@ -8,6 +8,11 @@ # from a top-level package into more specific packages in order to incrementally # migrate a federated plugin. # +# DO NOT move or delete this file without updating +# https://github.com/dart-lang/sdk/blob/master/tools/bots/flutter/analyze_flutter_plugins.sh +# which references this file from source, but out-of-repo. +# Contact stuartmorgan or devoncarew for assistance if necessary. + # TODO(ecosystem): Remove everything from this list. See: # https://github.com/flutter/flutter/issues/76229 - camera diff --git a/script/tool/test/analyze_command_test.dart b/script/tool/test/analyze_command_test.dart index 9dc8b6a3fca5..da2f0aba86c8 100644 --- a/script/tool/test/analyze_command_test.dart +++ b/script/tool/test/analyze_command_test.dart @@ -251,4 +251,43 @@ void main() { ]), ); }); + + // Ensure that the command used to analyze flutter/plugins in the Dart repo: + // https://github.com/dart-lang/sdk/blob/master/tools/bots/flutter/analyze_flutter_plugins.sh + // continues to work. + // + // DO NOT remove or modify this test without a coordination plan in place to + // modify the script above, as it is run from source, but out-of-repo. + // Contact stuartmorgan or devoncarew for assistance. + test('Dart repo analyze command works', () async { + final Directory pluginDir = createFakePlugin('foo', packagesDir, + extraFiles: ['analysis_options.yaml']); + final File allowFile = packagesDir.childFile('custom.yaml'); + allowFile.writeAsStringSync('- foo'); + + await runCapturingPrint(runner, [ + // DO NOT change this call; see comment above. + 'analyze', + '--analysis-sdk', + 'foo/bar/baz', + '--custom-analysis', + allowFile.path + ]); + + expect( + processRunner.recordedCalls, + orderedEquals([ + ProcessCall( + 'flutter', + const ['packages', 'get'], + pluginDir.path, + ), + ProcessCall( + 'foo/bar/baz/bin/dart', + const ['analyze', '--fatal-infos'], + pluginDir.path, + ), + ]), + ); + }); } From 8f238c5899eb0c01288f2f68f1d122ce53060870 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Mon, 26 Jul 2021 16:14:37 -0400 Subject: [PATCH 2/2] Add comment to cirrus.yaml --- .cirrus.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.cirrus.yml b/.cirrus.yml index 54c4c3799ec3..5e8425fc2437 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -72,6 +72,8 @@ task: - cd script/tool - dart analyze --fatal-infos script: + # DO NOT change the custom-analysis argument here without changing the Dart repo. + # See the comment in script/configs/custom_analysis.yaml for details. - ./script/tool_runner.sh analyze --custom-analysis=script/configs/custom_analysis.yaml ### Android tasks ### - name: build_all_plugins_apk