Skip to content

Commit fa0b74b

Browse files
authoredApr 14, 2025
Add support for hot restart tests in DWDS with the frontend server (#2608)
- Aligns the bootstrap script with Flutter tools for the DDC library bundle format. This includes adding the dartReloadModifiedModules callback and the script to wait until all sources are loaded before calling main. - Aligns the recompile code with Flutter tools. This includes adding support for detecting invalidated files, using recompile-restart, and writing a script that DWDS can use to detect files for a hot restart. - Refactors hot restart tests into shared test code that is now tested both with the build daemon and the frontend server. Tests that rely on build events are skipped in the frontend server by design and tests that rely on deferring main are skipped with the new DDC library bundle format until dart-lang/sdk#60528 is resolved. Tests are also renamed to use "restart" instead of "reload" to distinguish from hot reload tests, which will be added in a future CL.
1 parent c8b1cfa commit fa0b74b

16 files changed

+1406
-907
lines changed
 

‎dwds/CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
## 24.3.11-wip
2+
13
## 24.3.10
24

35
- Disabled breakpoints on changed files in a hot reload. They currently do not

‎dwds/lib/src/version.dart

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dwds/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: dwds
22
# Every time this changes you need to run `dart run build_runner build`.
3-
version: 24.3.10
3+
version: 24.3.11-wip
44
description: >-
55
A service that proxies between the Chrome debug protocol and the Dart VM
66
service protocol.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
@TestOn('vm')
6+
@Tags(['daily'])
7+
@Timeout(Duration(minutes: 2))
8+
library;
9+
10+
import 'package:dwds/expression_compiler.dart';
11+
import 'package:test/test.dart';
12+
import 'package:test_common/test_sdk_configuration.dart';
13+
14+
import 'common/hot_restart_correctness_common.dart';
15+
import 'fixtures/context.dart';
16+
17+
void main() {
18+
// Enable verbose logging for debugging.
19+
final debug = false;
20+
final canaryFeatures = false;
21+
final moduleFormat = ModuleFormat.amd;
22+
final compilationMode = CompilationMode.buildDaemon;
23+
24+
final provider = TestSdkConfigurationProvider(
25+
verbose: debug,
26+
canaryFeatures: canaryFeatures,
27+
ddcModuleFormat: moduleFormat,
28+
);
29+
30+
runTests(
31+
provider: provider,
32+
moduleFormat: moduleFormat,
33+
compilationMode: compilationMode,
34+
canaryFeatures: canaryFeatures,
35+
debug: debug,
36+
);
37+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
@TestOn('vm')
6+
@Tags(['daily'])
7+
@Timeout(Duration(minutes: 2))
8+
library;
9+
10+
import 'package:dwds/expression_compiler.dart';
11+
import 'package:test/test.dart';
12+
import 'package:test_common/test_sdk_configuration.dart';
13+
14+
import 'common/hot_restart_common.dart';
15+
import 'fixtures/context.dart';
16+
17+
void main() {
18+
// Enable verbose logging for debugging.
19+
final debug = false;
20+
final canaryFeatures = false;
21+
final moduleFormat = ModuleFormat.amd;
22+
final compilationMode = CompilationMode.buildDaemon;
23+
24+
final provider = TestSdkConfigurationProvider(
25+
verbose: debug,
26+
canaryFeatures: canaryFeatures,
27+
ddcModuleFormat: moduleFormat,
28+
);
29+
30+
runTests(
31+
provider: provider,
32+
moduleFormat: moduleFormat,
33+
compilationMode: compilationMode,
34+
canaryFeatures: canaryFeatures,
35+
debug: debug,
36+
);
37+
}

0 commit comments

Comments
 (0)