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/fixtures/_test/example/append_body/main.dart b/fixtures/_test/example/append_body/main.dart index b35e19192..1129ddb06 100644 --- a/fixtures/_test/example/append_body/main.dart +++ b/fixtures/_test/example/append_body/main.dart @@ -2,6 +2,8 @@ // 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. +// @dart=2.9 + import 'dart:async'; import 'dart:developer'; import 'dart:html'; diff --git a/fixtures/_test/example/hello_world/main.dart b/fixtures/_test/example/hello_world/main.dart index f36903c71..ee89a790e 100644 --- a/fixtures/_test/example/hello_world/main.dart +++ b/fixtures/_test/example/hello_world/main.dart @@ -2,6 +2,8 @@ // 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. +// @dart=2.9 + import 'dart:async'; import 'dart:convert'; import 'dart:developer'; diff --git a/fixtures/_test/example/hello_world/part.dart b/fixtures/_test/example/hello_world/part.dart index d155bc6a0..6ff5767d1 100644 --- a/fixtures/_test/example/hello_world/part.dart +++ b/fixtures/_test/example/hello_world/part.dart @@ -2,6 +2,8 @@ // 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. +// @dart=2.9 + part of 'main.dart'; var blah = 'blah'; diff --git a/fixtures/_test/pubspec.yaml b/fixtures/_test/pubspec.yaml index 51e52d58c..603085b4c 100644 --- a/fixtures/_test/pubspec.yaml +++ b/fixtures/_test/pubspec.yaml @@ -9,12 +9,12 @@ description: >- publish_to: none environment: - sdk: ">=2.5.0 <3.0.0" + sdk: ">=2.18.0 <3.0.0" dependencies: - intl: ^0.16.0 + intl: ^0.17.0 path: ^1.6.1 dev_dependencies: - build_runner: ^2.0.0 - build_web_compilers: ^3.0.0 + build_runner: '>=1.6.2 <3.0.0' + build_web_compilers: '>=2.12.0 <4.0.0' diff --git a/fixtures/_testCircular1/pubspec.yaml b/fixtures/_testCircular1/pubspec.yaml index f42bf6aa3..1664d7ab4 100644 --- a/fixtures/_testCircular1/pubspec.yaml +++ b/fixtures/_testCircular1/pubspec.yaml @@ -5,14 +5,14 @@ name: _test_circular1 version: 1.0.0 description: >- - A fake package used for testing weak null-safety. + A fake package used for testing weak null-safety with circular dependency. publish_to: none environment: - sdk: ">=2.5.0 <3.0.0" + sdk: ">=2.18.0 <3.0.0" dependencies: - intl: ^0.16.0 + intl: ^0.17.0 path: ^1.6.1 _test_circular2: path: ../_testCircular2 diff --git a/fixtures/_testCircular1Sound/pubspec.yaml b/fixtures/_testCircular1Sound/pubspec.yaml index 6a5741a6f..e439414b7 100644 --- a/fixtures/_testCircular1Sound/pubspec.yaml +++ b/fixtures/_testCircular1Sound/pubspec.yaml @@ -1,11 +1,11 @@ name: _test_circular1_sound version: 1.0.0 description: >- - A fake package used for testing sound null-safety. + A fake package used for testing imports with sound null-safety with circular dependency. publish_to: none environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.18.0 <3.0.0' dependencies: intl: ^0.17.0 diff --git a/fixtures/_testCircular2/pubspec.yaml b/fixtures/_testCircular2/pubspec.yaml index 13f43ac70..fecaf31e0 100644 --- a/fixtures/_testCircular2/pubspec.yaml +++ b/fixtures/_testCircular2/pubspec.yaml @@ -5,11 +5,11 @@ name: _test_circular2 version: 1.0.0 description: >- - A fake package used for testing imports with weak null-safety. Imports _test. + A fake package used for testing imports with weak null-safety with circular dependency. publish_to: none environment: - sdk: ">=2.10.0 <3.0.0" + sdk: ">=2.18.0 <3.0.0" dependencies: _test_circular1: diff --git a/fixtures/_testCircular2Sound/pubspec.yaml b/fixtures/_testCircular2Sound/pubspec.yaml index bee2c2c3d..ad8ca1a58 100644 --- a/fixtures/_testCircular2Sound/pubspec.yaml +++ b/fixtures/_testCircular2Sound/pubspec.yaml @@ -1,11 +1,11 @@ name: _test_circular2_sound version: 1.0.0 description: >- - A fake package used for testing imports with sound null-safety. Imports _test. + A fake package used for testing imports with sound null-safety with circular dependency. publish_to: none environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.18.0 <3.0.0' dependencies: _test_circular1_sound: diff --git a/fixtures/_testPackage/pubspec.yaml b/fixtures/_testPackage/pubspec.yaml index 070e0b21f..dd80f7449 100644 --- a/fixtures/_testPackage/pubspec.yaml +++ b/fixtures/_testPackage/pubspec.yaml @@ -9,7 +9,7 @@ description: >- publish_to: none environment: - sdk: ">=2.10.0 <3.0.0" + sdk: ">=2.18.0 <3.0.0" dependencies: _test: 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); } diff --git a/webdev/test/e2e_test.dart b/webdev/test/e2e_test.dart index 6fdffd55b..bf7c7b1b0 100644 --- a/webdev/test/e2e_test.dart +++ b/webdev/test/e2e_test.dart @@ -302,6 +302,7 @@ void main() { 'daemon', 'web:$openPort', '--enable-expression-evaluation', + '--null-safety=$nullSafetyOption', '--verbose', ]; var process = await runWebDev(args,