diff --git a/dwds/test/fixtures/context.dart b/dwds/test/fixtures/context.dart index 07144df7e..f563ddc29 100644 --- a/dwds/test/fixtures/context.dart +++ b/dwds/test/fixtures/context.dart @@ -229,6 +229,7 @@ class TestContext { String basePath = ''; _port = await findUnusedPort(); + final soundNullSafety = nullSafety == NullSafety.sound; switch (compilationMode) { case CompilationMode.buildDaemon: { @@ -237,6 +238,8 @@ class TestContext { '--define', 'build_web_compilers|ddc=generate-full-dill=true', ], + '--define', + 'build_web_compilers:entrypoint=sound_null_safety=$soundNullSafety', '--verbose', ]; _daemonClient = diff --git a/dwds/test/utils/version_compatibility.dart b/dwds/test/utils/version_compatibility.dart index 1ff63ae81..6206a07da 100644 --- a/dwds/test/utils/version_compatibility.dart +++ b/dwds/test/utils/version_compatibility.dart @@ -2,21 +2,11 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'dart:io'; - -import 'package:pub_semver/pub_semver.dart'; - import '../fixtures/context.dart'; bool supportedMode( {required CompilationMode compilationMode, required NullSafety nullSafetyMode}) { - final isDart3 = Version.parse(Platform.version.split(' ')[0]).major == 3; - // TODO(https://github.com/dart-lang/webdev/issues/1818): Support compiling to - // to weak null-safety for both FrontendServer and BuildDaemon. - if (isDart3 && nullSafetyMode == NullSafety.weak) { - return false; - } // TODO(https://github.com/dart-lang/webdev/issues/1591): Support compiling to // sound null-safety for the FrontendServer. if (compilationMode == CompilationMode.frontendServer && diff --git a/frontend_server_common/lib/src/frontend_server_client.dart b/frontend_server_common/lib/src/frontend_server_client.dart index 321c6ac14..fd69a7abc 100644 --- a/frontend_server_common/lib/src/frontend_server_client.dart +++ b/frontend_server_common/lib/src/frontend_server_client.dart @@ -259,6 +259,7 @@ class ResidentCompiler { required this.fileSystemRoots, required this.fileSystemScheme, required this.platformDill, + required this.soundNullSafety, this.verbose = false, CompilerMessageConsumer compilerMessageConsumer = defaultConsumer, }) : _stdoutHandler = StdoutHandler(consumer: compilerMessageConsumer); @@ -269,6 +270,7 @@ class ResidentCompiler { final List fileSystemRoots; final String fileSystemScheme; final String platformDill; + final bool soundNullSafety; final bool verbose; /// The path to the root of the Dart SDK used to compile. @@ -386,6 +388,8 @@ class ResidentCompiler { ], if (useDebuggerModuleNames) '--debugger-module-names', '--experimental-emit-debug-metadata', + if (soundNullSafety) '--sound-null-safety', + if (!soundNullSafety) '--no-sound-null-safety', if (verbose) '--verbose' ]; diff --git a/frontend_server_common/lib/src/resident_runner.dart b/frontend_server_common/lib/src/resident_runner.dart index 16c793b8a..a369f1b9f 100644 --- a/frontend_server_common/lib/src/resident_runner.dart +++ b/frontend_server_common/lib/src/resident_runner.dart @@ -46,6 +46,7 @@ class ResidentWebRunner { fileSystemRoots: fileSystemRoots, fileSystemScheme: fileSystemScheme, verbose: verbose, + soundNullSafety: soundNullSafety, ); expressionCompiler = TestExpressionCompiler(generator); }