• Stars
    star
    1,156
  • Rank 40,363 (Top 0.8 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created almost 7 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Gazelle is a Bazel build file generator for Bazel projects. It natively supports Go and protobuf, and it may be extended to support new languages and custom rule sets.

Gazelle build file generator

Gazelle is a build file generator for Bazel projects. It can create new BUILD.bazel files for a project that follows language conventions, and it can update existing build files to include new sources, dependencies, and options. Gazelle natively supports Go and protobuf, and it may be extended to support new languages and custom rule sets.

Gazelle may be run by Bazel using the gazelle rule, or it may be installed and run as a command line tool. Gazelle can also generate build files for external repositories as part of the go_repository rule.

Gazelle is under active development. Its interface and the rules it generates may change. Gazelle is not an official Google product.

Mailing list: bazel-go-discuss

Slack: #go on Bazel Slack, #bazel on Go Slack

rules_go and Gazelle are getting community maintainers! If you are a regular user of either project and are interested in helping out with development, code reviews, and issue triage, please drop by our Slack channels (linked above) and say hello!

See also:

Supported languages

Gazelle can generate Bazel BUILD files for many languages:

  • Go

    Go supported is included here in bazel-gazelle, see below.

  • Haskell

    Tweag's rules_haskell has two extensions: gazelle_cabal, for generating rules from Cabal files and gazelle_haskell_modules for even more fine-grained build definitions.

  • Java

    bazel-contrib's rules_jvm extensions include a gazelle extension for generating java_library, java_binary, java_test, and java_test_suite rules.

  • JavaScript / TypeScript

    BenchSci's rules_nodejs_gazelle supports generating ts_project, js_library, jest_test, and web_asset rules, and is able to support module bundlers like Webpack and Next.js

  • Protocol Buffers

    Support for the proto_library rule, as well as go_proto_library is in this repository, see below. Other language-specific proto rules are not supported here. stackb/rules_proto is a good resource for these rules.

  • Python

    rules_python has an extension for generating py_library, py_binary, and py_test rules.

  • R

    rules_r has an extension for generating rules for R package builds and tests.

  • Starlark

    bazel-skylib has an extension for generating bzl_library rules. See `bazel_skylib//gazelle/bzl`_.

  • Swift

    swift_bazel has an extension for generating swift_library, swift_binary, and swift_test rules. It also includes facilities for resolving, downloading and building external Swift packages for a Bazel workspace.

If you know of an extension which could be linked here, please open a PR!

More languages can be added by Extending Gazelle. Chat with us in the #gazelle channel on Bazel Slack if you'd like to discuss your design.

If you've written your own extension, please consider open-sourcing it for use by the rest of the community. Note that such extensions belong in a language-specific repository, not in bazel-gazelle. See discussion in #1030.

Setup

Running Gazelle with Bazel

To use Gazelle in a new project, add the bazel_gazelle repository and its dependencies to your WORKSPACE file and call gazelle_dependencies. It should look like this:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "io_bazel_rules_go",
    sha256 = "6dc2da7ab4cf5d7bfc7c949776b1b7c733f05e56edc4bcd9022bb249d2e2a996",
    urls = [
        "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.39.1/rules_go-v0.39.1.zip",
        "https://github.com/bazelbuild/rules_go/releases/download/v0.39.1/rules_go-v0.39.1.zip",
    ],
)

http_archive(
    name = "bazel_gazelle",
    sha256 = "727f3e4edd96ea20c29e8c2ca9e8d2af724d8c7778e7923a854b2c80952bc405",
    urls = [
        "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.30.0/bazel-gazelle-v0.30.0.tar.gz",
        "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.30.0/bazel-gazelle-v0.30.0.tar.gz",
    ],
)


load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")

############################################################
# Define your own dependencies here using go_repository.
# Else, dependencies declared by rules_go/gazelle will be used.
# The first declaration of an external repository "wins".
############################################################

go_rules_dependencies()

go_register_toolchains(version = "1.20.4")

gazelle_dependencies()

gazelle_dependencies supports optional argument go_env (dict-mapping) to set project specific go environment variables. If you are using a WORKSPACE.bazel file, you will need to specify that using:

gazelle_dependencies(go_repository_default_config = "//:WORKSPACE.bazel")

Add the code below to the BUILD or BUILD.bazel file in the root directory of your repository.

Important: For Go projects, replace the string after prefix with the portion of your import path that corresponds to your repository.

load("@bazel_gazelle//:def.bzl", "gazelle")

# gazelle:prefix github.com/example/project
gazelle(name = "gazelle")

After adding this code, you can run Gazelle with Bazel.

$ bazel run //:gazelle

This will generate new BUILD.bazel files for your project. You can run the same command in the future to update existing BUILD.bazel files to include new source files or options.

You can write other gazelle rules to run alternate commands like update-repos.

gazelle(
    name = "gazelle-update-repos",
    args = [
        "-from_file=go.mod",
        "-to_macro=deps.bzl%go_dependencies",
        "-prune",
    ],
    command = "update-repos",
)

You can also pass additional arguments to Gazelle after a -- argument.

$ bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro=deps.bzl%go_dependencies

After running update-repos, you might want to run bazel run //:gazelle again, as the update-repos command can affect the output of a normal run of Gazelle.

Running Gazelle with Go

If you have a Go toolchain installed, you can install Gazelle with the command below:

go install github.com/bazelbuild/bazel-gazelle/cmd/gazelle@latest

Make sure to re-run this command to upgrade Gazelle whenever you upgrade rules_go in your repository.

To generate BUILD.bazel files in a new project, run the command below, replacing the prefix with the portion of your import path that corresponds to your repository.

gazelle -go_prefix github.com/example/project

Most of Gazelle's command-line arguments can be expressed as special comments in build files. See Directives below. You may want to copy this line into your root build files to avoid having to type -go_prefix every time.

# gazelle:prefix github.com/example/project

Compatibility with Go

Gazelle is compatible with supported releases of Go, per the Go Release Policy. The Go Team officially supports the current and previous minor releases. Older releases are not supported and don't receive bug fixes or security updates.

Gazelle may use language and library features from the oldest supported release.

Compatibility with rules_go

Gazelle generates build files that use features in newer versions of rules_go. Newer versions of Gazelle may generate build files that work with older versions of rules_go, but check the table below to ensure you're using a compatible version.

Gazelle version Minimum rules_go version Maximum rules_go version
0.8 0.8 n/a
0.9 0.9 n/a
0.10 0.9 0.11
0.11 0.11 0.24
0.12 0.11 0.24
0.13 0.13 0.24
0.14 0.13 0.24
0.15 0.13 0.24
0.16 0.13 0.24
0.17 0.13 0.24
0.18 0.19 0.24
0.19 0.19 0.24
0.20 0.20 0.24
0.21 0.20 0.24
0.22 0.20 0.24
0.23 0.26 0.28
0.24 0.29 n/a
0.25 0.29 n/a
0.26 0.29 n/a
0.27 0.29 n/a
0.28 0.35 n/a
0.29 0.35 n/a
0.30 0.35 n/a

Usage

Command line

gazelle <command> [flags...] [package-dirs...]

The first argument to Gazelle may be one of the commands below. If no command is specified, update is assumed. The remaining arguments are specific to each command and are documented below.

update
Scans sources files, then generates and updates build files.
fix
Same as the update command, but it also fixes deprecated usage of rules.
update-repos
Adds and updates repository rules in the WORKSPACE file.

Bazel rule

Gazelle may be run via a rule. See Running Gazelle with Bazel for setup instructions. This rule builds Gazelle and generates a wrapper script that executes Gazelle with baked-in set of arguments. You can run this script with bazel run, or you can copy it into your workspace and run it directly.

The following attributes are available on the gazelle rule.

Name Type Default value
gazelle label @bazel_gazelle//cmd/gazelle
The gazelle_binary rule that builds Gazelle. You can substitute a modified version of Gazelle with this. See Extending Gazelle.
external string external
The method for resolving unknown imports to Bazel dependencies. May be external, static or vendored. See Dependency resolution.
build_tags string_list []
The list of Go build tags that Gazelle should consider to always be true.
prefix string ""

The import path that corresponds to the repository root directory.

Note: It's usually better to write a directive like # gazelle:prefix example.com/repo in your build file instead of setting this attribute.

extra_args string_list []
A list of extra command line arguments passed to Gazelle. Note that extra_args are suppressed by extra command line args (e.g. bazel run //:gazelle -- subdir). See #536 for explanation.
command string update
The Gazelle command to use. May be fix, update or update-repos.

fix and update

The update command is the most common way of running Gazelle. Gazelle scans sources in directories throughout the repository, then creates and updates build files.

The fix command does everything update does, but it also fixes deprecated usage of rules, analogous to go fix. For example, cgo_library will be consolidated with go_library. This command may delete or rename rules, so it's not on by default. See Fix command transformations for details.

Both commands accept a list of directories to process as positional arguments. If no directories are specified, Gazelle will process the current directory. Subdirectories will be processed recursively.

The following flags are accepted:

Name Default value
-build_file_name file1,file2,... BUILD.bazel,BUILD
Comma-separated list of file names. Gazelle recognizes these files as Bazel build files. New files will use the first name in this list. Use this if your project contains non-Bazel files named BUILD (or build on case-insensitive file systems).
-build_tags tag1,tag2 Β 

List of Go build tags Gazelle will consider to be true. Gazelle applies constraints when generating Go rules. It assumes certain tags are true on certain platforms (for example, amd64,linux). It assumes all Go release tags are true (for example, go1.8). It considers other tags to be false (for example, ignore). This flag overrides that behavior.

Bazel may still filter sources with these tags. Use bazel build --define gotags=foo,bar to set tags at build time.

-exclude pattern Β 

Prevents Gazelle from processing a file or directory if the given doublestar.Match pattern matches. If the pattern refers to a source file, Gazelle won't include it in any rules. If the pattern refers to a directory, Gazelle won't recurse into it.

This option may be repeated. Patterns must be slash-separated, relative to the repository root. This is equivalent to the # gazelle:exclude pattern directive.

-external external|static|vendored external
Determines how Gazelle resolves import paths that cannot be resolve in the current repository. May be external, static or vendored. See Dependency resolution.
-index true|false true
Determines whether Gazelle should index the libraries in the current repository and whether it should use the index to resolve dependencies. If this is switched off, Gazelle would rely on # gazelle:prefix directive or -go_prefix flag to resolve dependencies.
-go_grpc_compiler @io_bazel_rules_go//proto:go_grpc

The protocol buffers compiler to use for building go bindings for gRPC. May be repeated.

See Predefined plugins for available options; commonly used options include @io_bazel_rules_go//proto:gofast_grpc and @io_bazel_rules_go//proto:gogofaster_grpc.

-go_naming_convention Β 
Controls the names of generated Go targets. Equivalent to the # gazelle:go_naming_convention directive. See details in Directives below.
-go_naming_convention_external Β 
Controls the default naming convention used when resolving libraries in external repositories with unknown naming conventions. Equivalent to the # gazelle:go_naming_convention_external directive.
-go_prefix example.com/repo Β 

A prefix of import paths for libraries in the repository that corresponds to the repository root. Equivalent to setting the # gazelle:prefix directive in the root BUILD.bazel file or the prefix attribute of the gazelle rule. If neither of those are set, this option is mandatory.

This prefix is used to determine whether an import path refers to a library in the current repository or an external dependency.

-go_proto_compiler @io_bazel_rules_go//proto:go_proto

The protocol buffers compiler to use for building go bindings. May be repeated.

See Predefined plugins for available options; commonly used options include @io_bazel_rules_go//proto:gofast_proto and @io_bazel_rules_go//proto:gogofaster_proto.

-known_import example.com Β 

Skips import path resolution for a known domain. May be repeated.

When Gazelle resolves an import path to an external dependency, it attempts to discover the remote repository root over HTTP. Gazelle skips this discovery step for a few well-known domains with predictable structure, like golang.org and github.com. This flag specifies additional domains to skip, which is useful in situations where the lookup would fail for some reason.

-mode fix|print|diff fix

Method for emitting merged build files.

In fix mode, Gazelle writes generated and merged files to disk. In print mode, it prints them to stdout. In diff mode, it prints a unified diff.

-proto default|file|package|legacy|disable|disable_global default
Determines how Gazelle should generate rules for .proto files. See details in Directives below.
-proto_group group ""
Determines the proto option Gazelle uses to group .proto files into rules when in package mode. See details in Directives below.
-proto_import_prefix path Β 
Sets the import_prefix attribute of generated proto_library rules. This adds a prefix to the string used to import .proto files listed in the srcs attribute of generated rules. Equivalent to the # gazelle:proto_import_prefix directive. See details in Directives below.
-repo_root dir Β 

The root directory of the repository. Gazelle normally infers this to be the directory containing the WORKSPACE file.

Gazelle will not process packages outside this directory.

-lang lang1,lang2,... ""

Selects languages for which to compose and index rules.

By default, all languages that this Gazelle was built with are processed.

update-repos

The update-repos command updates repository rules. It can write the rules to either the WORKSPACE (by default) or a .bzl file macro function. It can be used to add new repository rules or update existing rules to the specified version. It can also import repository rules from a go.mod or a go.work file.

# Add or update a repository to latest version by import path
$ gazelle update-repos example.com/new/repo

# Add or update a repository to specified version/commit by import path
$ gazelle update-repos example.com/new/[email protected]

# Import repositories from go.mod
$ gazelle update-repos -from_file=go.mod

# Import repositories from go.work
$ gazelle update-repos -from_file=go.work

# Import repositories from go.mod and update macro
$ gazelle update-repos -from_file=go.mod -to_macro=repositories.bzl%go_repositories

# Import repositories from go.work and update macro
$ gazelle update-repos -from_file=go.work -to_macro=repositories.bzl%go_repositories

The following flags are accepted:

Name Default value
-from_file lock-file Β 

Import repositories from a file as go_repository rules. These rules will be added to the bottom of the WORKSPACE file or merged with existing rules.

The lock file format is inferred from the file name. go.mod and ``go.work` are all supported.

-repo_root dir Β 

The root directory of the repository. Gazelle normally infers this to be the directory containing the WORKSPACE file.

Gazelle will not process packages outside this directory.

-to_macro macroFile%defName Β 

Tells Gazelle to write new repository rules into a .bzl macro function rather than the WORKSPACE file.

The repository_macro directive should be added to the WORKSPACE in order for future Gazelle calls to recognize the repos defined in the macro file.

-prune true|false false

When true, Gazelle will remove go_repository rules that no longer have equivalent repos in the go.mod file.

This flag can only be used with -from_file.

-build_directives arg1,arg2,... Β 
Sets the build_directives attribute for the generated go_repository rule(s).
-build_external external|vendored Β 
Sets the build_external attribute for the generated go_repository rule(s).
-build_extra_args arg1,arg2,... Β 
Sets the build_extra_args attribute for the generated go_repository rule(s).
-build_file_generation auto|on|off Β 
Sets the build_file_generation attribute for the generated go_repository rule(s).
-build_file_names file1,file2,... Β 
Sets the build_file_name attribute for the generated go_repository rule(s).
-build_file_proto_mode default|package|legacy|disable|disable_global Β 
Sets the build_file_proto_mode attribute for the generated go_repository rule(s).
-build_tags tag1,tag2,... Β 
Sets the build_tags attribute for the generated go_repository rule(s).

Directives

Gazelle can be configured with directives, which are written as top-level comments in build files. Most options that can be set on the command line can also be set using directives. Some options can only be set with directives.

Directive comments have the form # gazelle:key value. For example:

load("@io_bazel_rules_go//go:def.bzl", "go_library")

# gazelle:prefix github.com/example/project
# gazelle:build_file_name BUILD,BUILD.bazel

go_library(
    name = "go_default_library",
    srcs = ["example.go"],
    importpath = "github.com/example/project",
    visibility = ["//visibility:public"],
)

Directives apply in the directory where they are set and in subdirectories. This means, for example, if you set # gazelle:prefix in the build file in your project's root directory, it affects your whole project. If you set it in a subdirectory, it only affects rules in that subtree.

The following directives are recognized:

Gazelle also reads directives from the WORKSPACE file. They may be used to discover custom repository names and known prefixes. The fix and update commands use these directives for dependency resolution. update-repos uses them to learn about repository rules defined in alternate locations.

WORKSPACE Directive Default value
# gazelle:repository_macro [+]macroFile%defName n/a

Tells Gazelle to look for repository rules in a macro in a .bzl file. The directive can be repeated multiple times. The macro can be generated by calling update-repos with the to_macro flag.

The directive can be prepended with a "+", which will tell Gazelle to also look for repositories within any macros called by the specified macro.

# gazelle:repository rule_kind attr1_name=attr1_value ... n/a

Specifies a repository rule that Gazelle should know about. The directive can be repeated multiple times, and can be declared from within a macro definition that Gazelle knows about. At the very least the directive must define a rule kind and a name attribute, but it can define extra attributes after that.

This is useful for teaching Gazelle about repos declared in external macros. The directive can also be used to override an actual repository rule. For example, a git_repository rule for org_golang_x_tools could be overriden with the directive:

# gazelle:repository go_repository name=org_golang_x_tools importpath=golang.org/x/tools

Gazelle would then proceed as if org_golang_x_tools was declared as a go_repository rule.

Keep comments

In addition to directives, Gazelle supports # keep comments that protect parts of build files from being modified. # keep may be written before a rule, before an attribute, or after a string within a list.

# keep comments might take one of 2 forms; the # keep literal or a description prefixed by ``# keep: ``.

Example

Suppose you have a library that includes a generated .go file. Gazelle won't know what imports to resolve, so you may need to add dependencies manually with # keep comments.

load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@com_github_example_gen//:gen.bzl", "gen_go_file")

gen_go_file(
    name = "magic",
    srcs = ["magic.go.in"],
    outs = ["magic.go"],
)

go_library(
    name = "go_default_library",
    srcs = ["magic.go"],
    visibility = ["//visibility:public"],
    deps = [
        "@com_github_example_gen//:go_default_library",  # keep
        "@com_github_example_gen//a/b/c:go_default_library",  # keep: this is also important
    ],
)

Dependency resolution

One of Gazelle's most important jobs is resolving library import strings (like import "golang.org/x/sys/unix") to Bazel labels (like @org_golang_x_sys//unix:go_default_library). Gazelle follows the rules below to resolve dependencies:

  1. If the import to be resolved is part of a standard library, no explicit dependency is written. For example, in Go, you don't need to declare that you depend on "fmt".
  2. If a # gazelle:resolve directive matches the import to be resolved, the label at the end of the directive will be used.
  3. If proto rule generation is enabled, special rules will be used when importing certain libraries. These rules may be disabled by adding # gazelle:proto disable_global to a build file (this will affect subdirectories, too) or by passing -proto disable_global on the command line.
    1. Imports of Well Known Types are mapped to rules in @io_bazel_rules_go//proto/wkt.
    2. Imports of Google APIs are mapped to @go_googleapis.
    3. Imports of github.com/golang/protobuf/ptypes, descriptor, and jsonpb are mapped to special rules in @com_github_golang_protobuf. See Avoiding conflicts with proto rules.
  4. If the import to be resolved is in the library index, the import will be resolved to that library. If -index=true, Gazelle builds an index of library rules in the current repository before starting dependency resolution, and this is how most dependencies are resolved.
    1. For Go, the match is based on the importpath attribute.
    2. For proto, the match is based on the srcs attribute.
  5. If -index=false and a package is imported that has the current go_prefix as a prefix, Gazelle generates a label following a convention. For example, if the build file in //src set the prefix with # gazelle:prefix example.com/repo/foo, and you import the library "example.com/repo/foo/bar, the dependency will be "//src/foo/bar:go_default_library".
  6. Otherwise, Gazelle will use the current external mode to resolve the dependency.
    1. In external mode (the default), Gazelle will transform the import string into an external repository label. For example, "golang.org/x/sys/unix" would be resolved to "@org_golang_x_sys//unix:go_default_library". Gazelle does not confirm whether the external repository is actually declared in WORKSPACE, but if there is a go_repository in WORKSPACE with a matching importpath, Gazelle will use its name. Gazelle does not index rules in external repositories, so it's possible the resolved dependency does not exist.
    2. In static mode, Gazelle has the same behavior as external mode, except that it will not call out to the network for resolution when no matching import is found within WORKSPACE. Instead, it will skip the unknown import. This is the default mode for go_repository rules.
    3. In vendored mode, Gazelle will transform the import string into a label in the vendor directory. For example, "golang.org/x/sys/unix" would be resolved to "//vendor/golang.org/x/sys/unix:go_default_library". This mode is usually not necessary, since vendored libraries will be indexed and resolved using rule 4.

Fix command transformations

Gazelle will generate and update build files when invoked with either gazelle update or gazelle fix (update is the default). Both commands perform several transformations to fix deprecated usage of the Go rules. update performs a safe set of tranformations, while fix performs some additional transformations that may delete or rename rules.

The following transformations are performed:

Migrate library to embed (fix and update): Gazelle replaces library attributes with embed attributes.

Migrate gRPC compilers (fix and update): Gazelle converts go_grpc_library rules to go_proto_library rules with compilers = ["@io_bazel_rules_go//proto:go_grpc"].

Flatten srcs (fix and update): Gazelle converts srcs attributes that use OS and architecture-specific select expressions to flat lists. rules_go filters these sources anyway.

Squash cgo libraries (fix only): Gazelle will remove cgo_library rules named cgo_default_library and merge their attributes with a go_library rule in the same package named go_default_library. If no such go_library rule exists, a new one will be created. Other cgo_library rules will not be removed.

Squash external tests (fix only): Gazelle will squash go_test rules named go_default_xtest into go_default_test. Earlier versions of rules_go required internal and external tests to be built separately, but this is no longer needed.

Remove legacy protos (fix only): Gazelle will remove usage of go_proto_library rules loaded from @io_bazel_rules_go//proto:go_proto_library.bzl and filegroup rules named go_default_library_protos. Newly generated proto rules will take their place. Since filegroup isn't needed anymore and go_proto_library has different attributes and was always written by hand, Gazelle will not attempt to merge anything from these rules with the newly generated rules.

This transformation is only applied in the default proto mode. Since Gazelle will run in legacy proto mode if go_proto_library.bzl is loaded, this transformation is not usually applied. You can set the proto mode explicitly using the directive # gazelle:proto default.

Update loads of gazelle rule (fix and update): Gazelle will remove loads of gazelle from @io_bazel_rules_go//go:def.bzl. It will automatically add a load from @bazel_gazelle//:def.bzl if gazelle is not loaded from another location.

More Repositories

1

bazel

a fast, scalable, multi-language and extensible build system
Java
22,794
star
2

starlark

Starlark Language
Starlark
2,435
star
3

bazelisk

A user-friendly launcher for Bazel.
Go
2,060
star
4

rules_go

Go rules for Bazel
Go
1,356
star
5

rules_docker

Rules for building and handling Docker images with Bazel
Starlark
1,074
star
6

buildtools

A bazel BUILD file formatter and editor
Go
1,007
star
7

examples

Examples for Bazel
Starlark
831
star
8

intellij

IntelliJ plugin for Bazel projects
Java
762
star
9

rules_rust

Rust rules for Bazel
Starlark
660
star
10

bazel-buildfarm

Bazel remote caching and execution service
Java
650
star
11

tulsi

An Xcode Project Generator For Bazel
Swift
547
star
12

rules_python

Bazel Python Rules
Starlark
521
star
13

rules_apple

Bazel rules to build apps for Apple platforms.
Starlark
509
star
14

bazel-watcher

Tools for building Bazel targets when source files change.
Go
440
star
15

bazel-skylib

Common useful functions and rules for Bazel
Starlark
393
star
16

sandboxfs

A virtual file system for sandboxing
Rust
371
star
17

rules_scala

Scala rules for Bazel
Starlark
360
star
18

rules_kotlin

Bazel rules for Kotlin
Kotlin
331
star
19

remote-apis

An API for caching and execution of actions on a remote system.
Go
328
star
20

rules_swift

Bazel rules to build Swift on Apple and Linux platforms
Starlark
311
star
21

rules_k8s

This repository contains rules for interacting with Kubernetes configurations / clusters.
Starlark
289
star
22

rules_typescript

MOVED to https://github.com/bazelbuild/rules_nodejs/tree/3.x/third_party/github.com/bazelbuild/rules_typescript
TypeScript
275
star
23

continuous-integration

Bazel's Continuous Integration Setup
Python
258
star
24

bazel-central-registry

The central registry of Bazel modules for the Bzlmod external dependency system.
Starlark
247
star
25

rules_pkg

Bazel rules for creating packages of many types (zip, tar, deb, rpm, ...)
Starlark
225
star
26

rules_cc

C++ Rules for Bazel
Starlark
184
star
27

bazel-toolchains

Repository that hosts Bazel toolchain configs for remote execution and related support tools.
Go
183
star
28

rules_android

Android rules for Bazel
Starlark
175
star
29

rules_proto

Protocol buffer rules for Bazel
Starlark
163
star
30

rules_closure

Closure rules for Bazel
Java
153
star
31

vim-bazel

Vim support for Bazel
Vim Script
144
star
32

platforms

Constraint values for specifying platforms and toolchains
Starlark
108
star
33

stardoc

Stardoc: Starlark Documentation Generator
Java
107
star
34

proposals

Index of all Bazel proposals and design documents
106
star
35

rules_webtesting

Bazel rules to allow testing against a browser with WebDriver.
Go
96
star
36

apple_support

Apple support for Bazel rules
Starlark
83
star
37

emacs-bazel-mode

Emacs mode for Bazel
Emacs Lisp
80
star
38

rules_license

Starlark
77
star
39

rules_java

Java rules for Bazel
Starlark
72
star
40

reclient

Go
65
star
41

setup-bazelisk

Set up your GitHub Actions workflow with a specific version of Bazelisk
TypeScript
56
star
42

rules_sass

Sass rules for Bazel
Starlark
51
star
43

remote-apis-sdks

This repository contains client libraries for the Remote Execution API https://github.com/bazelbuild/remote-apis
Go
48
star
44

bazel-federation

Starlark
47
star
45

skydoc

Documentation generator for Skylark
Python
46
star
46

migration-tooling

Migration tools for Bazel
Java
44
star
47

codelabs

Shell
39
star
48

BUILD_file_generator

Generate BUILD files for your Java files
Java
39
star
49

eclipse

Eclipse For Bazel (deprecated, see https://github.com/salesforce/bazel-eclipse instead)
Java
32
star
50

bazel-integration-testing

Framework for integration tests that call Bazel
Java
32
star
51

rules_appengine

AppEngine rules for Bazel
Starlark
30
star
52

rules_android_ndk

Starlark
29
star
53

tools_remote

Java
28
star
54

bazel-bench

Benchmarking tool for bazel
Python
27
star
55

vim-ft-bzl

Vim Script
27
star
56

rules_perl

Perl rules for Bazel
Starlark
25
star
57

tools_android

Tools for use with building Android apps with Bazel
Starlark
24
star
58

homebrew-tap

This repository contains a collection of Homebrew (aka, Brew) "formulae" for Bazel
24
star
59

rules_d

D rules for Bazel
Starlark
24
star
60

bazel-blog

Content of the Bazel blog
HTML
20
star
61

bzlmod

Go
20
star
62

rules_testing

Starlark testing framework and utility libraries
Starlark
20
star
63

rules_gwt

Bazel rules for GWT
Starlark
19
star
64

bazel-website

Website for Bazel, a fast, scalable, multi-language and extensible build system
HTML
17
star
65

bazelcon

Artifacts from BazelCon
15
star
66

java_tools

Python
12
star
67

rules_groovy

Groovy rules for Bazel
Starlark
11
star
68

rules_postcss

PostCSS rules for Bazel
Starlark
10
star
69

rules_platform

Starlark
8
star
70

bazel_metrics

Python
7
star
71

community

Resources for community management efforts, such as SIGs
6
star
72

rules_angular

OBSOLETE see https://github.com/angular/angular/tree/master/packages/bazel
Python
5
star
73

gmaven_rules

This repository is deprecated. Please instead use https://github.com/bazelbuild/rules_jvm_external
Python
3
star
74

rules_utp

Starlark
2
star
75

.allstar

1
star
76

.github

1
star
77

bazel-worker-api

Java
1
star
78

build-event-stream

1
star
79

rules_sh

1
star