mirror of
https://github.com/flutter/packages.git
synced 2025-06-17 20:19:14 +08:00
[tool] Improve changed-package run mode logging (#6521)
This commit is contained in:
@ -338,11 +338,14 @@ abstract class PackageCommand extends Command<void> {
|
|||||||
|
|
||||||
if (changedFileFinder != null) {
|
if (changedFileFinder != null) {
|
||||||
final String baseSha = await changedFileFinder.getBaseSha();
|
final String baseSha = await changedFileFinder.getBaseSha();
|
||||||
print(
|
|
||||||
'Running for all packages that have diffs relative to "$baseSha"\n');
|
|
||||||
final List<String> changedFiles =
|
final List<String> changedFiles =
|
||||||
await changedFileFinder.getChangedFiles();
|
await changedFileFinder.getChangedFiles();
|
||||||
if (!_changesRequireFullTest(changedFiles)) {
|
if (_changesRequireFullTest(changedFiles)) {
|
||||||
|
print('Running for all packages, since a file has changed that could '
|
||||||
|
'affect the entire repository.');
|
||||||
|
} else {
|
||||||
|
print(
|
||||||
|
'Running for all packages that have diffs relative to "$baseSha"\n');
|
||||||
packages = _getChangedPackageNames(changedFiles);
|
packages = _getChangedPackageNames(changedFiles);
|
||||||
}
|
}
|
||||||
} else if (getBoolArg(_runOnDirtyPackagesArg)) {
|
} else if (getBoolArg(_runOnDirtyPackagesArg)) {
|
||||||
|
@ -408,11 +408,18 @@ packages/plugin1/CHANGELOG
|
|||||||
createFakePlugin('plugin1', packagesDir);
|
createFakePlugin('plugin1', packagesDir);
|
||||||
final RepositoryPackage plugin2 =
|
final RepositoryPackage plugin2 =
|
||||||
createFakePlugin('plugin2', packagesDir);
|
createFakePlugin('plugin2', packagesDir);
|
||||||
await runCapturingPrint(runner,
|
|
||||||
|
final List<String> output = await runCapturingPrint(runner,
|
||||||
<String>['sample', '--base-sha=main', '--run-on-changed-packages']);
|
<String>['sample', '--base-sha=main', '--run-on-changed-packages']);
|
||||||
|
|
||||||
expect(command.plugins,
|
expect(command.plugins,
|
||||||
unorderedEquals(<String>[plugin1.path, plugin2.path]));
|
unorderedEquals(<String>[plugin1.path, plugin2.path]));
|
||||||
|
expect(
|
||||||
|
output,
|
||||||
|
containsAllInOrder(<Matcher>[
|
||||||
|
contains('Running for all packages, since a file has changed '
|
||||||
|
'that could affect the entire repository.')
|
||||||
|
]));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('all plugins should be tested if .ci.yaml changes', () async {
|
test('all plugins should be tested if .ci.yaml changes', () async {
|
||||||
@ -426,11 +433,17 @@ packages/plugin1/CHANGELOG
|
|||||||
createFakePlugin('plugin1', packagesDir);
|
createFakePlugin('plugin1', packagesDir);
|
||||||
final RepositoryPackage plugin2 =
|
final RepositoryPackage plugin2 =
|
||||||
createFakePlugin('plugin2', packagesDir);
|
createFakePlugin('plugin2', packagesDir);
|
||||||
await runCapturingPrint(runner,
|
final List<String> output = await runCapturingPrint(runner,
|
||||||
<String>['sample', '--base-sha=main', '--run-on-changed-packages']);
|
<String>['sample', '--base-sha=main', '--run-on-changed-packages']);
|
||||||
|
|
||||||
expect(command.plugins,
|
expect(command.plugins,
|
||||||
unorderedEquals(<String>[plugin1.path, plugin2.path]));
|
unorderedEquals(<String>[plugin1.path, plugin2.path]));
|
||||||
|
expect(
|
||||||
|
output,
|
||||||
|
containsAllInOrder(<Matcher>[
|
||||||
|
contains('Running for all packages, since a file has changed '
|
||||||
|
'that could affect the entire repository.')
|
||||||
|
]));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('all plugins should be tested if anything in .ci/ changes',
|
test('all plugins should be tested if anything in .ci/ changes',
|
||||||
@ -445,14 +458,20 @@ packages/plugin1/CHANGELOG
|
|||||||
createFakePlugin('plugin1', packagesDir);
|
createFakePlugin('plugin1', packagesDir);
|
||||||
final RepositoryPackage plugin2 =
|
final RepositoryPackage plugin2 =
|
||||||
createFakePlugin('plugin2', packagesDir);
|
createFakePlugin('plugin2', packagesDir);
|
||||||
await runCapturingPrint(runner,
|
final List<String> output = await runCapturingPrint(runner,
|
||||||
<String>['sample', '--base-sha=main', '--run-on-changed-packages']);
|
<String>['sample', '--base-sha=main', '--run-on-changed-packages']);
|
||||||
|
|
||||||
expect(command.plugins,
|
expect(command.plugins,
|
||||||
unorderedEquals(<String>[plugin1.path, plugin2.path]));
|
unorderedEquals(<String>[plugin1.path, plugin2.path]));
|
||||||
|
expect(
|
||||||
|
output,
|
||||||
|
containsAllInOrder(<Matcher>[
|
||||||
|
contains('Running for all packages, since a file has changed '
|
||||||
|
'that could affect the entire repository.')
|
||||||
|
]));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('all plugins should be tested if anything in script changes.',
|
test('all plugins should be tested if anything in script/ changes.',
|
||||||
() async {
|
() async {
|
||||||
processRunner.mockProcessesForExecutable['git-diff'] = <Process>[
|
processRunner.mockProcessesForExecutable['git-diff'] = <Process>[
|
||||||
MockProcess(stdout: '''
|
MockProcess(stdout: '''
|
||||||
@ -464,11 +483,17 @@ packages/plugin1/CHANGELOG
|
|||||||
createFakePlugin('plugin1', packagesDir);
|
createFakePlugin('plugin1', packagesDir);
|
||||||
final RepositoryPackage plugin2 =
|
final RepositoryPackage plugin2 =
|
||||||
createFakePlugin('plugin2', packagesDir);
|
createFakePlugin('plugin2', packagesDir);
|
||||||
await runCapturingPrint(runner,
|
final List<String> output = await runCapturingPrint(runner,
|
||||||
<String>['sample', '--base-sha=main', '--run-on-changed-packages']);
|
<String>['sample', '--base-sha=main', '--run-on-changed-packages']);
|
||||||
|
|
||||||
expect(command.plugins,
|
expect(command.plugins,
|
||||||
unorderedEquals(<String>[plugin1.path, plugin2.path]));
|
unorderedEquals(<String>[plugin1.path, plugin2.path]));
|
||||||
|
expect(
|
||||||
|
output,
|
||||||
|
containsAllInOrder(<Matcher>[
|
||||||
|
contains('Running for all packages, since a file has changed '
|
||||||
|
'that could affect the entire repository.')
|
||||||
|
]));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('all plugins should be tested if the root analysis options change.',
|
test('all plugins should be tested if the root analysis options change.',
|
||||||
@ -483,11 +508,17 @@ packages/plugin1/CHANGELOG
|
|||||||
createFakePlugin('plugin1', packagesDir);
|
createFakePlugin('plugin1', packagesDir);
|
||||||
final RepositoryPackage plugin2 =
|
final RepositoryPackage plugin2 =
|
||||||
createFakePlugin('plugin2', packagesDir);
|
createFakePlugin('plugin2', packagesDir);
|
||||||
await runCapturingPrint(runner,
|
final List<String> output = await runCapturingPrint(runner,
|
||||||
<String>['sample', '--base-sha=main', '--run-on-changed-packages']);
|
<String>['sample', '--base-sha=main', '--run-on-changed-packages']);
|
||||||
|
|
||||||
expect(command.plugins,
|
expect(command.plugins,
|
||||||
unorderedEquals(<String>[plugin1.path, plugin2.path]));
|
unorderedEquals(<String>[plugin1.path, plugin2.path]));
|
||||||
|
expect(
|
||||||
|
output,
|
||||||
|
containsAllInOrder(<Matcher>[
|
||||||
|
contains('Running for all packages, since a file has changed '
|
||||||
|
'that could affect the entire repository.')
|
||||||
|
]));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('all plugins should be tested if formatting options change.',
|
test('all plugins should be tested if formatting options change.',
|
||||||
@ -502,11 +533,17 @@ packages/plugin1/CHANGELOG
|
|||||||
createFakePlugin('plugin1', packagesDir);
|
createFakePlugin('plugin1', packagesDir);
|
||||||
final RepositoryPackage plugin2 =
|
final RepositoryPackage plugin2 =
|
||||||
createFakePlugin('plugin2', packagesDir);
|
createFakePlugin('plugin2', packagesDir);
|
||||||
await runCapturingPrint(runner,
|
final List<String> output = await runCapturingPrint(runner,
|
||||||
<String>['sample', '--base-sha=main', '--run-on-changed-packages']);
|
<String>['sample', '--base-sha=main', '--run-on-changed-packages']);
|
||||||
|
|
||||||
expect(command.plugins,
|
expect(command.plugins,
|
||||||
unorderedEquals(<String>[plugin1.path, plugin2.path]));
|
unorderedEquals(<String>[plugin1.path, plugin2.path]));
|
||||||
|
expect(
|
||||||
|
output,
|
||||||
|
containsAllInOrder(<Matcher>[
|
||||||
|
contains('Running for all packages, since a file has changed '
|
||||||
|
'that could affect the entire repository.')
|
||||||
|
]));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Only changed plugin should be tested.', () async {
|
test('Only changed plugin should be tested.', () async {
|
||||||
|
Reference in New Issue
Block a user