Skip to content

feat(rules_dart): first-class Bazel ruleset with RBE, IDE aspects, and version conflict detection#512

Merged
yesudeep merged 4 commits intomainfrom
yesudeep/feat/careful-level
Feb 1, 2026
Merged

feat(rules_dart): first-class Bazel ruleset with RBE, IDE aspects, and version conflict detection#512
yesudeep merged 4 commits intomainfrom
yesudeep/feat/careful-level

Conversation

@yesudeep
Copy link
Copy Markdown
Collaborator

@yesudeep yesudeep commented Feb 1, 2026

Summary

This PR transforms rules_dart into a first-class Bazel ruleset with feature parity to rules_go and rules_rust. It is now ready for BCR (Bazel Central Registry) publication.

Feature Parity Matrix

Category Feature Status
Core Rules dart_library, dart_binary, dart_test, dart_native_binary
Compilation dart_js_binary, dart_wasm_binary, dart_aot_snapshot
Toolchain dart_toolchain, DartToolchainInfo, multi-SDK support
Dependencies deps.bzl, dart_package, version conflict detection
Code Generation dart_proto_library, dart_grpc_library, dart_build_runner
Testing Coverage (LCOV), test sharding (shard_count)
Remote Execution RBE configuration (BuildBuddy, Google RBE)
IDE Integration dart_ide_info aspect, DartIdeInfo provider
Platform Support Windows (.bat), macOS, Linux - 100% cross-platform
Performance Persistent workers (JSON protocol)
Gazelle Go-based BUILD.bazel generator

Key Changes

Phase 1-2: Foundation & Toolchain

  • Cross-platform script generation (100% Windows native, no MSYS)
  • Hermetic SDK download
  • Persistent workers with JSON protocol
  • dart_toolchain rule with DartToolchainInfo provider
  • toolchain_type registration for multi-SDK support

Phase 3: Dependency Management

  • pubspec.lock parsing in Starlark
  • dart_package repository rule
  • dart_deps module extension
  • Version conflict detection across modules with actionable error messages

Phase 4: Testing & Coverage

  • Coverage script generation (Unix/Windows)
  • LCOV output format for bazel coverage
  • Test sharding via shard_count attribute

Phase 5: Code Generation

  • dart_proto_library - Proto message generation
  • dart_grpc_library - gRPC service stub generation
  • dart_build_runner - freezed/json_serializable support
  • Working examples: proto_example/, freezed_example/

Phase 6: Advanced Features

  • rbe.bazelrc - Complete RBE configuration
  • BuildBuddy and Google Cloud Build support
  • Remote caching (read-only and read-write modes)

Phase 8: IDE Integration

  • dart_ide_info aspect for IntelliJ/VSCode
  • DartIdeInfo provider with source/dependency info
  • VSCode settings generator
  • IntelliJ facet generator

File Structure

rules_dart/
├── defs.bzl           # Core rules
├── deps.bzl           # Dependency management + conflict detection
├── toolchain.bzl      # Toolchain abstraction
├── proto.bzl          # Proto/gRPC code generation
├── build_runner.bzl   # build_runner integration
├── aspects.bzl        # IDE aspects
├── rbe.bazelrc        # Remote execution config
├── ROADMAP.md         # Feature parity tracking
├── private/
│   ├── coverage.bzl   # Coverage support
│   ├── rbe.bzl        # RBE utilities
│   ├── helpers.bzl    # Common utilities
│   ├── windows.bzl    # Windows script generation
│   └── unix.bzl       # Unix script generation
├── worker/            # Persistent worker
├── gazelle/           # Go-based Gazelle extension
├── scripts/           # Cross-platform test scripts
└── examples/
    ├── hello_world/       # Basic rules
    ├── proto_example/     # Proto/gRPC (with test.sh + test.bat)
    └── freezed_example/   # build_runner (with test.sh + test.bat)

Remaining Future Work

  • Flutter Support (Phase 7): flutter_library, flutter_test, flutter_application

Testing

  • All core rules tested on Windows, macOS, Linux
  • Cross-platform test scripts (.sh + .bat) for all examples
  • CI workflow validates portability

Breaking Changes

None - all changes are additive.

@yesudeep yesudeep force-pushed the yesudeep/feat/careful-level branch 17 times, most recently from 636f783 to edf2d0f Compare February 1, 2026 09:09
@yesudeep yesudeep force-pushed the yesudeep/feat/careful-level branch 13 times, most recently from af9b734 to dfb0ae7 Compare February 1, 2026 10:14
@yesudeep yesudeep force-pushed the yesudeep/feat/careful-level branch 3 times, most recently from 8a7df75 to 6dfb00f Compare February 1, 2026 10:32
@yesudeep yesudeep force-pushed the yesudeep/feat/careful-level branch 2 times, most recently from 4a21128 to 1410cfa Compare February 1, 2026 10:44
@yesudeep yesudeep force-pushed the yesudeep/feat/careful-level branch 2 times, most recently from 752bb83 to 3d81346 Compare February 1, 2026 10:59
@yesudeep yesudeep force-pushed the yesudeep/feat/careful-level branch from 3d81346 to 2d5f9e9 Compare February 1, 2026 11:04
@yesudeep yesudeep changed the title feat(rules_dart): more features to support independence feat(rules_dart): first-class Bazel ruleset with RBE, IDE aspects, and version conflict detection Feb 1, 2026
@yesudeep yesudeep merged commit 1624c75 into main Feb 1, 2026
64 checks passed
@yesudeep yesudeep deleted the yesudeep/feat/careful-level branch February 1, 2026 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants