Skip to content

Allow running build daemon tests in canary mode #2171

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
1 change: 1 addition & 0 deletions dwds/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

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

## 19.0.2

Expand Down
2 changes: 1 addition & 1 deletion dwds/debug_extension/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dependencies:

dev_dependencies:
build: ^2.0.0
build_web_compilers: ^4.0.0
build_web_compilers: ^4.0.4
build_runner: ^2.4.0
built_collection: ^5.0.0
dwds: ^11.0.0
Expand Down
2 changes: 1 addition & 1 deletion dwds/debug_extension_mv3/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dev_dependencies:
build_runner: ^2.4.0
built_collection: ^5.0.0
built_value_generator: ^8.3.0
build_web_compilers: ^4.0.0
build_web_compilers: ^4.0.4
dwds: ^16.0.0
sse: ^4.1.2
web_socket_channel: ^2.2.0
Expand Down
5 changes: 5 additions & 0 deletions dwds/lib/src/services/expression_compiler_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class _Compiler {
bool soundNullSafety,
SdkConfiguration sdkConfiguration,
List<String> experiments,
bool canaryFeatures,
bool verbose,
) async {
sdkConfiguration.validateSdkDir();
Expand Down Expand Up @@ -95,6 +96,7 @@ class _Compiler {
if (verbose) '--verbose',
soundNullSafety ? '--sound-null-safety' : '--no-sound-null-safety',
for (final experiment in experiments) '--enable-experiment=$experiment',
if (canaryFeatures) '--canary',
];

_logger.info('Starting...');
Expand Down Expand Up @@ -240,6 +242,7 @@ class ExpressionCompilerService implements ExpressionCompiler {
final String _address;
final FutureOr<int> _port;
final List<String> experiments;
final bool canaryFeatures;
final bool _verbose;

final SdkConfigurationProvider sdkConfigurationProvider;
Expand All @@ -250,6 +253,7 @@ class ExpressionCompilerService implements ExpressionCompiler {
bool verbose = false,
required this.sdkConfigurationProvider,
this.experiments = const [],
this.canaryFeatures = false,
}) : _verbose = verbose;

@override
Expand Down Expand Up @@ -287,6 +291,7 @@ class ExpressionCompilerService implements ExpressionCompiler {
soundNullSafety,
await sdkConfigurationProvider.configuration,
experiments,
canaryFeatures,
_verbose,
);

Expand Down
2 changes: 1 addition & 1 deletion dwds/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ dev_dependencies:
build_daemon: ^4.0.0
build_runner: ^2.4.0
build_version: ^2.1.1
build_web_compilers: ^4.0.0
build_web_compilers: ^4.0.4
built_value_generator: ^8.3.0
dart_code_metrics: ^5.5.0
graphs: ^2.1.0
Expand Down
7 changes: 7 additions & 0 deletions dwds/test/fixtures/context.dart
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,12 @@ class TestContext {
],
for (final experiment in experiments)
'--enable-experiment=$experiment',
if (canaryFeatures) ...[
'--define',
'build_web_compilers|ddc=canary=true',
'--define',
'build_web_compilers|sdk_js=canary=true',
],
'--verbose',
];
_daemonClient = await connectClient(
Expand Down Expand Up @@ -265,6 +271,7 @@ class TestContext {
verbose: verboseCompiler,
sdkConfigurationProvider: sdkConfigurationProvider,
experiments: experiments,
canaryFeatures: canaryFeatures,
);
expressionCompiler = ddcService;
}
Expand Down
12 changes: 7 additions & 5 deletions dwds/test/instances/instance_canary_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ void main() {
// Enable verbose logging for debugging.
final debug = false;

_runAllTests(
canaryFeatures: true,
compilationMode: CompilationMode.frontendServer,
debug: debug,
);
for (var compilationMode in CompilationMode.values) {
_runAllTests(
canaryFeatures: true,
compilationMode: compilationMode,
debug: debug,
);
}
}

void _runAllTests({
Expand Down
2 changes: 1 addition & 1 deletion dwds/test/instances/instance_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void main() {
final provider = TestSdkConfigurationProvider(verbose: debug);
tearDownAll(provider.dispose);

for (var compilationMode in [CompilationMode.frontendServer]) {
for (var compilationMode in CompilationMode.values) {
_runTests(
provider: provider,
compilationMode: compilationMode,
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ environment:

dev_dependencies:
build_runner: ^2.4.0
build_web_compilers: ^4.0.0
build_web_compilers: ^4.0.4
2 changes: 1 addition & 1 deletion fixtures/_experimentSound/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ dependencies:

dev_dependencies:
build_runner: ^2.4.0
build_web_compilers: ^4.0.0
build_web_compilers: ^4.0.4
2 changes: 1 addition & 1 deletion fixtures/_testCircular1Sound/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ dependencies:

dev_dependencies:
build_runner: ^2.4.0
build_web_compilers: ^4.0.0
build_web_compilers: ^4.0.4

2 changes: 1 addition & 1 deletion fixtures/_testCircular2Sound/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ dependencies:

dev_dependencies:
build_runner: ^2.4.0
build_web_compilers: ^4.0.0
build_web_compilers: ^4.0.4

2 changes: 1 addition & 1 deletion fixtures/_testPackageSound/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ dependencies:

dev_dependencies:
build_runner: ^2.4.0
build_web_compilers: ^4.0.0
build_web_compilers: ^4.0.4

2 changes: 1 addition & 1 deletion fixtures/_testSound/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ dependencies:

dev_dependencies:
build_runner: ^2.4.0
build_web_compilers: ^4.0.0
build_web_compilers: ^4.0.4

2 changes: 1 addition & 1 deletion fixtures/_webdevSoundSmoke/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ environment:

dev_dependencies:
build_runner: ^2.4.0
build_web_compilers: ^4.0.0
build_web_compilers: ^4.0.4
2 changes: 2 additions & 0 deletions webdev/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## 3.0.7-wip

- Update `build_web_compilers` constraint to `^4.0.4`.

## 3.0.6

- Update `dwds` constraint to `19.0.2`.
Expand Down
2 changes: 1 addition & 1 deletion webdev/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ similar to:
...
dev_dependencies:
build_runner: ^2.4.0
build_web_compilers: ^4.0.0
build_web_compilers: ^4.0.4
...
```

Expand Down
16 changes: 14 additions & 2 deletions webdev/lib/src/command/configuration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const nullSafetyUnsound = 'unsound';
const nullSafetyAuto = 'auto';
const disableDdsFlag = 'disable-dds';
const enableExperimentOption = 'enable-experiment';
const canaryFeaturesFlag = 'canary';

ReloadConfiguration _parseReloadConfiguration(ArgResults argResults) {
var auto = argResults.options.contains(autoOption)
Expand Down Expand Up @@ -105,6 +106,7 @@ class Configuration {
final bool? _disableDds;
final String? _nullSafety;
final List<String>? _experiments;
final bool? _canaryFeatures;

Configuration({
bool? autoRun,
Expand All @@ -130,6 +132,7 @@ class Configuration {
bool? disableDds,
String? nullSafety,
List<String>? experiments,
bool? canaryFeatures,
}) : _autoRun = autoRun,
_chromeDebugPort = chromeDebugPort,
_debugExtension = debugExtension,
Expand All @@ -150,7 +153,8 @@ class Configuration {
_enableExpressionEvaluation = enableExpressionEvaluation,
_verbose = verbose,
_nullSafety = nullSafety,
_experiments = experiments {
_experiments = experiments,
_canaryFeatures = canaryFeatures {
_validateConfiguration();
}

Expand Down Expand Up @@ -224,7 +228,8 @@ class Configuration {
other._enableExpressionEvaluation ?? _enableExpressionEvaluation,
verbose: other._verbose ?? _verbose,
nullSafety: other._nullSafety ?? _nullSafety,
experiments: other._experiments ?? _experiments);
experiments: other._experiments ?? _experiments,
canaryFeatures: other._canaryFeatures ?? _canaryFeatures);

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

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

bool get canaryFeatures => _canaryFeatures ?? false;

/// Returns a new configuration with values updated from the parsed args.
static Configuration fromArgs(ArgResults? argResults,
{Configuration? defaultConfiguration}) {
Expand Down Expand Up @@ -397,6 +404,10 @@ class Configuration {
? argResults[enableExperimentOption] as List<String>?
: defaultConfiguration.experiments;

var canaryFeatures = argResults.options.contains(canaryFeaturesFlag)
? argResults[canaryFeaturesFlag] as bool?
: defaultConfiguration.canaryFeatures;

return Configuration(
autoRun: defaultConfiguration.autoRun,
chromeDebugPort: chromeDebugPort,
Expand All @@ -421,6 +432,7 @@ class Configuration {
verbose: verbose,
nullSafety: nullSafety,
experiments: experiments,
canaryFeatures: canaryFeatures,
);
}
}
Expand Down
6 changes: 6 additions & 0 deletions webdev/lib/src/command/shared.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ void addSharedArgs(ArgParser argParser,
defaultsTo: null,
hide: true,
help: 'Enable experiment features in the debugger.')
..addFlag(canaryFeaturesFlag,
abbr: 'c',
defaultsTo: false,
negatable: true,
hide: true,
help: 'Enables DDC canary features.')
..addFlag(verboseFlag,
abbr: 'v',
defaultsTo: false,
Expand Down
2 changes: 1 addition & 1 deletion webdev/lib/src/pubspec.dart
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ Future<List<PackageExceptionDetails>> _validateBuildDaemonVersion(
}

final buildRunnerConstraint = VersionConstraint.parse('^2.4.0');
final buildWebCompilersConstraint = VersionConstraint.parse('^4.0.0');
final buildWebCompilersConstraint = VersionConstraint.parse('^4.0.4');

// Note the minimum versions should never be dev versions as users will not
// get them by default.
Expand Down
1 change: 1 addition & 0 deletions webdev/lib/src/serve/webdev_server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ class WebDevServer {
verbose: options.configuration.verbose,
experiments: options.configuration.experiments,
sdkConfigurationProvider: const DefaultSdkConfigurationProvider(),
canaryFeatures: options.configuration.canaryFeatures,
);
}
var shouldServeDevTools =
Expand Down
2 changes: 1 addition & 1 deletion webdev/test/integration_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ dependencies:
}

const _supportedBuildRunnerVersion = '2.4.0';
const _supportedWebCompilersVersion = '4.0.0';
const _supportedWebCompilersVersion = '4.0.4';
const _supportedBuildDaemonVersion = '4.0.0';

String _pubspecYaml = '''
Expand Down