Bazel BUILD Encyclopedia of Functions
Contents
Concepts and terminology
Functions
Rules
Native rules ship with the Bazel binary and do not require aload
statement.
Native rules are available globally in BUILD files. In .bzl files, you can find them in
the native
module.
Language-specific native rules
Language | Binary rules | Library rules | Test rules | Other rules | |
---|---|---|---|---|---|
Android |
android_binary
|
aar_import
android_library |
android_instrumentation_test
android_local_test |
android_device
android_ndk_repository android_sdk_repository |
|
C / C++ |
cc_binary
|
cc_import
cc_library cc_proto_library fdo_prefetch_hints fdo_profile |
cc_test
|
cc_toolchain
cc_toolchain_suite |
|
Java |
java_binary
|
java_import
java_library java_lite_proto_library java_proto_library |
java_test
|
java_package_configuration
java_plugin |
java_runtime
java_toolchain |
Objective-C |
apple_binary
apple_static_library |
j2objc_library
objc_import objc_library objc_proto_library |
|||
Protocol Buffer |
proto_lang_toolchain
proto_library |
||||
Python |
py_binary
|
py_library
|
py_test
|
py_runtime
|
|
Shell |
sh_binary
|
sh_library
|
sh_test
|
Native rules that do not apply to a specific programming language
Extra Actions |
action_listener
|
extra_action
|
|||
General |
filegroup
|
genquery
|
test_suite
|
alias
config_setting genrule |
|
Platform |
constraint_setting
constraint_value |
platform
toolchain |
|||
Workspace |
bind
local_repository maven_jar |
maven_server
new_local_repository xcode_config xcode_version |
Additional rules
Non-native rules extend Bazel's capabilities. Rules for many popular languages have been created and are being maintained outside of Bazel. Contact the respective rule set's maintainers regarding issues and feature requests.
To find more Bazel rules, use a search engine or look on GitHub.
Here is a selection of popular rules:
- Android
- Apple platforms
- Boost
- C#
- Closure
- Docker
- Go
- Haskell
- Jsonnet
- Kotlin
- Kubernetes
- NodeJS
- Protobuf
- Python
- Rust
- Scala
- Swift
- Typescript
- Webtesting (Webdriver)
The repository Skylib contains additional functions that can be useful when writing new rules and new macros.