Bump actions/checkout from 4.1.0 to 4.1.1 (#83)

Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.0 to 4.1.1.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/8ade135a41bc03ea155e62e844d188df1ea18608...b4ffde65f46336ab88eb53be808477a3936bae11)

- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 file changed
tree: dd6e6747ca9ffc17253221fcb22c3624551c4f81
  1. .github/
  2. benchmark/
  3. e2e_test/
  4. example/
  5. lib/
  6. test/
  7. tool/
  8. .gitignore
  9. analysis_options.yaml
  11. CHANGELOG.md
  14. pubspec.yaml
  15. README.md

Tools for creating a persistent worker loop for bazel.


There are two abstract classes provided by this package, AsyncWorkerLoop and SyncWorkerLoop. These each have a performRequest method which you must implement.

Lets look at a simple example of a SyncWorkerLoop implementation:

import 'dart:io';
import 'package:bazel_worker/bazel_worker.dart';

void main() {
  // Blocks until it gets an EOF from stdin.

class SyncSimpleWorker extends SyncWorkerLoop {
  /// Must synchronously return a [WorkResponse], since this is a
  /// [SyncWorkerLoop].
  WorkResponse performRequest(WorkRequest request) {
    File('hello.txt').writeAsStringSync('hello world!');
    return WorkResponse()..exitCode = EXIT_CODE_OK;

And now the same thing, implemented as an AsyncWorkerLoop:

import 'dart:io';
import 'package:bazel_worker/bazel_worker.dart';

void main() {
  // Doesn't block, runs tasks async as they are received on stdin.

class AsyncSimpleWorker extends AsyncWorkerLoop {
  /// Must return a [Future<WorkResponse>], since this is an
  /// [AsyncWorkerLoop].
  Future<WorkResponse> performRequest(WorkRequest request) async {
    await File('hello.txt').writeAsString('hello world!');
    return WorkResponse()..exitCode = EXIT_CODE_OK;

As you can see, these are nearly identical, it mostly comes down to the constraints on your package and personal preference which one you choose to implement.


A package:bazel_worker/testing.dart file is also provided, which can greatly assist with writing unit tests for your worker. See the test/worker_loop_test.dart test included in this package for an example of how the helpers can be used.

Features and bugs

Please file feature requests and bugs at the issue tracker.