From f704582893487112f64e8cdfe36be4b59e0d36bf Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Fri, 23 Sep 2022 09:44:07 -0400 Subject: [PATCH] [tools] Add 'run_tests.sh' to the dev-only list Ensures that `run_tests.sh` changes are treaded as developer-only files, so that they won't trigger version and changelog requirements. Fixes https://github.com/flutter/flutter/issues/112215 --- script/tool/CHANGELOG.md | 4 +++ .../lib/src/common/package_state_utils.dart | 3 ++ script/tool/pubspec.yaml | 2 +- .../test/common/package_state_utils_test.dart | 1 + .../tool/test/version_check_command_test.dart | 32 +++++++++++++++++++ 5 files changed, 41 insertions(+), 1 deletion(-) diff --git a/script/tool/CHANGELOG.md b/script/tool/CHANGELOG.md index 8dbb4840a672..e5e1d8a6dfb6 100644 --- a/script/tool/CHANGELOG.md +++ b/script/tool/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.10.0+1 + +* Recognizes `run_test.sh` as a developer-only file in `version-check`. + ## 0.10.0 * Improves the logic in `version-check` to determine what changes don't require diff --git a/script/tool/lib/src/common/package_state_utils.dart b/script/tool/lib/src/common/package_state_utils.dart index 1cff65bb6b0c..c9465876f290 100644 --- a/script/tool/lib/src/common/package_state_utils.dart +++ b/script/tool/lib/src/common/package_state_utils.dart @@ -168,6 +168,9 @@ Future _isDevChange(List pathComponents, // The top-level "tool" directory is for non-client-facing utility // code, such as test scripts. pathComponents.first == 'tool' || + // Entry point for the 'custom-test' command, which is only for CI and + // local testing. + pathComponents.first == 'run_tests.sh' || // Ignoring lints doesn't affect clients. pathComponents.contains('lint-baseline.xml') || await _isGradleTestDependencyChange(pathComponents, diff --git a/script/tool/pubspec.yaml b/script/tool/pubspec.yaml index e51c7433aa5c..9b9d73288552 100644 --- a/script/tool/pubspec.yaml +++ b/script/tool/pubspec.yaml @@ -1,7 +1,7 @@ name: flutter_plugin_tools description: Productivity utils for flutter/plugins and flutter/packages repository: https://github.com/flutter/plugins/tree/main/script/tool -version: 0.10.0 +version: 0.10.0+1 dependencies: args: ^2.1.0 diff --git a/script/tool/test/common/package_state_utils_test.dart b/script/tool/test/common/package_state_utils_test.dart index 63ac1802e70c..c20951876e39 100644 --- a/script/tool/test/common/package_state_utils_test.dart +++ b/script/tool/test/common/package_state_utils_test.dart @@ -66,6 +66,7 @@ void main() { 'packages/a_plugin/example/ios/RunnerTests/Foo.m', 'packages/a_plugin/example/ios/RunnerUITests/info.plist', 'packages/a_plugin/tool/a_development_tool.dart', + 'packages/a_plugin/run_tests.sh', 'packages/a_plugin/CHANGELOG.md', ]; diff --git a/script/tool/test/version_check_command_test.dart b/script/tool/test/version_check_command_test.dart index 2ff48d618258..0e94712e9ef0 100644 --- a/script/tool/test/version_check_command_test.dart +++ b/script/tool/test/version_check_command_test.dart @@ -1059,6 +1059,38 @@ packages/plugin/android/build.gradle ]), ); }); + + test('allows missing CHANGELOG and version change for dev-only changes', + () async { + final RepositoryPackage plugin = + createFakePlugin('plugin', packagesDir, version: '1.0.0'); + + const String changelog = ''' +## 1.0.0 +* Some changes. +'''; + plugin.changelogFile.writeAsStringSync(changelog); + processRunner.mockProcessesForExecutable['git-show'] = [ + MockProcess(stdout: 'version: 1.0.0'), + ]; + processRunner.mockProcessesForExecutable['git-diff'] = [ + // File list. + MockProcess(stdout: ''' +packages/plugin/tool/run_tests.dart +packages/plugin/run_tests.sh +'''), + ]; + + final List output = + await _runWithMissingChangeDetection([]); + + expect( + output, + containsAllInOrder([ + contains('Running for plugin'), + ]), + ); + }); }); test('allows valid against pub', () async {