Skip to content

Commit 1624c75

Browse files
authored
feat(rules_dart): first-class Bazel ruleset with RBE, IDE aspects, and version conflict detection (#512)
* feat(rules_dart): more features to support independence * refactor(rules_dart): modularize * feat: workers * feat: more features and proto
1 parent 3b2982c commit 1624c75

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+8843
-565
lines changed

.bazelrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import %workspace%/ts.bazelrc
1313
import %workspace%/java.bazelrc
1414
import %workspace%/rust.bazelrc
1515
import %workspace%/python.bazelrc
16+
import %workspace%/dart.bazelrc
1617

1718
# Allow user overrides. This should be the very last line and this file should
1819
# be in .gitignore.

.github/workflows/dart.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ jobs:
131131
uses: actions/checkout@v6
132132

133133
- name: Setup Bazel
134-
uses: bazel-contrib/setup-bazel@0.14.0
134+
uses: bazel-contrib/setup-bazel@0.18.0
135135
with:
136136
bazelisk-cache: true
137137
disk-cache: ${{ github.workflow }}
@@ -141,7 +141,7 @@ jobs:
141141
run: bazel build //dart/...
142142

143143
- name: Run Dart tests via Bazel
144-
run: bazel test //dart/dotprompt/test:... --test_output=errors
144+
run: bazel test //dart/... --test_output=errors
145145
continue-on-error: true # Tests may need network access
146146

147147
antlr-grammar:

.github/workflows/rules_dart.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Copyright 2026 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
# SPDX-License-Identifier: Apache-2.0
16+
17+
name: Rules Dart Tests
18+
19+
on:
20+
push:
21+
branches: [ main ]
22+
paths:
23+
- 'bazel/rules_dart/**'
24+
- '.github/workflows/rules_dart.yml'
25+
pull_request:
26+
branches: [ main ]
27+
paths:
28+
- 'bazel/rules_dart/**'
29+
- '.github/workflows/rules_dart.yml'
30+
workflow_dispatch:
31+
32+
jobs:
33+
smoke_test:
34+
name: Smoke Test
35+
strategy:
36+
matrix:
37+
os: [ubuntu-latest, macos-latest, windows-latest]
38+
runs-on: ${{ matrix.os }}
39+
defaults:
40+
run:
41+
shell: bash
42+
43+
steps:
44+
- uses: actions/checkout@v4
45+
46+
- name: Setup Bazel
47+
uses: bazel-contrib/setup-bazel@0.18.0
48+
with:
49+
bazelisk-cache: true
50+
disk-cache: ${{ github.workflow }}-${{ matrix.os }}
51+
repository-cache: true
52+
cache-save: true
53+
54+
- name: Run Smoke Tests (Unix)
55+
if: runner.os != 'Windows'
56+
run: ./bazel/rules_dart/scripts/test_examples.sh
57+
58+
- name: Run Smoke Tests (Windows)
59+
if: runner.os == 'Windows'
60+
shell: cmd
61+
run: bazel\rules_dart\scripts\test_examples.bat

BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,5 @@ npm_link_package(
3838
# This macro expands to a npm_link_package for each of the dependencies in
3939
# package.json.
4040
npm_link_all_packages(name = "node_modules")
41+
42+
exports_files(["MODULE.bazel"])

MODULE.bazel

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@ module(
2424
bazel_dep(name = "bazel_skylib", version = "1.8.2")
2525
bazel_dep(name = "gazelle", version = "0.47.0")
2626
bazel_dep(name = "platforms", version = "1.0.0")
27-
2827
bazel_dep(name = "rules_dart", version = "0.0.1")
29-
local_path_override(module_name = "rules_dart", path = "bazel/rules_dart")
28+
local_path_override(
29+
module_name = "rules_dart",
30+
path = "bazel/rules_dart",
31+
)
3032

3133
include("//:dart.MODULE.bazel")
3234
include("//:go.MODULE.bazel")

MODULE.bazel.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bazel/dart/defs.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ chmod +x $@
133133
DART_SDK,
134134
"//dart/dotprompt:dotprompt",
135135
"//dart/dotprompt:pubspec.yaml",
136-
"//dart/dotprompt/test:spec_test.dart",
136+
"//dart/dotprompt:test/spec_test.dart",
137137
# Include handlebarrz as it's a path dependency
138138
"//dart/handlebarrz:handlebarrz",
139139
"//dart/handlebarrz:pubspec.yaml",

bazel/rules_dart/BUILD.bazel

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,20 @@
1717
"""Custom Bazel rules for Dart language support."""
1818

1919
exports_files([
20+
"aspects.bzl",
21+
"build_runner.bzl",
2022
"defs.bzl",
23+
"deps.bzl",
2124
"extensions.bzl",
25+
"proto.bzl",
26+
"rbe.bazelrc",
2227
"repositories.bzl",
28+
"toolchain.bzl",
2329
])
30+
31+
# Toolchain type for Dart
32+
# Rules use this to request a Dart toolchain via ctx.toolchains
33+
toolchain_type(
34+
name = "toolchain_type",
35+
visibility = ["//visibility:public"],
36+
)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Code of Conduct
2+
3+
This project follows [Google's Open Source Community Guidelines](https://opensource.google/conduct/).
4+
5+
We are committed to maintaining a community that satisfies these guidelines.

0 commit comments

Comments
 (0)