Skip to content
This repository was archived by the owner on Nov 1, 2024. It is now read-only.

Commit dc28513

Browse files
committed
bump lints dep and fix
1 parent 2fb4fbf commit dc28513

13 files changed

+30
-19
lines changed

.github/workflows/test-package.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
strategy:
2020
fail-fast: false
2121
matrix:
22-
sdk: [2.19.0, dev]
22+
sdk: [3.1.0, dev]
2323
steps:
2424
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
2525
- uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.1.2-wip
2+
3+
* Require Dart SDK `^3.1.0`.
4+
15
## 1.1.1
26

37
* Fix a bug where if spawnWorker threw an error, work requests would hang

lib/src/async_message_grouper.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class AsyncMessageGrouper implements MessageGrouper {
2323
/// Position in the current input buffer.
2424
int _inputBufferPos = 0;
2525

26-
/// Completes after [cancel] is called or [inputStream] is closed.
26+
/// Completes after [cancel] is called or `inputStream` is closed.
2727
Future<void> get done => _done.future;
2828
final _done = Completer<void>();
2929

lib/src/driver/driver.dart

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class BazelWorkerDriver {
2323
/// The maximum number of idle workers at any given time.
2424
final int _maxIdleWorkers;
2525

26-
/// The maximum number of times to retry a [WorkAttempt] if there is an error.
26+
/// The maximum number of times to retry a [_WorkAttempt] if there is an error.
2727
final int _maxRetries;
2828

2929
/// The maximum number of concurrent workers to run at any given time.
@@ -57,7 +57,7 @@ class BazelWorkerDriver {
5757
/// to determine when actual work is being done versus just waiting for an
5858
/// available worker.
5959
Future<WorkResponse> doWork(WorkRequest request,
60-
{Function(Future<WorkResponse?>)? trackWork}) {
60+
{void Function(Future<WorkResponse?>)? trackWork}) {
6161
var attempt = _WorkAttempt(request, trackWork: trackWork);
6262
_workQueue.add(attempt);
6363
_runWorkQueue();
@@ -130,7 +130,7 @@ class BazelWorkerDriver {
130130
_runWorkQueue();
131131
}
132132

133-
/// Sends [request] to [worker].
133+
/// Sends [attempt] to [worker].
134134
///
135135
/// Once the worker responds then it will be added back to the pool of idle
136136
/// workers.
@@ -227,7 +227,7 @@ class BazelWorkerDriver {
227227
class _WorkAttempt {
228228
final WorkRequest request;
229229
final responseCompleter = Completer<WorkResponse>();
230-
final Function(Future<WorkResponse?>)? trackWork;
230+
final void Function(Future<WorkResponse?>)? trackWork;
231231

232232
Future<WorkResponse> get response => responseCompleter.future;
233233

lib/src/driver/driver_connection.dart

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import 'dart:isolate';
99

1010
import '../async_message_grouper.dart';
1111
import '../constants.dart';
12+
import '../message_grouper.dart';
1213
import '../utils.dart';
1314
import '../worker_protocol.pb.dart';
1415

lib/src/message_grouper.dart

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5+
import 'async_message_grouper.dart';
6+
import 'sync_message_grouper.dart';
7+
58
/// Interface for a [MessageGrouper], which groups bytes in delimited proto
69
/// format into the bytes for each message.
710
///

lib/src/message_grouper_state.dart

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import 'dart:typed_data';
66

77
import 'package:protobuf/protobuf.dart';
88

9+
import 'message_grouper.dart';
10+
911
/// State held by the [MessageGrouper] while waiting for additional data to
1012
/// arrive.
1113
class MessageGrouperState {
@@ -18,7 +20,7 @@ class MessageGrouperState {
1820
/// Handle one byte at a time.
1921
///
2022
/// Returns a [List<int>] of message bytes if [byte] was the last byte in a
21-
/// message, otherwise returns [null].
23+
/// message, otherwise returns `null`.
2224
List<int>? handleInput(int byte) {
2325
if (!_lengthReader.done) {
2426
_lengthReader.readByte(byte);

lib/src/worker/worker_connection.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import '../worker_protocol.pb.dart';
1616
/// program using `BazelWorkerDriver`, or any other process that speaks the
1717
/// protocol).
1818
abstract class WorkerConnection {
19-
/// Reads a [WorkRequest] or returns [null] if there are none left.
19+
/// Reads a [WorkRequest] or returns `null` if there are none left.
2020
///
2121
/// See [AsyncWorkerConnection] and [SyncWorkerConnection] for more narrow
2222
/// interfaces.

lib/src/worker/worker_loop.dart

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
// BSD-style license that can be found in the LICENSE file.
44

55
import '../worker_protocol.pb.dart';
6+
import 'async_worker_loop.dart';
7+
import 'sync_worker_loop.dart';
68

79
/// Interface for a [WorkerLoop].
810
///
@@ -13,6 +15,6 @@ abstract class WorkerLoop {
1315
/// a [Future<WorkResponse>].
1416
dynamic performRequest(WorkRequest request);
1517

16-
/// Run the worker loop. Should return either a [Future] or [null].
18+
/// Run the worker loop. Should return either a [Future] or `null`.
1719
dynamic run();
1820
}

lib/testing.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import 'dart:collection';
77
import 'dart:io';
88
import 'dart:typed_data';
99

10-
import 'package:bazel_worker/bazel_worker.dart';
10+
import 'bazel_worker.dart';
1111

1212
export 'src/async_message_grouper.dart';
1313
export 'src/sync_message_grouper.dart';
@@ -150,7 +150,7 @@ class TestSyncWorkerLoop extends SyncWorkerLoop implements TestWorkerLoop {
150150
}
151151

152152
/// Adds [response] to the queue. These will be returned from
153-
/// [performResponse] in the order they are added, otherwise it will throw
153+
/// [performRequest] in the order they are added, otherwise it will throw
154154
/// if the queue is empty.
155155
@override
156156
void enqueueResponse(WorkResponse response) {
@@ -194,7 +194,7 @@ class TestAsyncWorkerLoop extends AsyncWorkerLoop implements TestWorkerLoop {
194194
}
195195

196196
/// Adds [response] to the queue. These will be returned from
197-
/// [performResponse] in the order they are added, otherwise it will throw
197+
/// [performRequest] in the order they are added, otherwise it will throw
198198
/// if the queue is empty.
199199
@override
200200
void enqueueResponse(WorkResponse response) {

pubspec.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
name: bazel_worker
2-
version: 1.1.1
2+
version: 1.1.2-wip
33
description: >-
44
Protocol and utilities to implement or invoke persistent bazel workers.
55
repository: https://github.com/dart-lang/bazel_worker
66

77
environment:
8-
sdk: '>=2.19.0 <4.0.0'
8+
sdk: ^3.1.0
99

1010
dependencies:
1111
async: ^2.5.0
1212
protobuf: ^3.0.0
1313

1414
dev_dependencies:
15-
dart_flutter_team_lints: ^1.0.0
15+
dart_flutter_team_lints: ^3.0.0
1616
test: ^1.16.0

test/driver_test.dart

+2-3
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ void main() {
159159
Future _doRequests(
160160
{BazelWorkerDriver? driver,
161161
int count = 100,
162-
Function(Future<WorkResponse?>)? trackWork}) async {
162+
void Function(Future<WorkResponse?>)? trackWork}) async {
163163
// If we create a driver, we need to make sure and terminate it.
164164
var terminateDriver = driver == null;
165165
driver ??= BazelWorkerDriver(MockWorker.spawn);
@@ -178,8 +178,7 @@ Future _doRequests(
178178
class MockWorkerLoop extends AsyncWorkerLoop {
179179
final Queue<WorkResponse> _responseQueue;
180180

181-
MockWorkerLoop(this._responseQueue, {AsyncWorkerConnection? connection})
182-
: super(connection: connection);
181+
MockWorkerLoop(this._responseQueue, {super.connection});
183182

184183
@override
185184
Future<WorkResponse> performRequest(WorkRequest request) async {

test/worker_loop_test.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ void runTests<T extends TestWorkerConnection>(
112112
(stdinStream as TestStdinSync).pendingBytes.clear();
113113
await workerLoop.run();
114114
} else if (stdinStream is TestStdinAsync) {
115-
var done = Completer();
115+
var done = Completer<void>();
116116
// ignore: avoid_dynamic_calls
117117
workerLoop.run().then((_) => done.complete(null));
118118
(stdinStream as TestStdinAsync).controller.addError('Error!!');

0 commit comments

Comments
 (0)