Bazel BUILD Encyclopedia of Functions

Concepts and terminology

Functions

Rules

Native rules ship with the Bazel binary and do not require a load statement. Native rules are available globally in BUILD files. In .bzl files, you can find them in the native module. For non-native Starlark rules that ship separately from Bazel, see the list of recommended rules.

Language-specific native rules

Language Flags Binary rules Library rules Test rules Other rules
C / C++ cc_binary cc_import cc_library cc_shared_library cc_static_library cc_test cc_toolchain fdo_prefetch_hints fdo_profile memprof_profile propeller_optimize
Java java_binary java_import java_library java_test java_package_configuration java_plugin java_runtime java_single_jar java_toolchain
Objective-C objc_import objc_library
Protocol Buffer cc_proto_library java_lite_proto_library java_proto_library proto_library py_proto_library proto_lang_toolchain proto_toolchain
Python py_binary py_library py_test py_runtime
Shell sh_binary sh_library sh_test

Language-agnostic native rules

Family Rules
Extra Actions * action_listener* extra_action
General * alias* config_setting* filegroup* genquery* genrule* starlark_doc_extract* test_suite
Platforms and Toolchains * constraint_setting* constraint_value* platform* toolchain* toolchain_type

Licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License.
https://bazel.build/versions/9.1.0/reference/be/overview