Skip to content

Commit 05031da

Browse files
author
Anna Gringauze
authored
Update build_daemon constraint and log errors (#2029)
* Update build_daemon constraint and log errors * Fix test failures * Disable failing records tests * Disable failing crome tests * Reference an issue instead of a pull request
1 parent 49013b8 commit 05031da

File tree

13 files changed

+49
-16
lines changed

13 files changed

+49
-16
lines changed

dwds/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ dependencies:
4141
dev_dependencies:
4242
args: ^2.3.1
4343
build: ^2.3.0
44-
build_daemon: ^3.1.0
44+
build_daemon: ^4.0.0
4545
build_runner: ^2.4.0
4646
build_version: ^2.1.1
4747
build_web_compilers: ^4.0.0

dwds/test/fixtures/server.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ class TestServer {
9797
return BuildResult((b) => b.status = BuildStatus.failed);
9898
case daemon.BuildStatus.succeeded:
9999
return BuildResult((b) => b.status = BuildStatus.succeeded);
100+
default:
101+
break;
100102
}
101103
throw StateError('Unexpected Daemon build result: $result');
102104
});

dwds/test/instances/record_inspection_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,5 +394,5 @@ Future<void> _runTests({
394394
expect(await getFields(instanceRef, offset: 0), {1: false, 2: 5});
395395
});
396396
});
397-
});
397+
}, skip: 'https://github.com/dart-lang/webdev/issues/2033');
398398
}

webdev/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
## 3.0.2-dev
22

3+
- Update `build_daemon` constraint to `^4.0.0`.
4+
35
## 3.0.1
46

57
- Update SDK constraint to `>=3.0.0-188.0.dev <4.0.0`.

webdev/lib/src/command/build_command.dart

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import 'package:logging/logging.dart' as logging;
1616

1717
import '../daemon_client.dart';
1818
import '../logging.dart';
19+
import '../pubspec.dart';
1920
import 'configuration.dart';
2021
import 'shared.dart';
2122

@@ -48,9 +49,17 @@ class BuildCommand extends Command<int> {
4849

4950
var configuration = Configuration.fromArgs(argResults);
5051
configureLogWriter(configuration.verbose);
51-
var pubspecLock = await readPubspecLock(configuration);
52-
final arguments = buildRunnerArgs(pubspecLock, configuration)
53-
..addAll(validExtraArgs);
52+
53+
List<String> arguments;
54+
try {
55+
var pubspecLock = await readPubspecLock(configuration);
56+
arguments = buildRunnerArgs(pubspecLock, configuration)
57+
..addAll(validExtraArgs);
58+
} on PackageException catch (e) {
59+
logWriter(logging.Level.SEVERE, 'Pubspec errors: ',
60+
error: '${e.details}');
61+
rethrow;
62+
}
5463

5564
try {
5665
logWriter(logging.Level.INFO, 'Connecting to the build daemon...');

webdev/lib/src/command/daemon_command.dart

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import '../daemon/app_domain.dart';
1515
import '../daemon/daemon.dart';
1616
import '../daemon/daemon_domain.dart';
1717
import '../logging.dart';
18+
import '../pubspec.dart';
1819
import '../serve/dev_workflow.dart';
1920
import '../serve/utils.dart';
2021
import 'configuration.dart';
@@ -65,7 +66,13 @@ class DaemonCommand extends Command<int> {
6566
launchInChrome: true, debug: true, autoRun: false, release: false));
6667
configureLogWriter(configuration.verbose);
6768
// Validate the pubspec first to ensure we are in a Dart project.
68-
var pubspecLock = await readPubspecLock(configuration);
69+
PubspecLock? pubspecLock;
70+
try {
71+
pubspecLock = await readPubspecLock(configuration);
72+
} on PackageException catch (e) {
73+
logWriter(Level.SEVERE, 'Pubspec errors: ', error: '${e.details}');
74+
rethrow;
75+
}
6976

7077
Daemon? daemon;
7178
DevWorkflow? workflow;

webdev/lib/src/command/serve_command.dart

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ import 'dart:async';
66

77
import 'package:args/args.dart';
88
import 'package:args/command_runner.dart';
9+
import 'package:logging/logging.dart';
910

1011
import '../logging.dart';
12+
import '../pubspec.dart';
1113
import '../serve/dev_workflow.dart';
1214
import 'configuration.dart';
1315
import 'shared.dart';
@@ -93,7 +95,13 @@ refresh: Performs a full page refresh.
9395
Configuration configuration;
9496
configuration = Configuration.fromArgs(argResults);
9597
configureLogWriter(configuration.verbose);
96-
var pubspecLock = await readPubspecLock(configuration);
98+
PubspecLock? pubspecLock;
99+
try {
100+
pubspecLock = await readPubspecLock(configuration);
101+
} on PackageException catch (e) {
102+
logWriter(Level.SEVERE, 'Pubspec errors: ', error: '${e.details}');
103+
rethrow;
104+
}
97105
// Forward remaining arguments as Build Options to the Daemon.
98106
// This isn't documented. Should it be advertised?
99107
var buildOptions = buildRunnerArgs(pubspecLock, configuration)

webdev/lib/src/daemon/app_domain.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ class AppDomain extends Domain {
4848
'finished': true,
4949
});
5050
break;
51+
default:
52+
break;
5153
}
5254
}
5355

webdev/lib/src/pubspec.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ class PubspecLock {
126126

127127
Future<List<PackageExceptionDetails>> _validateBuildDaemonVersion(
128128
PubspecLock pubspecLock) async {
129-
var buildDaemonConstraint = '>=2.0.0 <4.0.0';
129+
var buildDaemonConstraint = '^4.0.0';
130130

131131
var issues = <PackageExceptionDetails>[];
132132

webdev/lib/src/serve/webdev_server.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ class WebDevServer {
101101
return BuildResult((b) => b.status = BuildStatus.failed);
102102
case daemon.BuildStatus.succeeded:
103103
return BuildResult((b) => b.status = BuildStatus.succeeded);
104+
default:
105+
break;
104106
}
105107
throw StateError('Unexpected Daemon build result: $result');
106108
});

0 commit comments

Comments
 (0)