Rules
The rules of the prelude that have a reference page. A build file can use
them without a load().
| Rule | Category | Description |
|---|---|---|
alias | core | An alias() gives another name to a target. |
android_aar | android | An android_aar() rule is used to generate an Android AAR. |
android_app_modularity | android | An android_app_modularity() rule is used to determine the modular structure of an Android app. |
android_binary | android | An android_binary() rule is used to generate an Android APK. |
android_build_config | android | An android_build_config() rule is used to generate a BuildConfig class with global configuration variables that other android_library() rules can compile against. |
android_bundle | android | An android_bundle() rule is used to generate an Android App Bundle (AAB). |
android_emulators | android | |
android_instrumentation_apk | android | An android_instrumentation_apk() rule is used to generate an Android Instrumentation APK. |
android_instrumentation_test | android | An android_instrumentation_test() rule is used to define apks that should be used to run Android instrumentation tests. |
android_library | android | An android_library() rule is used to define a set of Java files that can be compiled together against the Android SDK. |
android_manifest | android | An android_manifest() rule is used to generate an Android Manifest to be used by android_binary() and android_aar() rules. |
android_prebuilt_aar | android | An android_prebuilt_aar() rule takes an .aar file and makes it available as an Android dependency. |
android_resource | android | An android_resource() rule is used to bundle Android resources that are traditionally stored in res and assets directories. |
apk_genrule | android | An apk_genrule() rule is used to post-process an APK. |
apple_app_intents | apple | An apple_app_intents() rule represents App Intents definitions for Apple platforms. |
apple_asset_catalog | apple | An apple_asset_catalog() rule contains resources stored in Apple asset catalog directories. |
apple_binary | apple | An apple_binary() rule builds a native executable - such as an iOS or OSX app - from the supplied set of Objective-C/C++ source files and dependencies. |
apple_bundle | apple | An apple_bundle() rule takes an Apple binary and all of the resources and asset catalogs in the rule's transitive dependencies and generates a bundle containing all of those files. |
apple_info_plist | apple | An apple_info_plist() rule defines mutations to apply to an Info.plist file. |
apple_ipa_package | apple | An apple_ipa_package() rule packages an apple_bundle() into an IPA file for distribution. |
apple_library | apple | An apple_library() rule represents a set of Objective-C/C++/Swift source files and is similar to a cxx_library() rule with which it shares many attributes. |
apple_library_for_distribution | apple | An apple_library_for_distribution() rule creates a library for distribution (for instance via a Framework or Xcframework) with link group support. |
apple_macos_bundle | apple | An apple_macos_bundle() rule generates a macOS application bundle. |
apple_metal_library | apple | An apple_metal_library() rule contains .metal and .h source files to be bundled together to create a .metallib |
apple_package | apple | An apple_package() rule takes the output of an apple_bundle() rule and compresses it in an IPA (iOS App Store Package) file. |
apple_provisioning_profile_sources | apple | An apple_provisioning_profile_sources() rule specifies a set of provisioning profile targets that are available for code signing Apple bundles. |
apple_resource | apple | An apple_resource() rule contains sets of resource directories, files and file variants that can be bundled in an application bundle. |
apple_resource_dedupe_alias | apple | An apple_resource_dedupe_alias() rule creates an alias for a resource target with a resource configuration transition applied. |
apple_selective_debugging | apple | An apple_selective_debugging() rule configures which targets have debug information included in the final binary. |
apple_simulators | apple | An apple_simulators() rule configures the Apple simulator environment used for running tests. |
apple_spm_package | apple | An apple_spm_package() rule packages a set of dependencies into a Swift Package Manager (SPM) compatible package. |
apple_static_archive | apple | An apple_static_archive() rule combines one or more Apple libraries into a single static archive (.a file). |
apple_test | apple | An apple_test() rule contains Objective-C/C++ code which can be built and used to test code contained in other rules. |
apple_toolchain | apple | An apple_toolchain() rule defines the set of tools and settings used to build Apple targets. |
apple_tools | apple | The apple_tools rule exposes a set of supplementary tools required by the Apple rules internally. |
apple_universal_executable | apple | An apple_universal_executable() rule takes a target via its binary attribute, builds it for multiple architectures and combines the result into a single binary using lipo. |
apple_watchos_bundle | apple | An apple_watchos_bundle() rule generates a watchOS application bundle. |
apple_xcframework | apple | An apple_xcframework() rule packages a framework target built for multiple platforms (e.g., iOS device, iOS simulator, macOS) into a single .xcframework bundle that can be distributed and consumed by Xcode projects or other build systems. |
apple_xcuitest | apple | An apple_xcuitest() rule defines an XCUITest UI test target. |
build_variants | core | A build_variants() rule lists the named ways of building one target: for each variant, the target platform to build for, and the buckconfigs, modefiles and modifiers to build with. |
command_alias | core | The command_alias rule enables you to wrap build rules that create binaries and to pre-apply command-line arguments and environment variables. |
config_setting | core | config_setting() accepts a list of constraint_values and a list of values (buckconfig keys + expected values) and matches if all of those match. |
configuration_alias | core | configuration_alias() acts like alias() but for configuration targets. |
configured_alias | core | A configured_alias() is an alias for a target as it is built for one platform. |
constraint | core | Unified constraint rule that defines both a constraint setting and its possible values. |
constraint_setting | core | Deprecated: use constraint() instead. |
constraint_value | core | Deprecated: use constraint() instead. |
core_data_model | apple | An core_data_model() rule contains models for Apple's Core Data framework. |
csharp_binary | .NET | A csharp_binary() rule builds a .Net executable from the supplied set of C# source files and dependencies by invoking csc. |
csharp_library | .NET | A csharp_library() rule builds a .Net library from the supplied set of C# source files and dependencies by invoking csc. |
cxx_binary | cxx | A cxx_binary() rule builds a native executable from the supplied set of C/C++ source files and dependencies. |
cxx_flags | cxx | A cxx_flags() target holds flags that C++ targets pull in through their flags attribute. |
cxx_genrule | cxx | A cxx_genrule() enables you to run shell commands as part of the Buck build process. |
cxx_headers_bundle | cxx | Bundles transitive exported C/C++ headers from C/C++ libraries, allowing them to e.g. be consumed via the resourcess parameter in other rules. |
cxx_library | cxx | A cxx_library() rule specifies a set of C/C++ source files and also provides flags that specify how those files should be built. |
cxx_lua_extension | lua | A cxx_lua_extension() rule is a variant of a C/C++ library which is built as a Lua module. |
cxx_precompiled_header | cxx | A cxx_precompiled_header rule specifies a single header file that can be precompiled and made available for use in other build rules such as a cxx_library() or a cxx_binary(). |
cxx_python_extension | python | A cxx_python_extension() rule is a variant of a C/C++ library which is built as a Python module. |
cxx_test | cxx | A cxx_test() rule builds a C/C++ binary against a C/C++ testing framework and runs it as part of test. |
cxx_toolchain | cxx | A cxx_toolchain() rule declares a complete C/C++ toolchain — a set of compilers (C, C++, Objective-C, asm, CUDA, HIP, etc.), preprocessors, linker, archiver, and binary utilities (strip, objcopy, dwp, nm, etc.) — along with the flags and behavior options that control how each tool is invoked. |
cxx_toolchain_override | cxx | |
cxx_universal_executable | apple | A cxx_universal_executable() rule takes a target via its binary attribute, builds it for multiple architectures and combines the result into a single binary using lipo. |
cython_library | cython | A rule that compiles Cython (.pyx) sources into Python C extensions. |
cython_static_extension | cython | A rule that compiles a single Cython (.pyx) source into a statically-linkable Python C extension. |
cython_toolchain | cython | A toolchain rule that provides the Cython compiler configuration. |
erlang_app | erlang | This rule is the main rule for Erlang applications. |
erlang_app_includes | erlang | This rule is a supplementary rule for Erlang applications. |
erlang_escript | erlang | The erlang_escript target builds and runs bundled escripts. |
erlang_otp_binaries | erlang | This target defines the executables for the Erlang toolchains, and is required to defined a toolchain. |
erlang_release | erlang | The erlang_release target builds OTP releases. |
erlang_test | erlang | The erlang_test ruls defines a test target for a single test suite. |
exec_platform_marker_constraint | core | Special constraint rule for defining execution platform markers. |
export_file | core | An export_file() takes a single file or folder and exposes it so other rules can use it. |
extract_archive | core | Extracts an archive into a directory. |
filegroup | core | This rule provides access to a set of files. |
gen_aidl | android | A gen_aidl() rule is used to generate .java files from .aidl files. |
genrule | core | A genrule() is used to generate files from a shell command. |
git_fetch | git | Checkout a commit from a git repository. |
go_binary | go | A go_binary() rule builds a native executable from the supplied set of Go source files and dependencies. |
go_bootstrap_binary | go | A go_bootstrap_binary() rule builds a minimal Go executable used during bootstrap, where the full go_binary() machinery is not yet available. |
go_exported_library | go | A go_exported_library() rule builds a C library from the supplied set of Go source files and dependencies. |
go_library | go | A go_library() rule builds a native library from the supplied set of Go source files and dependencies. |
go_stdlib | go | A go_stdlib() rule represents the Go standard library for the target configuration. |
go_test | go | A go_test() rule builds a native binary from the specified Go source and resource files—and a generated main file. |
gwt_binary | java | A gwt_binary() rule produces a GWT (Google Web Toolkit) application by invoking the GWT compiler against the listed modules. |
haskell_binary | haskell | A haskell_binary() rule represents a groups of Haskell sources and deps which build an executable. |
haskell_ghci | haskell | A haskell_ghci() rule produces a deployable script that launches a GHCi session with the given sources and dependencies preloaded. |
haskell_haddock | haskell | A haskell_haddock() rule generates Haddock documentation for the given Haskell dependencies. |
haskell_ide | haskell | A haskell_ide() rule defines a project set for use with an LSP-based Haskell IDE (such as ghcide/HLS). |
haskell_library | haskell | A haskell_library() rule is used to identity a group of Haskell sources. |
haskell_prebuilt_library | haskell | A prebuilt_haskell_library() rule is used to identify Haskell prebuilt libraries and their associated interface files. |
http_archive | core | An http_archive() rule is used to download and extract archives from the Internet to be used as dependencies for other rules. |
http_file | core | An http_file() rule is used to download files from the Internet to be used as dependencies for other rules. |
jar_genrule | java | A jar_genrule() is a variant of genrule() whose output is packaged into a JAR file. |
java_annotation_processor | java | A java_annotation_processor() rule declares a Java annotation processor (identified by processor_class) that can be referenced from java_library() and kotlin_library() rules to run during compilation. |
java_binary | java | A java_binary() rule is used to create a JAR file of the compiled .class files and resources of the java_library() rules on which it depends. |
java_library | java | A java_library() rule defines a set of Java files that can be compiled together. |
java_plugin | java | A java_plugin() rule declares a javac plugin (identified by plugin_name) that can be referenced from java_library() and kotlin_library() rules to run during compilation. |
java_test | java | A java_test() rule is used to define a set of .java files that contain tests to run via JUnit. |
js_bundle | js | A js_bundle() rule builds a JavaScript bundle from one or more entry points, pulling in js_library() dependencies and invoking a worker tool to perform the bundling. |
js_bundle_genrule | js | js_bundle_genrule is a genrule that acts on a js_bundle and provides a bunch of additional environment variables for the genrule to use. |
js_library | js | A js_library() rule groups together JavaScript source files and assets so they can be consumed by a js_bundle(). |
julia_binary | julia | |
julia_jll_library | julia | |
julia_library | julia | |
julia_test | julia | |
keystore | android | A keystore() contains the data for a key pair created by the keytool executable that comes with the JDK. |
kotlin_library | kotlin | A kotlin_library() rule is used to define a set of Kotlin files that can be compiled together. |
kotlin_test | kotlin | A kotlin_test() rule is used to define a set of .kt files that contain tests to run via JUnit. |
link_group_map | cxx | |
llvm_link_bitcode | cxx | An llvm_link_bitcode() rule combines a set of LLVM bitcode inputs into a single bitcode object using llvm-link. |
lua_binary | lua | A lua_binary() rule is used to build an executable that uses Lua sources from all transitive lua_library() dependencies. |
lua_library | lua | A lua_library() rule is used to group together Lua sources to be packaged into a top-level lua_binary() rule. |
matlab_program | matlab | |
mockingbird_mock | apple | A mockingbird_mock() rule generates mock implementations using the Mockingbird mocking framework. |
ndk_toolchain | android | |
nodejs_binary | nodejs | A runnable Node.js script, executed with the toolchain's Node runtime and no custom loaders. |
nodejs_build | nodejs | Runs a Node.js build tool, such as a bundler, as a build action, and outputs the directory it writes. |
nodejs_library | nodejs | A Node.js library that packages code as a regular node_modules package loadable by Node without custom loaders. |
nodejs_node_modules | nodejs | A prebuilt node_modules directory tree, for third-party packages with no nodejs_library target (e.g. a yarn install output). |
nodejs_runtime | nodejs | A Node.js runtime that an app runs on or ships with, provided as NodejsRuntimeInfo. |
nodejs_test | nodejs | A Node.js test, run with the toolchain's Node runtime and no custom loaders. |
ocaml_binary | ocaml | A ocaml_binary() rule builds both native and bytecode executables from the supplied set of OCaml and C source files and dependencies. |
ocaml_library | ocaml | A ocaml_library() rule builds a native and a bytecode libraries from the supplied set of OCaml source files and dependencies. |
ocaml_object | ocaml | |
ocaml_shared | ocaml | |
platform | core | Declares a platform, which is a build configuration composed of constraint values. |
prebuilt_apple_framework | apple | A prebuilt_apple_framework() rule represents a set of Objective-C/C++ source files and is very similar to a prebuilt_cxx_library() rule. |
prebuilt_cxx_library | cxx | A prebuilt_cxx_library() rule represents a set of native libraries and C/C++ header files and provides various flags to control how they are linked and exported. |
prebuilt_cxx_library_group | cxx | A prebuilt_cxx_library_group() rule represents a group of native libraries which should be handled together in a single rule, perhaps using special link-line construction. |
prebuilt_dotnet_library | .NET | A prebuilt_dotnet_library() rule is used to include prebuilt .Net assembles into your .Net code. |
prebuilt_jar | java | A prebuilt_jar() rule is used to identify a JAR file that is checked into our repository as a precompiled binary rather than one that is built from source by Buck. |
prebuilt_native_library | android | A prebuilt_native_library() rule is used to bundle native libraries (i.e., .so files) for Android. |
prebuilt_ocaml_library | ocaml | A prebuilt_ocaml_library() rule wraps a precompiled OCaml library (bytecode and/or native) along with any companion C libraries so it can be consumed as a dependency by ocaml_binary() and ocaml_library() rules. |
prebuilt_python_library | python | A prebuilt_python_library() rule is used to include prebuilt python packages into the output of a top-level python_binary() or python_test() rule. |
python_binary | python | A python_binary() rule is used to build an executable Python package that includes Python sources and resources from all transitive dependencies. |
python_bootstrap_binary | python | A python_bootstrap_binary() rule declares a Python binary intended to be used in scripts that bootstrap other aspects of the Buck2 prelude. |
python_bootstrap_binary_stage0 | python | |
python_bootstrap_library | python | A python_bootstrap_library() rule groups together Python sources that may be consumed by python_bootstrap_binary() targets or by other python_bootstrap_library() rules. |
python_library | python | A python_library() rule is used to group together Python source files and resources to be passed together in as a dep of other rules. |
python_needed_coverage_test | python | A python_needed_coverage_test() rule wraps an existing python_test() target so that it runs as a coverage-collecting bundle and is checked against per-module coverage thresholds. |
python_runtime_bundle | python | A python_runtime_bundle() rule declares a bundled Python runtime — a full install of Python including the interpreter, standard library, headers, and optionally libpython.so and additional shared libraries — that can be embedded in a PAR to produce a fully hermetic distribution. |
python_test | python | A python_test() rule defines a set of .py files that contain tests to run via the Python unit testing framework. |
remote_file | core | A remote_file() rule is used to download files from the Internet to be used as dependencies for other rules. |
required_reasons_tools | apple | A required_reasons_tools() rule bundles the tools used to validate Apple Required Reasons API (RRAPI) usage against a bundle's .xcprivacy privacy manifest. |
resource_group_map | apple | A resource_group_map() rule defines a mapping of resource groups for an apple_bundle(). |
robolectric_test | android | A robolectric_test() rule is used to define a set of .java files that contain tests to run via JUnit with Robolectric test runner. |
rust_binary | rust | A rust_binary() rule builds a native executable from the supplied set of Rust source files and dependencies. |
rust_library | rust | A rust_library() rule builds a native library from the supplied set of Rust source files and dependencies. |
rust_python_extension | rust | A rust_python_extension() rule builds a Python extension module from Rust source code (typically using PyO3), producing a .so or a Windows .pyd. |
rust_test | rust | A rust_test() rule builds a Rust test native executable from the supplied set of Rust source files and dependencies and runs this test. |
scene_kit_assets | apple | A scene_kit_assets() rule specifies a SceneKit asset catalog (.scnassets directory) to be included in an apple_bundle(). |
sh_binary | shell | An sh_binary() is used to execute a shell script. |
sh_test | shell | A sh_test() is a test rule that can pass results to the test runner by invoking a shell script. |
swift_toolchain | apple | A swift_toolchain() rule defines the Swift compiler and associated tools used to build Swift code in Apple targets. |
test_suite | core | A test_suite() is used to create a grouping of tests that should all be run by just testing this rule. |
toolchain_alias | core | toolchain_alias acts like alias but for toolchain rules. |
transformation_spec | cxx | A transformation_spec() rule declares a list of transformation rules that map targets (by Label, by build target pattern, or by build graph pattern) to a TransformationKind (debug or optimized). |
versioned_alias | core | |
windows_resource | cxx | A windows_resource() rule specifies a set of Window's Resource File (.rc) that are compiled into object files. |
worker_tool | core | Some external tools have high startup costs. |
write_file | core | Writes a text file from lines given in the build file. |
xcode_files | apple | |
zip_file | core | A zip_file() allows builds to create basic zip files in a platform-agnostic way. |