Skip to content

Prepare for dart 3.0 alpha breaking changes #1880

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
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
6 changes: 5 additions & 1 deletion dwds/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@
- Pre-warm expression compiler cache to speed up Flutter Inspector loading.
- Remove `ChromeProxyService.setExceptionPauseMode()`.
- Display full error on failure to start DDS.
- Fix crash on processing DevTools event when starting DevTools from observatory
- Fix crash on processing DevTools event when starting DevTools from DevTools
uri.
- Prepare or Dart 3 alpha breaking changes:
- Move weak null safety tests to special branch of `build_web_compilers`.
- Do not pass `--(no)-sound-null-safety` flag to build daemon.


## 16.0.1

Expand Down
17 changes: 17 additions & 0 deletions dwds/test/evaluate_common.dart
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,23 @@ void testAll({
await setup.service.resume(isolateId);
});

test('uses correct null safety mode', () async {
await onBreakPoint(isolateId, mainScript, 'printLocal', () async {
final event = await stream
.firstWhere((event) => event.kind == EventKind.kPauseBreakpoint);

final isNullSafetyEnabled =
'() { const sound = !(<Null>[] is List<int>); return sound; } ()';
final result = await setup.service.evaluateInFrame(
isolateId, event.topFrame!.index!, isNullSafetyEnabled);

expect(
result,
isA<InstanceRef>().having((instance) => instance.valueAsString,
'valueAsString', '${nullSafety == NullSafety.sound}'));
});
});

test('does not crash if class metadata cannot be found', () async {
await onBreakPoint(isolateId, mainScript, 'printStream', () async {
final event = await stream
Expand Down
3 changes: 0 additions & 3 deletions dwds/test/fixtures/context.dart
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,6 @@ class TestContext {
String basePath = '';

_port = await findUnusedPort();
final soundNullSafety = nullSafety == NullSafety.sound;
switch (compilationMode) {
case CompilationMode.buildDaemon:
{
Expand All @@ -275,8 +274,6 @@ class TestContext {
'--define',
'build_web_compilers|ddc=generate-full-dill=true',
],
'--define',
'build_web_compilers:entrypoint=sound_null_safety=$soundNullSafety',
'--verbose',
];
_daemonClient =
Expand Down
6 changes: 5 additions & 1 deletion fixtures/_test/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@ dependencies:

dev_dependencies:
build_runner: '>=1.6.2 <3.0.0'
build_web_compilers: '>=2.12.0 <4.0.0'
build_web_compilers:
git:
url: https://github.com/dart-lang/build.git
ref: legacy_force_opt_out
path: build_web_compilers
6 changes: 5 additions & 1 deletion fixtures/_testCircular1/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@ dependencies:

dev_dependencies:
build_runner: ^2.0.0
build_web_compilers: ^3.0.0
build_web_compilers:
git:
url: https://github.com/dart-lang/build.git
ref: legacy_force_opt_out
path: build_web_compilers
6 changes: 5 additions & 1 deletion fixtures/_testCircular2/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@ dependencies:

dev_dependencies:
build_runner: ^2.0.0
build_web_compilers: ^3.0.0
build_web_compilers:
git:
url: https://github.com/dart-lang/build.git
ref: legacy_force_opt_out
path: build_web_compilers
6 changes: 5 additions & 1 deletion fixtures/_testPackage/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@ dependencies:

dev_dependencies:
build_runner: ^2.0.0
build_web_compilers: ^3.0.0
build_web_compilers:
git:
url: https://github.com/dart-lang/build.git
ref: legacy_force_opt_out
path: build_web_compilers
6 changes: 5 additions & 1 deletion fixtures/_webdevSmoke/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@ environment:

dev_dependencies:
build_runner: '>=1.6.2 <3.0.0'
build_web_compilers: '>=2.12.0 <4.0.0'
build_web_compilers:
git:
url: https://github.com/dart-lang/build.git
ref: legacy_force_opt_out
path: build_web_compilers
3 changes: 3 additions & 0 deletions webdev/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

- Add `--enable-experiment` flag to webdev commands and pass it
to the build runner and the expression compiler service.
- Prepare or Dart 3 alpha breaking changes:
- Move weak null safety tests to special branch of `build_web_compilers`.
- Do not pass `--(no)-sound-null-safety` flag to build daemon.

## 2.7.12

Expand Down
7 changes: 0 additions & 7 deletions webdev/lib/src/command/shared.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,6 @@ List<String> buildRunnerArgs(
..add('build_web_compilers|ddc=generate-full-dill=true');
}

if (configuration.nullSafety != nullSafetyAuto) {
arguments
..add('--define')
..add('build_web_compilers:entrypoint=sound_null_safety='
'${configuration.nullSafety == nullSafetySound}');
}

for (var experiment in configuration.experiments) {
arguments.add('--enable-experiment=$experiment');
}
Expand Down
51 changes: 23 additions & 28 deletions webdev/test/e2e_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ void main() {
});

test('smoke test is configured properly', () async {
var smokeYaml =
loadYaml(await File('$exampleDirectory/pubspec.yaml').readAsString())
as YamlMap;
var smokeYaml = loadYaml(
await File('$soundExampleDirectory/pubspec.yaml').readAsString())
as YamlMap;
var webdevYaml =
loadYaml(await File('pubspec.yaml').readAsString()) as YamlMap;
expect(smokeYaml['environment']['sdk'],
Expand Down Expand Up @@ -168,32 +168,24 @@ void main() {
: 'SDK does not support sound null safety',
);

test(
'and --null-safety=unsound',
() async {
var args = [
'build',
'-o',
'web:${d.sandbox}',
'--no-release',
'--null-safety=unsound'
];
test('and --null-safety=unsound', () async {
var args = [
'build',
'-o',
'web:${d.sandbox}',
'--no-release',
'--null-safety=unsound'
];

var process =
await runWebDev(args, workingDirectory: soundExampleDirectory);
var process = await runWebDev(args, workingDirectory: exampleDirectory);

var expectedItems = <Object>['Succeeded'];
var expectedItems = <Object>['Succeeded'];

await checkProcessStdout(process, expectedItems);
await process.shouldExit(0);
await checkProcessStdout(process, expectedItems);
await process.shouldExit(0);

await d.file('main.unsound.ddc.js', isNotEmpty).validate();
},
skip: semver.Version.parse(Platform.version.split(' ').first) >
semver.Version.parse('2.11.0')
? null
: 'SDK does not support sound null safety',
);
await d.file('main.unsound.ddc.js', isNotEmpty).validate();
});
});

group('should build with --output=NONE', () {
Expand Down Expand Up @@ -344,14 +336,17 @@ void main() {
await stream.firstWhere(
(Event event) => event.kind == EventKind.kPauseBreakpoint);

var result =
await vmService.evaluateInFrame(isolateId, 0, 'true');
final isNullSafetyEnabled =
'() { const sound = !(<Null>[] is List<int>); return sound; } ()';
final result = await vmService.evaluateInFrame(
isolateId, 0, isNullSafetyEnabled);

expect(
result,
const TypeMatcher<InstanceRef>().having(
(instance) => instance.valueAsString,
'valueAsString',
'true'));
'$soundNullSafety'));
} finally {
await vmService?.dispose();
await exitWebdev(process);
Expand Down