Skip to content

Commit 6172458

Browse files
michaltcommit-bot@chromium.org
authored andcommitted
Trigger checks for generated files also on failed builds
Bug: http://b/183199080 Change-Id: If8a9baed10068f70d24a8831a093e4a4bf240303 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192383 Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Michal Terepeta <[email protected]>
1 parent 3ecbfd9 commit 6172458

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

pkg/analysis_server/test/integration/server/bazel_changes_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,15 +132,15 @@ void main() { my_fun(); }
132132
// error again.
133133
await resetCompleterAndErrors();
134134
writeFile(generatedFilePath, 'different_fun() {}');
135-
writeFile(commandLogPath, 'Build completed successfully');
135+
writeFile(commandLogPath, 'Build completed');
136136

137137
await processedNotification.future;
138138
expect(errors, isNotEmpty);
139139

140140
// Now delete the file completely.
141141
await resetCompleterAndErrors();
142142
File(generatedFilePath).deleteSync();
143-
writeFile(commandLogPath, 'Build completed successfully');
143+
writeFile(commandLogPath, 'Build did NOT complete successfully');
144144

145145
await processedNotification.future;
146146
expect(errors, isNotEmpty);

pkg/analyzer/lib/src/workspace/bazel_watcher.dart

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -435,9 +435,13 @@ class _BazelInvocationWatcher implements PollTrigger {
435435
/// Determines how often do we check for `command.log` changes.
436436
static const _pollInterval = Duration(seconds: 1);
437437

438-
/// To confirm that a build finished, we check for this message in the
438+
/// To confirm that a build finished, we check for these messages in the
439439
/// `command.log`.
440-
static const _buildCompletedMsg = 'Build completed successfully';
440+
static const _buildCompletedMsgs = [
441+
'Build completed successfully',
442+
'Build completed',
443+
'Build did NOT complete successfully',
444+
];
441445

442446
final _controller = StreamController<WatchEvent>.broadcast();
443447
final ResourceProvider _provider;
@@ -459,7 +463,7 @@ class _BazelInvocationWatcher implements PollTrigger {
459463
bool _buildFinished(String contents) {
460464
// Only look at the last 100 characters.
461465
var offset = max(0, contents.length - 100);
462-
return contents.contains(_buildCompletedMsg, offset);
466+
return _buildCompletedMsgs.any((msg) => contents.contains(msg, offset));
463467
}
464468

465469
Future<String?> _getCommandLogPath() async {

0 commit comments

Comments
 (0)