Skip to content

Commit c65c473

Browse files
author
Anna Gringauze
authored
Allow running build daemon tests in canary mode (#2171)
* Add canary option for build daemon tests * Updated build_web_compilers and added tests * Fix webdev test failure * Updated PR reference and built
1 parent f0ba743 commit c65c473

File tree

22 files changed

+57
-21
lines changed

22 files changed

+57
-21
lines changed

dwds/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
- Require clients to specify the `basePath` on `AssetReader`. - [#2160](https://github.com/dart-lang/webdev/pull/2160)
44
- Update SDK constraint to `>=3.1.0-254.0.dev <4.0.0`. - [#2169](https://github.com/dart-lang/webdev/pull/2169)
5+
- Require min `build_web_compilers` version `4.0.4` - [#2171](https://github.com/dart-lang/webdev/pull/2171)
56

67
## 19.0.2
78

dwds/debug_extension/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ dependencies:
1818

1919
dev_dependencies:
2020
build: ^2.0.0
21-
build_web_compilers: ^4.0.0
21+
build_web_compilers: ^4.0.4
2222
build_runner: ^2.4.0
2323
built_collection: ^5.0.0
2424
dwds: ^11.0.0

dwds/debug_extension_mv3/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ dev_dependencies:
1818
build_runner: ^2.4.0
1919
built_collection: ^5.0.0
2020
built_value_generator: ^8.3.0
21-
build_web_compilers: ^4.0.0
21+
build_web_compilers: ^4.0.4
2222
dwds: ^16.0.0
2323
sse: ^4.1.2
2424
web_socket_channel: ^2.2.0

dwds/lib/src/services/expression_compiler_service.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ class _Compiler {
6868
bool soundNullSafety,
6969
SdkConfiguration sdkConfiguration,
7070
List<String> experiments,
71+
bool canaryFeatures,
7172
bool verbose,
7273
) async {
7374
sdkConfiguration.validateSdkDir();
@@ -95,6 +96,7 @@ class _Compiler {
9596
if (verbose) '--verbose',
9697
soundNullSafety ? '--sound-null-safety' : '--no-sound-null-safety',
9798
for (final experiment in experiments) '--enable-experiment=$experiment',
99+
if (canaryFeatures) '--canary',
98100
];
99101

100102
_logger.info('Starting...');
@@ -240,6 +242,7 @@ class ExpressionCompilerService implements ExpressionCompiler {
240242
final String _address;
241243
final FutureOr<int> _port;
242244
final List<String> experiments;
245+
final bool canaryFeatures;
243246
final bool _verbose;
244247

245248
final SdkConfigurationProvider sdkConfigurationProvider;
@@ -250,6 +253,7 @@ class ExpressionCompilerService implements ExpressionCompiler {
250253
bool verbose = false,
251254
required this.sdkConfigurationProvider,
252255
this.experiments = const [],
256+
this.canaryFeatures = false,
253257
}) : _verbose = verbose;
254258

255259
@override
@@ -287,6 +291,7 @@ class ExpressionCompilerService implements ExpressionCompiler {
287291
soundNullSafety,
288292
await sdkConfigurationProvider.configuration,
289293
experiments,
294+
canaryFeatures,
290295
_verbose,
291296
);
292297

dwds/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ dev_dependencies:
4343
build_daemon: ^4.0.0
4444
build_runner: ^2.4.0
4545
build_version: ^2.1.1
46-
build_web_compilers: ^4.0.0
46+
build_web_compilers: ^4.0.4
4747
built_value_generator: ^8.3.0
4848
dart_code_metrics: ^5.5.0
4949
graphs: ^2.1.0

dwds/test/fixtures/context.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,12 @@ class TestContext {
225225
],
226226
for (final experiment in experiments)
227227
'--enable-experiment=$experiment',
228+
if (canaryFeatures) ...[
229+
'--define',
230+
'build_web_compilers|ddc=canary=true',
231+
'--define',
232+
'build_web_compilers|sdk_js=canary=true',
233+
],
228234
'--verbose',
229235
];
230236
_daemonClient = await connectClient(
@@ -265,6 +271,7 @@ class TestContext {
265271
verbose: verboseCompiler,
266272
sdkConfigurationProvider: sdkConfigurationProvider,
267273
experiments: experiments,
274+
canaryFeatures: canaryFeatures,
268275
);
269276
expressionCompiler = ddcService;
270277
}

dwds/test/instances/instance_canary_test.dart

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@ void main() {
1818
// Enable verbose logging for debugging.
1919
final debug = false;
2020

21-
_runAllTests(
22-
canaryFeatures: true,
23-
compilationMode: CompilationMode.frontendServer,
24-
debug: debug,
25-
);
21+
for (var compilationMode in CompilationMode.values) {
22+
_runAllTests(
23+
canaryFeatures: true,
24+
compilationMode: compilationMode,
25+
debug: debug,
26+
);
27+
}
2628
}
2729

2830
void _runAllTests({

dwds/test/instances/instance_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ void main() {
2323
final provider = TestSdkConfigurationProvider(verbose: debug);
2424
tearDownAll(provider.dispose);
2525

26-
for (var compilationMode in [CompilationMode.frontendServer]) {
26+
for (var compilationMode in CompilationMode.values) {
2727
_runTests(
2828
provider: provider,
2929
compilationMode: compilationMode,

example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ environment:
88

99
dev_dependencies:
1010
build_runner: ^2.4.0
11-
build_web_compilers: ^4.0.0
11+
build_web_compilers: ^4.0.4

fixtures/_experimentSound/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ dependencies:
1313

1414
dev_dependencies:
1515
build_runner: ^2.4.0
16-
build_web_compilers: ^4.0.0
16+
build_web_compilers: ^4.0.4

fixtures/_testCircular1Sound/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ dependencies:
1515

1616
dev_dependencies:
1717
build_runner: ^2.4.0
18-
build_web_compilers: ^4.0.0
18+
build_web_compilers: ^4.0.4
1919

fixtures/_testCircular2Sound/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ dependencies:
1313

1414
dev_dependencies:
1515
build_runner: ^2.4.0
16-
build_web_compilers: ^4.0.0
16+
build_web_compilers: ^4.0.4
1717

fixtures/_testPackageSound/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ dependencies:
1313

1414
dev_dependencies:
1515
build_runner: ^2.4.0
16-
build_web_compilers: ^4.0.0
16+
build_web_compilers: ^4.0.4
1717

fixtures/_testSound/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ dependencies:
1313

1414
dev_dependencies:
1515
build_runner: ^2.4.0
16-
build_web_compilers: ^4.0.0
16+
build_web_compilers: ^4.0.4
1717

fixtures/_webdevSoundSmoke/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ environment:
88

99
dev_dependencies:
1010
build_runner: ^2.4.0
11-
build_web_compilers: ^4.0.0
11+
build_web_compilers: ^4.0.4

webdev/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
## 3.0.7-wip
22

3+
- Update `build_web_compilers` constraint to `^4.0.4`.
4+
35
## 3.0.6
46

57
- Update `dwds` constraint to `19.0.2`.

webdev/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ similar to:
1111
...
1212
dev_dependencies:
1313
build_runner: ^2.4.0
14-
build_web_compilers: ^4.0.0
14+
build_web_compilers: ^4.0.4
1515
...
1616
```
1717

webdev/lib/src/command/configuration.dart

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const nullSafetyUnsound = 'unsound';
3636
const nullSafetyAuto = 'auto';
3737
const disableDdsFlag = 'disable-dds';
3838
const enableExperimentOption = 'enable-experiment';
39+
const canaryFeaturesFlag = 'canary';
3940

4041
ReloadConfiguration _parseReloadConfiguration(ArgResults argResults) {
4142
var auto = argResults.options.contains(autoOption)
@@ -105,6 +106,7 @@ class Configuration {
105106
final bool? _disableDds;
106107
final String? _nullSafety;
107108
final List<String>? _experiments;
109+
final bool? _canaryFeatures;
108110

109111
Configuration({
110112
bool? autoRun,
@@ -130,6 +132,7 @@ class Configuration {
130132
bool? disableDds,
131133
String? nullSafety,
132134
List<String>? experiments,
135+
bool? canaryFeatures,
133136
}) : _autoRun = autoRun,
134137
_chromeDebugPort = chromeDebugPort,
135138
_debugExtension = debugExtension,
@@ -150,7 +153,8 @@ class Configuration {
150153
_enableExpressionEvaluation = enableExpressionEvaluation,
151154
_verbose = verbose,
152155
_nullSafety = nullSafety,
153-
_experiments = experiments {
156+
_experiments = experiments,
157+
_canaryFeatures = canaryFeatures {
154158
_validateConfiguration();
155159
}
156160

@@ -224,7 +228,8 @@ class Configuration {
224228
other._enableExpressionEvaluation ?? _enableExpressionEvaluation,
225229
verbose: other._verbose ?? _verbose,
226230
nullSafety: other._nullSafety ?? _nullSafety,
227-
experiments: other._experiments ?? _experiments);
231+
experiments: other._experiments ?? _experiments,
232+
canaryFeatures: other._canaryFeatures ?? _canaryFeatures);
228233

229234
factory Configuration.noInjectedClientDefaults() =>
230235
Configuration(autoRun: false, debug: false, debugExtension: false);
@@ -277,6 +282,8 @@ class Configuration {
277282

278283
List<String> get experiments => _experiments ?? [];
279284

285+
bool get canaryFeatures => _canaryFeatures ?? false;
286+
280287
/// Returns a new configuration with values updated from the parsed args.
281288
static Configuration fromArgs(ArgResults? argResults,
282289
{Configuration? defaultConfiguration}) {
@@ -397,6 +404,10 @@ class Configuration {
397404
? argResults[enableExperimentOption] as List<String>?
398405
: defaultConfiguration.experiments;
399406

407+
var canaryFeatures = argResults.options.contains(canaryFeaturesFlag)
408+
? argResults[canaryFeaturesFlag] as bool?
409+
: defaultConfiguration.canaryFeatures;
410+
400411
return Configuration(
401412
autoRun: defaultConfiguration.autoRun,
402413
chromeDebugPort: chromeDebugPort,
@@ -421,6 +432,7 @@ class Configuration {
421432
verbose: verbose,
422433
nullSafety: nullSafety,
423434
experiments: experiments,
435+
canaryFeatures: canaryFeatures,
424436
);
425437
}
426438
}

webdev/lib/src/command/shared.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ void addSharedArgs(ArgParser argParser,
6363
defaultsTo: null,
6464
hide: true,
6565
help: 'Enable experiment features in the debugger.')
66+
..addFlag(canaryFeaturesFlag,
67+
abbr: 'c',
68+
defaultsTo: false,
69+
negatable: true,
70+
hide: true,
71+
help: 'Enables DDC canary features.')
6672
..addFlag(verboseFlag,
6773
abbr: 'v',
6874
defaultsTo: false,

webdev/lib/src/pubspec.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ Future<List<PackageExceptionDetails>> _validateBuildDaemonVersion(
162162
}
163163

164164
final buildRunnerConstraint = VersionConstraint.parse('^2.4.0');
165-
final buildWebCompilersConstraint = VersionConstraint.parse('^4.0.0');
165+
final buildWebCompilersConstraint = VersionConstraint.parse('^4.0.4');
166166

167167
// Note the minimum versions should never be dev versions as users will not
168168
// get them by default.

webdev/lib/src/serve/webdev_server.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ class WebDevServer {
139139
verbose: options.configuration.verbose,
140140
experiments: options.configuration.experiments,
141141
sdkConfigurationProvider: const DefaultSdkConfigurationProvider(),
142+
canaryFeatures: options.configuration.canaryFeatures,
142143
);
143144
}
144145
var shouldServeDevTools =

webdev/test/integration_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ dependencies:
264264
}
265265

266266
const _supportedBuildRunnerVersion = '2.4.0';
267-
const _supportedWebCompilersVersion = '4.0.0';
267+
const _supportedWebCompilersVersion = '4.0.4';
268268
const _supportedBuildDaemonVersion = '4.0.0';
269269

270270
String _pubspecYaml = '''

0 commit comments

Comments
 (0)