Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions app_dart/lib/src/service/scheduler/files_changed_optimization.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,25 +66,33 @@ final class FilesChangedOptimizer {
log.warn('$refusePrefix: $reason');
return FilesChangedOptimization.none;
case SuccessfulFilesChanged(:final filesChanged):
var markdownOnly = true;
var noSourceImpact = true;
for (final file in filesChanged) {
if (file == 'DEPS' || file.startsWith('engine/')) {
log.info(
'$refusePrefix: Engine sources changed.\n${filesChanged.join('\n')}',
);
return FilesChangedOptimization.none;
}
if (markdownOnly && p.posix.extension(file) != '.md') {
markdownOnly = false;
if (noSourceImpact &&
p.posix.extension(file) != '.md' &&

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at some point, not today, we'll probably want to refactor this to a chain filter or something.

file != _binInternalEngineVersion) {
noSourceImpact = false;
}
}
if (!markdownOnly) {
if (!noSourceImpact) {
return FilesChangedOptimization.skipPresubmitEngine;
} else {
return FilesChangedOptimization.skipPresubmitAllExceptFlutterAnalyze;
}
}
}

static final _binInternalEngineVersion = p.posix.join(
'bin',
'internal',
'engine.version',
);
}

/// Given a [FilesChanged], a determined safe optimization that can be made.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,26 @@ void main() {
);
});

test('include bin/internal/engine.version as ignored', () async {
final optimizer = FilesChangedOptimizer(
getFilesChanged: filesChanged([
'README.md',
'CONTRIBUTING.md',
'bin/internal/engine.version',
'packages/flutter_tools/lib/src/engine/NOT_THE_ENGINE.md',
]),
ciYamlFetcher: ciYamlFetcher(slug: Config.flutterSlug),
config: config(maxFilesChangedForSkippingEnginePhase: 100),
);

await expectLater(
optimizer.checkPullRequest(
generatePullRequest(repo: 'flutter', changedFilesCount: 4, number: 123),
),
completion(FilesChangedOptimization.skipPresubmitAllExceptFlutterAnalyze),
);
});

test('only non-engine files', () async {
final optimizer = FilesChangedOptimizer(
getFilesChanged: filesChanged(['packages/flutter/lib/flutter.dart']),
Expand Down