Skip to content

Support compiling with weak null-safety with the Frontend Server #1823

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

Closed
wants to merge 3 commits into from
Closed
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
6 changes: 4 additions & 2 deletions dwds/test/utils/version_compatibility.dart
Original file line number Diff line number Diff line change
@@ -13,8 +13,10 @@ bool supportedMode(
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) {
// weak null-safety for BuildDaemon.
if (isDart3 &&
compilationMode == CompilationMode.buildDaemon &&
nullSafetyMode == NullSafety.weak) {
return false;
}
// TODO(https://github.com/dart-lang/webdev/issues/1591): Support compiling to
4 changes: 2 additions & 2 deletions fixtures/_test/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -9,10 +9,10 @@ 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.18.0
path: ^1.6.1

dev_dependencies:
4 changes: 2 additions & 2 deletions fixtures/_testCircular1/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -9,10 +9,10 @@ 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.18.0
path: ^1.6.1
_test_circular2:
path: ../_testCircular2
4 changes: 2 additions & 2 deletions fixtures/_testCircular1Sound/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -5,10 +5,10 @@ description: >-
publish_to: none

environment:
sdk: '>=2.12.0 <3.0.0'
sdk: '>=2.18.0 <3.0.0'

dependencies:
intl: ^0.17.0
intl: ^0.18.0
path: ^1.6.1
_test_circular2_sound:
path: ../_testCircular2Sound
2 changes: 1 addition & 1 deletion fixtures/_testCircular2/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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_circular1:
2 changes: 1 addition & 1 deletion fixtures/_testCircular2Sound/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ description: >-
publish_to: none

environment:
sdk: '>=2.12.0 <3.0.0'
sdk: '>=2.18.0 <3.0.0'

dependencies:
_test_circular1_sound:
2 changes: 1 addition & 1 deletion fixtures/_testPackage/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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:
2 changes: 1 addition & 1 deletion fixtures/_testPackageSound/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ description: >-
publish_to: none

environment:
sdk: '>=2.13.0 <3.0.0'
sdk: '>=2.18.0 <3.0.0'

dependencies:
_test_sound:
4 changes: 2 additions & 2 deletions fixtures/_testSound/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -5,10 +5,10 @@ description: >-
publish_to: none

environment:
sdk: '>=2.13.0 <3.0.0'
sdk: '>=2.18.0 <3.0.0'

dependencies:
intl: ^0.17.0
intl: ^0.18.0
path: ^1.8.2

dev_dependencies:
3 changes: 3 additions & 0 deletions frontend_server_common/lib/src/frontend_server_client.dart
Original file line number Diff line number Diff line change
@@ -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<Uri> 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,7 @@ class ResidentCompiler {
],
if (useDebuggerModuleNames) '--debugger-module-names',
'--experimental-emit-debug-metadata',
'--${soundNullSafety ? '' : 'no-'}sound-null-safety',
if (verbose) '--verbose'
];

1 change: 1 addition & 0 deletions frontend_server_common/lib/src/resident_runner.dart
Original file line number Diff line number Diff line change
@@ -45,6 +45,7 @@ class ResidentWebRunner {
soundNullSafety ? '$platformDillSound' : '$platformDillUnsound',
fileSystemRoots: fileSystemRoots,
fileSystemScheme: fileSystemScheme,
soundNullSafety: soundNullSafety,
verbose: verbose,
);
expressionCompiler = TestExpressionCompiler(generator);