All Projects → dart-lang → bazel_worker

dart-lang / bazel_worker

Licence: BSD-3-Clause license
Dart integration for Bazel build system

Programming Languages

dart
5743 projects
shell
77523 projects

Labels

Projects that are alternatives of or similar to bazel worker

wollemi
No description or website provided.
Stars: ✭ 25 (+38.89%)
Mutual labels:  bazel
vim-bazel
Vim support for Bazel
Stars: ✭ 118 (+555.56%)
Mutual labels:  bazel
toktok-stack
A snapshot of the complete software stack (excluding some external libraries and programs)
Stars: ✭ 12 (-33.33%)
Mutual labels:  bazel
rules ruby
Ruby Rules for Bazel. It is, perhaps, production-ready. This project builds atop the work of Yugui, whose original rules can be found at https://github.com/yugui/rules_ruby. Please be aware there is an active fork of this project maintained by Coinbase at https://github.com/coinbase/rules_ruby.
Stars: ✭ 85 (+372.22%)
Mutual labels:  bazel
vim-bazel
Trigger bazel from vim and load errors into the quickfix list
Stars: ✭ 15 (-16.67%)
Mutual labels:  bazel
copr-build-bazel
copr build of bazel | https://copr.fedorainfracloud.org/coprs/vbatts/bazel/
Stars: ✭ 14 (-22.22%)
Mutual labels:  bazel
bazel-nx-example
⚡ Example monorepo for Nest + Angular built with Bazel
Stars: ✭ 41 (+127.78%)
Mutual labels:  bazel
containers by bazel
Container images created with Bazel
Stars: ✭ 32 (+77.78%)
Mutual labels:  bazel
sbt-bazel
Easily convert SBT projects to Bazel workspaces
Stars: ✭ 55 (+205.56%)
Mutual labels:  bazel
buildkube
Bazel Remote Cache + Remote Execution in Kubernetes
Stars: ✭ 60 (+233.33%)
Mutual labels:  bazel
rules java
Java rules for Bazel
Stars: ✭ 44 (+144.44%)
Mutual labels:  bazel
eclipse
Eclipse For Bazel (deprecated, see https://github.com/salesforce/bazel-eclipse instead)
Stars: ✭ 31 (+72.22%)
Mutual labels:  bazel
AlphaZero-Renju
No description or website provided.
Stars: ✭ 17 (-5.56%)
Mutual labels:  bazel
Grazel
A tool to migrate Android projects from Gradle to Bazel incrementally and automatically
Stars: ✭ 222 (+1133.33%)
Mutual labels:  bazel
rules helm
rules_helm: Bazel rules for managing helm charts
Stars: ✭ 46 (+155.56%)
Mutual labels:  bazel
bazel-website
Website for Bazel, a fast, scalable, multi-language and extensible build system
Stars: ✭ 16 (-11.11%)
Mutual labels:  bazel
stuff
All stuff in a single repo (tests, ideas, benchmarks)
Stars: ✭ 13 (-27.78%)
Mutual labels:  bazel
tensorflow-builds
Tensorflow binaries and Docker images compiled with GPU support and CPU optimizations.
Stars: ✭ 15 (-16.67%)
Mutual labels:  bazel
rules elm
Bazel rules for building web applications written in Elm
Stars: ✭ 22 (+22.22%)
Mutual labels:  bazel
vim-ft-bzl
No description or website provided.
Stars: ✭ 26 (+44.44%)
Mutual labels:  bazel

Tools for creating a persistent worker loop for bazel.

Usage

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.
  SyncSimpleWorker().run();
}

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.
  AsyncSimpleWorker().run();
}

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.

Testing

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].