diff --git a/script/tool/lib/src/common/cmake.dart b/script/tool/lib/src/common/cmake.dart index 04ad880292..3f5d8452bd 100644 --- a/script/tool/lib/src/common/cmake.dart +++ b/script/tool/lib/src/common/cmake.dart @@ -3,9 +3,9 @@ // found in the LICENSE file. import 'package:file/file.dart'; -import 'package:flutter_plugin_tools/src/common/core.dart'; import 'package:platform/platform.dart'; +import 'core.dart'; import 'process_runner.dart'; const String _cacheCommandKey = 'CMAKE_COMMAND:INTERNAL'; diff --git a/script/tool/lib/src/common/package_state_utils.dart b/script/tool/lib/src/common/package_state_utils.dart index 870956a24b..a0c82400e1 100644 --- a/script/tool/lib/src/common/package_state_utils.dart +++ b/script/tool/lib/src/common/package_state_utils.dart @@ -3,10 +3,10 @@ // found in the LICENSE file. import 'package:file/file.dart'; -import 'package:flutter_plugin_tools/src/common/git_version_finder.dart'; import 'package:meta/meta.dart'; import 'package:path/path.dart' as p; +import 'git_version_finder.dart'; import 'repository_package.dart'; /// The state of a package on disk relative to git state. diff --git a/script/tool/lib/src/common/plugin_utils.dart b/script/tool/lib/src/common/plugin_utils.dart index f33d3d73bb..94677fe7e5 100644 --- a/script/tool/lib/src/common/plugin_utils.dart +++ b/script/tool/lib/src/common/plugin_utils.dart @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'package:flutter_plugin_tools/src/common/repository_package.dart'; import 'package:yaml/yaml.dart'; import 'core.dart'; +import 'repository_package.dart'; /// Possible plugin support options for a platform. enum PlatformSupport { diff --git a/script/tool/lib/src/federation_safety_check_command.dart b/script/tool/lib/src/federation_safety_check_command.dart index 383637a9e8..93a832eb0e 100644 --- a/script/tool/lib/src/federation_safety_check_command.dart +++ b/script/tool/lib/src/federation_safety_check_command.dart @@ -3,7 +3,6 @@ // found in the LICENSE file. import 'package:file/file.dart'; -import 'package:flutter_plugin_tools/src/common/plugin_utils.dart'; import 'package:git/git.dart'; import 'package:path/path.dart' as p; import 'package:platform/platform.dart'; @@ -13,6 +12,7 @@ import 'common/core.dart'; import 'common/file_utils.dart'; import 'common/git_version_finder.dart'; import 'common/package_looping_command.dart'; +import 'common/plugin_utils.dart'; import 'common/process_runner.dart'; import 'common/repository_package.dart'; diff --git a/script/tool/lib/src/lint_android_command.dart b/script/tool/lib/src/lint_android_command.dart index 607674c80d..eb78ce8916 100644 --- a/script/tool/lib/src/lint_android_command.dart +++ b/script/tool/lib/src/lint_android_command.dart @@ -3,12 +3,12 @@ // found in the LICENSE file. import 'package:file/file.dart'; -import 'package:flutter_plugin_tools/src/common/plugin_utils.dart'; import 'package:platform/platform.dart'; import 'common/core.dart'; import 'common/gradle.dart'; import 'common/package_looping_command.dart'; +import 'common/plugin_utils.dart'; import 'common/process_runner.dart'; import 'common/repository_package.dart'; diff --git a/script/tool/lib/src/main.dart b/script/tool/lib/src/main.dart index 0f73c71e84..078976d973 100644 --- a/script/tool/lib/src/main.dart +++ b/script/tool/lib/src/main.dart @@ -7,13 +7,13 @@ import 'dart:io' as io; import 'package:args/command_runner.dart'; import 'package:file/file.dart'; import 'package:file/local.dart'; -import 'package:flutter_plugin_tools/src/dependabot_check_command.dart'; import 'analyze_command.dart'; import 'build_examples_command.dart'; import 'common/core.dart'; import 'create_all_plugins_app_command.dart'; import 'custom_test_command.dart'; +import 'dependabot_check_command.dart'; import 'drive_examples_command.dart'; import 'federation_safety_check_command.dart'; import 'firebase_test_lab_command.dart'; diff --git a/script/tool/lib/src/make_deps_path_based_command.dart b/script/tool/lib/src/make_deps_path_based_command.dart index a09511ad7f..10abcd44ae 100644 --- a/script/tool/lib/src/make_deps_path_based_command.dart +++ b/script/tool/lib/src/make_deps_path_based_command.dart @@ -158,10 +158,12 @@ class MakeDepsPathBasedCommand extends PackageCommand { ...pubspec.dependencies.keys, ...pubspec.devDependencies.keys, ]; - final Iterable packagesToOverride = combinedDependencies + final List packagesToOverride = combinedDependencies .where( (String packageName) => localDependencies.containsKey(packageName)) .toList(); + // Sort the combined list to avoid sort_pub_dependencies lint violations. + packagesToOverride.sort(); if (packagesToOverride.isNotEmpty) { final String commonBasePath = packagesDir.path; // Find the relative path to the common base. diff --git a/script/tool/lib/src/update_excerpts_command.dart b/script/tool/lib/src/update_excerpts_command.dart index 320a3c5963..5a59104d4e 100644 --- a/script/tool/lib/src/update_excerpts_command.dart +++ b/script/tool/lib/src/update_excerpts_command.dart @@ -5,12 +5,12 @@ import 'dart:io' as io; import 'package:file/file.dart'; -import 'package:flutter_plugin_tools/src/common/core.dart'; import 'package:git/git.dart'; import 'package:platform/platform.dart'; import 'package:yaml/yaml.dart'; import 'package:yaml_edit/yaml_edit.dart'; +import 'common/core.dart'; import 'common/package_looping_command.dart'; import 'common/process_runner.dart'; import 'common/repository_package.dart'; diff --git a/script/tool/lib/src/update_release_info_command.dart b/script/tool/lib/src/update_release_info_command.dart index 465b475eb9..67aa994d96 100644 --- a/script/tool/lib/src/update_release_info_command.dart +++ b/script/tool/lib/src/update_release_info_command.dart @@ -4,11 +4,11 @@ import 'package:args/command_runner.dart'; import 'package:file/file.dart'; -import 'package:flutter_plugin_tools/src/common/core.dart'; import 'package:git/git.dart'; import 'package:pub_semver/pub_semver.dart'; import 'package:yaml_edit/yaml_edit.dart'; +import 'common/core.dart'; import 'common/git_version_finder.dart'; import 'common/package_looping_command.dart'; import 'common/package_state_utils.dart'; diff --git a/script/tool/test/make_deps_path_based_command_test.dart b/script/tool/test/make_deps_path_based_command_test.dart index 7e52dd6bbb..36753e8001 100644 --- a/script/tool/test/make_deps_path_based_command_test.dart +++ b/script/tool/test/make_deps_path_based_command_test.dart @@ -184,6 +184,42 @@ ${devDependencies.map((String dep) => ' $dep: ^1.0.0').join('\n')} ])); }); + test( + 'alphabetizes overrides from different sectinos to avoid lint warnings in analysis', + () async { + createFakePackage('a', packagesDir); + createFakePackage('b', packagesDir); + createFakePackage('c', packagesDir); + final RepositoryPackage targetPackage = + createFakePackage('target', packagesDir); + + _addDependencies(targetPackage, ['a', 'c']); + _addDevDependenciesSection(targetPackage, ['b']); + + final List output = await runCapturingPrint(runner, + ['make-deps-path-based', '--target-dependencies=c,a,b']); + + expect( + output, + containsAllInOrder([ + 'Rewriting references to: c, a, b...', + ' Modified packages/target/pubspec.yaml', + ])); + + expect( + targetPackage.pubspecFile.readAsLinesSync(), + containsAllInOrder([ + '# FOR TESTING ONLY. DO NOT MERGE.', + 'dependency_overrides:', + ' a:', + ' path: ../a', + ' b:', + ' path: ../b', + ' c:', + ' path: ../c', + ])); + }); + // This test case ensures that running CI using this command on an interim // PR that itself used this command won't fail on the rewrite step. test('running a second time no-ops without failing', () async {