From e5fdb7bf5e5212ee37dd107753967a3c7b3dda68 Mon Sep 17 00:00:00 2001
From: Alan Mond It produces an executable binary. Name; required A unique name for this target. List of labels; default is These can be List of labels; default is All Pure assembler files (.s, .asm) are not preprocessed and are typically built using
+the assembler. Preprocessed assembly files (.S) are preprocessed and are typically built
+using the C/C++ compiler.
+ A All If the
+ Permitted
+ ... and any rules that produce those files (e.g. List of labels; default is If a If a Your C++ code can access these data files like so: List of labels; default is
+ For example, compiled Windows .res files can be provided here to be embedded in
+ the binary target.
+ List of strings; default is List of strings; default is
+ Each string in this attribute is added in the given order to
+ If the package declares the feature
+ List of strings; default is List of strings; default is List of strings; default is List of labels; default is
+The String; default is List of strings; default is
+The added Label; default is
+ By default, C++ binaries are linked against List of strings; default is
+ Each element of this list that does not start with Boolean; default is
+ The presence of this flag means that linking occurs with the
+ If you specify both Boolean; default is By default this option is on for
+ If enabled and this is a binary or test, this option tells the build tool to link in
+
+There are really three different ways to link an executable:
+
+If the
+The
+There should be very little code built with List of strings; default is Label; default is
+ By default, C++ binaries are linked against List of labels; default is
+C++ Standard has no restriction about module interface file extension
+ The use is guarded by the flag
+ String; default is List of labels; default is Integer; default is Stamped binaries are not rebuilt unless their dependencies change. Label; default is This attribute should only be used when Windows is the target platform.
+It can be used to
+export symbols during linking a shared library.
+
+The following are the typical use cases: On Unix:
+ On Windows:
+ On Unix:
+ On Windows:
+ On Unix:
+ On Windows:
+ The remaining is the same on Unix and Windows:
+
+C / C++ Rules
+
+{% dynamic setvar source_file "src/main/java/com/google/devtools/build/docgen/templates/be/rules.vm" %}
+{% include "_buttons.html" %}
+
+
+
+
+Rules
+
+
+
+
+ cc_binary
+
+
+
+ View rule source
+
+
+ cc_binary(name, deps, srcs, data, additional_linker_inputs, args, aspect_hints, compatible_with, conlyopts, copts, cxxopts, defines, deprecation, distribs, dynamic_deps, env, exec_compatible_with, exec_group_compatible_with, exec_properties, features, hdrs_check, includes, licenses, link_extra_lib, linkopts, linkshared, linkstatic, local_defines, malloc, module_interfaces, nocopts, output_licenses, package_metadata, reexport_deps, restricted_to, stamp, tags, target_compatible_with, testonly, toolchains, visibility, win_def_file)
+
+
The name of the target should be the same as the name of the
+source file that is the main entry point of the application (minus the extension).
+For example, if your entry point is in main.cc, then your name should
+be main.
+
+Implicit output targets
+
+
+
+ name.stripped (only built if explicitly requested): A stripped
+ version of the binary. strip -g is run on the binary to remove debug
+ symbols. Additional strip options can be provided on the command line using
+ --stripopt=-foo.name.dwp (only built if explicitly requested): If
+ Fission is enabled: a debug
+ information package file suitable for debugging remotely deployed binaries. Else: an
+ empty file.Arguments
+
+
+
+
+
+
+ Attributes
+
+
+
+ name
+
+
+
+
+
+ deps
+
+
+ []cc_library or objc_library
+targets.
+
+
+
+ srcs
+
+
+ [].cc, .c, and .cpp files will
+ be compiled. These might be generated files: if a named file is in
+ the outs of some other rule, this cc_library
+ will automatically depend on that other rule.
+.h file will not be compiled, but will be available for
+ inclusion by sources in this rule. Both .cc and
+ .h files can directly include headers listed in
+ these srcs or in the hdrs of this rule or any
+ rule listed in the deps argument.
+#included files must be mentioned in the
+ hdrs attribute of this or referenced cc_library
+ rules, or they should be listed in srcs if they are private
+ to this library. See "Header inclusion checking" for
+ a more detailed description.
+.so, .lo, and .a files are
+ pre-compiled files. Your library might have these as
+ srcs if it uses third-party code for which we don't
+ have source code.
+srcs attribute includes the label of another rule,
+ cc_library will use the output files of that rule as source files to
+ compile. This is useful for one-off generation of source code (for more than occasional
+ use, it's better to implement a Starlark rule class and use the cc_common
+ API)
+srcs file types:
+
+
+
+.c, .cc, .cpp,
+ .cxx, .c++, .C.h, .hh, .hpp,
+ .hxx, .inc, .inl, .H.S.a, .pic.a.lo, .pic.lo.so,
+ .so.version.o, .pic.occ_embed_data).
+ Different extensions denote different programming languages in
+ accordance with gcc convention.
+
+
+
+
+ data
+
+
+ []data
+at Typical attributes defined by
+most build rules.
+data is the name of a generated file, then this
+ cc_library rule automatically depends on the generating
+ rule.
+data is a rule name, then this
+ cc_library rule automatically depends on that rule,
+ and that rule's outs are automatically added to
+ this cc_library's data files.
+
+
+ const std::string path = devtools_build::GetDataDependencyFilepath(
+ "my/test/data/file");
+
+
+
+
+ additional_linker_inputs
+
+
+ []
+
+
+
+ conlyopts
+
+
+ []
+
+
+
+ copts
+
+
+ []COPTS before
+ compiling the binary target. The flags take effect only for compiling this target, not
+ its dependencies, so be careful about header files included elsewhere.
+ All paths should be relative to the workspace, not to the current package.
+ This attribute should not be needed outside of third_party.
+no_copts_tokenization, Bourne shell tokenization applies only to strings
+ that consist of a single "Make" variable.
+
+
+
+
+ cxxopts
+
+
+ []
+
+
+
+ defines
+
+
+ []-D and added to the compile command line to this target,
+as well as to every rule that depends on it. Be very careful, since this may have
+far-reaching effects. When in doubt, add define values to
+local_defines instead.
+
+
+
+
+ distribs
+
+
+ []
+
+
+
+ dynamic_deps
+
+
+ []cc_shared_library dependencies the current target depends on.
+
+cc_shared_library implementation will use the list of
+dynamic_deps (transitively, i.e. also the dynamic_deps of the
+current target's dynamic_deps) to decide which cc_libraries in
+the transitive deps should not be linked in because they are already provided
+by a different cc_shared_library.
+
+
+
+
+ hdrs_check
+
+
+ ""
+
+
+
+ includes
+
+
+ []-isystem path_to_package/include_entry.
+This should only be used for third-party libraries that
+do not conform to the Google style of writing #include statements.
+Unlike COPTS, these flags are added for this rule
+and every rule that depends on it. (Note: not the rules it depends upon!) Be
+very careful, since this may have far-reaching effects. When in doubt, add
+"-I" flags to COPTS instead.
+include paths will include generated files as well as
+files in the source tree.
+
+
+
+
+ link_extra_lib
+
+
+ "@bazel_tools//tools/cpp:link_extra_lib"//tools/cpp:link_extra_lib,
+ which by default depends on the label flag //tools/cpp:link_extra_libs.
+ Without setting the flag, this library is empty by default. Setting the label flag
+ allows linking optional dependencies, such as overrides for weak symbols, interceptors
+ for shared library functions, or special runtime libraries (for malloc replacements,
+ prefer malloc or --custom_malloc). Setting this attribute to
+ None disables this behaviour.
+
+
+
+
+ linkopts
+
+
+ []LINKOPTS before
+linking the binary target.
+$ or - is
+ assumed to be the label of a target in deps. The
+ list of files generated by that target is appended to the linker
+ options. An error is reported if the label is invalid, or is
+ not declared in deps.
+
+
+
+
+ linkshared
+
+
+ Falselinkshared=True in your rule. By default
+this option is off.
+-shared flag
+ to gcc, and the resulting shared library is suitable for loading into for
+ example a Java program. However, for build purposes it will never be linked into the
+ dependent binary, as it is assumed that shared libraries built with a
+ cc_binary rule are only loaded manually by other programs, so
+ it should not be considered a substitute for the cc_library
+ rule. For sake of scalability we recommend avoiding this approach altogether and
+ simply letting java_library depend on cc_library rules
+ instead.
+linkopts=['-static'] and linkshared=True,
+ you get a single completely self-contained unit. If you specify both
+ linkstatic=True and linkshared=True, you get a single, mostly
+ self-contained unit.
+
+
+
+
+ linkstatic
+
+
+ Truecc_binary and
+cc_test: link the binary in static
+mode. For cc_library.link_static: see below.
+cc_binary and off for the rest..a's instead of .so's for user libraries whenever possible.
+ System libraries such as libc (but not the C/C++ runtime libraries,
+ see below) are still linked dynamically, as are libraries for which
+ there is no static library. So the resulting executable will still be dynamically
+ linked, hence only mostly static.
+
+
+gcc -static foo.o libbar.a libbaz.a -lm".
+ This mode is enabled by specifying fully_static_link in the
+ features attribute.gcc foo.o libfoo.a libbaz.a -lm".
+ This mode is enabled by specifying linkstatic=True.gcc foo.o libfoo.so libbaz.so -lm".
+ This mode is enabled by specifying linkstatic=False.linkstatic attribute or fully_static_link in
+features is used outside of //third_party
+please include a comment near the rule to explain why.
+linkstatic attribute has a different meaning if used on a
+cc_library() rule.
+For a C++ library, linkstatic=True indicates that only
+static linking is allowed, so no .so will be produced. linkstatic=False does
+not prevent static libraries from being created. The attribute is meant to control the
+creation of dynamic libraries.
+linkstatic=False in production.
+If linkstatic=False, then the build tool will create symlinks to
+depended-upon shared libraries in the *.runfiles area.
+
+
+
+
+ local_defines
+
+
+ []-D and added to the compile command line for this target,
+but not to its dependents.
+
+
+
+
+ malloc
+
+
+ "@bazel_tools//tools/cpp:malloc"//tools/cpp:malloc,
+ which is an empty library so the binary ends up using libc malloc.
+ This label must refer to a cc_library. If compilation is for a non-C++
+ rule, this option has no effect. The value of this attribute is ignored if
+ linkshared=True is specified.
+
+
+
+
+ module_interfaces
+
+
+ []
+
+
+--experimental_cpp_modules.
+
+
+
+ nocopts
+
+
+ ""COPTS that match this regular expression
+(including values explicitly specified in the rule's copts attribute)
+will be removed from COPTS for purposes of compiling this rule.
+This attribute should not be needed or used
+outside of third_party. The values are not preprocessed
+in any way other than the "Make" variable substitution.
+
+
+
+
+ reexport_deps
+
+
+ []
+
+
+
+ stamp
+
+
+ -1
+
+stamp = 1: Always stamp the build information into the binary, even in
+ --nostamp builds. This
+ setting should be avoided, since it potentially kills remote caching for the
+ binary and any downstream actions that depend on it.
+stamp = 0: Always replace build information by constant values. This
+ gives good build result caching.
+stamp = -1: Embedding of build information is controlled by the
+ --[no]stamp flag.
+
+
+
+
+
+ win_def_file
+
+
+ None
+ cc_import
+
+
+
+ View rule source
+
+
+ cc_import(name, deps, data, hdrs, alwayslink, aspect_hints, compatible_with, deprecation, exec_compatible_with, exec_group_compatible_with, exec_properties, features, includes, interface_library, linkopts, objects, package_metadata, pic_objects, pic_static_library, restricted_to, shared_library, static_library, strip_include_prefix, system_provided, tags, target_compatible_with, testonly, toolchains, visibility)
+
+ cc_import rules allows users to import precompiled C/C++ libraries.
+
+
+1. Linking a static library
+
+
+2. Linking a shared library (Unix)
+
+cc_import(
+ name = "mylib",
+ hdrs = ["mylib.h"],
+ static_library = "libmylib.a",
+ # If alwayslink is turned on,
+ # libmylib.a will be forcely linked into any binary that depends on it.
+ # alwayslink = 1,
+)
+
+
+3. Linking a shared library with interface library
+
+
+cc_import(
+ name = "mylib",
+ hdrs = ["mylib.h"],
+ shared_library = "libmylib.so",
+)
+
+
+
+cc_import(
+ name = "mylib",
+ hdrs = ["mylib.h"],
+ # libmylib.ifso is an interface library for libmylib.so which will be passed to linker
+ interface_library = "libmylib.ifso",
+ # libmylib.so will be available for runtime
+ shared_library = "libmylib.so",
+)
+
+
+4. Linking a shared library with
+cc_import(
+ name = "mylib",
+ hdrs = ["mylib.h"],
+ # mylib.lib is an import library for mylib.dll which will be passed to linker
+ interface_library = "mylib.lib",
+ # mylib.dll will be available for runtime
+ shared_library = "mylib.dll",
+)
+system_provided=True
+
+
+
+
+cc_import(
+ name = "mylib",
+ hdrs = ["mylib.h"],
+ interface_library = "libmylib.ifso", # Or we can also use libmylib.so as its own interface library
+ # libmylib.so is provided by system environment, for example it can be found in LD_LIBRARY_PATH.
+ # This indicates that Bazel is not responsible for making libmylib.so available.
+ system_provided = 1,
+)
+
+
+5. Linking to static or shared library
+
+
+cc_import(
+ name = "mylib",
+ hdrs = ["mylib.h"],
+ # mylib.lib is an import library for mylib.dll which will be passed to linker
+ interface_library = "mylib.lib",
+ # mylib.dll is provided by system environment, for example it can be found in PATH.
+ # This indicates that Bazel is not responsible for making mylib.dll available.
+ system_provided = 1,
+)
+
+
+
+cc_import(
+ name = "mylib",
+ hdrs = ["mylib.h"],
+ static_library = "libmylib.a",
+ shared_library = "libmylib.so",
+)
+
+
+
+cc_import(
+ name = "mylib",
+ hdrs = ["mylib.h"],
+ static_library = "libmylib.lib", # A normal static library
+ interface_library = "mylib.lib", # An import library for mylib.dll
+ shared_library = "mylib.dll",
+)
+
+
+
+# first will link to libmylib.a (or libmylib.lib)
+cc_binary(
+ name = "first",
+ srcs = ["first.cc"],
+ deps = [":mylib"],
+ linkstatic = 1, # default value
+)
+
+# second will link to libmylib.so (or libmylib.lib)
+cc_binary(
+ name = "second",
+ srcs = ["second.cc"],
+ deps = [":mylib"],
+ linkstatic = 0,
+)
+cc_import supports an include attribute. For example:
+
+
+cc_import(
+ name = "curl_lib",
+ hdrs = glob(["vendor/curl/include/curl/*.h"]),
+ includes = ["vendor/curl/include"],
+ shared_library = "vendor/curl/lib/.libs/libcurl.dylib",
+)
+
| Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ deps
+ |
+
+ List of labels; default is deps
+at Typical attributes defined by
+most build rules.
+ |
+
+ hdrs
+ |
+
+ List of labels; default is |
+
+ alwayslink
+ |
+
+ Boolean; default is If alwayslink doesn't work with VS 2017 on Windows, that is due to a +known issue, +please upgrade your VS 2017 to the latest version. + |
+
+ includes
+ |
+
+ List of strings; default is -isystem path_to_package/include_entry.
+This should only be used for third-party libraries that
+do not conform to the Google style of writing #include statements.
+Unlike COPTS, these flags are added for this rule
+and every rule that depends on it. (Note: not the rules it depends upon!) Be
+very careful, since this may have far-reaching effects. When in doubt, add
+"-I" flags to COPTS instead.
+
+The default |
+
+ interface_library
+ |
+
+ Label; default is Permitted file types:
+ |
+
+ linkopts
+ |
+
+ List of strings; default is LINKOPTS before
+linking the binary target.
+
+ Each element of this list that does not start with |
+
+ objects
+ |
+
+ List of labels; default is |
+
+ pic_objects
+ |
+
+ List of labels; default is |
+
+ pic_static_library
+ |
+
+ Label; default is |
+
+ shared_library
+ |
+
+ Label; default is Permitted file types:
+ |
+
+ static_library
+ |
+
+ Label; default is Permitted file types:
+ |
+
+ strip_include_prefix
+ |
+
+ String; default is When set, the headers in the If it's a relative path, it's taken as a package-relative one. If it's an absolute one, +it's understood as a repository-relative path. + + The prefix in the This attribute is only legal under |
+
+ system_provided
+ |
+
+ Boolean; default is interface_library should be specified and
+shared_library should be empty.
+ |
+
cc_library(name, deps, srcs, data, hdrs, additional_compiler_inputs, additional_linker_inputs, alwayslink, aspect_hints, compatible_with, conlyopts, copts, cxxopts, defines, deprecation, exec_compatible_with, exec_group_compatible_with, exec_properties, features, hdrs_check, implementation_deps, include_prefix, includes, licenses, linkopts, linkstamp, linkstatic, local_defines, module_interfaces, package_metadata, restricted_to, strip_include_prefix, tags, target_compatible_with, testonly, textual_hdrs, toolchains, visibility, win_def_file)+ +
Use cc_library() for C++-compiled libraries.
+ The result is either a .so, .lo,
+ or .a, depending on what is needed.
+
+ If you build something with static linking that depends on
+ a cc_library, the output of a depended-on library rule
+ is the .a file. If you specify
+ alwayslink=True, you get the .lo file.
+
+ The actual output file name is libfoo.so for
+ the shared library, where foo is the name of the rule. The
+ other kinds of libraries end with .lo and .a,
+ respectively. If you need a specific shared library name, for
+ example, to define a Python module, use a genrule to copy the library
+ to the desired name.
+
+ All header files that are used in the build must be declared in
+ the hdrs or srcs of cc_* rules.
+ This is enforced.
+
+ For cc_library rules, headers in hdrs comprise the
+ public interface of the library and can be directly included both
+ from the files in hdrs and srcs of the library
+ itself as well as from files in hdrs and srcs
+ of cc_* rules that list the library in their deps.
+ Headers in srcs must only be directly included from the files
+ in hdrs and srcs of the library itself. When
+ deciding whether to put a header into hdrs or srcs,
+ you should ask whether you want consumers of this library to be able to
+ directly include it. This is roughly the same decision as
+ between public and private visibility in programming languages.
+
+ cc_binary and cc_test rules do not have an exported
+ interface, so they also do not have a hdrs attribute. All headers
+ that belong to the binary or test directly should be listed in
+ the srcs.
+
+ To illustrate these rules, look at the following example. +
+ +
+cc_binary(
+ name = "foo",
+ srcs = [
+ "foo.cc",
+ "foo.h",
+ ],
+ deps = [":bar"],
+)
+
+cc_library(
+ name = "bar",
+ srcs = [
+ "bar.cc",
+ "bar-impl.h",
+ ],
+ hdrs = ["bar.h"],
+ deps = [":baz"],
+)
+
+cc_library(
+ name = "baz",
+ srcs = [
+ "baz.cc",
+ "baz-impl.h",
+ ],
+ hdrs = ["baz.h"],
+)
+
+
+
+ The allowed direct inclusions in this example are listed in the table below.
+ For example foo.cc is allowed to directly
+ include foo.h and bar.h, but not baz.h.
+
| Including file | Allowed inclusions |
|---|---|
| foo.h | bar.h |
| foo.cc | foo.h bar.h |
| bar.h | bar-impl.h baz.h |
| bar-impl.h | bar.h baz.h |
| bar.cc | bar.h bar-impl.h baz.h |
| baz.h | baz-impl.h |
| baz-impl.h | baz.h |
| baz.cc | baz.h baz-impl.h |
+ The inclusion checking rules only apply to direct
+ inclusions. In the example above foo.cc is allowed to
+ include bar.h, which may include baz.h, which in
+ turn is allowed to include baz-impl.h. Technically, the
+ compilation of a .cc file may transitively include any header
+ file in the hdrs or srcs in
+ any cc_library in the transitive deps closure. In
+ this case the compiler may read baz.h and baz-impl.h
+ when compiling foo.cc, but foo.cc must not
+ contain #include "baz.h". For that to be
+ allowed, baz must be added to the deps
+ of foo.
+
+ Bazel depends on toolchain support to enforce the inclusion checking rules.
+ The layering_check feature has to be supported by the toolchain
+ and requested explicitly, for example via the
+ --features=layering_check command-line flag or the
+ features parameter of the
+ package function. The toolchains
+ provided by Bazel only support this feature with clang on Unix and macOS.
+
+ We use the alwayslink flag to force the linker to link in
+ this code although the main binary code doesn't reference it.
+
+cc_library(
+ name = "ast_inspector_lib",
+ srcs = ["ast_inspector_lib.cc"],
+ hdrs = ["ast_inspector_lib.h"],
+ visibility = ["//visibility:public"],
+ deps = ["//third_party/llvm/llvm/tools/clang:frontend"],
+ # alwayslink as we want to be able to call things in this library at
+ # debug time, even if they aren't used anywhere in the code.
+ alwayslink = 1,
+)
+
+
+
+The following example comes from
+ third_party/python2_4_3/BUILD.
+ Some of the code uses the dl library (to load
+ another, dynamic library), so this
+ rule specifies the -ldl link option to link the
+ dl library.
+
+cc_library(
+ name = "python2_4_3",
+ linkopts = [
+ "-ldl",
+ "-lutil",
+ ],
+ deps = ["//third_party/expat"],
+)
+
+
+The following example comes from third_party/kde/BUILD.
+ We keep pre-built .so files in the depot.
+ The header files live in a subdirectory named include.
+
+cc_library(
+ name = "kde",
+ srcs = [
+ "lib/libDCOP.so",
+ "lib/libkdesu.so",
+ "lib/libkhtml.so",
+ "lib/libkparts.so",
+ ...more .so files...,
+ ],
+ includes = ["include"],
+ deps = ["//third_party/X11"],
+)
+
+
+The following example comes from third_party/gles/BUILD.
+ Third-party code often needs some defines and
+ linkopts.
+
+cc_library(
+ name = "gles",
+ srcs = [
+ "GLES/egl.h",
+ "GLES/gl.h",
+ "ddx.c",
+ "egl.c",
+ ],
+ defines = [
+ "USE_FLOAT",
+ "__GL_FLOAT",
+ "__GL_COMMON",
+ ],
+ linkopts = ["-ldl"], # uses dlopen(), dl library
+ deps = [
+ "es",
+ "//third_party/X11",
+ ],
+)
+
+
+ | Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ deps
+ |
+
+ List of labels; default is These can be See general comments about These should be names of C++ library rules.
+ When you build a binary that links this rule's library,
+ you will also link the libraries in Despite the "deps" name, not all of this library's clients
+ belong here. Run-time data dependencies belong in To link in a pre-compiled third-party library, add its name to
+ the To depend on something without linking it to this library, add its
+ name to the |
+
+ srcs
+ |
+
+ List of labels; default is All Pure assembler files (.s, .asm) are not preprocessed and are typically built using +the assembler. Preprocessed assembly files (.S) are preprocessed and are typically built +using the C/C++ compiler. + +A All
If the
+ Permitted
+ ... and any rules that produce those files (e.g. |
+
+ data
+ |
+
+ List of labels; default is data
+at Typical attributes defined by
+most build rules.
+If a If a Your C++ code can access these data files like so: +
+ |
+
+ hdrs
+ |
+
+ List of labels; default is This is the strongly preferred location for declaring header files that
+ describe the interface for the library. These headers will be made
+ available for inclusion by sources in this rule or in dependent rules.
+ Headers not meant to be included by a client of this library should be
+ listed in the Permitted |
+
+ additional_compiler_inputs
+ |
+
+ List of labels; default is |
+
+ additional_linker_inputs
+ |
+
+ List of labels; default is + For example, compiled Windows .res files can be provided here to be embedded in + the binary target. + + |
+
+ alwayslink
+ |
+
+ Boolean; default is srcs, even if some contain no symbols referenced by the binary.
+This is useful if your code isn't explicitly called by code in
+the binary, e.g., if your code registers to receive some callback
+provided by some service.
+
+If alwayslink doesn't work with VS 2017 on Windows, that is due to a +known issue, +please upgrade your VS 2017 to the latest version. + |
+
+ conlyopts
+ |
+
+ List of strings; default is |
+
+ copts
+ |
+
+ List of strings; default is
+ Each string in this attribute is added in the given order to
+ If the package declares the feature
+ |
+
+ cxxopts
+ |
+
+ List of strings; default is |
+
+ defines
+ |
+
+ List of strings; default is -D and added to the compile command line to this target,
+as well as to every rule that depends on it. Be very careful, since this may have
+far-reaching effects. When in doubt, add define values to
+local_defines instead.
+ |
+
+ hdrs_check
+ |
+
+ String; default is |
+
+ implementation_deps
+ |
+
+ List of labels; default is deps, the headers and include paths of these libraries (and all their
+transitive deps) are only used for compilation of this library, and not libraries that
+depend on it. Libraries specified with implementation_deps are still linked in
+binary targets that depend on this library.
+ |
+
+ include_prefix
+ |
+
+ String; default is When set, the headers in the The prefix in the This attribute is only legal under |
+
+ includes
+ |
+
+ List of strings; default is -isystem path_to_package/include_entry.
+This should only be used for third-party libraries that
+do not conform to the Google style of writing #include statements.
+Unlike COPTS, these flags are added for this rule
+and every rule that depends on it. (Note: not the rules it depends upon!) Be
+very careful, since this may have far-reaching effects. When in doubt, add
+"-I" flags to COPTS instead.
+
+The added |
+
+ linkopts
+ |
+
+ List of strings; default is cc_binary.linkopts.
+The linkopts attribute is also applied to any target that
+depends, directly or indirectly, on this library via deps
+attributes (or via other attributes that are treated similarly:
+the malloc
+attribute of cc_binary). Dependency
+linkopts take precedence over dependent linkopts (i.e. dependency linkopts
+appear later in the command line). Linkopts specified in
+--linkopt
+take precedence over rule linkopts.
+
+
+Note that the +Also, it is important to note that "-Wl,-soname" or "-Xlinker -soname" +options are not supported and should never be specified in this attribute. + + The |
+
+ linkstamp
+ |
+
+ Label; default is base package.
+ |
+
+ linkstatic
+ |
+
+ Boolean; default is cc_binary and
+cc_test: link the binary in static
+mode. For cc_library.link_static: see below.
+By default this option is on for
+ If enabled and this is a binary or test, this option tells the build tool to link in
+ +There are really three different ways to link an executable: + +
+If the
+The
+There should be very little code built with |
+
+ local_defines
+ |
+
+ List of strings; default is -D and added to the compile command line for this target,
+but not to its dependents.
+ |
+
+ module_interfaces
+ |
+
+ List of labels; default is +C++ Standard has no restriction about module interface file extension +
The use is guarded by the flag
+ |
+
+ strip_include_prefix
+ |
+
+ String; default is When set, the headers in the If it's a relative path, it's taken as a package-relative one. If it's an absolute one, +it's understood as a repository-relative path. + + The prefix in the This attribute is only legal under |
+
+ textual_hdrs
+ |
+
+ List of labels; default is This is the location for declaring header files that cannot be compiled on their own; + that is, they always need to be textually included by other source files to build valid + code. + |
+
+ win_def_file
+ |
+
+ Label; default is This attribute should only be used when Windows is the target platform. +It can be used to +export symbols during linking a shared library. + |
+
cc_shared_library(name, deps, additional_linker_inputs, aspect_hints, compatible_with, deprecation, dynamic_deps, exec_compatible_with, exec_group_compatible_with, exec_properties, experimental_disable_topo_sort_do_not_use_remove_before_7_0, exports_filter, features, package_metadata, restricted_to, roots, shared_lib_name, static_deps, tags, target_compatible_with, testonly, toolchains, user_link_flags, visibility, win_def_file)+ +
It produces a shared library.
+ ++cc_shared_library( + name = "foo_shared", + deps = [ + ":foo", + ], + dynamic_deps = [ + ":bar_shared", + ], + additional_linker_inputs = [ + ":foo.lds", + ], + user_link_flags = [ + "-Wl,--version-script=$(location :foo.lds)", + ], +) +cc_library( + name = "foo", + srcs = ["foo.cc"], + hdrs = ["foo.h"], + deps = [ + ":bar", + ":baz", + ], +) +cc_shared_library( + name = "bar_shared", + shared_lib_name = "bar.so", + deps = [":bar"], +) +cc_library( + name = "bar", + srcs = ["bar.cc"], + hdrs = ["bar.h"], +) +cc_library( + name = "baz", + srcs = ["baz.cc"], + hdrs = ["baz.h"], +) ++ +
In the example foo_shared statically links foo
+and baz, the latter being a transitive dependency. It doesn't
+link bar because it is already provided dynamically by the
+dynamic_dep bar_shared.
foo_shared uses a linker script *.lds file to control which
+symbols should be exported. The cc_shared_library rule logic does
+not control which symbols get exported, it only uses what is assumed to be
+exported to give errors during analysis phase if two shared libraries export the
+same targets.
Every direct dependency of cc_shared_library is assumed to be
+exported. Therefore, Bazel assumes during analysis that foo is being
+exported by foo_shared. baz is not assumed to be exported
+by foo_shared. Every target matched by the exports_filter
+is also assumed to be exported.
Every single cc_library in the example should appear at most in one
+cc_shared_library. If we wanted to link baz also into
+bar_shared we would need to add
+tags = ["LINKABLE_MORE_THAN_ONCE"] to baz.
Due to the shared_lib_name attribute, the file produced by
+bar_shared will have the name bar.so as opposed
+to the name libbar.so that it would have by default on Linux.
Two shared libraries in dependencies export the same symbols.This will happen whenever you are creating a target with two different
+cc_shared_library dependencies that export the same target. To fix this
+you need to stop the libraries from being exported in one of the
+cc_shared_library dependencies.
Two shared libraries in dependencies link the same library staticallyThis will happen whenever you are creating a new cc_shared_library with two
+different cc_shared_library dependencies that link the same target statically.
+Similar to the error with exports.
One way to fix this is to stop linking the library into one of the
+cc_shared_library dependencies. At the same time, the one that still links it
+needs to export the library so that the one not linking it keeps visibility to
+the symbols. Another way is to pull out a third library that exports the target.
+A third way is to tag the culprit cc_library with LINKABLE_MORE_THAN_ONCE
+but this fix should be rare and you should absolutely make sure that the
+cc_library is indeed safe to link more than once.
'//foo:foo' is already linked statically in '//bar:bar' but not exported`This means that a library in the transitive closure of your deps is reachable
+without going through one of the cc_shared_library dependencies but is already
+linked into a different cc_shared_library in dynamic_deps and is not
+exported.
The solution is to export it from the cc_shared_library dependency or pull out
+a third cc_shared_library that exports it.
Do not place libraries which only contain a precompiled dynamic library in deps.
+If you have a precompiled dynamic library, this doesn't need to and cannot be
+linked statically into the current cc_shared_library target that you are
+currently creating. Therefore, it doesn't belong in deps of the
+cc_shared_library. If this precompiled dynamic library is a dependency of one
+of your cc_libraries, then the cc_library needs to depend on it
+directly.
Trying to export a library already exported by a different shared libraryYou will see this error if on the current rule you are claiming to export a +target that is already being exported by one of your dynamic dependencies.
+ +To fix this, remove the target from deps and just rely on it from the dynamic
+dependency or make sure that the exports_filter doesn't catch this target.
| Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ deps
+ |
+
+ List of labels; default is
+Any transitive library dependency of these direct deps will be linked into this shared
+library as long as they have not already been linked by a
+During analysis, the rule implementation will consider any target listed in
+
+The implementation will also trigger errors whenever the same library is linked statically
+into more than one |
+
+ additional_linker_inputs
+ |
+
+ List of labels; default is user_link_flags attribute.
+ |
+
+ dynamic_deps
+ |
+
+ List of labels; default is cc_shared_library dependencies the current target depends on.
+
+
+The |
+
+ experimental_disable_topo_sort_do_not_use_remove_before_7_0
+ |
+
+ Boolean; default is |
+
+ exports_filter
+ |
+
+ List of strings; default is
+Any target
+Note that this attribute is not actually adding a dependency edge to those targets, the
+dependency edge should instead be created by The following syntax is allowed: +
|
+
+ roots
+ |
+
+ List of labels; default is |
+
+ shared_lib_name
+ |
+
+ String; default is |
+
+ static_deps
+ |
+
+ List of strings; default is |
+
+ user_link_flags
+ |
+
+ List of strings; default is
+ |
+
+ win_def_file
+ |
+
+ Label; default is This attribute should only be used when Windows is the target platform. +It can be used to +export symbols during linking a shared library. + |
+
cc_static_library(name, deps, aspect_hints, compatible_with, deprecation, exec_compatible_with, exec_group_compatible_with, exec_properties, features, package_metadata, restricted_to, tags, target_compatible_with, testonly, toolchains, visibility)+ + Produces a static library from a list of targets and their transitive dependencies. + +
The resulting static library contains the object files of the targets listed in
+deps as well as their transitive dependencies, with preference given to
+PIC objects.
linkdepsA text file containing the labels of those transitive dependencies of targets listed in
+deps that did not contribute any object files to the static library, but do
+provide at least one static, dynamic or interface library. The resulting static library
+may require these libraries to be available at link time.
linkoptsA text file containing the user-provided linkopts of all transitive
+dependencies of targets listed in deps.
+
+
By default, the cc_static_library rule checks that the resulting static
+library does not contain any duplicate symbols. If it does, the build fails with an error
+message that lists the duplicate symbols and the object files containing them.
This check can be disabled per target or per package by setting
+features = ["-symbol_check"] or globally via
+--features=-symbol_check.
symbol_checkThe auto-configured C++ toolchains shipped with Bazel support the
+symbol_check feature on all platforms. Custom toolchains can add support for
+it in one of two ways:
ACTION_NAMES.validate_static_library action and
+ enabling it with the symbol_check feature. The tool set in the action is
+ invoked with two arguments, the static library to check for duplicate symbols and the
+ path of a file that must be created if the check passes.symbol_check feature add archiver flags that cause the
+ action creating the static library to fail on duplicate symbols.| Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ deps
+ |
+
+ List of labels; default is Dependencies that do not provide any object files are not included in the static
+library, but their labels are collected in the file provided by the
+ |
+
cc_test(name, deps, srcs, data, additional_linker_inputs, args, aspect_hints, compatible_with, conlyopts, copts, cxxopts, defines, deprecation, distribs, dynamic_deps, env, env_inherit, exec_compatible_with, exec_group_compatible_with, exec_properties, features, flaky, hdrs_check, includes, licenses, link_extra_lib, linkopts, linkshared, linkstatic, local, local_defines, malloc, module_interfaces, nocopts, package_metadata, reexport_deps, restricted_to, shard_count, size, stamp, tags, target_compatible_with, testonly, timeout, toolchains, visibility, win_def_file)+ +
+A cc_test() rule compiles a test. Here, a test
+is a binary wrapper around some testing code.
+
By default, C++ tests are dynamically linked.
+ To statically link a unit test, specify
+ linkstatic=True.
+ It would probably be good to comment why your test needs
+ linkstatic; this is probably not obvious.
name.stripped (only built if explicitly requested): A stripped
+ version of the binary. strip -g is run on the binary to remove debug
+ symbols. Additional strip options can be provided on the command line using
+ --stripopt=-foo.name.dwp (only built if explicitly requested): If
+ Fission is enabled: a debug
+ information package file suitable for debugging remotely deployed binaries. Else: an
+ empty file.
+See the cc_binary() arguments, except that
+the stamp argument is set to 0 by default for tests and
+that cc_test has extra
+attributes common to all test rules (*_test).
| Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ deps
+ |
+
+ List of labels; default is These can be |
+
+ srcs
+ |
+
+ List of labels; default is All Pure assembler files (.s, .asm) are not preprocessed and are typically built using +the assembler. Preprocessed assembly files (.S) are preprocessed and are typically built +using the C/C++ compiler. + +A All
If the
+ Permitted
+ ... and any rules that produce those files (e.g. |
+
+ data
+ |
+
+ List of labels; default is data
+at Typical attributes defined by
+most build rules.
+If a If a Your C++ code can access these data files like so: +
+ |
+
+ additional_linker_inputs
+ |
+
+ List of labels; default is + For example, compiled Windows .res files can be provided here to be embedded in + the binary target. + + |
+
+ conlyopts
+ |
+
+ List of strings; default is |
+
+ copts
+ |
+
+ List of strings; default is
+ Each string in this attribute is added in the given order to
+ If the package declares the feature
+ |
+
+ cxxopts
+ |
+
+ List of strings; default is |
+
+ defines
+ |
+
+ List of strings; default is -D and added to the compile command line to this target,
+as well as to every rule that depends on it. Be very careful, since this may have
+far-reaching effects. When in doubt, add define values to
+local_defines instead.
+ |
+
+ distribs
+ |
+
+ List of strings; default is |
+
+ dynamic_deps
+ |
+
+ List of labels; default is cc_shared_library dependencies the current target depends on.
+
+
+The |
+
+ hdrs_check
+ |
+
+ String; default is |
+
+ includes
+ |
+
+ List of strings; default is -isystem path_to_package/include_entry.
+This should only be used for third-party libraries that
+do not conform to the Google style of writing #include statements.
+Unlike COPTS, these flags are added for this rule
+and every rule that depends on it. (Note: not the rules it depends upon!) Be
+very careful, since this may have far-reaching effects. When in doubt, add
+"-I" flags to COPTS instead.
+
+The added |
+
+ link_extra_lib
+ |
+
+ Label; default is
+ By default, C++ binaries are linked against |
+
+ linkopts
+ |
+
+ List of strings; default is LINKOPTS before
+linking the binary target.
+
+ Each element of this list that does not start with |
+
+ linkshared
+ |
+
+ Boolean; default is linkshared=True in your rule. By default
+this option is off.
+
+ The presence of this flag means that linking occurs with the
+ If you specify both |
+
+ linkstatic
+ |
+
+ Boolean; default is cc_binary and
+cc_test: link the binary in static
+mode. For cc_library.link_static: see below.
+By default this option is on for
+ If enabled and this is a binary or test, this option tells the build tool to link in
+ +There are really three different ways to link an executable: + +
+If the
+The
+There should be very little code built with |
+
+ local_defines
+ |
+
+ List of strings; default is -D and added to the compile command line for this target,
+but not to its dependents.
+ |
+
+ malloc
+ |
+
+ Label; default is
+ By default, C++ binaries are linked against |
+
+ module_interfaces
+ |
+
+ List of labels; default is +C++ Standard has no restriction about module interface file extension +
The use is guarded by the flag
+ |
+
+ nocopts
+ |
+
+ String; default is COPTS that match this regular expression
+(including values explicitly specified in the rule's copts attribute)
+will be removed from COPTS for purposes of compiling this rule.
+This attribute should not be needed or used
+outside of third_party. The values are not preprocessed
+in any way other than the "Make" variable substitution.
+ |
+
+ reexport_deps
+ |
+
+ List of labels; default is |
+
+ stamp
+ |
+
+ Integer; default is
Stamped binaries are not rebuilt unless their dependencies change. + |
+
+ win_def_file
+ |
+
+ Label; default is This attribute should only be used when Windows is the target platform. +It can be used to +export symbols during linking a shared library. + |
+
cc_toolchain(name, all_files, ar_files, as_files, aspect_hints, compatible_with, compiler_files, compiler_files_without_includes, coverage_files, deprecation, dwp_files, dynamic_runtime_lib, exec_compatible_with, exec_group_compatible_with, exec_properties, exec_transition_for_inputs, features, libc_top, licenses, linker_files, module_map, objcopy_files, output_licenses, package_metadata, restricted_to, static_runtime_lib, strip_files, supports_header_parsing, supports_param_files, tags, target_compatible_with, testonly, toolchain_config, toolchain_identifier, toolchains, visibility)+ +
Represents a C++ toolchain.
+ ++ This rule is responsible for: + +
all_files, compiler_files,
+ linker_files, or other attributes ending with _files). These are
+ most commonly filegroups globbing all required files.
+ CcToolchainConfigInfo provider (details below).
+
+ Use toolchain_config attribute to configure the C++ toolchain.
+ See also this
+
+ page
+ for elaborate C++ toolchain configuration and toolchain selection documentation.
+
+ Use tags = ["manual"] in order to prevent toolchains from being built and configured
+ unnecessarily when invoking bazel build //...
+
| Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ all_files
+ |
+
+ Label; required + Collection of all cc_toolchain artifacts. These artifacts will be added as inputs to all +rules_cc related actions (with the exception of actions that are using more precise sets of +artifacts from attributes below). Bazel assumes thatall_files is a superset
+of all other artifact-providing attributes (e.g. linkstamp compilation needs both compile
+and link files, so it takes all_files).
+
+
+This is what |
+
+ ar_files
+ |
+
+ Label; default is |
+
+ as_files
+ |
+
+ Label; default is |
+
+ compiler_files
+ |
+
+ Label; required + Collection of all cc_toolchain artifacts required for compile actions. + |
+
+ compiler_files_without_includes
+ |
+
+ Label; default is |
+
+ coverage_files
+ |
+
+ Label; default is |
+
+ dwp_files
+ |
+
+ Label; required + Collection of all cc_toolchain artifacts required for dwp actions. + |
+
+ dynamic_runtime_lib
+ |
+
+ Label; default is This will be used when 'static_link_cpp_runtimes' feature is enabled, and we're linking +dependencies dynamically. + |
+
+ exec_transition_for_inputs
+ |
+
+ Boolean; default is |
+
+ libc_top
+ |
+
+ Label; default is |
+
+ linker_files
+ |
+
+ Label; required + Collection of all cc_toolchain artifacts required for linking actions. + |
+
+ module_map
+ |
+
+ Label; default is |
+
+ objcopy_files
+ |
+
+ Label; required + Collection of all cc_toolchain artifacts required for objcopy actions. + |
+
+ output_licenses
+ |
+
+ List of strings; default is |
+
+ static_runtime_lib
+ |
+
+ Label; default is This will be used when 'static_link_cpp_runtimes' feature is enabled, and we're linking +dependencies statically. + |
+
+ strip_files
+ |
+
+ Label; required + Collection of all cc_toolchain artifacts required for strip actions. + |
+
+ supports_header_parsing
+ |
+
+ Boolean; default is |
+
+ supports_param_files
+ |
+
+ Boolean; default is |
+
+ toolchain_config
+ |
+
+ Label; required + The label of the rule providingcc_toolchain_config_info.
+ |
+
+ toolchain_identifier
+ |
+
+ String; default is
+ Until issue #5380 is fixed
+ this is the recommended way of associating |
+
fdo_prefetch_hints(name, aspect_hints, compatible_with, deprecation, exec_compatible_with, exec_group_compatible_with, exec_properties, features, package_metadata, profile, restricted_to, tags, target_compatible_with, testonly, toolchains, visibility)+ +
Represents an FDO prefetch hints profile that is either in the workspace. +Examples:
+ +
+fdo_prefetch_hints(
+ name = "hints",
+ profile = "//path/to/hints:profile.afdo",
+)
+
+
+ | Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ profile
+ |
+
+ Label; required + Label of the hints profile. The hints file has the .afdo extension +The label can also point to an fdo_absolute_path_profile rule. + |
+
fdo_profile(name, aspect_hints, compatible_with, deprecation, exec_compatible_with, exec_group_compatible_with, exec_properties, features, memprof_profile, package_metadata, profile, proto_profile, restricted_to, tags, target_compatible_with, testonly, toolchains, visibility)+ +
Represents an FDO profile that is in the workspace. +Example:
+ +
+fdo_profile(
+ name = "fdo",
+ profile = "//path/to/fdo:profile.zip",
+)
+
+
+ | Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ memprof_profile
+ |
+
+ Label; default is |
+
+ profile
+ |
+
+ Label; required + Label of the FDO profile or a rule which generates it. The FDO file can have one of the +following extensions: .profraw for unindexed LLVM profile, .profdata for indexed LLVM +profile, .zip that holds an LLVM profraw profile, .afdo for AutoFDO profile, .xfdo for +XBinary profile. The label can also point to an fdo_absolute_path_profile rule. + |
+
+ proto_profile
+ |
+
+ Label; default is |
+
memprof_profile(name, aspect_hints, compatible_with, deprecation, exec_compatible_with, exec_group_compatible_with, exec_properties, features, package_metadata, profile, restricted_to, tags, target_compatible_with, testonly, toolchains, visibility)+ +
Represents a MEMPROF profile that is in the workspace. +Example:
+ +
+memprof_profile(
+ name = "memprof",
+ profile = "//path/to/memprof:profile.afdo",
+)
+
+
+
+ | Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ profile
+ |
+
+ Label; required + Label of the MEMPROF profile. The profile is expected to have +either a .profdata extension (for an indexed/symbolized memprof +profile), or a .zip extension for a zipfile containing a memprof.profdata +file. +The label can also point to an fdo_absolute_path_profile rule. + |
+
propeller_optimize(name, aspect_hints, cc_profile, compatible_with, deprecation, exec_compatible_with, exec_group_compatible_with, exec_properties, features, ld_profile, package_metadata, restricted_to, tags, target_compatible_with, testonly, toolchains, visibility)+ +
Represents a Propeller optimization profile in the workspace. +Example:
+ +
+propeller_optimize(
+ name = "layout",
+ cc_profile = "//path:cc_profile.txt",
+ ld_profile = "//path:ld_profile.txt"
+)
+
+
+ | Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ cc_profile
+ |
+
+ Label; required + Label of the profile passed to the various compile actions. This file has +the .txt extension. + |
+
+ ld_profile
+ |
+
+ Label; required + Label of the profile passed to the link action. This file has +the .txt extension. + |
+
This section defines various terms and concepts that are common to +many functions or build rules. +
+ ++ Certain string attributes of some rules are split into multiple + words according to the tokenization rules of the Bourne shell: + unquoted spaces delimit separate words, and single- and + double-quotes characters and backslashes are used to prevent + tokenization. +
++ Those attributes that are subject to this tokenization are + explicitly indicated as such in their definitions in this document. +
+
+ Attributes subject to "Make" variable expansion and Bourne shell
+ tokenization are typically used for passing arbitrary options to
+ compilers and other tools. Examples of such attributes are
+ cc_library.copts and java_library.javacopts.
+ Together these substitutions allow a
+ single string variable to expand into a configuration-specific list
+ of option words.
+
+ Some string attributes of a very few rules are subject to label
+ expansion: if those strings contain a valid label as a
+ substring, such as //mypkg:target, and that label is a
+ declared prerequisite of the current rule, it is expanded into the
+ pathname of the file represented by the
+ target
+ //mypkg:target.
+
+ Example attributes include genrule.cmd and
+ cc_binary.linkopts. The details may vary significantly in
+ each case, over such issues as: whether relative labels are
+ expanded; how labels that expand to multiple files are
+ treated, etc. Consult the rule attribute documentation for
+ specifics.
+
This section describes attributes that are defined by many build rules, +but not all. +
+ +| Attribute | +Description | +
|---|---|
data |
+
+ List of labels; default is +Files needed by this rule at runtime. May list file or rule targets. Generally +allows any target. + + +
+The default outputs and runfiles of targets in the
+New rules should define a |
+
deps |
+
+ List of labels; default is
+Dependencies for this target. Generally should only list rule targets. (Though
+some rules permit files to be listed directly in +Language-specific rules generally limit the listed targets to those with +specific providers. + +
+The precise semantics of what it means for a target to depend on another using
+
+Most often, a |
+
licenses |
+
+ List of strings; nonconfigurable;
+ default is + A list of license-type strings to be used for this particular target. + +This is part of a deprecated licensing API that Bazel no longer uses. Don't +use this. + + |
+
srcs |
+ List of labels; default is
+Files processed or included by this rule. Generally lists files directly, but
+may list rule targets (like +Language-specific rules often require that the listed files have particular +file extensions. + + |
+
This section describes attributes that are implicitly added to all build +rules. +
+ +| Attribute | +Description | +
|---|---|
aspect_hints |
+ List of labels; default is A list of arbitrary labels which is exposed to aspects (in +particular - aspects invoked by this rule's reverse dependencies), but isn't exposed to this rule's +own implementation. Consult documentation for language-specific rule sets for details about what +effect a particular aspect hint would have. + +You could think of an aspect hint as a richer alternative to a tag:
+while a tag conveys only a boolean state (the tag is either present or absent in the
+ In practice, aspect hints are used for interoperability between different language-specific
+rule sets. For example, imagine you have a For a concrete example, see
+ Best practices: +
|
+
compatible_with |
+ List of labels;
+ nonconfigurable; default is +The list of environments this target can be built for, in addition to +default-supported environments. + + ++This is part of Bazel's constraint system, which lets users declare which +targets can and cannot depend on each other. For example, externally deployable +binaries shouldn't depend on libraries with company-secret code. See + +ConstraintSemantics for details. + + |
+
deprecation |
+ String; nonconfigurable; default is +An explanatory warning message associated with this target. +Typically this is used to notify users that a target has become obsolete, +or has become superseded by another rule, is private to a package, or is +perhaps considered harmful for some reason. It is a good idea to include +some reference (like a webpage, a bug number or example migration CLs) so +that one can easily find out what changes are required to avoid the message. +If there is a new target that can be used as a drop in replacement, it is a +good idea to just migrate all users of the old target. + + +
+This attribute has no effect on the way things are built, but it
+may affect a build tool's diagnostic output. The build tool issues a
+warning when a rule with a +Intra-package dependencies are exempt from this warning, so that, +for example, building the tests of a deprecated rule does not +encounter a warning. + + ++If a deprecated target depends on another deprecated target, no warning +message is issued. + + ++Once people have stopped using it, the target can be removed. + + |
+
exec_compatible_with |
+ List of labels;
+ nonconfigurable; default is
+A list of
+ |
+
exec_group_compatible_with |
+ Dictionary of strings to lists of labels;
+ nonconfigurable; default is
+A dictionary of exec group names to lists of
+ |
+
exec_properties |
+ Dictionary of strings; default is A dictionary of strings that will be added to the If a key is present in both the platform and target-level properties, the value will be taken from the target. + +Keys can be prefixed with the name of an execution group followed by a |
+
features |
+ List of feature strings; default is A feature is string tag that can be enabled or disabled on a target. The + meaning of a feature depends on the rule itself. + +This |
+
package_metadata |
+ List of labels;
+ nonconfigurable; default is the package's
+ +A list of labels that are associated metadata about this target. +Typically, the labels are simple rules that return a provider of +constant values. Rules and aspects may use these labels to perform some +additional analysis on the build graph. + + +
+The canonical use case is that of
+rules_license.
+For that use case, |
+
restricted_to |
+ List of labels;
+ nonconfigurable; default is +The list of environments this target can be built for, instead of +default-supported environments. + + +
+This is part of Bazel's constraint system. See
+ |
+
tags |
+
+ List of strings; nonconfigurable;
+ default is
+ Tags can be used on any rule. Tags on test and
+
+ Bazel modifies the behavior of its sandboxing code if it finds the following
+ keywords in the
+ Tags on tests are generally used to annotate a test's role in your + debug and release process. Typically, tags are most useful for C++ and Python + tests, which lack any runtime annotation ability. The use of tags and size + elements gives flexibility in assembling suites of tests based around codebase + check-in policy. + + +
+ Bazel modifies test running behavior if it finds the following keywords in the
+
|
+
target_compatible_with |
+
+List of labels; default is
+A list of
+ +Targets that transitively depend on incompatible targets are themselves +considered incompatible. They are also skipped for building and testing. + + ++An empty list (which is the default) signifies that the target is compatible +with all platforms. + + +
+All rules other than Workspace Rules support this
+attribute.
+For some rules this attribute has no effect. For example, specifying
+ + + +See the +Platforms +page for more information about incompatible target skipping. + + |
+
testonly |
+ Boolean; nonconfigurable; default is
+If
+Equivalently, a rule that is not
+Tests ( +This attribute is intended to mean that the target should not be +contained in binaries that are released to production. + + ++Because testonly is enforced at build time, not run time, and propagates +virally through the dependency tree, it should be applied judiciously. For +example, stubs and fakes that +are useful for unit tests may also be useful for integration tests +involving the same binaries that will be released to production, and +therefore should probably not be marked testonly. Conversely, rules that +are dangerous to even link in, perhaps because they unconditionally +override normal behavior, should definitely be marked testonly. + + |
+
toolchains |
+ List of labels;
+ nonconfigurable; default is
+ The set of targets whose Make variables this target is
+ allowed to access. These targets are either instances of rules that provide
+
+ Note that this is distinct from the concept of
+ toolchain resolution
+ that is used by rule implementations for platform-dependent configuration. You cannot use this
+ attribute to determine which specific |
+
visibility |
+ List of labels; + nonconfigurable; + default varies + + +
+ The
+ For targets declared directly in a BUILD file or in legacy macros called from
+ a BUILD file, the default value is the package's
+ |
+
This section describes attributes that are common to all test rules.
+ +| Attribute | +Description | +||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
args |
+ List of strings; subject to
+$(location) and
+"Make variable" substitution, and
+Bourne shell tokenization; default is Command line arguments that Bazel passes to the target when it is
+executed with
+These arguments are passed before any |
+ ||||||||||||||||||||
env |
+
+ Dictionary of strings; values are subject to
+ $(location) and
+ "Make variable" substitution; default is
+ Specifies additional environment variables to set when the test is executed by
+
+ This attribute only applies to native rules, like |
+ ||||||||||||||||||||
env_inherit |
+ List of strings; default is Specifies additional environment variables to inherit from the
+ external environment when the test is executed by
+ This attribute only applies to native rules, like |
+ ||||||||||||||||||||
size |
+ String Specifies a test target's "heaviness": how much time/resources it needs to run. + +Unit tests are considered "small", integration tests "medium", and end-to-end tests "large" or
+"enormous". Bazel uses the size to determine a default timeout, which can be overridden using the
+ Test sizes correspond to the following default timeouts and assumed peak local resource +usages: + +
+ The environment variable
+ |
+ ||||||||||||||||||||
timeout |
+ String +How long the test is expected to run before returning. + + +
+While a test's size attribute controls resource estimation, a test's
+timeout may be set independently. If not explicitly specified, the
+timeout is based on the test's size. The test
+timeout can be overridden with the
+For times other than the above, the test timeout can be overridden with the
+
+ The environment variable
+ |
+ ||||||||||||||||||||
flaky |
+ Boolean; nonconfigurable;
+ default is +Marks test as flaky. + + ++If set, executes the test up to three times, marking it as failed only if it +fails each time. By default, this attribute is set to False and the test is +executed only once. Note, that use of this attribute is generally discouraged - +tests should pass reliably when their assertions are upheld. + + |
+ ||||||||||||||||||||
shard_count |
+ Non-negative integer less than or equal to 50; default is Specifies the number of parallel shards +to use to run the test. + +If set, this value will override any heuristics used to determine the number of
+parallel shards with which to run the test. Note that for some test
+rules, this parameter may be required to enable sharding
+in the first place. Also see If test sharding is enabled, the environment variable Sharding requires the test runner to support the test sharding protocol. +If it does not, then it will most likely run every test in every shard, which +is not what you want. + +See +Test Sharding +in the Test Encyclopedia for details on sharding. + |
+ ||||||||||||||||||||
local |
+ Boolean; nonconfigurable;
+ default is Forces the test to be run locally, without sandboxing. + +Setting this to True is equivalent to providing "local" as a tag
+( |
+
This section describes attributes that are common to all binary rules.
+ +| Attribute | +Description | +
|---|---|
args |
+
+ List of strings; subject to
+ $(location) and
+ "Make variable" substitution, and
+ Bourne shell tokenization;
+ nonconfigurable;
+ default is
+Command line arguments that Bazel will pass to the target when it is executed
+either by the
+NOTE: The arguments are not passed when you run the target
+outside of Bazel (for example, by manually executing the binary in
+ |
+
env |
+ Dictionary of strings; values are subject to
+$(location) and
+"Make variable" substitution; default is Specifies additional environment variables to set when the target is
+ executed by
+ This attribute only applies to native rules, like
+NOTE: The environment variables are not set when you run the target
+outside of Bazel (for example, by manually executing the binary in
+ |
+
output_licenses |
+ List of strings; default is +The licenses of the output files that this binary generates. + +This is part of a deprecated licensing API that Bazel no longer uses. Don't +use this. + + + |
+
+ Most attributes are "configurable", meaning that their values may change when + the target is built in different ways. Specifically, configurable attributes + may vary based on the flags passed to the Bazel command line, or what + downstream dependency is requesting the target. This can be used, for + instance, to customize the target for multiple platforms or compilation modes. +
+ +
+ The following example declares different sources for different target
+ architectures. Running bazel build :multiplatform_lib --cpu x86
+ will build the target using x86_impl.cc, while substituting
+ --cpu arm will instead cause it to use arm_impl.cc.
+
+cc_library(
+ name = "multiplatform_lib",
+ srcs = select({
+ ":x86_mode": ["x86_impl.cc"],
+ ":arm_mode": ["arm_impl.cc"]
+ })
+)
+config_setting(
+ name = "x86_mode",
+ values = { "cpu": "x86" }
+)
+config_setting(
+ name = "arm_mode",
+ values = { "cpu": "arm" }
+)
+
+
+
+ The select() function
+ chooses among different alternative values for a configurable attribute based
+ on which config_setting
+ or constraint_value
+ criteria the target's configuration satisfies.
+
+ Bazel evaluates configurable attributes after processing macros and before
+ processing rules (technically, between the
+
+ loading and analysis phases).
+ Any processing before select() evaluation doesn't know which
+ branch the select() chooses. Macros, for example, can't change
+ their behavior based on the chosen branch, and bazel query can
+ only make conservative guesses about a target's configurable dependencies. See
+
+ this FAQ
+ for more on using select() with rules and macros.
+
+ Attributes marked nonconfigurable in their documentation cannot
+ use this feature. Usually an attribute is nonconfigurable because Bazel
+ internally needs to know its value before it can determine how to resolve a
+ select().
+
+ See + Configurable Build Attributes for a detailed overview. +
+ ++ Implicit outputs in C++ are deprecated. Please refrain from using it + in other languages where possible. We don't have a deprecation path yet + but they will eventually be deprecated too. +
+ +When you define a build rule in a BUILD file, you are explicitly
+ declaring a new, named rule target in a package. Many build rule
+ functions also implicitly entail one or more output file
+ targets, whose contents and meaning are rule-specific.
+
+ For example, when you explicitly declare a
+ java_binary(name='foo', ...) rule, you are also
+ implicitly declaring an output file
+ target foo_deploy.jar as a member of the same package.
+ (This particular target is a self-contained Java archive suitable
+ for deployment.)
+
+ Implicit output targets are first-class members of the global
+ target graph. Just like other targets, they are built on demand,
+ either when specified in the top-level built command, or when they
+ are necessary prerequisites for other build targets. They can be
+ referenced as dependencies in BUILD files, and can be observed in
+ the output of analysis tools such as bazel query.
+
+ For each kind of build rule, the rule's documentation contains a + special section detailing the names and contents of any implicit + outputs entailed by a declaration of that kind of rule. +
+ +
+ An important but somewhat subtle distinction between the
+ two namespaces used by the build system:
+ labels identify targets,
+ which may be rules or files, and file targets may be divided into
+ either source (or input) file targets and derived (or output) file
+ targets. These are the things you can mention in BUILD files,
+ build from the command-line, or examine using bazel query;
+ this is the target namespace. Each file target corresponds
+ to one actual file on disk (the "file system namespace"); each rule
+ target may correspond to zero, one or more actual files on disk.
+ There may be files on disk that have no corresponding target; for
+ example, .o object files produced during C++ compilation
+ cannot be referenced from within BUILD files or from the command line.
+ In this way, the build tool may hide certain implementation details of
+ how it does its job. This is explained more fully in
+ the BUILD Concept Reference.
+
action_listener(name, aspect_hints, compatible_with, deprecation, exec_compatible_with, exec_group_compatible_with, exec_properties, extra_actions, features, licenses, mnemonics, package_metadata, restricted_to, tags, target_compatible_with, testonly, visibility)+ + +
+ WARNING: Extra actions are deprecated. Use + aspects + instead. +
+ +
+ An action_listener rule doesn't produce any output itself.
+ Instead, it allows tool developers to insert
+ extra_actions into the build system,
+ by providing a mapping from action to extra_action
+ .
+
+ This rule's arguments map action mnemonics to
+ extra_action rules.
+
+ By specifying the option
+ --experimental_action_listener=<label>,
+ the build will use the specified action_listener to insert
+ extra_actions into the build graph.
+
+action_listener( + name = "index_all_languages", + mnemonics = [ + "Javac", + "CppCompile", + "Python", + ], + extra_actions = [":indexer"], +) + +action_listener( + name = "index_java", + mnemonics = ["Javac"], + extra_actions = [":indexer"], +) + +extra_action( + name = "indexer", + tools = ["//my/tools:indexer"], + cmd = "$(location //my/tools:indexer)" + + "--extra_action_file=$(EXTRA_ACTION_FILE)", +) ++ + + +
| Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ extra_actions
+ |
+
+ List of labels; required + A list ofextra_action targets
+ this action_listener should add to the build graph.
+ E.g. [ "//my/tools:analyzer" ].
+
+ |
+
+ mnemonics
+ |
+
+ List of strings; required + A list of action mnemonics thisaction_listener should listen
+ for, e.g. [ "Javac" ].
+ + Mnemonics are not a public interface. + There's no guarantee that the mnemonics and their actions don't change. + + + |
+
extra_action(name, data, aspect_hints, cmd, compatible_with, deprecation, exec_compatible_with, exec_group_compatible_with, exec_properties, features, licenses, out_templates, package_metadata, requires_action_output, restricted_to, tags, target_compatible_with, testonly, toolchains, tools, visibility)+ + +
+ WARNING: Extra actions are deprecated. Use + aspects + instead. +
+ +
+ An extra_action rule doesn't produce any meaningful output
+ when specified as a regular build target. Instead, it allows tool developers
+ to insert additional actions into the build graph that shadow existing actions.
+
+ See action_listener for details
+ on how to enable extra_actions.
+
+ The extra_actions run as a command-line. The command-line tool gets
+ access to a file containing a protocol buffer as $(EXTRA_ACTION_FILE)
+ with detailed information on the original action it is shadowing.
+ It also has access to all the input files the original action has access to.
+ See extra_actions_base.proto
+ for details on the data stored inside the protocol buffer. Each proto file
+ contains an ExtraActionInfo message.
+
+ Just like all other actions, extra actions are sandboxed, and should be designed to handle that. +
+ + + +| Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + You may refer to this rule bylabel in the extra_actions argument
+ of action_listener rules.
+
+ |
+
+ cmd
+ |
+
+ String; required + The command to run. ++ Like genrule cmd attribute with the following + differences: + +
|
+
+ out_templates
+ |
+
+ List of strings; default is extra_action command.
+ + The template can use the following variables: +
|
+
+ requires_action_output
+ |
+
+ Boolean; default is extra_action requires the output of the
+ original action to be present as input to this extra_action.
+ + When true (default false), the extra_action can assume that the + original action outputs are available as part of its inputs. + + + |
+
+ tools
+ |
+
+ List of labels; default is tool dependencies for this rule.
+ + See the definition of dependencies for more + information. + +
+ The build system ensures these prerequisites are built before running the
+ + All tools and their data dependencies are consolidated into a single tree + within which the command can use relative paths. The working directory will + be the root of that unified tree. + + + |
+
+package(default_deprecation, default_package_metadata, default_testonly, default_visibility, features) ++
This function declares metadata that applies to every rule in the +package. It is used at most once within a package (BUILD file).
+ +For the counterpart that declares metadata applying to every rule in the whole
+repository, use the repo() function in the
+REPO.bazel file at the root of your repo.
+The repo() function takes exactly the same arguments as package().
The package() function should be called right after all the load() statements at the top of the +file, before any rule.
+ +| Attribute | +Description | +
|---|---|
default_applicable_licenses |
+
+ Alias for |
+
default_visibility |
+
+ List of labels; default is The default visibility of the top-level rule targets and symbolic
+ macros in this package — that is, the targets and symbolic macros
+ that are not themselves declared inside a symbolic macro. This attribute
+ is ignored if the target or macro specifies a For detailed information about the syntax of this attribute, see the + documentation of + visibility. The package default visibility does not apply to + exports_files, which is public by default. + + |
+
default_deprecation |
+
+ String; default is Sets the default
+ |
+
default_package_metadata |
+
+ List of labels; default is Sets a default list of metadata targets which apply to all other targets in the package. + These are typically targets related to OSS package and license declarations. + See rules_license for examples. + |
+
default_testonly |
+
+ Boolean; default is Sets the default
+ In packages under |
+
features |
+
+ List strings; default is Sets various flags that affect the semantics of this BUILD file. +This feature is mainly used by the people working on the build system to + tag packages that need some kind of special handling. Do not use this unless + explicitly requested by someone working on the build system. + + |
+
//foo:target. Individual visibility declarations
+on a rule, if present, override this specification.
+
++package(default_visibility = ["//foo:target"]) ++ + + +
package_group(name, packages, includes)+ +
This function defines a set of packages
+and associates a label with the set. The label can be referenced in
+visibility attributes.
Package groups are primarily used for visibility control. A publicly visible +target can be referenced from every package in the source tree. A privately +visible target can only be referenced within its own package (not subpackages). +In between these extremes, a target may allow access to its own package plus any +of the packages described by one or more package groups. For a more detailed +explanation of the visibility system, see the +visibility +attribute.
+ +A given package is considered to be in the group if it either matches the
+packages attribute, or is already contained in one of the other
+package groups mentioned in the includes attribute.
Package groups are technically targets, but are not created by rules, and do +not themselves have any visibility protection.
+ +| Attribute | +Description | +
|---|---|
name |
+
+ Name; required +A unique name for this target. + |
+
packages |
+
+ List of strings; default is A list of zero or more package specifications. + +Each package specification string can have one of the following + forms: + +
In addition, the first two kinds of package specifications may also
+ be prefixed with The package group contains any package that matches at least one of
+ its positive specifications and none of its negative specifications
+ For instance, the value Aside from public visibility, there is no way to directly specify + packages outside the current repository. + +If this attribute is missing, it is the same as setting it to an
+ empty list, which is also the same as setting it to a list containing
+ only Note: Prior to Bazel 6.0, the specification Note: Prior to Bazel 6.0, when this attribute is serialized as
+ part of |
+
includes |
+
+ List of labels; default is Other package groups that are included in this one. + +The labels in this attribute must refer to other package groups.
+ Packages in referenced package groups are taken to be part of this
+ package group. This is transitive — if package group
+ When used together with negated package specifications, note that the + set of packages for each group is first computed independently and the + results are then unioned together. This means that negated + specifications in one group have no effect on the specifications in + another group. + |
+
The following package_group declaration specifies a
+package group called "tropical" that contains tropical fruits.
+package_group( + name = "tropical", + packages = [ + "//fruits/mango", + "//fruits/orange", + "//fruits/papaya/...", + ], +) ++ +
The following declarations specify the package groups of a fictional +application:
+ ++package_group( + name = "fooapp", + includes = [ + ":controller", + ":model", + ":view", + ], +) + +package_group( + name = "model", + packages = ["//fooapp/database"], +) + +package_group( + name = "view", + packages = [ + "//fooapp/swingui", + "//fooapp/webui", + ], +) + +package_group( + name = "controller", + packages = ["//fooapp/algorithm"], +) ++ + + +
exports_files([label, ...], visibility, licenses)+ +
+ exports_files() specifies a list of files belonging to
+ this package that are exported to other packages.
+
+ The BUILD file for a package may only refer directly to source files belonging
+ to another package if they are explicitly exported with an
+ exports_files() statement. Read more about
+ visibility of files.
+
+ As a legacy behaviour, also files mentioned as input to a rule are exported
+ with the default visibility until the flag
+ --incompatible_no_implicit_file_export
+ is flipped. However, this behavior should not be relied upon and actively
+ migrated away from.
+
+ The argument is a list of names of files within the current package. A
+ visibility declaration can also be specified; in this case, the files will be
+ visible to the targets specified. If no visibility is specified, the files
+ will be visible to every package, even if a package default visibility was
+ specified in the package
+ function. The licenses
+ can also be specified.
+
+ The following example exports golden.txt, a
+ text file from the test_data package, so that other
+ packages may use it, for example, in the data attribute
+ of tests.
+
+# from //test_data/BUILD + +exports_files(["golden.txt"]) ++ + + +
glob(include, exclude=[], exclude_directories=1, allow_empty=True)+ +
+Glob is a helper function that finds all files that match certain path patterns, +and returns a new, mutable, sorted list of their paths. Glob only searches files +in its own package, and looks only for source files (not generated files nor +other targets). +
+ +
+A source file's Label is included in the result if the file's package-relative
+path matches any of the include patterns and none of the
+exclude patterns.
+
+The include and exclude lists contain path patterns
+that are relative to the current package. Every pattern may consist of one or
+more path segments. As usual with Unix paths, these segments are separated by
+/. The segments in the pattern are matched against the segments of
+the path. Segments may contain the * wildcard: this matches
+any substring in the path segment (even the empty substring), excluding the
+directory separator /. This wildcard can be used multiple times
+within one path segment. Additionally, the ** wildcard can match
+zero or more complete path segments, but it must be declared as a standalone
+path segment.
+
foo/bar.txt matches exactly the foo/bar.txt file
+in this package (unless foo/ is a subpackage)foo/*.txt matches every file in the foo/ directory
+if the file ends with .txt (unless foo/ is a
+subpackage)foo/a*.htm* matches every file in the foo/
+directory that starts with a, then has an arbitrary string (could
+be empty), then has .htm, and ends with another arbitrary string
+(unless foo/ is a subpackage); such as foo/axx.htm
+and foo/a.html or foo/axxx.htmlfoo/* matches every file in the foo/ directory,
+(unless foo/ is a subpackage); it does not match foo
+directory itself even if exclude_directories is set to
+0foo/** matches every file in every non-subpackage subdirectory
+under package's first level subdirectory foo/; if
+exclude_directories is set to 0, foo
+directory itself also matches the pattern; in this case, ** is
+considered to match zero path segments**/a.txt matches a.txt files in this package's
+directory plus non-subpackage subdirectories.**/bar/**/*.txt matches every .txt file in every
+non-subpackage subdirectory of this package, if at least one directory on the
+resulting path is called bar, such as
+xxx/bar/yyy/zzz/a.txt or bar/a.txt (remember that
+** also matches zero segments) or bar/zzz/a.txt** matches every file in every non-subpackage subdirectory of
+this packagefoo**/a.txt is an invalid pattern, because ** must
+stand on its own as a segmentfoo/ is an invalid pattern, because the second segment defined
+after / is an empty string
+If the exclude_directories argument is enabled (set to 1), files of
+type directory will be omitted from the results (default 1).
+
+If the allow_empty argument is set to False, the
+glob function will error-out if the result would otherwise be the
+empty list.
+
+There are several important limitations and caveats: +
+ +
+ Since glob() runs during BUILD file evaluation,
+ glob() matches files only in your source tree, never
+ generated files. If you are building a target that requires both
+ source and generated files, you must append an explicit list of generated
+ files to the glob. See the example
+ below with :mylib and :gen_java_srcs.
+
+ If a rule has the same name as a matched source file, the rule will + "shadow" the file. +
+
+ To understand this, remember that glob() returns a list of
+ paths, so using glob() in other rules' attribute (e.g.
+ srcs = glob(["*.cc"])) has the same effect as listing the
+ matched paths explicitly. If for example glob() yields
+ ["Foo.java", "bar/Baz.java"] but there's also a rule in the
+ package called "Foo.java" (which is allowed, though Bazel warns about it),
+ then the consumer of the glob() will use the "Foo.java" rule
+ (its outputs) instead of the "Foo.java" file. See
+ GitHub
+ issue #10395 for more details.
+
+ Labels are not allowed to cross the package boundary and glob does + not match files in subpackages. +
+ +
+ For example, the glob expression **/*.cc in package
+ x does not include x/y/z.cc if
+ x/y exists as a package (either as
+ x/y/BUILD, or somewhere else on the package-path). This
+ means that the result of the glob expression actually depends on the
+ existence of BUILD files — that is, the same glob expression would
+ include x/y/z.cc if there was no package called
+ x/y or it was marked as deleted using the
+ --deleted_packages
+ flag.
+
. is completely matched by
+ both the ** and the * wildcards. If you want to match a hidden file
+ with a compound pattern, your pattern needs to begin with a .. For example,
+ * and .*.txt will match .foo.txt, but *.txt
+ will not.
+
+ Hidden directories are also matched in the same manner. Hidden directories
+ may include files that are not required as inputs, and can increase the
+ number of unnecessarily globbed files and memory consumption. To exclude
+ hidden directories, add them to the "exclude" list argument.
+ "**" doesn't match the package's directory path. That is to
+ say, glob(["**"], exclude_directories = False) matches all files
+ and directories transitively strictly under the current package's directory
+ (but of course not going into directories of subpackages - see the previous
+ note about that).
+ +In general, you should try to provide an appropriate extension (e.g. *.html) +instead of using a bare '*' for a glob pattern. The more explicit name +is both self documenting and ensures that you don't accidentally match backup +files, or emacs/vi/... auto-save files. +
+ ++When writing build rules you can enumerate the elements of the glob. This +enables generating individual rules for every input, for example. See the +expanded glob example section below. +
+ + Create a Java library built from all java files in this directory,
+and all files generated by the :gen_java_srcs rule.
+java_library( + name = "mylib", + srcs = glob(["*.java"]) + [":gen_java_srcs"], + deps = "...", +) + +genrule( + name = "gen_java_srcs", + outs = [ + "Foo.java", + "Bar.java", + ], + ... +) ++ +
Include all txt files in directory testdata except experimental.txt. +Note that files in subdirectories of testdata will not be included. If +you want those files to be included, use a recursive glob (**).
++sh_test( + name = "mytest", + srcs = ["mytest.sh"], + data = glob( + ["testdata/*.txt"], + exclude = ["testdata/experimental.txt"], + ), +) ++ +
Make the test depend on all txt files in the testdata directory and any + of its subdirectories (and their subdirectories, and so on). + Subdirectories containing a BUILD file are ignored. (See limitations + and caveats above.)
++sh_test( + name = "mytest", + srcs = ["mytest.sh"], + data = glob(["testdata/**/*.txt"]), +) ++ +
Create a library built from all java files in this directory and all +subdirectories except those whose path includes a directory named testing. +This pattern should be avoided if possible, as it can reduce build +incrementality and therefore increase build times. +
++java_library( + name = "mylib", + srcs = glob( + ["**/*.java"], + exclude = ["**/testing/**"], + ), +) ++ +
+Create an individual genrule for *_test.cc in the current directory +that counts the number of lines in the file. +
+ ++# Conveniently, the build language supports list comprehensions. +[genrule( + name = "count_lines_" + f[:-3], # strip ".cc" + srcs = [f], + outs = ["%s-linecount.txt" % f[:-3]], + cmd = "wc -l $< >$@", + ) for f in glob(["*_test.cc"])] ++ +
+If the BUILD file above is in package //foo and the package contains three
+matching files, a_test.cc, b_test.cc and c_test.cc then running
+bazel query '//foo:all' will list all rules that were generated:
+
+
+$ bazel query '//foo:all' | sort +//foo:count_lines_a_test +//foo:count_lines_b_test +//foo:count_lines_c_test ++ + + +
+select(
+ {conditionA: valuesA, conditionB: valuesB, ...},
+ no_match_error = "custom message"
+)
+
+
+select() is the helper function that makes a rule attribute
+ configurable.
+ It can replace the right-hand side of
+
+ almost
+ any attribute assignment so its value depends on command-line Bazel flags.
+ You can use this, for example, to define platform-specific dependencies or to
+ embed different resources depending on whether a rule is built in "developer"
+ vs. "release" mode.
+
Basic use is as follows:
+ +
+sh_binary(
+ name = "mytarget",
+ srcs = select({
+ ":conditionA": ["mytarget_a.sh"],
+ ":conditionB": ["mytarget_b.sh"],
+ "//conditions:default": ["mytarget_default.sh"]
+ })
+)
+
+
+This makes the srcs attribute of
+ a sh_binary configurable by replacing its normal label
+ list assignment with a select call that maps
+ configuration conditions to matching values. Each condition is a label
+ reference to
+ a config_setting or
+ constraint_value,
+ which "matches" if the target's configuration matches an expected set of
+ values. The value of mytarget#srcs then becomes whichever
+ label list matches the current invocation.
+
Notes:
+ +//conditions:default is
+ considered to match if no other condition matches. If this condition
+ is left out, some other rule must match to avoid an error.
+ select can be embedded inside a larger
+ attribute assignment. So srcs = ["common.sh"]
+ + select({ ":conditionA": ["myrule_a.sh"], ...}) and
+ srcs = select({ ":conditionA": ["a.sh"]}) + select({ ":conditionB":
+ ["b.sh"]}) are valid expressions.
+ select works with most, but not all, attributes. Incompatible
+ attributes are marked nonconfigurable in their documentation.
+
+
+
+subpackages(include, exclude=[], allow_empty=True)+ +
+ subpackages() is a helper function, similar to glob()
+ that lists subpackages instead of files and directories. It uses the same
+ path patterns as glob() and can match any subpackage that is a
+ direct descendant of the currently loading BUILD file. See glob for a detailed explanation and examples of include and
+ exclude patterns.
+
+ The resulting list of subpackages returned is in sorted order and contains
+ paths relative to the current loading package that match the given patterns in
+ include and not those in exclude.
+
+
+ The following example lists all the direct subpackages for the package foo/BUILD
+
+
+# The following BUILD files exist: +# foo/BUILD +# foo/bar/baz/BUILD +# foo/bar/but/bad/BUILD +# foo/sub/BUILD +# foo/sub/deeper/BUILD +# +# In foo/BUILD a call to +subs1 = subpackages(include = ["**"]) + +# results in subs1 == ["sub", "bar/baz", "bar/but/bad"] +# +# 'sub/deeper' is not included because it is a subpackage of 'foo/sub' not of +# 'foo' + +subs2 = subpackages(include = ["bar/*"]) +# results in subs2 = ["bar/baz"] +# +# Since 'bar' is not a subpackage itself, this looks for any subpackages under +# all first level subdirectories of 'bar'. + +subs3 = subpackages(include = ["bar/**"]) +# results in subs3 = ["bar/baz", "bar/but/bad"] +# +# Since bar is not a subpackage itself, this looks for any subpackages which are +# (1) under all subdirectories of 'bar' which can be at any level, (2) not a +# subpackage of another subpackages. + +subs4 = subpackages(include = ["sub"]) +subs5 = subpackages(include = ["sub/*"]) +subs6 = subpackages(include = ["sub/**"]) +# results in subs4 and subs6 being ["sub"] +# results in subs5 = []. +# +# In subs4, expression "sub" checks whether 'foo/sub' is a package (i.e. is a +# subpackage of 'foo'). +# In subs5, "sub/*" looks for subpackages under directory 'foo/sub'. Since +# 'foo/sub' is already a subpackage itself, the subdirectories will not be +# traversed anymore. +# In subs6, 'foo/sub' is a subpackage itself and matches pattern "sub/**", so it +# is returned. But the subdirectories of 'foo/sub' will not be traversed +# anymore. ++ +
+ In general it is preferred that instead of calling this function directly + that users use the 'subpackages' module of + skylib. + + + + + diff --git a/reference/be/general.mdx b/reference/be/general.mdx new file mode 100644 index 0000000..946c9b9 --- /dev/null +++ b/reference/be/general.mdx @@ -0,0 +1,1529 @@ +--- +title: 'general' +--- + + +
+ + + + + + + + + + +alias(name, actual, aspect_hints, compatible_with, deprecation, features, package_metadata, restricted_to, tags, target_compatible_with, testonly, visibility)+ + +
+ The alias rule creates another name a rule can be referred to as.
+
+ Aliasing only works for "regular" targets. In particular, package_group
+ and test_suite cannot be aliased.
+
+ Aliasing may be of help in large repositories where renaming a target would require making + changes to lots of files. You can also use alias rule to store a + select function call if you want to reuse that logic for + multiple targets. +
+ ++ The alias rule has its own visibility declaration. In all other respects, it behaves + like the rule it references (e.g. testonly on the alias is ignored; the testonly-ness + of the referenced rule is used instead) with some minor exceptions: + +
test_suite
+ rule with a single target in its tests
+ attribute.
+ environment rules are not
+ supported. They are not supported in the --target_environment command line
+ option, either.
+ +filegroup( + name = "data", + srcs = ["data.txt"], +) + +alias( + name = "other", + actual = ":data", +) ++ + + +
| Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ actual
+ |
+
+ Label; required + The target this alias refers to. It does not need to be a rule, it can also be an input + file. + + |
+
config_setting(name, aspect_hints, constraint_values, define_values, deprecation, features, flag_values, licenses, package_metadata, tags, testonly, values, visibility)+ + +
+ Matches an expected configuration state (expressed as build flags or platform constraints) for + the purpose of triggering configurable attributes. See select for + how to consume this rule and + Configurable attributes for an overview of the general feature. + +
The following matches any build that sets --compilation_mode=opt or
+ -c opt (either explicitly at the command line or implicitly from .bazelrc files):
+
+ config_setting(
+ name = "simple",
+ values = {"compilation_mode": "opt"}
+ )
+
+
+ The following matches any build that targets ARM and applies the custom define
+ FOO=bar (for instance, bazel build --cpu=arm --define FOO=bar ...):
+
+ config_setting(
+ name = "two_conditions",
+ values = {
+ "cpu": "arm",
+ "define": "FOO=bar"
+ }
+ )
+
+
+ The following matches any build that sets
+ user-defined flag
+ --//custom_flags:foo=1 (either explicitly at the command line or implicitly from
+ .bazelrc files):
+
+ config_setting(
+ name = "my_custom_flag_is_set",
+ flag_values = { "//custom_flags:foo": "1" },
+ )
+
+
+ The following matches any build that targets a platform with an x86_64 architecture and glibc
+ version 2.25, assuming the existence of a constraint_value with label
+ //example:glibc_2_25. Note that a platform still matches if it defines additional
+ constraint values beyond these two.
+
+ config_setting( + name = "64bit_glibc_2_25", + constraint_values = [ + "@platforms//cpu:x86_64", + "//example:glibc_2_25", + ] + ) ++ + In all these cases, it's possible for the configuration to change within the build, for example if + a target needs to be built for a different platform than its dep. This means that even when a +
config_setting doesn't match the top-level command-line flags, it may still match
+ some build targets.
+
+ config_settings match the current configuration state.
+ --compilation_mode vs.
+ -c), values definitions must use the full form. These automatically
+ match invocations using either form.
+ --copt=-Da --copt=-Db or a list-typed
+
+ Starlark flag), values = { "flag": "a" } matches if "a" is
+ present anywhere in the actual list.
+
+
+ values = { "myflag": "a,b" } works the same way: this matches
+ --myflag=a --myflag=b, --myflag=a --myflag=b --myflag=c,
+ --myflag=a,b, and --myflag=c,b,a. Exact semantics vary between
+ flags. For example, --copt doesn't support multiple values in the same
+ instance: --copt=a,b produces ["a,b"] while --copt=a
+ --copt=b produces ["a", "b"] (so values = { "copt": "a,b" }
+ matches the former but not the latter). But --ios_multi_cpus (for Apple rules)
+ does: -ios_multi_cpus=a,b and ios_multi_cpus=a --ios_multi_cpus=b
+ both produce ["a", "b"]. Check flag definitions and test your
+ conditions carefully to verify exact expectations.
+
--define, but this offers weaker
+ support and is not recommended. See
+ here for more discussion.
+ config_setting definitions in different packages.
+ Instead, reference a common config_setting that defined in a canonical package.
+ values,
+ define_values, and
+ constraint_values
+ can be used in any combination in the same config_setting but at least one must
+ be set for any given config_setting.
+ | Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ constraint_values
+ |
+
+ List of labels; nonconfigurable; default is constraint_values that the target platform must specify
+ in order to match this config_setting. (The execution platform is not
+ considered here.) Any additional constraint values that the platform has are ignored. See
+
+ Configurable Build Attributes for details.
+
+ If two If two |
+
+ define_values
+ |
+
+ Dictionary: String -> String; nonconfigurable; default is values but
+ specifically for the --define flag.
+
+
That means: + +
+ config_setting(
+ name = "a_and_b",
+ values = {
+ "define": "a=1",
+ "define": "b=2",
+ })
+
+
+ doesn't work because the same key (
+ config_setting(
+ name = "a_and_b",
+ define_values = {
+ "a": "1",
+ "b": "2",
+ })
+
+
+ correctly matches
|
+
+ flag_values
+ |
+
+ Dictionary: label -> String; nonconfigurable; default is values but
+ for
+ user-defined build flags.
+
+ This is a distinct attribute because user-defined flags are referenced as labels while + built-in flags are referenced as arbitrary strings. + + + |
+
+ values
+ |
+
+ Dictionary: String -> String; nonconfigurable; default is This rule inherits the configuration of the configured target that
+ references it in a For convenience's sake, configuration values are specified as build flags (without
+ the preceding If a flag is not explicitly set at the command line, its default value is used.
+ If a key appears multiple times in the dictionary, only the last instance is used.
+ If a key references a flag that can be set multiple times on the command line (e.g.
+ + + |
+
filegroup(name, srcs, data, aspect_hints, compatible_with, deprecation, features, licenses, output_group, package_metadata, restricted_to, tags, target_compatible_with, testonly, visibility)+ +
+ Use filegroup to gather the outputs of a set of targets under a single
+ label.
+
+ filegroup is not a substitute for listing targets on the command line or
+ in an attribute of another rule, because targets have many properties other than their
+ outputs, which are not collected in the same way. However, it's still useful in quite
+ a few cases, for example, in the srcs attribute of a genrule, or
+ the data attribute of a *_binary rule.
+
+ Using filegroup is encouraged instead of referencing directories directly.
+ Directly referencing directories is discouraged because the build system does not have
+ full knowledge of all files below the directory, so it may not rebuild when these files change.
+ When combined with glob, filegroup can ensure that all
+ files are explicitly known to the build system.
+
+ To create a filegroup consisting of two source files, do
+
+filegroup( + name = "mygroup", + srcs = [ + "a_file.txt", + "//a/library:target", + "//a/binary:target", + ], +) ++
+ Or, use a glob to fully crawl a testdata directory:
+
+filegroup( + name = "exported_testdata", + srcs = glob([ + "testdata/*.dat", + "testdata/logs/**/*.log", + ]), +) ++
+ To make use of these definitions, reference the filegroup with a label from any rule:
+
+cc_library( + name = "my_library", + srcs = ["foo.cc"], + data = [ + "//my_package:exported_testdata", + "//my_package:mygroup", + ], +) ++ + + +
| Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ srcs
+ |
+
+ List of labels; default is
+ It is common to use the result of a glob expression for
+ the value of the |
+
+ data
+ |
+
+ List of labels; default is
+ Targets named in the |
+
+ output_group
+ |
+
+ String; default is An "output group" is a category of output artifacts of a target, specified in that + rule's implementation. + + + |
+
genquery(name, deps, data, aspect_hints, compatible_with, compressed_output, deprecation, exec_compatible_with, exec_group_compatible_with, exec_properties, expression, features, licenses, opts, package_metadata, restricted_to, scope, strict, tags, target_compatible_with, testonly, visibility)+ + +
+ genquery() runs a query specified in the
+ Bazel query language and dumps the result
+ into a file.
+
+ In order to keep the build consistent, the query is allowed only to visit
+ the transitive closure of the targets specified in the scope
+ attribute. Queries violating this rule will fail during execution if
+ strict is unspecified or true (if strict is false,
+ the out of scope targets will simply be skipped with a warning). The
+ easiest way to make sure this does not happen is to mention the same labels
+ in the scope as in the query expression.
+
+ The only difference between the queries allowed here and on the command
+ line is that queries containing wildcard target specifications (e.g.
+ //pkg:* or //pkg:all) are not allowed here.
+ The reasons for this are two-fold: first, because genquery has
+ to specify a scope to prevent targets outside the transitive closure of the
+ query to influence its output; and, second, because BUILD files
+ do not support wildcard dependencies (e.g. deps=["//a/..."]
+ is not allowed).
+
+ The genquery's output is ordered lexicographically in order to enforce deterministic output,
+ with the exception of --output=graph|minrank|maxrank or when somepath
+ is used as the top-level function.
+
+ The name of the output file is the name of the rule. +
+ ++ This example writes the list of the labels in the transitive closure of the + specified target to a file. +
+ ++genquery( + name = "kiwi-deps", + expression = "deps(//kiwi:kiwi_lib)", + scope = ["//kiwi:kiwi_lib"], +) ++ + + +
| Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ compressed_output
+ |
+
+ Boolean; default is True, query output is written in GZIP file format. This setting can be used
+ to avoid spikes in Bazel's memory use when the query output is expected to be large. Bazel
+ already internally compresses query outputs greater than 220 bytes regardless of
+ the value of this setting, so setting this to True may not reduce retained
+ heap. However, it allows Bazel to skip decompression when writing the output file,
+ which can be memory-intensive.
+
+ |
+
+ expression
+ |
+
+ String; required + The query to be executed. In contrast to the command line and other places in BUILD files, + labels here are resolved relative to the root directory of the workspace. For example, the + label:b in this attribute in the file a/BUILD will refer to the
+ target //:b.
+
+ |
+
+ opts
+ |
+
+ List of strings; default is bazel query. Some query options are not allowed
+ here: --keep_going, --query_file, --universe_scope,
+ --order_results and --order_output. Options not specified here
+ will have their default values just like on the command line of bazel query.
+
+ |
+
+ scope
+ |
+
+ List of labels; required + The scope of the query. The query is not allowed to touch targets outside the transitive + closure of these targets. + + |
+
+ strict
+ |
+
+ Boolean; default is |
+
genrule(name, srcs, outs, aspect_hints, cmd, cmd_bash, cmd_bat, cmd_ps, compatible_with, deprecation, exec_compatible_with, exec_group_compatible_with, exec_properties, executable, features, licenses, local, message, output_licenses, output_to_bindir, package_metadata, restricted_to, tags, target_compatible_with, testonly, toolchains, tools, visibility)+ + +
A genrule generates one or more files using a user-defined Bash command.
+ Genrules are generic build rules that you can use if there's no specific rule for the task.
+ For example, you could run a Bash one-liner. If however you need to compile C++ files, stick
+ to the existing cc_* rules, because all the heavy lifting has already been done
+ for you.
+
+ Note that genrule requires a shell to interpret the command argument. + It is also easy to reference arbitrary programs available on the PATH, however this makes the + command non-hermetic and may not be reproducible. + If you only need to run a single tool, consider using + run_binary + instead. +
+
+ Like every other action, the action created by genrules should not assume anything about their
+ working directory; all Bazel guarantees is that their declared inputs will be available at the
+ path that $(location) returns for their label. For example, if the action is run in a
+ sandbox or remotely, the implementation of the sandbox or the remote execution will determine the
+ working directory. If run directly (using the standalone strategy), the working
+ directory will be the execution root, i.e. the result of bazel info execution_root.
+
+ Do not use a genrule for running tests. There are special dispensations for tests and test
+ results, including caching policies and environment variables. Tests generally need to be run
+ after the build is complete and on the target architecture, whereas genrules are executed during
+ the build and on the exec architecture (the two may be different). If you need a general purpose
+ testing rule, use sh_test.
+
+ See the user manual for more info about + cross-compilation. +
++ While genrules run during a build, their outputs are often used after the build, for deployment or + testing. Consider the example of compiling C code for a microcontroller: the compiler accepts C + source files and generates code that runs on a microcontroller. The generated code obviously + cannot run on the CPU that was used for building it, but the C compiler (if compiled from source) + itself has to. +
++ The build system uses the exec configuration to describe the machine(s) on which the build runs + and the target configuration to describe the machine(s) on which the output of the build is + supposed to run. It provides options to configure each of these and it segregates the + corresponding files into separate directories to avoid conflicts. +
+
+ For genrules, the build system ensures that dependencies are built appropriately:
+ srcs are built (if necessary) for the target configuration,
+ tools are built for the exec configuration, and the output is considered to
+ be for the target configuration. It also provides
+ "Make" variables that genrule commands can pass to the corresponding tools.
+
+ It is intentional that genrule defines no deps attribute: other built-in rules use
+ language-dependent meta information passed between the rules to automatically determine how to
+ handle dependent rules, but this level of automation is not possible for genrules. Genrules work
+ purely at the file and runfiles level.
+
+ Exec-exec compilation: in some cases, the build system needs to run genrules such that the
+ output can also be executed during the build. If for example a genrule builds some custom compiler
+ which is subsequently used by another genrule, the first one has to produce its output for the
+ exec configuration, because that's where the compiler will run in the other genrule. In this case,
+ the build system does the right thing automatically: it builds the srcs and
+ outs of the first genrule for the exec configuration instead of the target
+ configuration. See the user manual for more
+ info.
+
+ JDK & C++ Tooling: to use a tool from the JDK or the C++ compiler suite, the build system + provides a set of variables to use. See "Make" variable for + details. +
+ +
+ The genrule command is executed by a Bash shell that is configured to fail when a command
+ or a pipeline fails, using set -e -o pipefail.
+
+ The build tool executes the Bash command in a sanitized process environment that
+ defines only core variables such as PATH, PWD,
+ TMPDIR, and a few others.
+
+ To ensure that builds are reproducible, most variables defined in the user's shell
+ environment are not passed though to the genrule's command. However, Bazel (but not
+ Blaze) passes through the value of the user's PATH environment variable.
+
+ Any change to the value of PATH will cause Bazel to re-execute the command
+ on the next build.
+
+
+ A genrule command should not access the network except to connect processes that are + children of the command itself, though this is not currently enforced. +
++ The build system automatically deletes any existing output files, but creates any necessary parent + directories before it runs a genrule. It also removes any output files in case of a failure. +
+ +$(location) extensively, for outputs, tools and sources. Due to the
+ segregation of output files for different configurations, genrules cannot rely on hard-coded
+ and/or absolute paths.$$ evaluates to a $, a literal dollar-sign, so in order to invoke a
+ shell command containing dollar-signs such as ls $(dirname $x), one must escape it
+ thus: ls $$(dirname $$x).srcs will avoid
+ unintentionally picking up other outputs of the genrule, but can be tedious if the genrule
+ produces many outputs.
+ This example generates foo.h. There are no sources, because the command doesn't take
+ any input. The "binary" run by the command is a perl script in the same package as the genrule.
+
+genrule( + name = "foo", + srcs = [], + outs = ["foo.h"], + cmd = "./$(location create_foo.pl) > \"$@\"", + tools = ["create_foo.pl"], +) ++ +
+ The following example shows how to use a filegroup
+ and the outputs of another genrule. Note that using $(SRCS) instead
+ of explicit $(location) directives would also work; this example uses the latter for
+ sake of demonstration.
+
+genrule( + name = "concat_all_files", + srcs = [ + "//some:files", # a filegroup with multiple files in it ==> $(locations) + "//other:gen", # a genrule with a single output ==> $(location) + ], + outs = ["concatenated.txt"], + cmd = "cat $(locations //some:files) $(location //other:gen) > $@", +) ++ + + +
| Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. +You may refer to this rule by name in the + srcs or deps section of other BUILD
+ rules. If the rule generates source files, you should use the
+ srcs attribute.
+
+ |
+
+ srcs
+ |
+
+ List of labels; default is
+ This attributes is not suitable to list tools executed by the
+ The build system ensures these prerequisites are built before running the genrule
+ command; they are built using the same configuration as the original build request. The
+ names of the files of these prerequisites are available to the command as a
+ space-separated list in |
+
+ outs
+ |
+
+ List of filenames; nonconfigurable; required + A list of files generated by this rule. ++ Output files must not cross package boundaries. + Output filenames are interpreted as relative to the package. + +
+ If the
+ The genrule command is expected to create each output file at a predetermined location.
+ The location is available in |
+
+ cmd
+ |
+
+ String; default is $(location)
+ and "Make" variable substitution.
+
cmd_bash, cmd_ps and cmd_bat,
+ if none of them are applicable.
+
+
+ If the command line length exceeds the platform limit (64K on Linux/macOS, 8K on Windows),
+ then genrule will write the command to a script and execute that script to work around. This
+ applies to all cmd attributes ( |
+
+ cmd_bash
+ |
+
+ String; default is This attribute has higher priority than |
+
+ cmd_bat
+ |
+
+ String; default is This attribute has higher priority than
|
+
+ cmd_ps
+ |
+
+ String; default is This attribute has higher priority than
To make Powershell easier to use and less error-prone, we run the following + commands to set up the environment before executing Powershell command in genrule. + +
|
+
+ executable
+ |
+
+ Boolean; nonconfigurable; default is
+ Setting this flag to True means the output is an executable file and can be run using the
+ Declaring data dependencies for the generated executable is not supported. + + |
+
+ local
+ |
+
+ Boolean; default is
+ If set to True, this option forces this
+ This is equivalent to providing 'local' as a tag ( |
+
+ message
+ |
+
+ String; default is
+ A progress message that will be printed as this build step is executed. By default, the
+ message is "Generating output" (or something equally bland) but you may provide a
+ more specific one. Use this attribute instead of |
+
+ output_licenses
+ |
+
+ List of strings; default is common attributes
+
+
+ |
+
+ output_to_bindir
+ |
+
+ Boolean; nonconfigurable; default is
+ If set to True, this option causes output files to be written into the |
+
+ toolchains
+ |
+
+ List of labels; nonconfigurable; default is
+ The set of targets whose Make variables this genrule
+ is allowed to access, or the
+ Toolchains accessed via |
+
+ tools
+ |
+
+ List of labels; default is +
+ The build system ensures these prerequisites are built before running the genrule command;
+ they are built using the exec
+ configuration, since these tools are executed as part of the build. The path of an
+ individual
+ Any |
+
starlark_doc_extract(name, deps, src, data, allow_unused_doc_comments, aspect_hints, compatible_with, deprecation, exec_compatible_with, exec_group_compatible_with, exec_properties, features, licenses, package_metadata, render_main_repo_name, restricted_to, symbol_names, tags, target_compatible_with, testonly, visibility)+ + +
starlark_doc_extract() extracts documentation for rules, functions (including
+macros), aspects, and providers defined or re-exported in a given .bzl or
+.scl file. The output of this rule is a ModuleInfo binary proto as defined
+in
+stardoc_output.proto
+in the Bazel source tree.
+
+
name.binaryproto (the default output): A
+ ModuleInfo binary proto.name.textproto (only built if explicitly requested): the text
+ proto version of name.binaryproto.Warning: the output format of this rule is not guaranteed to be stable. It is intended mainly for +internal use by Stardoc. + + + +
| Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ deps
+ |
+
+ List of labels; default is load()-ed by
+ src. These targets should under normal usage be
+ bzl_library
+ targets, but the starlark_doc_extract rule does not enforce that, and accepts
+ any target which provides Starlark files in its DefaultInfo.
+
+ Note that the wrapped Starlark files must be files in the source tree; Bazel cannot
+ |
+
+ src
+ |
+
+ Label; required + A Starlark file from which to extract documentation. + +Note that this must be a file in the source tree; Bazel cannot |
+
+ allow_unused_doc_comments
+ |
+
+ Boolean; default is #:)
+ which are not attached to any global variable, or which are attached to a variable whose
+ value's documentation should be provided in a different way (for example, in a docstring for
+ a function, or via rule(doc = ...) for a rule).
+
+ |
+
+ render_main_repo_name
+ |
+
+ Boolean; default is //foo:bar.bzl will be emitted as
+ @main_repo_name//foo:bar.bzl).
+ The name to use for the main repository is obtained from This attribute should be set to |
+
+ symbol_names
+ |
+
+ List of strings; default is
|
+
test_suite(name, aspect_hints, compatible_with, deprecation, features, licenses, package_metadata, restricted_to, tags, target_compatible_with, testonly, tests, visibility)+ + +
+A test_suite defines a set of tests that are considered "useful" to humans. This
+allows projects to define sets of tests, such as "tests you must run before checkin", "our
+project's stress tests" or "all small tests." The bazel test command respects this sort
+of organization: For an invocation like bazel test //some/test:suite, Bazel first
+enumerates all test targets transitively included by the //some/test:suite target (we
+call this "test_suite expansion"), then Bazel builds and tests those targets.
+
A test suite to run all of the small tests in the current package.
++test_suite( + name = "small_tests", + tags = ["small"], +) ++ +
A test suite that runs a specified set of tests:
+ ++test_suite( + name = "smoke_tests", + tests = [ + "system_unittest", + "public_api_unittest", + ], +) ++ +
A test suite to run all tests in the current package which are not flaky.
++test_suite( + name = "non_flaky_test", + tags = ["-flaky"], +) ++ + + +
| Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ tags
+ |
+
+ List of strings; nonconfigurable; default is + Tags which begin with a "-" character are considered negative tags. The + preceding "-" character is not considered part of the tag, so a suite tag + of "-small" matches a test's "small" size. All other tags are considered + positive tags. + ++ Optionally, to make positive tags more explicit, tags may also begin with the + "+" character, which will not be evaluated as part of the text of the tag. It + merely makes the positive and negative distinction easier to read. + ++ Only test rules that match all of the positive tags and none of the negative + tags will be included in the test suite. Note that this does not mean that error checking + for dependencies on tests that are filtered out is skipped; the dependencies on skipped + tests still need to be legal (e.g. not blocked by visibility constraints). + +
+ The
+ Note that a test's
+ If you need a |
+
+ tests
+ |
+
+ List of labels; nonconfigurable; default is
+ Any
+ If the |
+
java_binary(name, deps, srcs, data, resources, add_exports, add_opens, args, aspect_hints, bootclasspath, classpath_resources, compatible_with, create_executable, deploy_env, deploy_manifest_lines, deprecation, env, exec_compatible_with, exec_group_compatible_with, exec_properties, features, javacopts, jvm_flags, launcher, licenses, main_class, neverlink, output_licenses, package_metadata, plugins, resource_strip_prefix, restricted_to, runtime_deps, stamp, tags, target_compatible_with, testonly, toolchains, use_launcher, use_testrunner, visibility)+ +
+ Builds a Java archive ("jar file"), plus a wrapper shell script with the same name as the rule.
+ The wrapper shell script uses a classpath that includes, among other things, a jar file for each
+ library on which the binary depends. When running the wrapper shell script, any nonempty
+ JAVABIN environment variable will take precedence over the version specified via
+ Bazel's --java_runtime_version flag.
+
+ The wrapper script accepts several unique flags. Refer to
+ java_stub_template.txt
+ for a list of configurable flags and environment variables accepted by the wrapper.
+
name.jar: A Java archive, containing the class files and other
+ resources corresponding to the binary's direct dependencies.name-src.jar: An archive containing the sources ("source
+ jar").name_deploy.jar: A Java archive suitable for deployment (only
+ built if explicitly requested).
+
+ Building the <name>_deploy.jar target for your rule
+ creates a self-contained jar file with a manifest that allows it to be run with the
+ java -jar command or with the wrapper script's --singlejar
+ option. Using the wrapper script is preferred to java -jar because it
+ also passes the JVM flags and the options
+ to load native libraries.
+
+ The deploy jar contains all the classes that would be found by a classloader that + searched the classpath from the binary's wrapper script from beginning to end. It also + contains the native libraries needed for dependencies. These are automatically loaded + into the JVM at runtime. +
+If your target specifies a launcher + attribute, then instead of being a normal JAR file, the _deploy.jar will be a + native binary. This will contain the launcher plus any native (C++) dependencies of + your rule, all linked into a static binary. The actual jar file's bytes will be + appended to that native binary, creating a single binary blob containing both the + executable and the Java code. You can execute the resulting jar file directly + like you would execute any native binary.
+name_deploy-src.jar: An archive containing the sources
+ collected from the transitive closure of the target. These will match the classes in the
+ deploy.jar except where jars have no matching source jar.
+It is good practice to use the name of the source file that is the main entry point of the
+application (minus the extension). For example, if your entry point is called
+Main.java, then your name could be Main.
+
+ A deps attribute is not allowed in a java_binary rule without
+ srcs; such a rule requires a
+ main_class provided by
+ runtime_deps.
+
The following code snippet illustrates a common mistake:
+ +
+
+java_binary(
+ name = "DontDoThis",
+ srcs = [
+ ...,
+ "GeneratedJavaFile.java", # a generated .java file
+ ],
+ deps = [":generating_rule",], # rule that generates that file
+)
+
+
+
+Do this instead:
+ +
+
+java_binary(
+ name = "DoThisInstead",
+ srcs = [
+ ...,
+ ":generating_rule",
+ ],
+)
+
+
+
+ | Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ deps
+ |
+
+ List of labels; default is deps at
+Typical attributes defined by
+most build rules.
+ |
+
+ srcs
+ |
+
+ List of labels; default is
+Source files of type
+Source files of type
+Rules: if the rule (typically
+This argument is almost always required, except if a
+ |
+
+ data
+ |
+
+ List of labels; default is data
+at Typical attributes defined by
+most build rules.
+ |
+
+ resources
+ |
+
+ List of labels; default is +Resources may be source files or generated files. + + +
+If resources are specified, they will be bundled in the jar along with the usual
+ |
+
+ add_exports
+ |
+
+ List of strings; default is module or package.
++This corresponds to the javac and JVM --add-exports= flags. + |
+
+ add_opens
+ |
+
+ List of strings; default is module or
+package.
++This corresponds to the javac and JVM --add-opens= flags. + |
+
+ bootclasspath
+ |
+
+ Label; default is |
+
+ classpath_resources
+ |
+
+ List of labels; default is
+A list of resources that must be located at the root of the java tree. This attribute's
+only purpose is to support third-party libraries that require that their resources be
+found on the classpath as exactly |
+
+ create_executable
+ |
+
+ Boolean; default is java_single_jar instead.
+ |
+
+ deploy_env
+ |
+
+ List of labels; default is java_binary targets which represent the deployment
+environment for this binary.
+Set this attribute when building a plugin which will be loaded by another
+java_binary.Setting this attribute excludes all dependencies from +the runtime classpath (and the deploy jar) of this binary that are shared between this +binary and the targets specified in deploy_env.
+ |
+
+ deploy_manifest_lines
+ |
+
+ List of strings; default is META-INF/manifest.mf file generated for the
+*_deploy.jar target. The contents of this attribute are not subject
+to "Make variable" substitution.
+ |
+
+ javacopts
+ |
+
+ List of strings; default is These compiler options are passed to javac after the global compiler options. + |
+
+ jvm_flags
+ |
+
+ List of strings; default is The wrapper script for a Java binary includes a CLASSPATH definition
+(to find all the dependent jars) and invokes the right Java interpreter.
+The command line generated by the wrapper script includes the name of
+the main class followed by a Note that this attribute has no effect on |
+
+ launcher
+ |
+
+ Label; default is bin/java program included with the JDK.
+The target must be a cc_binary. Any cc_binary that
+implements the
+
+Java Invocation API can be specified as a value for this attribute.
+
+By default, Bazel will use the normal JDK launcher (bin/java or java.exe). + +The related Note that your native (C++, SWIG, JNI) dependencies will be built differently +depending on whether you are using the JDK launcher or another launcher: + +
When using any launcher other than the default JDK launcher, the format
+of the |
+
+ main_class
+ |
+
+ String; default is main() method to use as entry point.
+If a rule uses this option, it does not need a srcs=[...] list.
+Thus, with this attribute one can make an executable from a Java library that already
+contains one or more main() methods.
+
+The value of this attribute is a class name, not a source file. The class must be
+available at runtime: it may be compiled by this rule (from |
+
+ neverlink
+ |
+
+ Boolean; default is |
+
+ plugins
+ |
+
+ List of labels; default is java_plugin specified in this attribute will be run whenever this rule
+is built. A library may also inherit plugins from dependencies that use
+exported_plugins. Resources
+generated by the plugin will be included in the resulting jar of this rule.
+ |
+
+ resource_strip_prefix
+ |
+
+ String; default is
+If specified, this path prefix is stripped from every file in the |
+
+ runtime_deps
+ |
+
+ List of labels; default is deps, these will appear on the runtime classpath, but unlike
+them, not on the compile-time classpath. Dependencies needed only at runtime should be
+listed here. Dependency-analysis tools should ignore targets that appear in both
+runtime_deps and deps.
+ |
+
+ stamp
+ |
+
+ Integer; default is
Stamped binaries are not rebuilt unless their dependencies change. + |
+
+ use_launcher
+ |
+
+ Boolean; default is If this attribute is set to false, the
+launcher attribute and the related
+ |
+
+ use_testrunner
+ |
+
+ Boolean; default is com.google.testing.junit.runner.BazelTestRunner) class as the
+main entry point for a Java program, and provide the test class
+to the test runner as a value of bazel.test_suite
+system property.
+
++You can use this to override the default +behavior, which is to use test runner for + java_test rules,
+and not use it for java_binary rules. It is unlikely
+you will want to do this. One use is for AllTest
+rules that are invoked by another rule (to set up a database
+before running the tests, for example). The AllTest
+rule must be declared as a java_binary, but should
+still use the test runner as its main entry point.
+
+The name of a test runner class can be overridden with main_class attribute.
+ |
+
java_import(name, deps, data, add_exports, add_opens, aspect_hints, compatible_with, constraints, deprecation, exec_compatible_with, exec_group_compatible_with, exec_properties, exports, features, jars, licenses, neverlink, package_metadata, proguard_specs, restricted_to, runtime_deps, srcjar, tags, target_compatible_with, testonly, toolchains, visibility)+ +
+ This rule allows the use of precompiled .jar files as
+ libraries for java_library and
+ java_binary rules.
+
+
+ java_import(
+ name = "maven_model",
+ jars = [
+ "maven_model/maven-aether-provider-3.2.3.jar",
+ "maven_model/maven-model-3.2.3.jar",
+ "maven_model/maven-model-builder-3.2.3.jar",
+ ],
+ )
+
+
+
+ | Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ deps
+ |
+
+ List of labels; default is |
+
+ data
+ |
+
+ List of labels; default is |
+
+ add_exports
+ |
+
+ List of strings; default is module or package.
++This corresponds to the javac and JVM --add-exports= flags. + |
+
+ add_opens
+ |
+
+ List of strings; default is module or
+package.
++This corresponds to the javac and JVM --add-opens= flags. + |
+
+ constraints
+ |
+
+ List of strings; default is |
+
+ exports
+ |
+
+ List of labels; default is |
+
+ jars
+ |
+
+ List of labels; required + The list of JAR files provided to Java targets that depend on this target. + |
+
+ neverlink
+ |
+
+ Boolean; default is tools.jar for anything running on
+a standard JDK.
+ |
+
+ proguard_specs
+ |
+
+ List of labels; default is android_binary target depending on this library.
+
+The files included here must only have idempotent rules, namely -dontnote, -dontwarn,
+assumenosideeffects, and rules that start with -keep. Other options can only appear in
+android_binary's proguard_specs, to ensure non-tautological merges.
+ |
+
+ runtime_deps
+ |
+
+ List of labels; default is |
+
+ srcjar
+ |
+
+ Label; default is |
+
java_library(name, deps, srcs, data, resources, add_exports, add_opens, aspect_hints, bootclasspath, compatible_with, deprecation, exec_compatible_with, exec_group_compatible_with, exec_properties, exported_plugins, exports, features, javabuilder_jvm_flags, javacopts, licenses, neverlink, package_metadata, plugins, proguard_specs, resource_strip_prefix, restricted_to, runtime_deps, tags, target_compatible_with, testonly, toolchains, visibility)+ +
This rule compiles and links sources into a .jar file.
libname.jar: A Java archive containing the class files.libname-src.jar: An archive containing the sources ("source
+ jar").| Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ deps
+ |
+
+ List of labels; default is deps at
+Typical attributes defined by
+most build rules.
+
+ The jars built by
+ By contrast, targets in the |
+
+ srcs
+ |
+
+ List of labels; default is
+Source files of type
+Source files of type
+Rules: if the rule (typically
+Source files of type All other files are ignored, as long as there is at least one file of a +file type described above. Otherwise an error is raised. + +
+This argument is almost always required, except if you specify the |
+
+ data
+ |
+
+ List of labels; default is data at
+Typical attributes defined by
+most build rules.
+
+ When building a |
+
+ resources
+ |
+
+ List of labels; default is +Resources may be source files or generated files. + + +
+If resources are specified, they will be bundled in the jar along with the usual
+ |
+
+ add_exports
+ |
+
+ List of strings; default is module or package.
++This corresponds to the javac and JVM --add-exports= flags. + |
+
+ add_opens
+ |
+
+ List of strings; default is module or
+package.
++This corresponds to the javac and JVM --add-opens= flags. + |
+
+ bootclasspath
+ |
+
+ Label; default is |
+
+ exported_plugins
+ |
+
+ List of labels; default is java_plugins (e.g. annotation
+processors) to export to libraries that directly depend on this library.
+
+ The specified list of |
+
+ exports
+ |
+
+ List of labels; default is
+ Listing rules here will make them available to parent rules, as if the parents explicitly
+ depended on these rules. This is not true for regular (non-exported)
+ Summary: a rule X can access the code in Y if there exists a dependency
+ path between them that begins with a
+ Assume A depends on B and B depends on C. In this case
+ C is a transitive dependency of A, so changing C's sources and rebuilding A will
+ correctly rebuild everything. However A will not be able to use classes in C. To allow
+ that, either A has to declare C in its + The closure of exported libraries is available to all direct parent rules. Take a slightly + different example: A depends on B, B depends on C and D, and also exports C but not D. + Now A has access to C but not to D. Now, if C and D exported some libraries, C' and D' + respectively, A could only access C' but not D'. + +
+ Important: an exported rule is not a regular dependency. Sticking to the previous example,
+ if B exports C and wants to also use C, it has to also list it in its own
+ |
+
+ javabuilder_jvm_flags
+ |
+
+ List of strings; default is |
+
+ javacopts
+ |
+
+ List of strings; default is These compiler options are passed to javac after the global compiler options. + |
+
+ neverlink
+ |
+
+ Boolean; default is tools.jar for anything
+running on a standard JDK.
+
+ Note that + If the runtime library differs from the compilation library then you must ensure that it + differs only in places that the JLS forbids compilers to inline (and that must hold for + all future versions of the JLS). + + |
+
+ plugins
+ |
+
+ List of labels; default is java_plugin specified in this attribute will be run whenever this rule
+is built. A library may also inherit plugins from dependencies that use
+exported_plugins. Resources
+generated by the plugin will be included in the resulting jar of this rule.
+ |
+
+ proguard_specs
+ |
+
+ List of labels; default is android_binary target depending on this library.
+
+The files included here must only have idempotent rules, namely -dontnote, -dontwarn,
+assumenosideeffects, and rules that start with -keep. Other options can only appear in
+android_binary's proguard_specs, to ensure non-tautological merges.
+ |
+
+ resource_strip_prefix
+ |
+
+ String; default is
+If specified, this path prefix is stripped from every file in the |
+
+ runtime_deps
+ |
+
+ List of labels; default is deps, these will appear on the runtime classpath, but unlike
+them, not on the compile-time classpath. Dependencies needed only at runtime should be
+listed here. Dependency-analysis tools should ignore targets that appear in both
+runtime_deps and deps.
+ |
+
java_test(name, deps, srcs, data, resources, add_exports, add_opens, args, aspect_hints, bootclasspath, classpath_resources, compatible_with, create_executable, deploy_manifest_lines, deprecation, env, env_inherit, exec_compatible_with, exec_group_compatible_with, exec_properties, features, flaky, javacopts, jvm_flags, launcher, licenses, local, main_class, neverlink, package_metadata, plugins, resource_strip_prefix, restricted_to, runtime_deps, shard_count, size, stamp, tags, target_compatible_with, test_class, testonly, timeout, toolchains, use_launcher, use_testrunner, visibility)+ +
+A java_test() rule compiles a Java test. A test is a binary wrapper around your
+test code. The test runner's main method is invoked instead of the main class being compiled.
+
name.jar: A Java archive.name_deploy.jar: A Java archive suitable
+ for deployment. (Only built if explicitly requested.) See the description of the
+ name_deploy.jar output from
+ java_binary for more details.
+See the section on java_binary() arguments. This rule also
+supports all attributes common
+to all test rules (*_test).
+
+
+
+java_library(
+ name = "tests",
+ srcs = glob(["*.java"]),
+ deps = [
+ "//java/com/foo/base:testResources",
+ "//java/com/foo/testing/util",
+ ],
+)
+
+java_test(
+ name = "AllTests",
+ size = "small",
+ runtime_deps = [
+ ":tests",
+ "//util/mysql",
+ ],
+)
+
+
+
+ | Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ deps
+ |
+
+ List of labels; default is deps at
+Typical attributes defined by
+most build rules.
+ |
+
+ srcs
+ |
+
+ List of labels; default is
+Source files of type
+Source files of type
+Rules: if the rule (typically
+This argument is almost always required, except if a
+ |
+
+ data
+ |
+
+ List of labels; default is data
+at Typical attributes defined by
+most build rules.
+ |
+
+ resources
+ |
+
+ List of labels; default is +Resources may be source files or generated files. + + +
+If resources are specified, they will be bundled in the jar along with the usual
+ |
+
+ add_exports
+ |
+
+ List of strings; default is module or package.
++This corresponds to the javac and JVM --add-exports= flags. + |
+
+ add_opens
+ |
+
+ List of strings; default is module or
+package.
++This corresponds to the javac and JVM --add-opens= flags. + |
+
+ bootclasspath
+ |
+
+ Label; default is |
+
+ classpath_resources
+ |
+
+ List of labels; default is
+A list of resources that must be located at the root of the java tree. This attribute's
+only purpose is to support third-party libraries that require that their resources be
+found on the classpath as exactly |
+
+ create_executable
+ |
+
+ Boolean; default is java_single_jar instead.
+ |
+
+ deploy_manifest_lines
+ |
+
+ List of strings; default is META-INF/manifest.mf file generated for the
+*_deploy.jar target. The contents of this attribute are not subject
+to "Make variable" substitution.
+ |
+
+ javacopts
+ |
+
+ List of strings; default is These compiler options are passed to javac after the global compiler options. + |
+
+ jvm_flags
+ |
+
+ List of strings; default is The wrapper script for a Java binary includes a CLASSPATH definition
+(to find all the dependent jars) and invokes the right Java interpreter.
+The command line generated by the wrapper script includes the name of
+the main class followed by a Note that this attribute has no effect on |
+
+ launcher
+ |
+
+ Label; default is bin/java program included with the JDK.
+The target must be a cc_binary. Any cc_binary that
+implements the
+
+Java Invocation API can be specified as a value for this attribute.
+
+By default, Bazel will use the normal JDK launcher (bin/java or java.exe). + +The related Note that your native (C++, SWIG, JNI) dependencies will be built differently +depending on whether you are using the JDK launcher or another launcher: + +
When using any launcher other than the default JDK launcher, the format
+of the |
+
+ main_class
+ |
+
+ String; default is main() method to use as entry point.
+If a rule uses this option, it does not need a srcs=[...] list.
+Thus, with this attribute one can make an executable from a Java library that already
+contains one or more main() methods.
+
+The value of this attribute is a class name, not a source file. The class must be
+available at runtime: it may be compiled by this rule (from |
+
+ neverlink
+ |
+
+ Boolean; default is |
+
+ plugins
+ |
+
+ List of labels; default is java_plugin specified in this attribute will be run whenever this rule
+is built. A library may also inherit plugins from dependencies that use
+exported_plugins. Resources
+generated by the plugin will be included in the resulting jar of this rule.
+ |
+
+ resource_strip_prefix
+ |
+
+ String; default is
+If specified, this path prefix is stripped from every file in the |
+
+ runtime_deps
+ |
+
+ List of labels; default is deps, these will appear on the runtime classpath, but unlike
+them, not on the compile-time classpath. Dependencies needed only at runtime should be
+listed here. Dependency-analysis tools should ignore targets that appear in both
+runtime_deps and deps.
+ |
+
+ stamp
+ |
+
+ Integer; default is
Stamped binaries are not rebuilt unless their dependencies change. + |
+
+ test_class
+ |
+
+ String; default is +
+ By default, if this argument is not defined then the legacy mode is used and the
+ test arguments are used instead. Set the
+ This attribute specifies the name of a Java class to be run by
+ this test. It is rare to need to set this. If this argument is omitted,
+ it will be inferred using the target's
+ For JUnit3, the test class needs to either be a subclass of
+
+ This attribute allows several |
+
+ use_launcher
+ |
+
+ Boolean; default is If this attribute is set to false, the
+launcher attribute and the related
+ |
+
+ use_testrunner
+ |
+
+ Boolean; default is com.google.testing.junit.runner.BazelTestRunner) class as the
+main entry point for a Java program, and provide the test class
+to the test runner as a value of bazel.test_suite
+system property.
+
++You can use this to override the default +behavior, which is to use test runner for + java_test rules,
+and not use it for java_binary rules. It is unlikely
+you will want to do this. One use is for AllTest
+rules that are invoked by another rule (to set up a database
+before running the tests, for example). The AllTest
+rule must be declared as a java_binary, but should
+still use the test runner as its main entry point.
+
+The name of a test runner class can be overridden with main_class attribute.
+ |
+
java_package_configuration(name, data, aspect_hints, compatible_with, deprecation, exec_compatible_with, exec_group_compatible_with, exec_properties, features, javacopts, output_licenses, package_metadata, packages, restricted_to, system, tags, target_compatible_with, testonly, toolchains, visibility)+ +
+Configuration to apply to a set of packages.
+Configurations can be added to
+java_toolchain.javacoptss.
+
+
+
+java_package_configuration(
+ name = "my_configuration",
+ packages = [":my_packages"],
+ javacopts = ["-Werror"],
+)
+
+package_group(
+ name = "my_packages",
+ packages = [
+ "//com/my/project/...",
+ "-//com/my/project/testing/...",
+ ],
+)
+
+java_toolchain(
+ ...,
+ package_configuration = [
+ ":my_configuration",
+ ]
+)
+
+
+
+
+ | Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ data
+ |
+
+ List of labels; default is |
+
+ javacopts
+ |
+
+ List of strings; default is |
+
+ output_licenses
+ |
+
+ List of strings; default is |
+
+ packages
+ |
+
+ List of labels; default is package_groups
+the configuration should be applied to.
+ |
+
+ system
+ |
+
+ Label; default is |
+
java_plugin(name, deps, srcs, data, resources, add_exports, add_opens, aspect_hints, bootclasspath, compatible_with, deprecation, exec_compatible_with, exec_group_compatible_with, exec_properties, features, generates_api, javabuilder_jvm_flags, javacopts, licenses, neverlink, output_licenses, package_metadata, plugins, processor_class, proguard_specs, resource_strip_prefix, restricted_to, tags, target_compatible_with, testonly, toolchains, visibility)+ +
+ java_plugin defines plugins for the Java compiler run by Bazel. The
+ only supported kind of plugins are annotation processors. A java_library or
+ java_binary rule can run plugins by depending on them via the plugins
+ attribute. A java_library can also automatically export plugins to libraries that
+ directly depend on it using
+ exported_plugins.
+
libname.jar: A Java archive.Arguments are a subset of (and with identical semantics to) those of
+java_library(),
+except for the addition of the processor_class and
+generates_api arguments.
| Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ deps
+ |
+
+ List of labels; default is deps at
+Typical attributes defined by
+most build rules.
+
+ The jars built by
+ By contrast, targets in the |
+
+ srcs
+ |
+
+ List of labels; default is
+Source files of type
+Source files of type
+Rules: if the rule (typically
+Source files of type All other files are ignored, as long as there is at least one file of a +file type described above. Otherwise an error is raised. + +
+This argument is almost always required, except if you specify the |
+
+ data
+ |
+
+ List of labels; default is data at
+Typical attributes defined by
+most build rules.
+
+ When building a |
+
+ resources
+ |
+
+ List of labels; default is +Resources may be source files or generated files. + + +
+If resources are specified, they will be bundled in the jar along with the usual
+ |
+
+ add_exports
+ |
+
+ List of strings; default is module or package.
++This corresponds to the javac and JVM --add-exports= flags. + |
+
+ add_opens
+ |
+
+ List of strings; default is module or
+package.
++This corresponds to the javac and JVM --add-opens= flags. + |
+
+ bootclasspath
+ |
+
+ Label; default is |
+
+ generates_api
+ |
+
+ Boolean; default is If a rule uses an API-generating annotation processor, other rules +depending on it can refer to the generated code only if their +compilation actions are scheduled after the generating rule. This +attribute instructs Bazel to introduce scheduling constraints when +--java_header_compilation is enabled. + WARNING: This attribute affects build +performance, use it only if necessary. + |
+
+ javabuilder_jvm_flags
+ |
+
+ List of strings; default is |
+
+ javacopts
+ |
+
+ List of strings; default is These compiler options are passed to javac after the global compiler options. + |
+
+ neverlink
+ |
+
+ Boolean; default is tools.jar for anything
+running on a standard JDK.
+
+ Note that + If the runtime library differs from the compilation library then you must ensure that it + differs only in places that the JLS forbids compilers to inline (and that must hold for + all future versions of the JLS). + + |
+
+ output_licenses
+ |
+
+ List of strings; default is |
+
+ plugins
+ |
+
+ List of labels; default is java_plugin specified in this attribute will be run whenever this rule
+is built. A library may also inherit plugins from dependencies that use
+exported_plugins. Resources
+generated by the plugin will be included in the resulting jar of this rule.
+ |
+
+ processor_class
+ |
+
+ String; default is |
+
+ proguard_specs
+ |
+
+ List of labels; default is android_binary target depending on this library.
+
+The files included here must only have idempotent rules, namely -dontnote, -dontwarn,
+assumenosideeffects, and rules that start with -keep. Other options can only appear in
+android_binary's proguard_specs, to ensure non-tautological merges.
+ |
+
+ resource_strip_prefix
+ |
+
+ String; default is
+If specified, this path prefix is stripped from every file in the |
+
java_runtime(name, srcs, aspect_hints, compatible_with, default_cds, deprecation, exec_compatible_with, exec_group_compatible_with, exec_properties, features, hermetic_srcs, hermetic_static_libs, java, java_home, lib_ct_sym, lib_modules, output_licenses, package_metadata, restricted_to, tags, target_compatible_with, testonly, toolchains, version, visibility)+ +
+Specifies the configuration for a Java runtime. +
+ +
+
+
+java_runtime(
+ name = "jdk-9-ea+153",
+ srcs = glob(["jdk9-ea+153/**"]),
+ java_home = "jdk9-ea+153",
+)
+
+
+
+
+ | Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ srcs
+ |
+
+ List of labels; default is |
+
+ default_cds
+ |
+
+ Label; default is java_runtime. When hermetic
+is enabled for a java_binary target the java_runtime
+default CDS is packaged in the hermetic deploy JAR.
+ |
+
+ hermetic_srcs
+ |
+
+ List of labels; default is |
+
+ hermetic_static_libs
+ |
+
+ List of labels; default is |
+
+ java
+ |
+
+ Label; default is |
+
+ java_home
+ |
+
+ String; default is srcs and java attributes must be empty.
+ |
+
+ lib_ct_sym
+ |
+
+ Label; default is --release. If not specified and
+there is exactly one file in srcs whose path ends with
+/lib/ct.sym, that file is used.
+ |
+
+ lib_modules
+ |
+
+ Label; default is |
+
+ output_licenses
+ |
+
+ List of strings; default is |
+
+ version
+ |
+
+ Integer; default is Runtime.version().feature().
+ |
+
java_single_jar(name, deps, aspect_hints, compatible_with, compress, deploy_env, deploy_manifest_lines, deprecation, exclude_build_data, exec_compatible_with, exec_group_compatible_with, exec_properties, features, multi_release, package_metadata, restricted_to, tags, target_compatible_with, testonly, toolchains, visibility)+ + Collects Java dependencies and jar files into a single jar + +`java_single_jar` collects Java dependencies and jar files into a single jar. +This is similar to java_binary with everything related to executables disabled, +and provides an alternative to the java_binary "deploy jar hack". + +## Example + +```skylark +load("//tools/build_defs/java_single_jar:java_single_jar.bzl", "java_single_jar") + +java_single_jar( + name = "my_single_jar", + deps = [ + "//java/com/google/foo", + "//java/com/google/bar", + ], +) +``` + +Outputs: + {name}.jar: A single jar containing all of the inputs. + +
| Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ deps
+ |
+
+ List of labels; default is |
+
+ compress
+ |
+
+ String; default is |
+
+ deploy_env
+ |
+
+ List of labels; default is |
+
+ deploy_manifest_lines
+ |
+
+ List of strings; default is META-INF/manifest.mf file.
+ |
+
+ exclude_build_data
+ |
+
+ Boolean; default is |
+
+ multi_release
+ |
+
+ Boolean; default is |
+
java_toolchain(name, android_lint_data, android_lint_jvm_opts, android_lint_opts, android_lint_package_configuration, android_lint_runner, aspect_hints, bootclasspath, compatible_javacopts, compatible_with, deprecation, deps_checker, exec_compatible_with, exec_group_compatible_with, exec_properties, features, forcibly_disable_header_compilation, genclass, header_compiler, header_compiler_builtin_processors, header_compiler_direct, ijar, jacocorunner, java_runtime, javabuilder, javabuilder_data, javabuilder_jvm_opts, javac_supports_multiplex_workers, javac_supports_worker_cancellation, javac_supports_worker_multiplex_sandboxing, javac_supports_workers, javacopts, jspecify_implicit_deps, jspecify_javacopts, jspecify_packages, jspecify_processor, jspecify_processor_class, jspecify_stubs, jvm_opts, licenses, misc, oneversion, oneversion_allowlist, oneversion_allowlist_for_tests, oneversion_whitelist, package_configuration, package_metadata, proguard_allowlister, reduced_classpath_incompatible_processors, restricted_to, singlejar, source_version, tags, target_compatible_with, target_version, testonly, timezone_data, toolchains, tools, turbine_data, turbine_jvm_opts, visibility, xlint)+ +
+Specifies the configuration for the Java compiler. Which toolchain to be used can be changed through +the --java_toolchain argument. Normally you should not write those kind of rules unless you want to +tune your Java compiler. +
+ +A simple example would be: +
+ +
+
+
+java_toolchain(
+ name = "toolchain",
+ source_version = "7",
+ target_version = "7",
+ bootclasspath = ["//tools/jdk:bootclasspath"],
+ xlint = [ "classfile", "divzero", "empty", "options", "path" ],
+ javacopts = [ "-g" ],
+ javabuilder = ":JavaBuilder_deploy.jar",
+)
+
+
+
+ | Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ android_lint_data
+ |
+
+ List of labels; default is |
+
+ android_lint_jvm_opts
+ |
+
+ List of strings; default is |
+
+ android_lint_opts
+ |
+
+ List of strings; default is |
+
+ android_lint_package_configuration
+ |
+
+ List of labels; default is |
+
+ android_lint_runner
+ |
+
+ Label; default is |
+
+ bootclasspath
+ |
+
+ List of labels; default is |
+
+ compatible_javacopts
+ |
+
+ null; default is |
+
+ deps_checker
+ |
+
+ Label; default is |
+
+ forcibly_disable_header_compilation
+ |
+
+ Boolean; default is |
+
+ genclass
+ |
+
+ Label; default is |
+
+ header_compiler
+ |
+
+ Label; default is |
+
+ header_compiler_builtin_processors
+ |
+
+ List of strings; default is |
+
+ header_compiler_direct
+ |
+
+ Label; default is This tool does not support annotation processing. + |
+
+ ijar
+ |
+
+ Label; default is |
+
+ jacocorunner
+ |
+
+ Label; default is |
+
+ java_runtime
+ |
+
+ Label; default is |
+
+ javabuilder
+ |
+
+ Label; default is |
+
+ javabuilder_data
+ |
+
+ List of labels; default is |
+
+ javabuilder_jvm_opts
+ |
+
+ List of strings; default is |
+
+ javac_supports_multiplex_workers
+ |
+
+ Boolean; default is |
+
+ javac_supports_worker_cancellation
+ |
+
+ Boolean; default is |
+
+ javac_supports_worker_multiplex_sandboxing
+ |
+
+ Boolean; default is |
+
+ javac_supports_workers
+ |
+
+ Boolean; default is |
+
+ javacopts
+ |
+
+ List of strings; default is |
+
+ jspecify_implicit_deps
+ |
+
+ Label; default is |
+
+ jspecify_javacopts
+ |
+
+ List of strings; default is |
+
+ jspecify_packages
+ |
+
+ List of labels; default is |
+
+ jspecify_processor
+ |
+
+ Label; default is |
+
+ jspecify_processor_class
+ |
+
+ String; default is |
+
+ jspecify_stubs
+ |
+
+ List of labels; default is |
+
+ jvm_opts
+ |
+
+ List of strings; default is |
+
+ misc
+ |
+
+ List of strings; default is |
+
+ oneversion
+ |
+
+ Label; default is |
+
+ oneversion_allowlist
+ |
+
+ Label; default is |
+
+ oneversion_allowlist_for_tests
+ |
+
+ Label; default is |
+
+ oneversion_whitelist
+ |
+
+ Label; default is |
+
+ package_configuration
+ |
+
+ List of labels; default is |
+
+ proguard_allowlister
+ |
+
+ Label; default is |
+
+ reduced_classpath_incompatible_processors
+ |
+
+ List of strings; default is |
+
+ singlejar
+ |
+
+ Label; default is |
+
+ source_version
+ |
+
+ String; default is |
+
+ target_version
+ |
+
+ String; default is |
+
+ timezone_data
+ |
+
+ Label; default is |
+
+ tools
+ |
+
+ List of labels; default is |
+
+ turbine_data
+ |
+
+ List of labels; default is |
+
+ turbine_jvm_opts
+ |
+
+ List of strings; default is |
+
+ xlint
+ |
+
+ List of strings; default is |
+
+ "Make" variables are a special class of expandable string variables available + to attributes marked as "Subject to 'Make variable' substitution". +
+ ++ These can be used, for example, to inject specific toolchain paths into + user-constructed build actions. +
+ ++ Bazel provides both predefined variables, which are available to all + targets, and custom variables, which are defined in dependency targets + and only available to targets that depend on them. +
+ ++ The reason for the term "Make" is historical: the syntax and semantics of + these variables were originally intended to match GNU + Make. +
+ +
+ Attributes marked as "Subject to 'Make variable' substitution" can
+ reference the "Make" variable FOO as follows:
+
+my_attr = "prefix $(FOO) suffix"
+
+ In other words, any substring matching $(FOO) gets expanded
+ to FOO's value. If that value is "bar", the final
+ string becomes:
+
+my_attr = "prefix bar suffix"
+
+ If FOO doesn't correspond to a variable known to the consuming
+ target, Bazel fails with an error.
+
+ "Make" variables whose names are non-letter symbols, such as
+ @, can also be referenced using only a dollar sign, without
+ the parentheses. For example:
+
+my_attr = "prefix $@ suffix"
+
+ To write $ as a string literal (i.e. to prevent variable
+ expansion), write $$.
+
+ Predefined "Make" variables can be referenced by any attribute marked as + "Subject to 'Make variable' substitution" on any target. +
+ ++ To see the list of these variables and their values for a given set of build + options, run +
+ +bazel info --show_make_env [build options]
+ and look at the top output lines with capital letters. +
+ ++ See an example of predefined variables.
+ +Toolchain option variables
+ +COMPILATION_MODE:
+ fastbuild, dbg, or opt. (more
+ details)
+ Path variables
+ +
+ BINDIR: The base of the generated binary tree for the target
+ architecture.
+
+ Note that a different tree may be used for programs that run during the + build on the host architecture, to support cross-compiling. +
+ +
+ If you want to run a tool from within a genrule, the
+ recommended way to get its path is $(execpath toolname),
+ where toolname must be listed in the genrule's
+ tools attribute.
+
GENDIR:
+ The base of the generated code tree for the target architecture.
+ Machine architecture variables
+ +TARGET_CPU:
+ The target architecture's CPU, e.g. k8.
+ The following are specially available to genrule's
+ cmd attribute and are
+ generally important for making that attribute work.
+
+ See an example of predefined genrule variables.
+ +OUTS: The genrule's outs list. If you have
+ only one output file, you can also use $@.SRCS: The genrule's srcs list (or more
+ precisely: the path names of the files corresponding to labels in the
+ srcs list).
+ If you have only one source file, you can also use $<.
+ <: SRCS, if it is a single file. Else triggers
+ a build error.
+ @: OUTS, if it is a single file. Else triggers a
+ build error.
+
+ RULEDIR: The output directory of the target, that is, the
+ directory corresponding to the name of the package containing the target
+ under the genfiles or bin tree. For
+ //my/pkg:my_genrule this always ends in my/pkg,
+ even if //my/pkg:my_genrule's outputs are in subdirectories.
+
+ @D: The output directory. If
+ outs has one entry,
+ this expands to the directory containing that file. If it has multiple
+ entries, this expands to the package's root directory in the
+ genfiles tree, even if all output files are in the same
+ subdirectory!
+
+ Note: Use RULEDIR over @D because
+ RULEDIR has simpler semantics and behaves the same way
+ regardless of the number of output files.
+
+ If the genrule needs to generate temporary intermediate files (perhaps as
+ a result of using some other tool like a compiler), it should attempt to
+ write them to @D (although /tmp will also
+ be writable) and remove them before finishing.
+
+ Especially avoid writing to directories containing inputs. They may be on + read-only filesystems. Even if not, doing so would trash the source tree. +
+
+ Note: If the filenames corresponding to the input labels or the output
+ filenames contain spaces, ', or other special characters (or your
+ genrule is part of a Starlark macro which downstream users may invoke on such
+ files), then $(SRCS) and $(OUTS) are not suitable
+ for interpolation into a command line, as they do not have the semantics that
+ "${@}" would in Bash.
+
One workaround is to convert to a Bash array, with +
mapfile SRCS <<< "$$(sed -e 's/ /\\n/g' <<'genrule_srcs_expansion'
+$(SRC)
+genrule_srcs_expansion
+)
+and then use "$$\{SRCS[@]}" in subsequent command lines in place
+of $(SRCS). A more robust option is to write a Starlark rule
+instead.
+
+
+
+
+ The predefined variables execpath, execpaths,
+ rootpath, rootpaths, location, and
+ locations take label parameters (e.g. $(execpath
+ //foo:bar)) and substitute the file paths denoted by that label.
+
+ + For source files, this is the path relative to your workspace root. + For files that are outputs of rules, this is the file's output path + (see the explanation of output files below). +
+ ++ See an example of predefined path variables.
+ +
+ execpath: Denotes the path beneath the
+
+ execroot
+ where Bazel runs build actions.
+
+ In the above example, Bazel runs all build actions in the directory linked
+ by the bazel-myproject symlink in your workspace root. The
+ source file empty.source is linked at the path
+ bazel-myproject/testapp/empty.source. So its exec path (which
+ is the subpath below the root) is testapp/empty.source. This
+ is the path build actions can use to find the file.
+
+ Output files are staged similarly, but are also prefixed with the subpath
+ bazel-out/cpu-compilation_mode/bin (or for the outputs of
+ tools: bazel-out/cpu-opt-exec-hash/bin). In the above example,
+ //testapp:app is a tool because it appears in
+ show_app_output's tools attribute.
+ So its output file app is written to
+ bazel-myproject/bazel-out/cpu-opt-exec-hash/bin/testapp/app.
+ The exec path is thus
+ bazel-out/cpu-opt-exec-hash/bin/testapp/app. This extra prefix
+ makes it possible to build the same target for, say, two different CPUs in
+ the same build without the results clobbering each other.
+
+ The label passed to this variable must represent exactly one file. For + labels representing source files, this is automatically true. For labels + representing rules, the rule must generate exactly one output. If this is + false or the label is malformed, the build fails with an error. +
+
+ rootpath: Denotes the path that a built binary can use to
+ find a dependency at runtime relative to the subdirectory of its runfiles
+ directory corresponding to the main repository.
+ Note: This only works if
+ --enable_runfiles is enabled, which is not the case on
+ Windows by default. Use rlocationpath instead for
+ cross-platform support.
+
+ This is similar to execpath but strips the configuration
+ prefixes described above. In the example from above this means both
+ empty.source and app use pure workspace-relative
+ paths: testapp/empty.source and testapp/app.
+
+ The rootpath of a file in an external repository
+ repo will start with ../repo/, followed by the
+ repository-relative path.
+
+ This has the same "one output only" requirements as execpath.
+
+ rlocationpath: The path a built binary can pass to the
+ Rlocation function of a runfiles library to find a dependency at
+ runtime, either in the runfiles directory (if available) or using the
+ runfiles manifest.
+
+ This is similar to rootpath in that it does not contain
+ configuration prefixes, but differs in that it always starts with the
+ name of the repository. In the example from above this means that
+ empty.source and app result in the following
+ paths: myproject/testapp/empty.source and
+ myproject/testapp/app.
+
+ The rlocationpath of a file in an external repository
+ repo will start with repo/, followed by the
+ repository-relative path.
+
+ Passing this path to a binary and resolving it to a file system path using
+ the runfiles libraries is the preferred approach to find dependencies at
+ runtime. Compared to rootpath, it has the advantage that it
+ works on all platforms and even if the runfiles directory is not
+ available.
+
+ This has the same "one output only" requirements as execpath.
+
location: A synonym for either execpath or
+ rootpath, depending on the attribute being expanded. This is
+ legacy pre-Starlark behavior and not recommended unless you really know what
+ it does for a particular rule. See #2475
+ for details.
+
+ execpaths, rootpaths, rlocationpaths,
+ and locations are the plural variations of execpath,
+ rootpath, rlocationpath, andlocation,
+ respectively. They support labels producing multiple outputs, in which case
+ each output is listed separated by a space. Zero-output rules and malformed
+ labels produce build errors.
+
+ All referenced labels must appear in the consuming target's srcs,
+ output files, or deps. Otherwise the build fails. C++ targets can
+ also reference labels in data.
+
+ Labels don't have to be in canonical form: foo, :foo
+ and //somepkg:foo are all fine.
+
+ Custom "Make" variables can be referenced by any attribute marked as + "Subject to 'Make variable' substitution", but only on targets that + depend on other targets that define these variables. +
+ ++ As best practice all variables should be custom unless there's a really good + reason to bake them into core Bazel. This saves Bazel from having to load + potentially expensive dependencies to supply variables consuming tarets may + not care about. +
+ +C++ toolchain variables
+
+ The following are defined in C++ toolchain rules and available to any rule
+ that sets toolchains =
+ ["@bazel_tools//tools/cpp:toolchain_type"]
+ Some rules, like java_binary, implicitly
+ include the C++ toolchain in their rule definition. They inherit these variables
+ automatically.
+
+ The built-in C++ rules are much more sophisticated than "run the compiler on + it". In order to support compilation modes as diverse as *SAN, ThinLTO, + with/without modules, and carefully optimized binaries at the same time as + fast running tests on multiple platforms, the built-in rules go to great + lengths to ensure the correct inputs, outputs, and command-line flags are set + on each of potentially multiple internally generated actions. +
+ ++ These variables are a fallback mechanism to be used by language experts in + rare cases. If you are tempted to use them, please contact the Bazel devs first. +
+ +ABI: The C++ ABI version. AR: The "ar" command from crosstool. C_COMPILER:
+ The C/C++ compiler identifier, e.g. llvm.
+ CC: The C and C++ compiler command.
+ We strongly recommended always using CC_FLAGS in
+ combination with CC. Fail to do so at your own risk.
+
CC_FLAGS: A minimal set of flags for the C/C++
+ compiler to be usable by genrules. In particular, this contains flags to
+ select the correct architecture if CC supports multiple
+ architectures.
+ DUMPBIN: Microsoft COFF Binary File Dumper (dumpbin.exe) from
+ from Microsoft Visual Studio. NM: The "nm" command from crosstool. OBJCOPY: The objcopy command from the same suite as the C/C++
+ compiler. STRIP: The strip command from the same suite as the C/C++
+ compiler.Java toolchain variables
+ +
+ The following are defined in Java toolchain rules and available to any rule
+ that sets toolchains =
+["@rules_java//toolchains:current_java_runtime"] (or
+ "@rules_java//toolchains:current_host_java_runtime"
+ for the host toolchain equivalent).
+
+ Most of the tools in the JDK should not be used directly. The built-in Java + rules use much more sophisticated approaches to Java compilation and packaging + than upstream tools can express, such as interface Jars, header interface + Jars, and highly optimized Jar packaging and merging implementations. +
+ ++ These variables are a fallback mechanism to be used by language experts in + rare cases. If you are tempted to use them, please contact the Bazel devs first. +
+ +JAVA: The "java" command (a Java virtual
+ machine). Avoid this, and use a java_binary rule
+ instead where possible. May be a relative path. If you must change
+ directories before invoking java, you need to capture the
+ working directory before changing it.
+ JAVABASE: The base directory containing the
+ Java utilities. May be a relative path. It will have a "bin"
+ subdirectory.
+ Starlark-defined variables
+ +
+ Rule and toolchain writers can define
+ completely custom variables by returning a
+ TemplateVariableInfo
+ provider. Any rules depending on these through the
+ toolchains attribute can then read their values:
+
+ See an example of Starlark-defined variables.
+ + + + + + + diff --git a/reference/be/objective-c.mdx b/reference/be/objective-c.mdx new file mode 100644 index 0000000..e1f2160 --- /dev/null +++ b/reference/be/objective-c.mdx @@ -0,0 +1,558 @@ +--- +title: 'objective-c' +--- + + + + + + + + + + + + + +objc_import(name, deps, hdrs, alwayslink, archives, aspect_hints, compatible_with, deprecation, exec_compatible_with, exec_group_compatible_with, exec_properties, features, includes, package_metadata, restricted_to, sdk_dylibs, sdk_frameworks, sdk_includes, tags, target_compatible_with, testonly, textual_hdrs, toolchains, visibility, weak_sdk_frameworks)+ +
This rule encapsulates an already-compiled static library in the form of an
+.a file. It also allows exporting headers and resources using the same
+attributes supported by objc_library.
| Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ deps
+ |
+
+ List of labels; default is |
+
+ hdrs
+ |
+
+ List of labels; default is +These headers describe the public interface for the library and will be +made available for inclusion by sources in this rule or in dependent +rules. Headers not meant to be included by a client of this library +should be listed in the srcs attribute instead. + +These will be compiled separately from the source if modules are enabled. + |
+
+ alwayslink
+ |
+
+ Boolean; default is srcs and non_arc_srcs, even if some contain no
+symbols referenced by the binary.
+This is useful if your code isn't explicitly called by code in
+the binary, e.g., if your code registers to receive some callback
+provided by some service.
+ |
+
+ archives
+ |
+
+ List of labels; required + The list of.a files provided to Objective-C targets that
+depend on this target.
+ |
+
+ includes
+ |
+
+ List of strings; default is #include/#import search paths to add to this target
+and all depending targets.
+
+This is to support third party and open-sourced libraries that do not
+specify the entire workspace path in their
+#import/#include statements.
+
+The paths are interpreted relative to the package directory, and the
+genfiles and bin roots (e.g. +Unlike COPTS, these flags are added for this rule +and every rule that depends on it. (Note: not the rules it depends upon!) Be +very careful, since this may have far-reaching effects. When in doubt, add +"-iquote" flags to COPTS instead. + |
+
+ sdk_dylibs
+ |
+
+ List of strings; default is |
+
+ sdk_frameworks
+ |
+
+ List of strings; default is When linking a top level Apple binary, all SDK frameworks listed in that binary's +transitive dependency graph are linked. + |
+
+ sdk_includes
+ |
+
+ List of strings; default is #include/#import search paths to add to this target
+and all depending targets, where each path is relative to
+$(SDKROOT)/usr/include.
+ |
+
+ textual_hdrs
+ |
+
+ List of labels; default is |
+
+ weak_sdk_frameworks
+ |
+
+ List of strings; default is |
+
objc_library(name, deps, srcs, data, hdrs, alwayslink, aspect_hints, compatible_with, conlyopts, copts, cxxopts, defines, deprecation, enable_modules, exec_compatible_with, exec_group_compatible_with, exec_properties, features, implementation_deps, includes, linkopts, module_map, module_name, non_arc_srcs, package_metadata, pch, restricted_to, sdk_dylibs, sdk_frameworks, sdk_includes, stamp, tags, target_compatible_with, testonly, textual_hdrs, toolchains, visibility, weak_sdk_frameworks)+ +
This rule produces a static library from the given Objective-C source files.
+ +| Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ deps
+ |
+
+ List of labels; default is |
+
+ srcs
+ |
+
+ List of labels; default is |
+
+ hdrs
+ |
+
+ List of labels; default is +These headers describe the public interface for the library and will be +made available for inclusion by sources in this rule or in dependent +rules. Headers not meant to be included by a client of this library +should be listed in the srcs attribute instead. + +These will be compiled separately from the source if modules are enabled. + |
+
+ alwayslink
+ |
+
+ Boolean; default is srcs and non_arc_srcs, even if some contain no
+symbols referenced by the binary.
+This is useful if your code isn't explicitly called by code in
+the binary, e.g., if your code registers to receive some callback
+provided by some service.
+ |
+
+ conlyopts
+ |
+
+ List of strings; default is +Note that for the generated Xcode project, directory paths specified using "-I" flags in +copts are parsed out, prepended with "$(WORKSPACE_ROOT)/" if they are relative paths, and +added to the header search paths for the associated Xcode target. + |
+
+ copts
+ |
+
+ List of strings; default is +Note that for the generated Xcode project, directory paths specified using "-I" flags in +copts are parsed out, prepended with "$(WORKSPACE_ROOT)/" if they are relative paths, and +added to the header search paths for the associated Xcode target. + |
+
+ cxxopts
+ |
+
+ List of strings; default is +Note that for the generated Xcode project, directory paths specified using "-I" flags in +copts are parsed out, prepended with "$(WORKSPACE_ROOT)/" if they are relative paths, and +added to the header search paths for the associated Xcode target. + |
+
+ defines
+ |
+
+ List of strings; default is -D flags to pass to the compiler. They should be in
+the form KEY=VALUE or simply KEY and are
+passed not only to the compiler for this target (as copts
+are) but also to all objc_ dependers of this target.
+Subject to "Make variable" substitution and
+Bourne shell tokenization.
+ |
+
+ enable_modules
+ |
+
+ Boolean; default is |
+
+ implementation_deps
+ |
+
+ List of labels; default is deps, the headers and include paths of these libraries (and all their
+transitive deps) are only used for compilation of this library, and not libraries that
+depend on it. Libraries specified with implementation_deps are still linked
+in binary targets that depend on this library.
+ |
+
+ includes
+ |
+
+ List of strings; default is #include/#import search paths to add to this target
+and all depending targets.
+
+This is to support third party and open-sourced libraries that do not
+specify the entire workspace path in their
+#import/#include statements.
+
+The paths are interpreted relative to the package directory, and the
+genfiles and bin roots (e.g. +Unlike COPTS, these flags are added for this rule +and every rule that depends on it. (Note: not the rules it depends upon!) Be +very careful, since this may have far-reaching effects. When in doubt, add +"-iquote" flags to COPTS instead. + |
+
+ linkopts
+ |
+
+ List of strings; default is |
+
+ module_map
+ |
+
+ Label; default is |
+
+ module_name
+ |
+
+ String; default is |
+
+ non_arc_srcs
+ |
+
+ List of labels; default is |
+
+ pch
+ |
+
+ Label; default is |
+
+ sdk_dylibs
+ |
+
+ List of strings; default is |
+
+ sdk_frameworks
+ |
+
+ List of strings; default is When linking a top level Apple binary, all SDK frameworks listed in that binary's +transitive dependency graph are linked. + |
+
+ sdk_includes
+ |
+
+ List of strings; default is #include/#import search paths to add to this target
+and all depending targets, where each path is relative to
+$(SDKROOT)/usr/include.
+ |
+
+ stamp
+ |
+
+ Boolean; default is |
+
+ textual_hdrs
+ |
+
+ List of labels; default is |
+
+ weak_sdk_frameworks
+ |
+
+ List of strings; default is |
+
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 | +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
+ + |
+ + | +
| Family | +Rules | +
|---|---|
| Extra Actions | +
+
|
+
| General | +
+
|
+
| Platforms and Toolchains | ++ + | +
+This set of rules exists to allow you to model specific hardware platforms you are +building for and specify the specific tools you may need to compile code for those platforms. +The user should be familiar with the concepts explained here. +
+ + + + +constraint_setting(name, aspect_hints, default_constraint_value, deprecation, features, licenses, tags, testonly, visibility)+ + +
This rule is used to introduce a new constraint type for which a platform may specify a value.
+For instance, you might define a constraint_setting named "glibc_version" to represent
+the capability for platforms to have different versions of the glibc library installed.
+
+For more details, see the
+Platforms page.
+
+
Each constraint_setting has an extensible set of associated
+constraint_values. Usually these are defined in the same package, but sometimes a
+different package will introduce new values for an existing setting. For instance, the predefined
+setting @platforms//cpu:cpu can be extended with a custom value in order to
+define a platform targeting an obscure cpu architecture.
+
+
+
+
| Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ default_constraint_value
+ |
+
+ Name; nonconfigurable; default is constraint_value it points to must be defined in the
+ same package as this constraint_setting.
+
+ If a constraint setting has a default value, then whenever a platform does not include
+ any constraint value for that setting, it is the same as if the platform had specified the
+ default value. Otherwise, if there is no default value, the constraint setting is considered
+ to be unspecified by that platform. In that case, the platform would not match against any
+ constraint list (such as for a |
+
constraint_value(name, aspect_hints, constraint_setting, deprecation, features, licenses, tags, testonly, visibility)+ + +This rule introduces a new value for a given constraint type. + +For more details, see the +Platforms page. + +
The following creates a new possible value for the predefined constraint_value
+representing cpu architecture.
+
+constraint_value( + name = "mips", + constraint_setting = "@platforms//cpu:cpu", +) ++ +Platforms can then declare that they have the
mips architecture as an alternative to
+x86_64, arm, and so on.
+
+
+
+ | Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ constraint_setting
+ |
+
+ Label; nonconfigurable; required + Theconstraint_setting for which this constraint_value is a
+ possible choice.
+
+ |
+
platform(name, aspect_hints, constraint_values, deprecation, exec_properties, features, flags, licenses, missing_toolchain_error, parents, remote_execution_properties, required_settings, tags, testonly, visibility)+ + +
This rule defines a new platform -- a named collection of constraint choices +(such as cpu architecture or compiler version) describing an environment in +which part of the build may run. + +For more details, see the Platforms page. + + +
+ This defines a platform that describes any environment running Linux on ARM. +
++platform( + name = "linux_arm", + constraint_values = [ + "@platforms//os:linux", + "@platforms//cpu:arm", + ], +) ++ +
+ Platforms may use the flags attribute to specify a list of flags that will be added
+ to the configuration whenever the platform is used as the target platform (i.e., as the value of
+ the --platforms flag).
+
+ Flags set from the platform effectively have the highest precedence and overwrite any previous + value for that flag, from the command line, rc file, or transition. +
+ ++platform( + name = "foo", + flags = [ + "--dynamic_mode=fully", + "--//bool_flag", + "--no//package:other_bool_flag", + ], +) ++ +
+ This defines a platform named foo. When this is the target platform (either because
+ the user specified --platforms//:foo, because a transition set the
+ //command_line_option:platforms flag to ["//:foo"], or because
+ //:foo was used as an execution platform), then the given flags will be set in the
+ configuration.
+
+ Some flags will accumulate values when they are repeated, such as --features,
+ --copt, any Starlark flag created as config.string(repeatable = True).
+ These flags are not compatible with setting the flags from the platform: instead, all previous
+ values will be removed and overwritten with the values from the platform.
+
+ As an example, given the following platform, the invocation build --platforms=//:repeat_demo
+ --features feature_a --features feature_b will end up with the value of the
+ --feature flag being ["feature_c", "feature_d"], removing the features
+ set on the command line.
+
+platform( + name = "repeat_demo", + flags = [ + "--features=feature_c", + "--features=feature_d", + ], +) ++ +
+ For this reason, it is discouraged to use repeatable flags in the flags attribute.
+
+ Platforms may use the parents attribute to specify another platform that they will
+ inherit constraint values from. Although the parents attribute takes a list, no
+ more than a single value is currently supported, and specifying multiple parents is an error.
+
+ When checking for the value of a constraint setting in a platform, first the values directly set
+ (via the constraint_values attribute) are checked, and then the constraint values on
+ the parent. This continues recursively up the chain of parent platforms. In this manner, any
+ values set directly on a platform will override the values set on the parent.
+
+ Platforms inherit the exec_properties attribute from the parent platform.
+ The dictionary entries in exec_properties of the parent and child platforms
+ will be combined.
+ If the same key appears in both the parent's and the child's exec_properties,
+ the child's value will be used. If the child platform specifies an empty string as a value, the
+ corresponding property will be unset.
+
+ Platforms can also inherit the (deprecated) remote_execution_properties attribute
+ from the parent platform. Note: new code should use exec_properties instead. The
+ logic described below is maintained to be compatible with legacy behavior but will be removed
+ in the future.
+
+ The logic for setting the remote_execution_platform is as follows when there
+ is a parent platform:
+
+
remote_execution_property is not set on the child platform, the parent's
+ remote_execution_properties will be used.
+ remote_execution_property is set on the child platform, and contains the
+ literal string {PARENT_REMOTE_EXECUTION_PROPERTIES}, that macro will be
+ replaced with the contents of the parent's remote_execution_property attribute.
+ remote_execution_property is set on the child platform, and does not contain
+ the macro, the child's remote_execution_property will be used unchanged.
+
+ Since remote_execution_properties is deprecated and will be phased out, mixing
+ remote_execution_properties and exec_properties in the same
+ inheritance chain is not allowed.
+ Prefer to use exec_properties over the deprecated
+ remote_execution_properties.
+
+platform( + name = "parent", + constraint_values = [ + "@platforms//os:linux", + "@platforms//cpu:arm", + ], +) +platform( + name = "child_a", + parents = [":parent"], + constraint_values = [ + "@platforms//cpu:x86_64", + ], +) +platform( + name = "child_b", + parents = [":parent"], +) ++ +
+ In this example, the child platforms have the following properties: + +
child_a has the constraint values @platforms//os:linux (inherited
+ from the parent) and @platforms//cpu:x86_64 (set directly on the platform).
+ child_b inherits all constraint values from the parent, and doesn't set any of
+ its own.
+
+platform(
+ name = "parent",
+ exec_properties = {
+ "k1": "v1",
+ "k2": "v2",
+ },
+)
+platform(
+ name = "child_a",
+ parents = [":parent"],
+)
+platform(
+ name = "child_b",
+ parents = [":parent"],
+ exec_properties = {
+ "k1": "child"
+ }
+)
+platform(
+ name = "child_c",
+ parents = [":parent"],
+ exec_properties = {
+ "k1": ""
+ }
+)
+platform(
+ name = "child_d",
+ parents = [":parent"],
+ exec_properties = {
+ "k3": "v3"
+ }
+)
+
+
++ In this example, the child platforms have the following properties: + +
child_a inherits the "exec_properties" of the parent and does not set its own.
+ child_b inherits the parent's exec_properties and overrides the
+ value of k1. Its exec_properties will be:
+ { "k1": "child", "k2": "v2" }.
+ child_c inherits the parent's exec_properties and unsets
+ k1. Its exec_properties will be:
+ { "k2": "v2" }.
+ child_d inherits the parent's exec_properties and adds a new
+ property. Its exec_properties will be:
+ { "k1": "v1", "k2": "v2", "k3": "v3" }.
+ | Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ constraint_values
+ |
+
+ List of labels; nonconfigurable; default is Each |
+
+ exec_properties
+ |
+
+ Dictionary: String -> String; nonconfigurable; default is exec_properties attributes.
+ If the child and parent platform define the same keys, the child's values are kept. Any
+ keys associated with a value that is an empty string are removed from the dictionary.
+
+ This attribute is a full replacement for the deprecated
+ remote_execution_properties.
+
+ |
+
+ flags
+ |
+
+ List of strings; nonconfigurable; default is --define flag.
+
+ |
+
+ missing_toolchain_error
+ |
+
+ String; nonconfigurable; default is |
+
+ parents
+ |
+
+ List of labels; nonconfigurable; default is platform target that this platform should inherit from. Although
+ the attribute takes a list, there should be no more than one platform present. Any
+ constraint_settings not set directly on this platform will be found in the parent platform.
+ See the section on Platform Inheritance for details.
+
+ |
+
+ remote_execution_properties
+ |
+
+ String; nonconfigurable; default is |
+
+ required_settings
+ |
+
+ List of labels; default is config_settings that must be satisfied by the target configuration
+ in order for this platform to be used as an execution platform during toolchain resolution.
+
+ Required settings are not inherited from parent platforms.
+
+ |
+
toolchain(name, aspect_hints, deprecation, exec_compatible_with, features, licenses, package_metadata, tags, target_compatible_with, target_settings, testonly, toolchain, toolchain_type, use_target_platform_constraints, visibility)+ + +
This rule declares a specific toolchain's type and constraints so that it can be selected +during toolchain resolution. See the +Toolchains page for more +details. + + + +
| Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ exec_compatible_with
+ |
+
+ List of labels; nonconfigurable; default is constraint_values that must be satisfied by an execution platform in
+ order for this toolchain to be selected for a target building on that platform.
+
+ |
+
+ target_compatible_with
+ |
+
+ List of labels; nonconfigurable; default is constraint_values that must be satisfied by the target platform in
+ order for this toolchain to be selected for a target building for that platform.
+
+ |
+
+ target_settings
+ |
+
+ List of labels; default is config_settings that must be satisfied by the target configuration
+ in order for this toolchain to be selected during toolchain resolution.
+
+ |
+
+ toolchain
+ |
+
+ Name; required + The target representing the actual tool or tool suite that is made available when this + toolchain is selected. + + |
+
+ toolchain_type
+ |
+
+ Label; nonconfigurable; required + The label of atoolchain_type target that represents the role that this
+ toolchain serves.
+
+ |
+
+ use_target_platform_constraints
+ |
+
+ Boolean; nonconfigurable; default is True, this toolchain behaves as if its exec_compatible_with and
+ target_compatible_with constraints are set to those of the current target
+ platform. exec_compatible_with and target_compatible_with must not
+ be set in that case.
+
+ |
+
toolchain_type(name, aspect_hints, compatible_with, deprecation, features, no_match_error, package_metadata, restricted_to, tags, target_compatible_with, testonly, visibility)+ + +
+ This rule defines a new type of toolchain -- a simple target that represents a class of tools that + serve the same role for different platforms. +
+ ++ See the Toolchains page for more details. +
+ ++ This defines a toolchain type for a custom rule. +
++toolchain_type( + name = "bar_toolchain_type", +) ++ +
+ This can be used in a bzl file. +
+
+bar_binary = rule(
+ implementation = _bar_binary_impl,
+ attrs = {
+ "srcs": attr.label_list(allow_files = True),
+ ...
+ # No `_compiler` attribute anymore.
+ },
+ toolchains = ["//bar_tools:toolchain_type"]
+)
+
+
+
+ | Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ no_match_error
+ |
+
+ String; nonconfigurable; default is |
+
cc_proto_library(name, deps, aspect_hints, compatible_with, deprecation, exec_compatible_with, exec_group_compatible_with, exec_properties, features, package_metadata, restricted_to, tags, target_compatible_with, testonly, toolchains, visibility)+ +
+cc_proto_library generates C++ code from .proto files.
+
+deps must point to proto_library
+ rules.
+
+Example: +
+ +
+
+cc_library(
+ name = "lib",
+ deps = [":foo_cc_proto"],
+)
+
+cc_proto_library(
+ name = "foo_cc_proto",
+ deps = [":foo_proto"],
+)
+
+proto_library(
+ name = "foo_proto",
+)
+
+
+
+ | Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ deps
+ |
+
+ List of labels; default is proto_library
+rules to generate C++ code for.
+ |
+
java_lite_proto_library(name, deps, aspect_hints, compatible_with, deprecation, exec_compatible_with, exec_group_compatible_with, exec_properties, features, package_metadata, restricted_to, tags, target_compatible_with, testonly, toolchains, visibility)+ +
+java_lite_proto_library generates Java code from .proto files.
+
+deps must point to proto_library
+ rules.
+
+Example: +
+ +
+
+java_library(
+ name = "lib",
+ runtime_deps = [":foo"],
+)
+
+java_lite_proto_library(
+ name = "foo",
+ deps = [":bar"],
+)
+
+proto_library(
+ name = "bar",
+)
+
+
+
+ | Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ deps
+ |
+
+ List of labels; default is proto_library
+rules to generate Java code for.
+ |
+
java_proto_library(name, deps, aspect_hints, compatible_with, deprecation, exec_compatible_with, exec_group_compatible_with, exec_properties, features, licenses, package_metadata, restricted_to, tags, target_compatible_with, testonly, toolchains, visibility)+ +
+java_proto_library generates Java code from .proto files.
+
+deps must point to proto_library
+ rules.
+
+Example: +
+ +
+
+java_library(
+ name = "lib",
+ runtime_deps = [":foo_java_proto"],
+)
+
+java_proto_library(
+ name = "foo_java_proto",
+ deps = [":foo_proto"],
+)
+
+proto_library(
+ name = "foo_proto",
+)
+
+
+
+ | Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ deps
+ |
+
+ List of labels; default is proto_library
+rules to generate Java code for.
+ |
+
proto_library(name, deps, srcs, data, allow_exports, aspect_hints, compatible_with, deprecation, exec_compatible_with, exec_group_compatible_with, exec_properties, exports, features, import_prefix, licenses, option_deps, package_metadata, restricted_to, strip_import_prefix, tags, target_compatible_with, testonly, toolchains, visibility)+ +
Use proto_library to define libraries of protocol buffers which
+may be used from multiple languages. A proto_library may be listed
+in the deps clause of supported rules, such as
+java_proto_library.
+
+
When compiled on the command-line, a proto_library creates a file
+named foo-descriptor-set.proto.bin, which is the descriptor set for
+the messages the rule srcs. The file is a serialized
+FileDescriptorSet, which is described in
+
+https://developers.google.com/protocol-buffers/docs/techniques#self-description.
+
+
It only contains information about the .proto files directly
+mentioned by a proto_library rule; the collection of transitive
+descriptor sets is available through the
+[ProtoInfo].transitive_descriptor_sets Starlark provider.
+See documentation in proto_info.bzl.
+
+
Recommended code organization: +
proto_library rule per .proto file.
+foo.proto will be in a rule named foo_proto,
+ which is located in the same package.
+[language]_proto_library that wraps a proto_library
+ named foo_proto should be called foo_[language]_proto,
+ and be located in the same package.
+| Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ deps
+ |
+
+ List of labels; default is proto_library rules that the target depends upon.
+A proto_library may only depend on other proto_library
+targets. It may not depend on language-specific libraries.
+ |
+
+ srcs
+ |
+
+ List of labels; default is .proto and .protodevel files that are
+processed to create the target. This is usually a non empty list. One usecase
+where srcs can be empty is an alias-library. This is a
+proto_library rule having one or more other proto_library in deps.
+This pattern can be used to e.g. export a public api under a persistent name.
+ |
+
+ allow_exports
+ |
+
+ Label; default is |
+
+ exports
+ |
+
+ List of labels; default is |
+
+ import_prefix
+ |
+
+ String; default is When set, the .proto source files in the The prefix in the |
+
+ option_deps
+ |
+
+ List of labels; default is proto_library rules that the target depends upon for options only.
+A proto_library may only depend on other proto_library
+targets. It may not depend on language-specific libraries.
+ |
+
+ strip_import_prefix
+ |
+
+ String; default is When set, .proto source files in the If it's a relative path (not starting with a slash), it's taken as a package-relative +one. If it's an absolute one, it's understood as a repository-relative path. + + The prefix in the |
+
py_proto_library(name, deps, aspect_hints, compatible_with, deprecation, exec_compatible_with, exec_group_compatible_with, exec_properties, features, package_metadata, restricted_to, tags, target_compatible_with, testonly, toolchains, visibility)+ + Use `py_proto_library` to generate Python libraries from `.proto` files. + + The convention is to name the `py_proto_library` rule `foo_py_pb2`, + when it is wrapping `proto_library` rule `foo_proto`. + + `deps` must point to a `proto_library` rule. + + Example: + +```starlark +py_library( + name = "lib", + deps = [":foo_py_pb2"], +) + +py_proto_library( + name = "foo_py_pb2", + deps = [":foo_proto"], +) + +proto_library( + name = "foo_proto", + srcs = ["foo.proto"], +) +``` + +
| Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ deps
+ |
+
+ List of labels; default is |
+
proto_lang_toolchain(name, allowlist_different_package, aspect_hints, blacklisted_protos, command_line, compatible_with, denylisted_protos, deprecation, exec_compatible_with, exec_group_compatible_with, exec_properties, features, mnemonic, output_files, package_metadata, plugin, plugin_format_flag, progress_message, protoc_minimal_do_not_use, restricted_to, runtime, tags, target_compatible_with, testonly, toolchain_type, toolchains, visibility)+ +
If using Bazel, please load the rule from +https://github.com/bazelbuild/rules_proto. + +
Specifies how a LANG_proto_library rule (e.g., java_proto_library) should invoke the
+proto-compiler.
+Some LANG_proto_library rules allow specifying which toolchain to use using command-line flags;
+consult their documentation.
+
+
Normally you should not write those kind of rules unless you want to +tune your Java compiler. + +
There's no compiler. The proto-compiler is taken from the proto_library rule we attach to. It is
+passed as a command-line flag to Blaze.
+Several features require a proto-compiler to be invoked on the proto_library rule itself.
+It's beneficial to enforce the compiler that LANG_proto_library uses is the same as the one
+proto_library does.
+
+
A simple example would be: +
+proto_lang_toolchain(
+ name = "javalite_toolchain",
+ command_line = "--javalite_out=shared,immutable:$(OUT)",
+ plugin = ":javalite_plugin",
+ runtime = ":protobuf_lite",
+)
+
+
+ | Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ allowlist_different_package
+ |
+
+ Label; default is |
+
+ blacklisted_protos
+ |
+
+ List of labels; default is denylisted_protos. Will be removed in a future release.
+ |
+
+ command_line
+ |
+
+ String; required + This value will be passed to proto-compiler to generate the code. Only include the parts +specific to this code-generator/plugin (e.g., do not include -I parameters) +
|
+
+ denylisted_protos
+ |
+
+ List of labels; default is srcs attribute of
+denylisted_protos.
+This is used for .proto files that are already linked into proto runtimes, such as
+any.proto.
+ |
+
+ mnemonic
+ |
+
+ String; default is |
+
+ output_files
+ |
+
+ String; default is $(OUT) in command_line is formatted, either by
+a path to a single file or output directory in case of multiple files.
+Possible values are: "single", "multiple".
+ |
+
+ plugin
+ |
+
+ Label; default is --plugin=protoc-gen-PLUGIN=<executable>.
+ |
+
+ plugin_format_flag
+ |
+
+ String; default is --plugin=protoc-gen-PLUGIN=<executable>.
+ |
+
+ progress_message
+ |
+
+ String; default is |
+
+ protoc_minimal_do_not_use
+ |
+
+ Label; default is |
+
+ runtime
+ |
+
+ Label; default is |
+
+ toolchain_type
+ |
+
+ Label; default is |
+
proto_toolchain(name, aspect_hints, command_line, compatible_with, deprecation, exec_compatible_with, exec_group_compatible_with, exec_properties, features, mnemonic, output_files, package_metadata, progress_message, proto_compiler, restricted_to, tags, target_compatible_with, testonly, toolchains, visibility)+ + + +
| Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ command_line
+ |
+
+ String; default is |
+
+ mnemonic
+ |
+
+ String; default is |
+
+ output_files
+ |
+
+ String; default is |
+
+ progress_message
+ |
+
+ String; default is |
+
+ proto_compiler
+ |
+
+ Label; default is |
+
py_binary(name, deps, srcs, data, args, aspect_hints, compatible_with, deprecation, distribs, env, exec_compatible_with, exec_group_compatible_with, exec_properties, features, imports, interpreter_args, legacy_create_init, licenses, main, main_module, output_licenses, package_metadata, precompile, precompile_invalidation_mode, precompile_optimize_level, precompile_source_retention, pyc_collection, pyi_deps, pyi_srcs, python_version, restricted_to, srcs_version, stamp, tags, target_compatible_with, testonly, toolchains, visibility)+ + + +
| Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ deps
+ |
+
+ List of labels; default is |
+
+ srcs
+ |
+
+ List of labels; default is |
+
+ data
+ |
+
+ List of labels; default is |
+
+ distribs
+ |
+
+ List of strings; default is |
+
+ imports
+ |
+
+ List of strings; default is |
+
+ interpreter_args
+ |
+
+ List of strings; default is |
+
+ legacy_create_init
+ |
+
+ Integer; default is |
+
+ main
+ |
+
+ Label; default is |
+
+ main_module
+ |
+
+ String; default is |
+
+ precompile
+ |
+
+ String; default is |
+
+ precompile_invalidation_mode
+ |
+
+ String; default is |
+
+ precompile_optimize_level
+ |
+
+ Integer; default is |
+
+ precompile_source_retention
+ |
+
+ String; default is |
+
+ pyc_collection
+ |
+
+ String; default is |
+
+ pyi_deps
+ |
+
+ List of labels; default is |
+
+ pyi_srcs
+ |
+
+ List of labels; default is |
+
+ python_version
+ |
+
+ String; default is |
+
+ srcs_version
+ |
+
+ String; default is |
+
+ stamp
+ |
+
+ Integer; default is |
+
py_library(name, deps, srcs, data, aspect_hints, compatible_with, deprecation, distribs, exec_compatible_with, exec_group_compatible_with, exec_properties, experimental_venvs_site_packages, features, imports, licenses, package_metadata, precompile, precompile_invalidation_mode, precompile_optimize_level, precompile_source_retention, pyi_deps, pyi_srcs, restricted_to, srcs_version, tags, target_compatible_with, testonly, toolchains, visibility)+ + A library of Python code that can be depended upon. + +Default outputs: +* The input Python sources +* The precompiled artifacts from the sources. + +NOTE: Precompilation affects which of the default outputs are included in the +resulting runfiles. See the precompile-related attributes and flags for +more information. + +:::{versionchanged} 0.37.0 +Source files are no longer added to the runfiles directly. +::: + +
| Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ deps
+ |
+
+ List of labels; default is |
+
+ srcs
+ |
+
+ List of labels; default is |
+
+ data
+ |
+
+ List of labels; default is |
+
+ distribs
+ |
+
+ List of strings; default is |
+
+ experimental_venvs_site_packages
+ |
+
+ Label; default is |
+
+ imports
+ |
+
+ List of strings; default is |
+
+ precompile
+ |
+
+ String; default is |
+
+ precompile_invalidation_mode
+ |
+
+ String; default is |
+
+ precompile_optimize_level
+ |
+
+ Integer; default is |
+
+ precompile_source_retention
+ |
+
+ String; default is |
+
+ pyi_deps
+ |
+
+ List of labels; default is |
+
+ pyi_srcs
+ |
+
+ List of labels; default is |
+
+ srcs_version
+ |
+
+ String; default is |
+
py_test(name, deps, srcs, data, args, aspect_hints, compatible_with, deprecation, distribs, env, env_inherit, exec_compatible_with, exec_group_compatible_with, exec_properties, features, flaky, imports, interpreter_args, legacy_create_init, licenses, local, main, main_module, package_metadata, precompile, precompile_invalidation_mode, precompile_optimize_level, precompile_source_retention, pyc_collection, pyi_deps, pyi_srcs, python_version, restricted_to, shard_count, size, srcs_version, stamp, tags, target_compatible_with, testonly, timeout, toolchains, visibility)+ + + +
| Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ deps
+ |
+
+ List of labels; default is |
+
+ srcs
+ |
+
+ List of labels; default is |
+
+ data
+ |
+
+ List of labels; default is |
+
+ distribs
+ |
+
+ List of strings; default is |
+
+ imports
+ |
+
+ List of strings; default is |
+
+ interpreter_args
+ |
+
+ List of strings; default is |
+
+ legacy_create_init
+ |
+
+ Integer; default is |
+
+ main
+ |
+
+ Label; default is |
+
+ main_module
+ |
+
+ String; default is |
+
+ precompile
+ |
+
+ String; default is |
+
+ precompile_invalidation_mode
+ |
+
+ String; default is |
+
+ precompile_optimize_level
+ |
+
+ Integer; default is |
+
+ precompile_source_retention
+ |
+
+ String; default is |
+
+ pyc_collection
+ |
+
+ String; default is |
+
+ pyi_deps
+ |
+
+ List of labels; default is |
+
+ pyi_srcs
+ |
+
+ List of labels; default is |
+
+ python_version
+ |
+
+ String; default is |
+
+ srcs_version
+ |
+
+ String; default is |
+
+ stamp
+ |
+
+ Integer; default is |
+
py_runtime(name, abi_flags, aspect_hints, bootstrap_template, compatible_with, coverage_tool, deprecation, exec_compatible_with, exec_group_compatible_with, exec_properties, features, files, implementation_name, interpreter, interpreter_path, interpreter_version_info, package_metadata, pyc_tag, python_version, restricted_to, site_init_template, stage2_bootstrap_template, stub_shebang, tags, target_compatible_with, testonly, toolchains, visibility, zip_main_template)+ + Represents a Python runtime used to execute Python code. + +A `py_runtime` target can represent either a *platform runtime* or an *in-build +runtime*. A platform runtime accesses a system-installed interpreter at a known +path, whereas an in-build runtime points to an executable target that acts as +the interpreter. In both cases, an "interpreter" means any executable binary or +wrapper script that is capable of running a Python script passed on the command +line, following the same conventions as the standard CPython interpreter. + +A platform runtime is by its nature non-hermetic. It imposes a requirement on +the target platform to have an interpreter located at a specific path. An +in-build runtime may or may not be hermetic, depending on whether it points to +a checked-in interpreter or a wrapper script that accesses the system +interpreter. + +Example + +``` +load("@rules_python//python:py_runtime.bzl", "py_runtime") + +py_runtime( + name = "python-2.7.12", + files = glob(["python-2.7.12/**"]), + interpreter = "python-2.7.12/bin/python", +) + +py_runtime( + name = "python-3.6.0", + interpreter_path = "/opt/pyenv/versions/3.6.0/bin/python", +) +``` + +
| Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ abi_flags
+ |
+
+ String; default is |
+
+ bootstrap_template
+ |
+
+ Label; default is |
+
+ coverage_tool
+ |
+
+ Label; default is |
+
+ files
+ |
+
+ List of labels; default is |
+
+ implementation_name
+ |
+
+ String; default is |
+
+ interpreter
+ |
+
+ Label; default is |
+
+ interpreter_path
+ |
+
+ String; default is |
+
+ interpreter_version_info
+ |
+
+ Dictionary: String -> String; default is |
+
+ pyc_tag
+ |
+
+ String; default is |
+
+ python_version
+ |
+
+ String; default is |
+
+ site_init_template
+ |
+
+ Label; default is |
+
+ stage2_bootstrap_template
+ |
+
+ Label; default is |
+
+ stub_shebang
+ |
+
+ String; default is |
+
+ zip_main_template
+ |
+
+ Label; default is |
+
sh_binary(name, deps, srcs, data, args, aspect_hints, compatible_with, deprecation, env, env_inherit, exec_compatible_with, exec_group_compatible_with, exec_properties, features, output_licenses, package_metadata, restricted_to, tags, target_compatible_with, testonly, toolchains, use_bash_launcher, visibility)+ +
+ The sh_binary rule is used to declare executable shell scripts.
+ (sh_binary is a misnomer: its outputs aren't necessarily binaries.) This rule ensures
+ that all dependencies are built, and appear in the runfiles area at execution time.
+ We recommend that you name your sh_binary() rules after the name of the script minus
+ the extension (e.g. .sh); the rule name and the file name must be distinct.
+ sh_binary respects shebangs, so any available interpreter may be used (eg.
+ #!/bin/zsh)
+
For a simple shell script with no dependencies and some data files: +
++sh_binary( + name = "foo", + srcs = ["foo.sh"], + data = glob(["datafiles/*.txt"]), +) ++ +
| Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ deps
+ |
+
+ List of labels; default is deps
+at Typical attributes defined by
+most build rules.
+
+ This attribute should be used to list other |
+
+ srcs
+ |
+
+ List of labels; default is
+ This attribute must be a singleton list, whose element is the shell script.
+ This script must be executable, and may be a source file or a generated file.
+ All other files required at runtime (whether scripts or data) belong in the
+ |
+
+ env_inherit
+ |
+
+ List of strings; default is |
+
+ use_bash_launcher
+ |
+
+ Boolean; default is |
+
sh_library(name, deps, srcs, data, aspect_hints, compatible_with, deprecation, exec_compatible_with, exec_group_compatible_with, exec_properties, features, package_metadata, restricted_to, tags, target_compatible_with, testonly, toolchains, visibility)+ +
+ The main use for this rule is to aggregate together a logical
+ "library" consisting of related scripts—programs in an
+ interpreted language that does not require compilation or linking,
+ such as the Bourne shell—and any data those programs need at
+ run-time. Such "libraries" can then be used from
+ the data attribute of one or
+ more sh_binary rules.
+
+ You can use the filegroup rule to aggregate data
+ files.
+
+ In interpreted programming languages, there's not always a clear
+ distinction between "code" and "data": after all, the program is
+ just "data" from the interpreter's point of view. For this reason
+ this rule has three attributes which are all essentially equivalent:
+ srcs, deps and data.
+ The current implementation does not distinguish between the elements of these lists.
+ All three attributes accept rules, source files and generated files.
+ It is however good practice to use the attributes for their usual purpose (as with other rules).
+
+sh_library( + name = "foo", + data = [ + ":foo_service_script", # an sh_binary with srcs + ":deploy_foo", # another sh_binary with srcs + ], +) ++ +
| Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ deps
+ |
+
+ List of labels; default is deps
+at Typical attributes defined by
+most build rules.
+
+ This attribute should be used to list other |
+
+ srcs
+ |
+
+ List of labels; default is
+ This attribute should be used to list shell script source files that belong to
+ this library. Scripts can load other scripts using the shell's |
+
sh_test(name, deps, srcs, data, args, aspect_hints, compatible_with, deprecation, env, env_inherit, exec_compatible_with, exec_group_compatible_with, exec_properties, features, flaky, local, package_metadata, restricted_to, shard_count, size, tags, target_compatible_with, testonly, timeout, toolchains, use_bash_launcher, visibility)+ +
A sh_test() rule creates a test written as a Bourne shell script.
See the +attributes common to all test rules (*_test).
+ ++sh_test( + name = "foo_integration_test", + size = "small", + srcs = ["foo_integration_test.sh"], + deps = [":foo_sh_lib"], + data = glob(["testdata/*.txt"]), +) ++ +
| Attributes | +|
|---|---|
name |
+
+ Name; required +A unique name for this target. + + |
+
+ deps
+ |
+
+ List of labels; default is deps
+at Typical attributes defined by
+most build rules.
+
+ This attribute should be used to list other |
+
+ srcs
+ |
+
+ List of labels; default is
+ This attribute must be a singleton list, whose element is the shell script.
+ This script must be executable, and may be a source file or a generated file.
+ All other files required at runtime (whether scripts or data) belong in the
+ |
+
+ use_bash_launcher
+ |
+
+ Boolean; default is |
+
+bazel [<startup options>] <command> [<args>] ++ +or + +
+bazel [<startup options>] <command> [<args>] -- [<target patterns>] ++ +See the User's Guide for the +target patterns syntax. + +
+Options can be passed to Bazel in different ways. Options that require a value +can be passed with either an equals sign or a space: +
+--<option>=<value> +--<option> <value> ++Some options have a single character short form; in that case, the short form +has to be passed with a single dash and a space. +
+-<short_form> <value> ++ + +
+Boolean options can be enabled as follows: +
+--<option> +--<option>=[true|yes|1] ++ +and disabled as follows: +
+--no<option> +--<option>=[false|no|0] ++ + +
+Tristate options are usually set to automatic by default, and can be +force-enabled as follows: +
+--<option>=[true|yes|1] ++or force-disabled as follows: +
+--no<option> +--<option>=[false|no|0] ++ +
aquery |
+ Analyzes the given targets and queries the action graph. | +
build |
+ Builds the specified targets. | +
canonicalize-flags |
+ Canonicalizes a list of bazel options. | +
clean |
+ Removes output files and optionally stops the server. | +
coverage |
+ Generates code coverage report for specified test targets. | +
cquery |
+ Loads, analyzes, and queries the specified targets w/ configurations. | +
dump |
+ Dumps the internal state of the bazel server process. | +
fetch |
+ Fetches external repositories that are prerequisites to the targets. | +
help |
+ Prints help for commands, or the index. | +
info |
+ Displays runtime info about the bazel server. | +
license |
+ Prints the license of this software. | +
mobile-install |
+ Installs targets to mobile devices. | +
mod |
+ Queries the Bzlmod external dependency graph | +
print_action |
+ Prints the command line args for compiling a file. | +
query |
+ Executes a dependency graph query. | +
run |
+ Runs the specified target. | +
shutdown |
+ Stops the bazel server. | +
test |
+ Builds and runs the specified test targets. | +
vendor |
+ Fetches external repositories into a folder specified by the flag --vendor_dir. | +
version |
+ Prints version information for bazel. | +
--[no]autodetect_server_javabase default: "true"When --noautodetect_server_javabase is passed, Bazel does not fall back to the local JDK for running the bazel server and instead exits.
+Tags:
+affects_outputs, loses_incremental_state
+
--[no]batch default: "false"If set, Bazel will be run as just a client process without a server, instead of in the standard client/server mode. This is deprecated and will be removed, please prefer shutting down the server explicitly if you wish to avoid lingering servers.
+Tags:
+loses_incremental_state, bazel_internal_configuration, deprecated
+
--[no]batch_cpu_scheduling default: "false"Only on Linux; use 'batch' CPU scheduling for Blaze. This policy is useful for workloads that are non-interactive, but do not want to lower their nice value. See 'man 2 sched_setscheduler'. If false, then Bazel does not perform a system call.
+Tags:
+host_machine_resource_optimizations
+
--bazelrc=<path> multiple uses are accumulatedThe location of the user .bazelrc file containing default values of Bazel options. /dev/null indicates that all further --bazelrcs will be ignored, which is useful to disable the search for a user rc file, e.g. in release builds.
+This option can also be specified multiple times.
+E.g. with --bazelrc=x.rc --bazelrc=y.rc --bazelrc=/dev/null --bazelrc=z.rc,
Tags:
+changes_inputs
+
--[no]block_for_lock default: "true"When --noblock_for_lock is passed, Bazel does not wait for a running command to complete, but instead exits immediately.
+Tags:
+eagerness_to_exit
+
--[no]client_debug default: "false"If true, log debug information from the client to stderr. Changing this option will not cause the server to restart.
+Tags:
+affects_outputs, bazel_monitoring
+
--connect_timeout_secs=<an integer> default: "30"The amount of time the client waits for each attempt to connect to the server
+Tags:
+bazel_internal_configuration
+
--digest_function=<hash function> default: see descriptionThe hash function to use when computing file digests.
+Tags:
+loses_incremental_state, bazel_internal_configuration
+
--experimental_cgroup_parent=<path> default: see descriptionThe cgroup where to start the bazel server as an absolute path. The server process will be started in the specified cgroup for each supported controller. For example, if the value of this flag is /build/bazel and the cpu and memory controllers are mounted respectively on /sys/fs/cgroup/cpu and /sys/fs/cgroup/memory, the server will be started in the cgroups /sys/fs/cgroup/cpu/build/bazel and /sys/fs/cgroup/memory/build/bazel.It is not an error if the specified cgroup is not writable for one or more of the controllers. This options does not have any effect on platforms that do not support cgroups.
+Tags:
+bazel_monitoring, execution
+
--[no]experimental_run_in_user_cgroup default: "false"If true, the Bazel server will be run with systemd-run, and the user will own the cgroup. This flag only takes effect on Linux.
+Tags:
+bazel_monitoring, execution
+
--failure_detail_out=<path> default: see descriptionIf set, specifies a location to write a failure_detail protobuf message if the server experiences a failure and cannot report it via gRPC, as normal. Otherwise, the location will be ${OUTPUT_BASE}/failure_detail.rawproto.
+Tags:
+affects_outputs, loses_incremental_state
+
--[no]home_rc default: "true"Whether or not to look for the home bazelrc file at $HOME/.bazelrc
+Tags:
+changes_inputs
+
--[no]idle_server_tasks default: "true"Run System.gc() when the server is idle
+Tags:
+loses_incremental_state, host_machine_resource_optimizations
+
--[no]ignore_all_rc_files default: "false"Disables all rc files, regardless of the values of other rc-modifying flags, even if these flags come later in the list of startup options.
+Tags:
+changes_inputs
+
--io_nice_level={-1,0,1,2,3,4,5,6,7} default: "-1"Only on Linux; set a level from 0-7 for best-effort IO scheduling using the sys_ioprio_set system call. 0 is highest priority, 7 is lowest. The anticipatory scheduler may only honor up to priority 4. If set to a negative value, then Bazel does not perform a system call.
+Tags:
+host_machine_resource_optimizations
+
--local_startup_timeout_secs=<an integer> default: "120"The maximum amount of time the client waits to connect to the server
+Tags:
+bazel_internal_configuration
+
--macos_qos_class=<a string> default: "default"Sets the QoS service class of the bazel server when running on macOS. This flag has no effect on all other platforms but is supported to ensure rc files can be shared among them without changes. Possible values are: user-interactive, user-initiated, default, utility, and background.
+Tags:
+host_machine_resource_optimizations
+
--max_idle_secs=<integer> default: "10800"The number of seconds the build server will wait idling before shutting down. Zero means that the server will never shutdown. This is only read on server-startup, changing this option will not cause the server to restart.
+Tags:
+eagerness_to_exit, loses_incremental_state
+
--output_base=<path> default: see descriptionIf set, specifies the output location to which all build output will be written. Otherwise, the location will be ${OUTPUT_ROOT}/blaze${USER}/${MD5_OF_WORKSPACE_ROOT}. Note: If you specify a different option from one to the next Bazel invocation for this value, you'll likely start up a new, additional Bazel server. Bazel starts exactly one server per specified output base. Typically there is one output base per workspace - however, with this option you may have multiple output bases per workspace and thereby run multiple builds for the same client on the same machine concurrently. See 'bazel help shutdown' on how to shutdown a Bazel server.
+Tags:
+affects_outputs, loses_incremental_state
+
--output_user_root=<path> default: see descriptionThe user-specific directory beneath which all build outputs are written; by default, this is a function of $USER, but by specifying a constant, build outputs can be shared between collaborating users.
+Tags:
+affects_outputs, loses_incremental_state
+
--[no]preemptible default: "false"If true, the command can be preempted if another command is started.
+Tags:
+eagerness_to_exit
+
--[no]quiet default: "false"If true, no informational messages are emitted on the console, only errors. Changing this option will not cause the server to restart.
+Tags:
+affects_outputs, bazel_monitoring
+
--server_jvm_out=<path> default: see descriptionThe location to write the server's JVM's output. If unset then defaults to a location in output_base.
+Tags:
+affects_outputs, loses_incremental_state
+
--[no]shutdown_on_low_sys_mem default: "false"If max_idle_secs is set and the build server has been idle for a while, shut down the server when the system is low on free RAM. Linux and MacOS only.
+Tags:
+eagerness_to_exit, loses_incremental_state
+
--[no]system_rc default: "true"Whether or not to look for the system-wide bazelrc.
+Tags:
+changes_inputs
+
--[no]unlimit_coredumps default: "false"Raises the soft coredump limit to the hard limit to make coredumps of the server (including the JVM) and the client possible under common conditions. Stick this flag in your bazelrc once and forget about it so that you get coredumps when you actually encounter a condition that triggers them.
+Tags:
+bazel_internal_configuration
+
--[no]windows_enable_symlinks default: "false"If true, real symbolic links will be created on Windows instead of file copying. Requires Windows developer mode to be enabled and Windows 10 version 1703 or greater.
+Tags:
+bazel_internal_configuration
+
--[no]workspace_rc default: "true"Whether or not to look for the workspace bazelrc file at $workspace/.bazelrc
+Tags:
+changes_inputs
+
--host_jvm_args=<jvm_arg> multiple uses are accumulatedFlags to pass to the JVM executing Blaze.
+--host_jvm_debugConvenience option to add some additional JVM startup flags, which cause the JVM to wait during startup until you connect from a JDWP-compliant debugger (like Eclipse) to port 5005.
+Expands to:
+
--host_jvm_args=-agentlib:jdwp=transport=dt_socket,server=y,address=5005
+
--server_javabase=<jvm path> default: ""Path to the JVM used to execute Bazel itself.
+--distdir=<a path> multiple uses are accumulatedAdditional places to search for archives before accessing the network to download them.
+Tags:
+bazel_internal_configuration
+
--[no]experimental_repository_cache_hardlinks default: "false"If set, the repository cache will hardlink the file in case of a cache hit, rather than copying. This is intended to save disk space.
+Tags:
+bazel_internal_configuration
+
--experimental_repository_downloader_retries=<an integer> default: "5"The maximum number of attempts to retry a download error. If set to 0, retries are disabled.
+Tags:
+experimental
+
--experimental_scale_timeouts=<a double> default: "1.0"Scale all timeouts in Starlark repository rules by this factor. In this way, external repositories can be made working on machines that are slower than the rule author expected, without changing the source code
+Tags:
+bazel_internal_configuration, experimental
+
--http_connector_attempts=<an integer> default: "8"The maximum number of attempts for http downloads.
+Tags:
+bazel_internal_configuration
+
--http_connector_retry_max_timeout=<An immutable length of time.> default: "0s"The maximum timeout for http download retries. With a value of 0, no timeout maximum is defined.
+Tags:
+bazel_internal_configuration
+
--http_max_parallel_downloads=<an integer> default: "8"The maximum number parallel http downloads.
+Tags:
+bazel_internal_configuration
+
--http_timeout_scaling=<a double> default: "1.0"Scale all timeouts related to http downloads by the given factor
+Tags:
+bazel_internal_configuration
+
--repo_contents_cache=<a path> default: see descriptionSpecifies the location of the repo contents cache, which contains fetched repo directories shareable across workspaces. An empty string as argument requests the repo contents cache to be disabled, otherwise the default of '<--repository_cache>/contents' is used. Note that this means setting '--repository_cache=' would by default disable the repo contents cache as well, unless '--repo_contents_cache=<some_path>' is also set.
+Tags:
+bazel_internal_configuration
+
--repo_contents_cache_gc_idle_delay=<An immutable length of time.> default: "5m"Specifies the amount of time the server must remain idle before garbage collection happens +to the repo contents cache.
+Tags:
+bazel_internal_configuration
+
--repo_contents_cache_gc_max_age=<An immutable length of time.> default: "14d"Specifies the amount of time an entry in the repo contents cache can stay unused before it's garbage collected. If set to zero, only duplicate entries will be garbage collected.
+Tags:
+bazel_internal_configuration
+
--repository_cache=<a path> default: see descriptionSpecifies the cache location of the downloaded values obtained during the fetching of external repositories. An empty string as argument requests the cache to be disabled, otherwise the default of '<--output_user_root>/cache/repos/v1' is used
+Tags:
+bazel_internal_configuration
+
--[no]repository_disable_download default: "false"If set, downloading using ctx.download{,_and_extract} is not allowed during repository fetching. Note that network access is not completely disabled; ctx.execute could still run an arbitrary executable that accesses the Internet.
+Tags:
+bazel_internal_configuration
+
--experimental_ui_max_stdouterr_bytes=<an integer in (-1)-1073741819 range> default: "1048576"The maximum size of the stdout / stderr files that will be printed to the console. -1 implies no limit.
+Tags:
+execution
+
--gc_churning_threshold=<an integer in 0-100 range> default: "100"At any point after an invocation has been running for at least one minute, if Blaze has spent at least this percentage of the invocation's wall time doing full GCs, Blaze will give up and fail with an OOM. A value of 100 effectively means to never give up for this reason.
+Tags:
+host_machine_resource_optimizations
+
--gc_churning_threshold_if_multiple_top_level_targets=<an integer> default: "-1"If set to a value in [0, 100] and this is a command that takes top-level targets (e.g. build but not query) and there are multiple such top-level targets, overrides --gc_churning_threshold. Useful to configure more aggressive OOMing behavior (i.e. a lower value than --gc_churning_threshold) when they are multiple top-level targets so that the invoker of Bazel can split and retry while still having less aggressive behavior when there is a single top-level target.
+Tags:
+host_machine_resource_optimizations
+
--gc_thrashing_threshold=<an integer in 0-100 range> default: "100"The percent of tenured space occupied (0-100) above which GcThrashingDetector considers memory pressure events against its limits (--gc_thrashing_limits). If set to 100, GcThrashingDetector is disabled.
+Tags:
+host_machine_resource_optimizations
+
--[no]incompatible_enable_proto_toolchain_resolution default: "false"If true, proto lang rules define toolchains from protobuf repository.
+Tags:
+loading_and_analysis, incompatible_change
+
--bep_maximum_open_remote_upload_files=<an integer> default: "-1"Maximum number of open files allowed during BEP artifact upload.
+Tags:
+affects_outputs
+
--remote_download_allDownloads all remote outputs to the local machine. This flag is an alias for --remote_download_outputs=all.
+Expands to:
+
--remote_download_outputs=all
+
Tags:
+affects_outputs
+
--remote_download_minimalDoes not download any remote build outputs to the local machine. This flag is an alias for --remote_download_outputs=minimal.
+Expands to:
+
--remote_download_outputs=minimal
+
Tags:
+affects_outputs
+
--remote_download_outputs=<all, minimal or toplevel> default: "toplevel"If set to 'minimal' doesn't download any remote build outputs to the local machine, except the ones required by local actions. If set to 'toplevel' behaves like 'minimal' except that it also downloads outputs of top level targets to the local machine. Both options can significantly reduce build times if network bandwidth is a bottleneck.
+Tags:
+affects_outputs
+
--remote_download_symlink_template=<a string> default: ""Instead of downloading remote build outputs to the local machine, create symbolic links. The target of the symbolic links can be specified in the form of a template string. This template string may contain {hash} and {size_bytes} that expand to the hash of the object and the size in bytes, respectively. These symbolic links may, for example, point to a FUSE file system that loads objects from the CAS on demand.
+Tags:
+affects_outputs
+
--remote_download_toplevelOnly downloads remote outputs of top level targets to the local machine. This flag is an alias for --remote_download_outputs=toplevel.
+Expands to:
+
--remote_download_outputs=toplevel
+
Tags:
+affects_outputs
+
--repo_env=<a 'name[=value]' assignment with an optional value part or the special syntax '=name' to unset a variable> multiple uses are accumulatedSpecifies additional environment variables to be available only for repository rules. Note that repository rules see the full environment anyway, but in this way variables can be set via command-line flags and <code>.bazelrc</code> entries. The special syntax <code>=NAME</code> can be used to explicitly unset a variable.
+Tags:
+action_command_lines
+
--[no]allow_experimental_loads default: "false"If enabled, issue only a warning instead of an error for loads of experimental .bzls.
+Tags:
+build_file_semantics
+
--[no]check_bzl_visibility default: "true"If disabled, .bzl load visibility errors are demoted to warnings.
+Tags:
+build_file_semantics
+
--[no]incompatible_enforce_starlark_utf8 default: "warning"If enabled (or set to 'error'), fail if Starlark files are not UTF-8 encoded. If set to 'warning', emit a warning instead. If set to 'off', Bazel assumes that Starlark files are UTF-8 encoded but does not verify this assumption. Note that Starlark files which are not UTF-8 encoded can cause Bazel to behave inconsistently.
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]experimental_bzl_visibility default: "true"If enabled, adds a visibility() function that .bzl files may call during top-level evaluation to set their visibility for the purpose of load() statements.
Tags:
+loading_and_analysis, experimental
+
If set to true, rule attributes and Starlark API methods needed for the rule cc_shared_library will be available
+Tags:
+build_file_semantics, loading_and_analysis, experimental
+
--[no]experimental_disable_external_package default: "false"If set to true, the auto-generated //external package will not be available anymore. Bazel will still be unable to parse the file 'external/BUILD', but globs reaching into external/ from the unnamed package will work.
+Tags:
+loading_and_analysis, loses_incremental_state, experimental
+
--[no]experimental_dormant_deps default: "false"If set to true, attr.label(materializer=), attr(for_dependency_resolution=), attr.dormant_label(), attr.dormant_label_list() and rule(for_dependency_resolution=) are allowed.
+Tags:
+build_file_semantics, experimental
+
--[no]experimental_enable_android_migration_apis default: "false"If set to true, enables the APIs required to support the Android Starlark migration.
+Tags:
+build_file_semantics
+
--[no]experimental_enable_first_class_macros default: "true"If set to true, enables the macro() construct for defining symbolic macros.
Tags:
+build_file_semantics
+
--[no]experimental_enable_scl_dialect default: "true"If set to true, .scl files may be used in load() statements.
+Tags:
+build_file_semantics
+
--[no]experimental_enable_starlark_set default: "true"If true, enable the set data type and set() constructor in Starlark.
+Tags:
+build_file_semantics, experimental
+
--[no]experimental_google_legacy_api default: "false"If set to true, exposes a number of experimental pieces of Starlark build API pertaining to Google legacy code.
+Tags:
+loading_and_analysis, experimental
+
--[no]experimental_isolated_extension_usages default: "false"If true, enables the <code>isolate</code> parameter in the <a href="https://bazel.build/rules/lib/globals/module#use_extension"><code>use_extension</code></a> function.
+Tags:
+loading_and_analysis
+
--[no]experimental_platforms_api default: "false"If set to true, enables a number of platform-related Starlark APIs useful for debugging.
+Tags:
+loading_and_analysis, experimental
+
--[no]experimental_repo_remote_exec default: "false"If set to true, repository_rule gains some remote execution capabilities.
+Tags:
+build_file_semantics, loading_and_analysis, experimental
+
--[no]experimental_repository_ctx_execute_wasm default: "false"If true enables the repository_ctx load_wasm and execute_wasm methods.
Tags:
+loading_and_analysis, experimental
+
--[no]experimental_sibling_repository_layout default: "false"If set to true, non-main repositories are planted as symlinks to the main repository in the execution root. That is, all repositories are direct children of the $output_base/execution_root directory. This has the side effect of freeing up $output_base/execution_root/main/external for the real top-level 'external' directory.
+Tags:
+action_command_lines, bazel_internal_configuration, loading_and_analysis, loses_incremental_state, experimental
+
--[no]experimental_single_package_toolchain_binding default: "false"If enabled, the register_toolchain function may not include target patterns which may refer to more than one package.
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]experimental_starlark_types default: "false"Enables type annotations and type checking. Locations where the annotations are allowed is further controlled by --experimental_starlark_types_allowed_paths.
Tags:
+loading_and_analysis, experimental
+
--experimental_starlark_types_allowed_paths=<comma-separated list of options> default: ""List of canonical Label prefixes under which Starlark type annotations are allowed.
+Tags:
+loading_and_analysis, experimental
+
If set to true, tags will be propagated from a target to the actions' execution requirements; otherwise tags are not propagated. See https://github.com/bazelbuild/bazel/issues/8830 for details.
+Tags:
+build_file_semantics, experimental
+
--[no]incompatible_always_check_depset_elements default: "true"Check the validity of elements added to depsets, in all constructors. Elements must be immutable, but historically the depset(direct=...) constructor forgot to check. Use tuples instead of lists in depset elements. See https://github.com/bazelbuild/bazel/issues/10313 for details.
+Tags:
+build_file_semantics, incompatible_change
+
--incompatible_autoload_externally=<comma-separated set of options> default: "+@rules_cc"A comma-separated list of rules (or other symbols) that were previously part of Bazel and which are now to be retrieved from their respective external repositories. This flag is intended to be used to facilitate migration of rules out of Bazel. See also https://github.com/bazelbuild/bazel/issues/23043.
+A symbol that is autoloaded within a file behaves as if its built-into-Bazel definition were replaced by its canonical new definition in an external repository. For a BUILD file, this essentially means implicitly adding a load() statement. For a .bzl file, it's either a load() statement or a change to a field of the native object, depending on whether the autoloaded symbol is a rule.
+Bazel maintains a hardcoded list of all symbols that may be autoloaded; only those symbols may appear in this flag. For each symbol, Bazel knows the new definition location in an external repository, as well as a set of special-cased repositories that must not autoload it to avoid creating cycles.
+A list item of "+foo" in this flag causes symbol foo to be autoloaded, except in foo's exempt repositories, within which the Bazel-defined version of foo is still available.
+A list item of "foo" triggers autoloading as above, but the Bazel-defined version of foo is not made available to the excluded repositories. This ensures that foo's external repository does not depend on the old Bazel implementation of foo
+A list item of "-foo" does not trigger any autoloading, but makes the Bazel-defined version of foo inaccessible throughout the workspace. This is used to validate that the workspace is ready for foo's definition to be deleted from Bazel.
+If a symbol is not named in this flag then it continues to work as normal -- no autoloading is done, nor is the Bazel-defined version suppressed. For configuration see https://github.com/bazelbuild/bazel/blob/master/src/main/java/com/google/devtools/build/lib/packages/AutoloadSymbols.java As a shortcut also whole repository may be used, for example +@rules_python will autoload all Python rules.
Tags:
+loses_incremental_state, build_file_semantics, incompatible_change
+
--[no]incompatible_disable_autoloads_in_main_repo default: "true"Controls if the autoloads (set by --incompatible_autoload_externally) are enabled in themain repository. When enabled the rules (or other symbols) that were previously part of Bazel need to have load statements. Use buildifier to add them.
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]incompatible_disable_objc_library_transition default: "true"Disable objc_library's custom transition and inherit from the top level target instead (No-op in Bazel)
+Tags:
+build_file_semantics, incompatible_change
+
--[no]incompatible_disable_starlark_host_transitions default: "false"If set to true, rule attributes cannot set 'cfg = "host"'. Rules should set 'cfg = "exec"' instead.
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]incompatible_disable_target_default_provider_fields default: "false"If set to true, disable the ability to utilize the default provider via field syntax. Use provider-key syntax instead. For example, instead of using ctx.attr.dep.files to access files, utilize `ctx.attr.dep[DefaultInfo].files See https://github.com/bazelbuild/bazel/issues/9014 for details.
Tags:
+build_file_semantics, incompatible_change
+
--incompatible_disable_transitions_on=<comma-separated set of options> default: ""A comma-separated list of flags that cannot be used in transitions inputs or outputs.
+Tags:
+loading_and_analysis, incompatible_change, non_configurable
+
--[no]incompatible_disallow_ctx_resolve_tools default: "true"If set to true, calling the deprecated ctx.resolve_tools API always fails. Uses of this API should be replaced by an executable or tools argument to ctx.actions.run or ctx.actions.run_shell.
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]incompatible_disallow_empty_glob default: "true"If set to true, the default value of the allow_empty argument of glob() is False.
Tags:
+build_file_semantics, incompatible_change
+
--[no]incompatible_enable_deprecated_label_apis default: "true"If enabled, certain deprecated APIs (native.repository_name, Label.workspace_name, Label.relative) can be used.
+Tags:
+loading_and_analysis
+
--[no]incompatible_fail_on_unknown_attributes default: "true"If enabled, targets that have unknown attributes set to None fail.
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]incompatible_fix_package_group_reporoot_syntax default: "true"In package_group's packages attribute, changes the meaning of the value "//..." to refer to all packages in the current repository instead of all packages in any repository. You can use the special value "public" in place of "//..." to obtain the old behavior. This flag requires that --incompatible_package_group_has_public_syntax also be enabled.
Tags:
+build_file_semantics, incompatible_change
+
--[no]incompatible_locations_prefers_executable default: "true"Whether a target that provides an executable expands to the executable rather than the files in <code>DefaultInfo.files</code> under $(locations ...) expansion if the number of files is not 1.
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]incompatible_no_attr_license default: "true"If set to true, disables the function attr.license.
Tags:
+build_file_semantics, incompatible_change
+
--[no]incompatible_no_implicit_file_export default: "false"If set, (used) source files are package private unless exported explicitly. See https://github.com/bazelbuild/proposals/blob/master/designs/2019-10-24-file-visibility.md
+Tags:
+build_file_semantics, incompatible_change
+
--[no]incompatible_no_implicit_watch_label default: "true"If true, then methods on <code>repository_ctx</code> that are passed a Label will no longer automatically watch the file under that label for changes even if <code>watch = "no"</code>, and <code>repository_ctx.path</code> no longer causes the returned path to be watched. Use <code>repository_ctx.watch</code> instead.
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]incompatible_no_rule_outputs_param default: "false"If set to true, disables the outputs parameter of the rule() Starlark function.
Tags:
+build_file_semantics, incompatible_change
+
--[no]incompatible_package_group_has_public_syntax default: "true"In package_group's packages attribute, allows writing "public" or "private" to refer to all packages or no packages respectively.
Tags:
+build_file_semantics, incompatible_change
+
--[no]incompatible_resolve_select_keys_eagerly default: "false"If enabled, string keys in dicts passed to select() in .bzl files are immediately resolved to Labels relative to the file instead of being interpreted relative to the BUILD file they are ultimately loaded from.
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]incompatible_run_shell_command_string default: "true"If set to true, the command parameter of actions.run_shell will only accept string
+Tags:
+build_file_semantics, incompatible_change
+
--[no]incompatible_simplify_unconditional_selects_in_rule_attrs default: "true"If true, simplify configurable rule attributes which contain only unconditional selects; for example, if ["a"] + select("//conditions:default", ["b"]) is assigned to a rule attribute, it is stored as ["a", "b"]. This option does not affect attributes of symbolic macros or attribute default values.
+Tags:
+build_file_semantics, incompatible_change
+
--[no]incompatible_stop_exporting_build_file_path default: "false"If set to true, deprecated ctx.build_file_path will not be available. ctx.label.package + '/BUILD' can be used instead.
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]incompatible_stop_exporting_language_modules default: "false"If enabled, certain language-specific modules (such as cc_common) are unavailable in user .bzl files and may only be called from their respective rules repositories.
Tags:
+loading_and_analysis, incompatible_change
+
--[no]incompatible_unambiguous_label_stringification default: "true"When true, Bazel will stringify the label @//foo:bar to @//foo:bar, instead of //foo:bar. This only affects the behavior of str(), the % operator, and so on; the behavior of repr() is unchanged. See https://github.com/bazelbuild/bazel/issues/15916 for more information.
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]incompatible_use_cc_configure_from_rules_cc default: "false"When true, Bazel will no longer allow using cc_configure from @bazel_tools. Please see https://github.com/bazelbuild/bazel/issues/10134 for details and migration instructions.
+Tags:
+loading_and_analysis, incompatible_change
+
--max_computation_steps=<a long integer> default: "0"The maximum number of Starlark computation steps that may be executed by a BUILD file (zero means no limit).
+Tags:
+build_file_semantics
+
--nested_set_depth_limit=<an integer> default: "3500"The maximum depth of the graph internal to a depset (also known as NestedSet), above which the depset() constructor will fail.
+Tags:
+loading_and_analysis
+
--repositories_without_autoloads=<comma-separated set of options> default: ""A list of additional repositories (beyond the hardcoded ones Bazel knows about) where autoloads are not to be added. This should typically contain repositories that are transitively depended on by a repository that may be loaded automatically (and which can therefore potentially create a cycle).
+Tags:
+loses_incremental_state, build_file_semantics, incompatible_change
+
--allow_yanked_versions=<a string> multiple uses are accumulatedSpecified the module versions in the form of <module1>@<version1>,<module2>@<version2> that will be allowed in the resolved dependency graph even if they are declared yanked in the registry where they come from (if they are not coming from a NonRegistryOverride). Otherwise, yanked versions will cause the resolution to fail. You can also define allowed yanked version with the BZLMOD_ALLOW_YANKED_VERSIONS environment variable. You can disable this check by using the keyword 'all' (not recommended).
Tags:
+loading_and_analysis
+
--check_bazel_compatibility=<error, warning or off> default: "error"Check bazel version compatibility of Bazel modules. Valid values are error to escalate it to a resolution failure, off to disable the check, or warning to print a warning when mismatch detected.
Tags:
+loading_and_analysis
+
--check_direct_dependencies=<off, warning or error> default: "warning"Check if the direct bazel_dep dependencies declared in the root module are the same versions you get in the resolved dependency graph. Valid values are off to disable the check, warning to print a warning when mismatch detected or error to escalate it to a resolution failure.
Tags:
+loading_and_analysis
+
--[no]ignore_dev_dependency default: "false"If true, Bazel ignores bazel_dep and use_extension declared as dev_dependency in the MODULE.bazel of the root module. Note that, those dev dependencies are always ignored in the MODULE.bazel if it's not the root module regardless of the value of this flag.
Tags:
+loading_and_analysis
+
--lockfile_mode=<off, update, refresh or error> default: "update"Specifies how and whether or not to use the lockfile. Valid values are update to use the lockfile and update it if there are changes, refresh to additionally refresh mutable information (yanked versions and previously missing modules) from remote registries from time to time, error to use the lockfile but throw an error if it's not up-to-date, or off to neither read from or write to the lockfile.
Tags:
+loading_and_analysis
+
--module_mirrors=<comma-separated list of options> default: see descriptionA comma-separated list of URLs under which the source URLs of Bazel modules can be found, +in addition to and taking precedence over any registry-provided mirror URLs. Set this to +an empty value to disable the use of any mirrors not specified by the registries. The +default set of mirrors may change over time, but all downloads from mirrors are verified +by hashes stored in the registry (and thus pinned by the lockfile).
+Tags:
+loading_and_analysis
+
--override_module=<an equals-separated mapping of module name to path> multiple uses are accumulatedOverride a module with a local path in the form of <module name>=<path>. If the given path is an absolute path, it will be used as it is. If the given path is a relative path, it is relative to the current working directory. If the given path starts with '%workspace%, it is relative to the workspace root, which is the output of bazel info workspace. If the given path is empty, then remove any previous overrides.
--registry=<a string> multiple uses are accumulatedSpecifies the registries to use to locate Bazel module dependencies. The order is important: modules will be looked up in earlier registries first, and only fall back to later registries when they're missing from the earlier ones.
+Tags:
+changes_inputs
+
--vendor_dir=<a path> default: see descriptionSpecifies the directory that should hold the external repositories in vendor mode, whether for the purpose of fetching them into it or using them while building. The path can be specified as either an absolute path or a path relative to the workspace directory.
+Tags:
+loading_and_analysis
+
--gc_thrashing_limits=<comma separated pairs of <period>:<count>> default: "1s:2,20s:3,1m:5"Limits which, if reached, cause GcThrashingDetector to crash Bazel with an OOM. Each limit is specified as <period>:<count> where period is a duration and count is a positive integer. If more than --gc_thrashing_threshold percent of tenured space (old gen heap) remains occupied after <count> consecutive full GCs within <period>, an OOM is triggered. Multiple limits can be specified separated by commas.
+Tags:
+host_machine_resource_optimizations
+
--[no]heuristically_drop_nodes default: "false"If true, Blaze will remove FileState and DirectoryListingState nodes after related File and DirectoryListing node is done to save memory. We expect that it is less likely that these nodes will be needed again. If so, the program will re-evaluate them.
+Tags:
+loses_incremental_state
+
--[no]incompatible_do_not_split_linking_cmdline default: "true"When true, Bazel no longer modifies command line flags used for linking, and also doesn't selectively decide which flags go to the param file and which don't. See https://github.com/bazelbuild/bazel/issues/7670 for details.
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]keep_state_after_build default: "true"If false, Blaze will discard the inmemory state from this build when the build finishes. Subsequent builds will not have any incrementality with respect to this one.
+Tags:
+loses_incremental_state
+
--skyframe_high_water_mark_full_gc_drops_per_invocation=<an integer, >= 0> default: "10"Flag for advanced configuration of Bazel's internal Skyframe engine. If Bazel detects its retained heap percentage usage exceeds the threshold set by --skyframe_high_water_mark_threshold, when a full GC event occurs, it will drop unnecessary temporary Skyframe state, up to this many times per invocation. Defaults to 10. Zero means that full GC events will never trigger drops. If the limit is reached, Skyframe state will no longer be dropped when a full GC event occurs and that retained heap percentage threshold is exceeded.
+Tags:
+host_machine_resource_optimizations
+
--skyframe_high_water_mark_minor_gc_drops_per_invocation=<an integer, >= 0> default: "10"Flag for advanced configuration of Bazel's internal Skyframe engine. If Bazel detects its retained heap percentage usage exceeds the threshold set by --skyframe_high_water_mark_threshold, when a minor GC event occurs, it will drop unnecessary temporary Skyframe state, up to this many times per invocation. Defaults to 10. Zero means that minor GC events will never trigger drops. If the limit is reached, Skyframe state will no longer be dropped when a minor GC event occurs and that retained heap percentage threshold is exceeded.
+Tags:
+host_machine_resource_optimizations
+
--skyframe_high_water_mark_threshold=<an integer> default: "85"Flag for advanced configuration of Bazel's internal Skyframe engine. If Bazel detects its retained heap percentage usage is at least this threshold, it will drop unnecessary temporary Skyframe state. Tweaking this may let you mitigate wall time impact of GC thrashing, when the GC thrashing is (i) caused by the memory usage of this temporary state and (ii) more costly than reconstituting the state when it is needed.
+Tags:
+host_machine_resource_optimizations
+
--[no]track_incremental_state default: "true"If false, Blaze will not persist data that allows for invalidation and re-evaluation on incremental builds in order to save memory on this build. Subsequent builds will not have any incrementality with respect to this one. Usually you will want to specify --batch when setting this to false.
+Tags:
+loses_incremental_state
+
--[no]announce_rc default: "false"Whether to announce rc options.
+Tags:
+affects_outputs
+
--[no]attempt_to_print_relative_paths default: "false"When printing the location part of messages, attempt to use a path relative to the workspace directory or one of the directories specified by --package_path.
+Tags:
+terminal_output
+
--bes_backend=<a string> default: ""Specifies the build event service (BES) backend endpoint in the form [SCHEME://]HOST[:PORT]. The default is to disable BES uploads. Supported schemes are grpc and grpcs (grpc with TLS enabled). If no scheme is provided, Bazel assumes grpcs.
+Tags:
+affects_outputs
+
--[no]bes_check_preceding_lifecycle_events default: "false"Sets the field check_preceding_lifecycle_events_present on PublishBuildToolEventStreamRequest which tells BES to check whether it previously received InvocationAttemptStarted and BuildEnqueued events matching the current tool event.
+Tags:
+affects_outputs
+
--bes_header=<a 'name=value' assignment> multiple uses are accumulatedSpecify a header in NAME=VALUE form that will be included in BES requests. Multiple headers can be passed by specifying the flag multiple times. Multiple values for the same name will be converted to a comma-separated list.
+Tags:
+affects_outputs
+
--bes_instance_name=<a string> default: see descriptionSpecifies the instance name under which the BES will persist uploaded BEP. Defaults to null.
+Tags:
+affects_outputs
+
--bes_keywords=<comma-separated list of options> multiple uses are accumulatedSpecifies a list of notification keywords to be added the default set of keywords published to BES ("command_name=<command_name> ", "protocol_name=BEP"). Defaults to none.
+Tags:
+affects_outputs
+
--[no]bes_lifecycle_events default: "true"Specifies whether to publish BES lifecycle events. (defaults to 'true').
+Tags:
+affects_outputs
+
--bes_oom_finish_upload_timeout=<An immutable length of time.> default: "10m"Specifies how long bazel should wait for the BES/BEP upload to complete while OOMing. This flag ensures termination when the JVM is severely GC thrashing and cannot make progress on any user thread.
+Tags:
+bazel_monitoring
+
--bes_outerr_buffer_size=<an integer> default: "10240"Specifies the maximal size of stdout or stderr to be buffered in BEP, before it is reported as a progress event. Individual writes are still reported in a single event, even if larger than the specified value up to --bes_outerr_chunk_size.
+Tags:
+affects_outputs
+
--bes_outerr_chunk_size=<an integer> default: "1048576"Specifies the maximal size of stdout or stderr to be sent to BEP in a single message.
+Tags:
+affects_outputs
+
--bes_proxy=<a string> default: see descriptionConnect to the Build Event Service through a proxy. Currently this flag can only be used to configure a Unix domain socket (unix:/path/to/socket).
+--bes_results_url=<a string> default: ""Specifies the base URL where a user can view the information streamed to the BES backend. Bazel will output the URL appended by the invocation id to the terminal.
+Tags:
+terminal_output
+
--bes_system_keywords=<comma-separated list of options> multiple uses are accumulatedSpecifies a list of notification keywords to be included directly, without the "user_keyword=" prefix included for keywords supplied via --bes_keywords. Intended for Build service operators that set --bes_lifecycle_events=false and include keywords when calling PublishLifecycleEvent. Build service operators using this flag should prevent users from overriding the flag value.
+Tags:
+affects_outputs
+
--bes_timeout=<An immutable length of time.> default: "0s"Specifies how long bazel should wait for the BES/BEP upload to complete after the build and tests have finished. A valid timeout is a natural number followed by a unit: Days (d), hours (h), minutes (m), seconds (s), and milliseconds (ms). The default value is '0' which means that there is no timeout.
+Tags:
+affects_outputs
+
--bes_upload_mode=<wait_for_upload_complete, nowait_for_upload_complete or fully_async> default: "wait_for_upload_complete"Specifies whether the Build Event Service upload should block the build completion or should end the invocation immediately and finish the upload in the background.
+wait_for_upload_complete: blocks at the end of the current invocation until all events (including lifecycle events if applicable) are uploaded and acknowledged by the backend.nowait_for_upload_complete: blocks at the beginning of the next invocation until all events (including lifecycle events if applicable) are uploaded and acknowledged by the backend.fully_async: blocks at the beginning of the next invocation until all events are uploaded but does not wait for acknowledgements. Events may be lost in case of (transient) failures and backends may report streams as incomplete in this mode. There is no guarantee that FinishInvocationAttempt or FinishBuild lifecycle events are sent.Tags:
+eagerness_to_exit
+
--build_event_binary_file=<a string> default: ""If non-empty, write a varint delimited binary representation of representation of the build event protocol to that file. This option implies --bes_upload_mode=wait_for_upload_complete.
+Tags:
+affects_outputs
+
--[no]build_event_binary_file_path_conversion default: "true"Convert paths in the binary file representation of the build event protocol to more globally valid URIs whenever possible; if disabled, the file:// uri scheme will always be used
+Tags:
+affects_outputs
+
--build_event_binary_file_upload_mode=<wait_for_upload_complete, nowait_for_upload_complete or fully_async> default: "wait_for_upload_complete"Specifies whether the Build Event Service upload for --build_event_binary_file should block the build completion or should end the invocation immediately and finish the upload in the background. Either 'wait_for_upload_complete' (default), 'nowait_for_upload_complete', or 'fully_async'.
+Tags:
+eagerness_to_exit
+
--build_event_json_file=<a string> default: ""If non-empty, write a JSON serialisation of the build event protocol to that file. This option implies --bes_upload_mode=wait_for_upload_complete.
+Tags:
+affects_outputs
+
--[no]build_event_json_file_path_conversion default: "true"Convert paths in the json file representation of the build event protocol to more globally valid URIs whenever possible; if disabled, the file:// uri scheme will always be used
+Tags:
+affects_outputs
+
--build_event_json_file_upload_mode=<wait_for_upload_complete, nowait_for_upload_complete or fully_async> default: "wait_for_upload_complete"Specifies whether the Build Event Service upload for --build_event_json_file should block the build completion or should end the invocation immediately and finish the upload in the background. Either 'wait_for_upload_complete' (default), 'nowait_for_upload_complete', or 'fully_async'.
+Tags:
+eagerness_to_exit
+
--build_event_max_named_set_of_file_entries=<an integer> default: "5000"The maximum number of entries for a single named_set_of_files event; values smaller than 2 are ignored and no event splitting is performed. This is intended for limiting the maximum event size in the build event protocol, although it does not directly control event size. The total event size is a function of the structure of the set as well as the file and uri lengths, which may in turn depend on the hash function.
+Tags:
+affects_outputs
+
--[no]build_event_publish_all_actions default: "false"Whether all actions should be published.
+Tags:
+affects_outputs
+
--build_event_text_file=<a string> default: ""If non-empty, write a textual representation of the build event protocol to that file
+Tags:
+affects_outputs
+
--[no]build_event_text_file_path_conversion default: "true"Convert paths in the text file representation of the build event protocol to more globally valid URIs whenever possible; if disabled, the file:// uri scheme will always be used
+Tags:
+affects_outputs
+
--build_event_text_file_upload_mode=<wait_for_upload_complete, nowait_for_upload_complete or fully_async> default: "wait_for_upload_complete"Specifies whether the Build Event Service upload for --build_event_text_file should block the build completion or should end the invocation immediately and finish the upload in the background. Either 'wait_for_upload_complete' (default), 'nowait_for_upload_complete', or 'fully_async'.
+Tags:
+eagerness_to_exit
+
--build_event_upload_max_retries=<an integer> default: "4"The maximum number of times Bazel should retry uploading a build event.
+Tags:
+bazel_internal_configuration
+
--[no]experimental_bep_target_summary default: "false"Whether to publish TargetSummary events.
+--[no]experimental_build_event_expand_filesets default: "false"If true, expand Filesets in the BEP when presenting output files.
+Tags:
+affects_outputs
+
--experimental_build_event_output_group_mode=<an output group name followed by an OutputGroupFileMode, e.g. default=both> multiple uses are accumulatedSpecify how an output group's files will be represented in TargetComplete/AspectComplete BEP events. Values are an assignment of an output group name to one of 'NAMED_SET_OF_FILES_ONLY', 'INLINE_ONLY', or 'BOTH'. The default value is 'NAMED_SET_OF_FILES_ONLY'. If an output group is repeated, the final value to appear is used. The default value sets the mode for coverage artifacts to BOTH: --experimental_build_event_output_group_mode=baseline.lcov=both
+Tags:
+affects_outputs
+
--experimental_build_event_upload_retry_minimum_delay=<An immutable length of time.> default: "1s"Initial, minimum delay for exponential backoff retries when BEP upload fails. (exponent: 1.6)
+Tags:
+bazel_internal_configuration
+
--experimental_build_event_upload_strategy=<a string> default: see descriptionSelects how to upload artifacts referenced in the build event protocol. In Bazel the valid options include 'local' and 'remote'. The default value is 'local'.
+Tags:
+affects_outputs
+
--[no]experimental_collect_load_average_in_profiler default: "true"If enabled, the profiler collects the system's overall load average.
+Tags:
+bazel_monitoring
+
--[no]experimental_collect_pressure_stall_indicators default: "false"If enabled, the profiler collects the Linux PSI data.
+Tags:
+bazel_monitoring
+
--[no]experimental_collect_resource_estimation default: "false"If enabled, the profiler collects CPU and memory usage estimation for local actions.
+Tags:
+bazel_monitoring
+
--[no]experimental_collect_skyframe_counts_in_profiler default: "false"If enabled, the profiler collects SkyFunction counts in the Skyframe graph over time for key function types, like configured targets and action executions. May have a performance hit as this visits the ENTIRE Skyframe graph at every profiling time unit. Do not use this flag with performance-critical measurements.
+Tags:
+bazel_monitoring
+
--[no]experimental_collect_system_network_usage default: "true"If enabled, the profiler collects the system's network usage.
+Tags:
+bazel_monitoring
+
--[no]experimental_collect_worker_data_in_profiler default: "true"If enabled, the profiler collects worker's aggregated resource data.
+Tags:
+bazel_monitoring
+
--experimental_command_profile=<cpu, wall, alloc or lock> default: see descriptionRecords a Java Flight Recorder profile for the duration of the command. One of the supported profiling event types (cpu, wall, alloc or lock) must be given as an argument. The profile is written to a file named after the event type under the output base directory. The syntax and semantics of this flag might change in the future to support additional profile types or output formats; use at your own risk.
+--experimental_profile_additional_tasks=<phase, action, discover_inputs, action_check, action_lock, action_update, action_complete, action_rewinding, bzlmod, info, create_package, remote_execution, local_execution, scanner, local_parse, upload_time, remote_process_time, remote_queue, remote_setup, fetch, local_process_time, vfs_stat, vfs_dir, vfs_readlink, vfs_md5, vfs_xattr, vfs_delete, vfs_open, vfs_read, vfs_write, vfs_glob, vfs_vmfs_stat, vfs_vmfs_dir, vfs_vmfs_read, wait, thread_name, thread_sort_index, skyframe_eval, skyfunction, critical_path, critical_path_component, handle_gc_notification, local_action_counts, starlark_parser, starlark_user_fn, starlark_builtin_fn, starlark_user_compiled_fn, starlark_repository_fn, action_fs_staging, remote_cache_check, remote_download, remote_network, filesystem_traversal, worker_execution, worker_setup, worker_borrow, worker_working, worker_copying_outputs, credential_helper, conflict_check, dynamic_lock, repository_fetch, repository_vendor, repo_cache_gc_wait, spawn_log, rpc, skycache, wasm_load, wasm_exec or unknown> multiple uses are accumulatedSpecifies additional profile tasks to be included in the profile.
+Tags:
+bazel_monitoring
+
--[no]experimental_profile_include_primary_output default: "false"Includes the extra "out" attribute in action events that contains the exec path to the action's primary output.
+Tags:
+bazel_monitoring
+
--[no]experimental_profile_include_target_configuration default: "false"Includes target configuration hash in action events' JSON profile data.
+Tags:
+bazel_monitoring
+
--[no]experimental_profile_include_target_label default: "false"Includes target label in action events' JSON profile data.
+Tags:
+bazel_monitoring
+
--[no]experimental_record_metrics_for_all_mnemonics default: "false"Controls the output of BEP ActionSummary and BuildGraphMetrics, limiting the number of mnemonics in ActionData and number of entries reported in BuildGraphMetrics.AspectCount/RuleClassCount. By default the number of types is limited to the top 20, by number of executed actions for ActionData, and instances for RuleClass and Asepcts. Setting this option will write statistics for all mnemonics, rule classes and aspects.
+--[no]experimental_record_skyframe_metrics default: "false"Controls the output of BEP BuildGraphMetrics, including expensiveto compute skyframe metrics about Skykeys, RuleClasses and Aspects.With this flag set to false BuildGraphMetrics.rule_count and aspectfields will not be populated in the BEP.
+--[no]experimental_run_bep_event_include_residue default: "false"Whether to include the command-line residue in run build events which could contain the residue. By default, the residue is not included in run command build events that could contain the residue.
+Tags:
+affects_outputs
+
--[no]experimental_stream_log_file_uploads default: "false"Stream log file uploads directly to the remote storage rather than writing them to disk.
+Tags:
+affects_outputs
+
--experimental_workspace_rules_log_file=<a path> default: see descriptionLog certain Workspace Rules events into this file as delimited WorkspaceEvent protos.
+--[no]generate_json_trace_profile default: "auto"If enabled, Bazel profiles the build and writes a JSON-format profile into a file in the output base. View profile by loading into chrome://tracing. By default Bazel writes the profile for all build-like commands and query.
+Tags:
+bazel_monitoring
+
--[no]heap_dump_on_oom default: "false"Whether to manually output a heap dump if an OOM is thrown (including manual OOMs due to reaching --gc_thrashing_limits). The dump will be written to <output_base>/<invocation_id>.heapdump.hprof. This option effectively replaces -XX:+HeapDumpOnOutOfMemoryError, which has no effect for manual OOMs.
+Tags:
+bazel_monitoring
+
--jvm_heap_histogram_internal_object_pattern=<a valid Java regular expression> default: "jdk\.internal\.vm\.Filler.+"Regex for overriding the matching logic for JDK21+ JVM heap memory collection. We are relying on volatile internal G1 GC implemenation details to get a clean memory metric, this option allows us to adapt to changes in that internal implementation without having to wait for a binary release. Passed to JDK Matcher.find()
+--[no]legacy_important_outputs default: "false"Use this to suppress generation of the legacy important_outputs field in the TargetComplete event. important_outputs are required for Bazel to ResultStore/BTX integration.
+Tags:
+affects_outputs
+
--logging=<0 <= an integer <= 6> default: "3"The logging level.
+Tags:
+affects_outputs
+
--memory_profile=<a path> default: see descriptionIf set, write memory usage data to the specified file at phase ends and stable heap to master log at end of build.
+Tags:
+bazel_monitoring
+
--memory_profile_stable_heap_parameters=<integers, separated by a comma expected in pairs> default: "1,0"Tune memory profile's computation of stable heap at end of build. Should be and even number of integers separated by commas. In each pair the first integer is the number of GCs to perform. The second integer in each pair is the number of seconds to wait between GCs. Ex: 2,4,4,0 would 2 GCs with a 4sec pause, followed by 4 GCs with zero second pause
+Tags:
+bazel_monitoring
+
--profile=<a path> default: see descriptionIf set, profile Bazel and write data to the specified file. See https://bazel.build/advanced/performance/json-trace-profile for more information.
+Tags:
+bazel_monitoring
+
--profiles_to_retain=<an integer> default: "5"Number of profiles to retain in the output base. If there are more than this number of profiles in the output base, the oldest are deleted until the total is under the limit.
+Tags:
+bazel_monitoring
+
--[no]record_full_profiler_data default: "false"By default, Bazel profiler will record only aggregated data for fast but numerous events (such as statting the file). If this option is enabled, profiler will record each event - resulting in more precise profiling data but LARGE performance hit. Option only has effect if --profile used as well.
+Tags:
+bazel_monitoring
+
--[no]redirect_local_instrumentation_output_writes default: "false"If true and supported, instrumentation output is redirected to be written locally on a different machine than where bazel is running on.
+Tags:
+bazel_monitoring
+
--remote_print_execution_messages=<failure, success or all> default: "failure"Choose when to print remote execution messages. Valid values are failure, to print only on failures, success to print only on successes and all to print always.
Tags:
+terminal_output
+
--[no]slim_profile default: "true"Slims down the size of the JSON profile by merging events if the profile gets too large.
+Tags:
+bazel_monitoring
+
--starlark_cpu_profile=<a string> default: ""Writes into the specified file a pprof profile of CPU usage by all Starlark threads.
+Tags:
+bazel_monitoring
+
--tool_tag=<a string> default: ""A tool name to attribute this Bazel invocation to.
+Tags:
+affects_outputs, bazel_monitoring
+
--ui_event_filters=<Convert list of comma separated event kind to list of filters> multiple uses are accumulatedSpecifies which events to show in the UI. It is possible to add or remove events to the default ones using leading +/-, or override the default set completely with direct assignment. The set of supported event kinds include INFO, DEBUG, ERROR and more.
+Tags:
+terminal_output
+
--[no]write_command_log default: "false"Whether or not to write the command.log file
+Tags:
+bazel_monitoring
+
--downloader_config=<a path> default: see descriptionSpecify a file to configure the remote downloader with. This file consists of lines, each of which starts with a directive (allow, block or rewrite) followed by either a host name (for allow and block) or two patterns, one to match against, and one to use as a substitute URL, with back-references starting from $1. It is possible for multiple rewrite directives for the same URL to be given, and in this case multiple URLs will be returned.
--experimental_circuit_breaker_strategy=<failure> default: see descriptionSpecifies the strategy for the circuit breaker to use. Available strategies are "failure". On invalid value for the option the behavior same as the option is not set.
+Tags:
+execution
+
--experimental_remote_cache_compression_threshold=<an integer> default: "100"The minimum blob size required to compress/decompress with zstd. Ineffectual unless --remote_cache_compression is set.
+--[no]experimental_remote_cache_lease_extension default: "false"If set to true, Bazel will extend the lease for outputs of remote actions during the build by sending FindMissingBlobs calls periodically to remote cache. The frequency is based on the value of --experimental_remote_cache_ttl.
--experimental_remote_cache_ttl=<An immutable length of time.> default: "3h"The guaranteed minimal TTL of blobs in the remote cache after their digests are recently referenced e.g. by an ActionResult or FindMissingBlobs. Bazel does several optimizations based on the blobs' TTL e.g. doesn't repeatedly call GetActionResult in an incremental build. The value should be set slightly less than the real TTL since there is a gap between when the server returns the digests and when Bazel receives them.
+Tags:
+execution
+
--experimental_remote_capture_corrupted_outputs=<a path> default: see descriptionA path to a directory where the corrupted outputs will be captured to.
+--[no]experimental_remote_discard_merkle_trees default: "true"If set to true, discard in-memory copies of the input root's Merkle tree and associated input mappings during calls to GetActionResult() and Execute(). This reduces memory usage significantly, but does require Bazel to recompute them upon remote cache misses and retries.
+--experimental_remote_downloader=<a string> default: see descriptionA Remote Asset API endpoint URI, to be used as a remote download proxy. The supported schemas are grpc, grpcs (grpc with TLS enabled) and unix (local UNIX sockets). If no schema is provided Bazel will default to grpcs. See: https://github.com/bazelbuild/remote-apis/blob/master/build/bazel/remote/asset/v1/remote_asset.proto
+--[no]experimental_remote_downloader_local_fallback default: "false"Whether to fall back to the local downloader if remote downloader fails.
+--[no]experimental_remote_downloader_propagate_credentials default: "false"Whether to propagate credentials from netrc and credential helper to the remote downloader server. The server implementation needs to support the new http_header_url:<url-index>:<header-key> qualifier where the <url-index> is a 0-based position of the URL inside the FetchBlobRequest's uris field. The URL-specific headers should take precedence over the global headers.
--[no]experimental_remote_execution_keepalive default: "false"Whether to use keepalive for remote execution calls.
+--experimental_remote_failure_rate_threshold=<an integer in 0-100 range> default: "10"Sets the allowed number of failure rate in percentage for a specific time window after which it stops calling to the remote cache/executor. By default the value is 10. Setting this to 0 means no limitation.
+Tags:
+execution
+
--experimental_remote_failure_window_interval=<An immutable length of time.> default: "60s"The interval in which the failure rate of the remote requests are computed. On zero or negative value the failure duration is computed the whole duration of the execution.Following units can be used: Days (d), hours (h), minutes (m), seconds (s), and milliseconds (ms). If the unit is omitted, the value is interpreted as seconds.
+Tags:
+execution
+
--[no]experimental_remote_mark_tool_inputs default: "false"If set to true, Bazel will mark inputs as tool inputs for the remote executor. This can be used to implement remote persistent workers.
+--[no]experimental_remote_merkle_tree_cache default: "false"If set to true, Merkle tree calculations will be memoized to improve the remote cache hit checking speed. The memory foot print of the cache is controlled by --experimental_remote_merkle_tree_cache_size.
+--experimental_remote_merkle_tree_cache_size=<a long integer> default: "1000"The number of Merkle trees to memoize to improve the remote cache hit checking speed. Even though the cache is automatically pruned according to Java's handling of soft references, out-of-memory errors can occur if set too high. If set to 0 the cache size is unlimited. Optimal value varies depending on project's size. Default to 1000.
+--experimental_remote_output_service=<a string> default: see descriptionHOST or HOST:PORT of a remote output service endpoint. The supported schemas are grpc, grpcs (grpc with TLS enabled) and unix (local UNIX sockets). If no schema is provided Bazel will default to grpcs. Specify grpc:// or unix: schema to disable TLS.
+--experimental_remote_output_service_output_path_prefix=<a string> default: ""The path under which the contents of output directories managed by the --experimental_remote_output_service are placed. The actual output directory used by a build will be a descendant of this path and determined by the output service.
+--[no]experimental_remote_require_cached default: "false"If set to true, enforce that all actions that can run remotely are cached, or else fail the build. This is useful to troubleshoot non-determinism issues as it allows checking whether actions that should be cached are actually cached without spuriously injecting new results into the cache.
+--experimental_remote_scrubbing_config=<Converts to a Scrubber> default: see descriptionEnables remote cache key scrubbing with the supplied configuration file, which must be a protocol buffer in text format (see src/main/protobuf/remote_scrubbing.proto).
+This feature is intended to facilitate sharing a remote/disk cache between actions executing on different platforms but targeting the same platform. It should be used with extreme care, as improper settings may cause accidental sharing of cache entries and result in incorrect builds.
+Scrubbing does not affect how an action is executed, only how its remote/disk cache key is computed for the purpose of retrieving or storing an action result. Scrubbed actions are incompatible with remote execution, and will always be executed locally instead.
+Modifying the scrubbing configuration does not invalidate outputs present in the local filesystem or internal caches; a clean build is required to reexecute affected actions.
+In order to successfully use this feature, you likely want to set a custom --host_platform together with --experimental_platform_in_output_dir (to normalize output prefixes) and --incompatible_strict_action_env (to normalize environment variables).
+--[no]guard_against_concurrent_changes default: "lite"Set this to 'full' to enable checking the ctime of all input files of an action before uploading it to a remote cache. There may be cases where the Linux kernel delays writing of files, which could cause false positives. The default is 'lite', which only checks source files in the main repository. Setting this to 'off' disables all checks. This is not recommended, as the cache may be polluted when a source file is changed while an action that takes it as an input is executing.
+Tags:
+execution
+
--[no]remote_accept_cached default: "true"Whether to accept remotely cached action results.
+--remote_build_event_upload=<all or minimal> default: "minimal"If set to 'all', all local outputs referenced by BEP are uploaded to remote cache. +If set to 'minimal', local outputs referenced by BEP are not uploaded to the remote cache, except for files that are important to the consumers of BEP (e.g. test logs and timing profile). bytestream:// scheme is always used for the uri of files even if they are missing from remote cache. +Default to 'minimal'.
+--remote_bytestream_uri_prefix=<a string> default: see descriptionThe hostname and instance name to be used in bytestream:// URIs that are written into build event streams. This option can be set when builds are performed using a proxy, which causes the values of --remote_executor and --remote_instance_name to no longer correspond to the canonical name of the remote execution service. When not set, it will default to "${hostname}/${instance_name}".
+--remote_cache=<a string> default: see descriptionA URI of a caching endpoint. The supported schemas are http, https, grpc, grpcs (grpc with TLS enabled) and unix (local UNIX sockets). If no schema is provided Bazel will default to grpcs. Specify grpc://, http:// or unix: schema to disable TLS. See https://bazel.build/remote/caching
+--[no]remote_cache_async default: "true"If true, uploading of action results to a disk or remote cache will happen in the background instead of blocking the completion of an action. Some actions are incompatible with background uploads, and may still block even when this flag is set.
+--[no]remote_cache_compression default: "false"If enabled, compress/decompress cache blobs with zstd when their size is at least --experimental_remote_cache_compression_threshold.
+--remote_cache_header=<a 'name=value' assignment> multiple uses are accumulatedSpecify a header that will be included in cache requests: --remote_cache_header=Name=Value. Multiple headers can be passed by specifying the flag multiple times. Multiple values for the same name will be converted to a comma-separated list.
+--remote_default_exec_properties=<a 'name=value' assignment> multiple uses are accumulatedSet the default exec properties to be used as the remote execution platform if an execution platform does not already set exec_properties.
+Tags:
+affects_outputs
+
--remote_default_platform_properties=<a string> default: ""Set the default platform properties to be set for the remote execution API, if the execution platform does not already set remote_execution_properties. This value will also be used if the host platform is selected as the execution platform for remote execution.
+--remote_download_regex=<a valid Java regular expression> multiple uses are accumulatedForce remote build outputs whose path matches this pattern to be downloaded, irrespective of --remote_download_outputs. Multiple patterns may be specified by repeating this flag.
+Tags:
+affects_outputs
+
--remote_downloader_header=<a 'name=value' assignment> multiple uses are accumulatedSpecify a header that will be included in remote downloader requests: --remote_downloader_header=Name=Value. Multiple headers can be passed by specifying the flag multiple times. Multiple values for the same name will be converted to a comma-separated list.
+--remote_exec_header=<a 'name=value' assignment> multiple uses are accumulatedSpecify a header that will be included in execution requests: --remote_exec_header=Name=Value. Multiple headers can be passed by specifying the flag multiple times. Multiple values for the same name will be converted to a comma-separated list.
+--remote_execution_priority=<an integer> default: "0"The relative priority of actions to be executed remotely. The semantics of the particular priority values are server-dependent.
+--remote_executor=<a string> default: see descriptionHOST or HOST:PORT of a remote execution endpoint. The supported schemas are grpc, grpcs (grpc with TLS enabled) and unix (local UNIX sockets). If no schema is provided Bazel will default to grpcs. Specify grpc:// or unix: schema to disable TLS.
+--remote_grpc_log=<a path> default: see descriptionIf specified, a path to a file to log gRPC call related details. This log consists of a sequence of serialized com.google.devtools.build.lib.remote.logging.RemoteExecutionLog.LogEntry protobufs with each message prefixed by a varint denoting the size of the following serialized protobuf message, as performed by the method LogEntry.writeDelimitedTo(OutputStream).
+--remote_header=<a 'name=value' assignment> multiple uses are accumulatedSpecify a header that will be included in requests: --remote_header=Name=Value. Multiple headers can be passed by specifying the flag multiple times. Multiple values for the same name will be converted to a comma-separated list.
+--remote_instance_name=<a string> default: ""Value to pass as instance_name in the remote execution API.
+--[no]remote_local_fallback default: "false"Whether to fall back to standalone local execution strategy if remote execution fails.
+--remote_local_fallback_strategy=<a string> default: "local"Deprecated. See https://github.com/bazelbuild/bazel/issues/7480 for details.
+--remote_max_connections=<an integer> default: "100"Limit the max number of concurrent connections to remote cache/executor. By default the value is 100. Setting this to 0 means no limitation.
+For HTTP remote cache, one TCP connection could handle one request at one time, so Bazel could make up to --remote_max_connections concurrent requests.
+For gRPC remote cache/executor, one gRPC channel could usually handle 100+ concurrent requests, so Bazel could make around --remote_max_connections * 100 concurrent requests.
Tags:
+host_machine_resource_optimizations
+
--remote_proxy=<a string> default: see descriptionConnect to the remote cache through a proxy. Currently this flag can only be used to configure a Unix domain socket (unix:/path/to/socket).
+--remote_result_cache_priority=<an integer> default: "0"The relative priority of remote actions to be stored in remote cache. The semantics of the particular priority values are server-dependent.
+--remote_retries=<an integer> default: "5"The maximum number of attempts to retry a transient error. If set to 0, retries are disabled.
+--remote_retry_max_delay=<An immutable length of time.> default: "5s"The maximum backoff delay between remote retry attempts. Following units can be used: Days (d), hours (h), minutes (m), seconds (s), and milliseconds (ms). If the unit is omitted, the value is interpreted as seconds.
+--remote_timeout=<An immutable length of time.> default: "60s"The maximum amount of time to wait for remote execution and cache calls. For the REST cache, this is both the connect and the read timeout. Following units can be used: Days (d), hours (h), minutes (m), seconds (s), and milliseconds (ms). If the unit is omitted, the value is interpreted as seconds.
+--[no]remote_upload_local_results default: "true"Whether to upload locally executed action results to the remote cache if the remote cache supports it and the user is authorized to do so.
+--[no]remote_verify_downloads default: "true"If set to true, Bazel will compute the hash sum of all remote downloads and discard the remotely cached values if they don't match the expected value.
+--build_metadata=<a 'name=value' assignment> multiple uses are accumulatedCustom key-value string pairs to supply in a build event.
+Tags:
+terminal_output
+
--color=<yes, no or auto> default: "auto"Use terminal controls to colorize output.
+--config=<a string> multiple uses are accumulatedSelects additional config sections from the rc files; for every <command>, it also pulls in the options from <command>:<config> if such a section exists; if this section doesn't exist in any .rc file, Blaze fails with an error. The config sections and flag combinations they are equivalent to are located in the tools/*.blazerc config files.
+--credential_helper=<Path to a credential helper. It may be absolute, relative to the PATH environment variable, or %workspace%-relative. The path be optionally prefixed by a scope followed by an '='. The scope is a domain name, optionally with a single leading '*' wildcard component. A helper applies to URIs matching its scope, with more specific scopes preferred. If a helper has no scope, it applies to every URI.> multiple uses are accumulatedConfigures a credential helper conforming to the <a href="https://github.com/EngFlow/credential-helper-spec">Credential Helper Specification</a> to use for retrieving authorization credentials for repository fetching, remote caching and execution, and the build event service.
+Credentials supplied by a helper take precedence over credentials supplied by --google_default_credentials, --google_credentials, a .netrc file, or the auth parameter to repository_ctx.download() and repository_ctx.download_and_extract().
May be specified multiple times to set up multiple helpers.
+See https://blog.engflow.com/2023/10/09/configuring-bazels-credential-helper/ for instructions.
+--credential_helper_cache_duration=<An immutable length of time.> default: "30m"How long to cache credentials for if the credential helper doesn't return an expiration time. Changing the value of this flag clears the cache.
+--credential_helper_timeout=<An immutable length of time.> default: "10s"Configures the timeout for a credential helper.
+Credential helpers failing to respond within this timeout will fail the invocation.
+--curses=<yes, no or auto> default: "auto"Use terminal cursor controls to minimize scrolling output.
+--disk_cache=<a path> default: see descriptionA path to a directory where Bazel can read and write actions and action outputs. If the directory does not exist, it will be created.
+--[no]enable_platform_specific_config default: "true"If true, Bazel picks up host-OS-specific config lines from bazelrc files. For example, if the host OS is Linux and you run bazel build, Bazel picks up lines starting with build:linux. Supported OS identifiers are linux, macos, windows, freebsd, and openbsd. Enabling this flag is equivalent to using --config=linux on Linux, --config=windows on Windows, etc.
+--experimental_action_cache_gc_idle_delay=<An immutable length of time.> default: "5m"How long the server must remain idle before a garbage collection of the action cache is attempted. Ineffectual unless --experimental_action_cache_gc_max_age is nonzero.
+Tags:
+host_machine_resource_optimizations
+
--experimental_action_cache_gc_max_age=<An immutable length of time.> default: "0"If set to a nonzero value, the action cache will be periodically garbage collected to remove entries older than this age. Garbage collection occurs in the background once the server has become idle, as determined by the --experimental_action_cache_gc_idle_delay and --experimental_action_cache_gc_threshold flags.
+Tags:
+host_machine_resource_optimizations
+
--experimental_action_cache_gc_threshold=<an integer in 0-100 range> default: "10"The percentage of stale action cache entries required for garbage collection to be triggered. Ineffectual unless --experimental_action_cache_gc_max_age is nonzero.
+Tags:
+host_machine_resource_optimizations
+
--experimental_disk_cache_gc_idle_delay=<An immutable length of time.> default: "5m"How long the server must remain idle before a garbage collection of the disk cache occurs. To specify the garbage collection policy, set --experimental_disk_cache_gc_max_size and/or --experimental_disk_cache_gc_max_age.
+--experimental_disk_cache_gc_max_age=<An immutable length of time.> default: "0"If set to a positive value, the disk cache will be periodically garbage collected to remove entries older than this age. If set in conjunction with --experimental_disk_cache_gc_max_size, both criteria are applied. Garbage collection occurrs in the background once the server has become idle, as determined by the --experimental_disk_cache_gc_idle_delay flag.
+--experimental_disk_cache_gc_max_size=<a size in bytes, optionally followed by a K, M, G or T multiplier> default: "0"If set to a positive value, the disk cache will be periodically garbage collected to stay under this size. If set in conjunction with --experimental_disk_cache_gc_max_age, both criteria are applied. Garbage collection occurrs in the background once the server has become idle, as determined by the --experimental_disk_cache_gc_idle_delay flag.
+--[no]experimental_enable_thread_dump default: "false"Whether to enable thread dumps. If true, Bazel will dump the state of all threads (including virtual threads) to a file every --experimental_thread_dump_interval, or after action execution being inactive for --experimental_thread_dump_action_execution_inactivity_duration. The dumps will be written to the <output_base>/server/thread_dumps/ directory.
+Tags:
+bazel_monitoring
+
--experimental_install_base_gc_max_age=<An immutable length of time.> default: "30d"How long an install base must go unused before it's eligible for garbage collection. If nonzero, the server will attempt to garbage collect other install bases when idle.
+Tags:
+host_machine_resource_optimizations
+
--[no]experimental_rule_extension_api default: "true"Enable experimental rule extension API and subrule APIs
+Tags:
+loading_and_analysis, experimental
+
--experimental_thread_dump_action_execution_inactivity_duration=<An immutable length of time.> default: "0"Dump the threads when action execution being inactive for this duration. If zero, no thread dumps are written for action execution being inactive.
+Tags:
+bazel_monitoring
+
--experimental_thread_dump_interval=<An immutable length of time.> default: "0"How often to dump the threads periodically. If zero, no thread dumps are written periodically.
+Tags:
+bazel_monitoring
+
--[no]experimental_windows_watchfs default: "false"If true, experimental Windows support for --watchfs is enabled. Otherwise --watchfsis a non-op on Windows. Make sure to also enable --watchfs.
+--google_auth_scopes=<comma-separated list of options> default: "https://www.googleapis.com/auth/cloud-platform"A comma-separated list of Google Cloud authentication scopes.
+--google_credentials=<a string> default: see descriptionSpecifies the file to get authentication credentials from. See https://cloud.google.com/docs/authentication for details.
+--[no]google_default_credentials default: "false"Whether to use 'Google Application Default Credentials' for authentication. See https://cloud.google.com/docs/authentication for details. Disabled by default.
+--grpc_keepalive_time=<An immutable length of time.> default: see descriptionConfigures keep-alive pings for outgoing gRPC connections. If this is set, then Bazel sends pings after this much time of no read operations on the connection, but only if there is at least one pending gRPC call. Times are treated as second granularity; it is an error to set a value less than one second. By default, keep-alive pings are disabled. You should coordinate with the service owner before enabling this setting. For example to set a value of 30 seconds to this flag, it should be done as this --grpc_keepalive_time=30s
+--grpc_keepalive_timeout=<An immutable length of time.> default: "20s"Configures a keep-alive timeout for outgoing gRPC connections. If keep-alive pings are enabled with --grpc_keepalive_time, then Bazel times out a connection if it does not receive a ping reply after this much time. Times are treated as second granularity; it is an error to set a value less than one second. If keep-alive pings are disabled, then this setting is ignored.
+--[no]incompatible_disable_non_executable_java_binary default: "false"If true, java_binary is always executable. create_executable attribute is removed.
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]incompatible_repo_env_ignores_action_env default: "true"If true, <code>--action_env=NAME=VALUE</code> will no longer affect repository rule and module extension environments.
+Tags:
+loading_and_analysis, incompatible_change
+
--inject_repository=<an equals-separated mapping of repository name to path> multiple uses are accumulatedAdds a new repository with a local path in the form of <repository name>=<path>. This only takes effect with --enable_bzlmod and is equivalent to adding a corresponding local_repository to the root module's MODULE.bazel file via use_repo_rule. If the given path is an absolute path, it will be used as it is. If the given path is a relative path, it is relative to the current working directory. If the given path starts with '%workspace%', it is relative to the workspace root, which is the output of bazel info workspace. If the given path is empty, then remove any previous injections.
--invocation_id=<a UUID> default: ""Unique identifier, in UUID format, for the command being run. If explicitly specified uniqueness must be ensured by the caller. The UUID is printed to stderr, the BEP and remote execution protocol.
+Tags:
+bazel_monitoring, bazel_internal_configuration
+
--override_repository=<an equals-separated mapping of repository name to path> multiple uses are accumulatedOverride a repository with a local path in the form of <repository name>=<path>. If the given path is an absolute path, it will be used as it is. If the given path is a relative path, it is relative to the current working directory. If the given path starts with '%workspace%, it is relative to the workspace root, which is the output of bazel info workspace. If the given path is empty, then remove any previous overrides.
--[no]progress_in_terminal_title default: "false"Show the command progress in the terminal title. Useful to see what bazel is doing when having multiple terminal tabs.
+--[no]show_progress default: "true"Display progress messages during a build.
+--show_progress_rate_limit=<a double> default: "0.2"Minimum number of seconds between progress messages in the output.
+--[no]show_timestamps default: "false"Include timestamps in messages
+--tls_certificate=<a string> default: see descriptionSpecify a path to a TLS certificate that is trusted to sign server certificates.
+--tls_client_certificate=<a string> default: see descriptionSpecify the TLS client certificate to use; you also need to provide a client key to enable client authentication.
+--tls_client_key=<a string> default: see descriptionSpecify the TLS client key to use; you also need to provide a client certificate to enable client authentication.
+--ui_actions_shown=<an integer> default: "8"Number of concurrent actions shown in the detailed progress bar; each action is shown on a separate line. The progress bar always shows at least one one, all numbers less than 1 are mapped to 1.
+Tags:
+terminal_output
+
--[no]watchfs default: "false"On Linux/macOS: If true, bazel tries to use the operating system's file watch service for local changes instead of scanning every file for a change. On Windows: this flag currently is a non-op but can be enabled in conjunction with --experimental_windows_watchfs. On any OS: The behavior is undefined if your workspace is on a network file system, and files are edited on a remote machine.
+Inherits all options from build.
+ +--aspect_deps=<off, conservative or precise> default: "conservative"How to resolve aspect dependencies when the output format is one of {xml,proto,record}. 'off' means no aspect dependencies are resolved, 'conservative' (the default) means all declared aspect dependencies are added regardless of whether they are given the rule class of direct dependencies, 'precise' means that only those aspects are added that are possibly active given the rule class of the direct dependencies. Note that precise mode requires loading other packages to evaluate a single target thus making it slower than the other modes. Also note that even precise mode is not completely precise: the decision whether to compute an aspect is decided in the analysis phase, which is not run during 'bazel query'.
+Tags:
+build_file_semantics
+
--[no]consistent_labels default: "false"If enabled, every query command emits labels as if by the Starlark <code>str</code> function applied to a <code>Label</code> instance. This is useful for tools that need to match the output of different query commands and/or labels emitted by rules. If not enabled, output formatters are free to emit apparent repository names (relative to the main repository) instead to make the output more readable.
+Tags:
+terminal_output
+
--[no]experimental_explicit_aspects default: "false"aquery, cquery: whether to include aspect-generated actions in the output. query: no-op (aspects are always followed).
+Tags:
+terminal_output
+
--[no]graph:factored default: "true"If true, then the graph will be emitted 'factored', i.e. topologically-equivalent nodes will be merged together and their labels concatenated. This option is only applicable to --output=graph.
+Tags:
+terminal_output
+
--graph:node_limit=<an integer> default: "512"The maximum length of the label string for a graph node in the output. Longer labels will be truncated; -1 means no truncation. This option is only applicable to --output=graph.
+Tags:
+terminal_output
+
--[no]implicit_deps default: "true"If enabled, implicit dependencies will be included in the dependency graph over which the query operates. An implicit dependency is one that is not explicitly specified in the BUILD file but added by bazel. For cquery, this option controls filtering resolved toolchains.
+Tags:
+build_file_semantics
+
--[no]include_artifacts default: "true"Includes names of the action inputs and outputs in the output (potentially large).
+Tags:
+terminal_output
+
--[no]include_aspects default: "true"aquery, cquery: whether to include aspect-generated actions in the output. query: no-op (aspects are always followed).
+Tags:
+terminal_output
+
--[no]include_commandline default: "true"Includes the content of the action command lines in the output (potentially large).
+Tags:
+terminal_output
+
--[no]include_file_write_contents default: "false"Include the file contents for the FileWrite, SourceSymlinkManifest, and RepoMappingManifest actions (potentially large).
+Tags:
+terminal_output
+
--[no]include_param_files default: "false"Include the content of the param files used in the command (potentially large). Note: Enabling this flag will automatically enable the --include_commandline flag.
+Tags:
+terminal_output
+
--[no]include_pruned_inputs default: "true"Includes action inputs that were pruned during action execution. Only affects actions that discover inputs and have been executed in a previous invocation. Only takes effect if --include_artifacts is also set.
+Tags:
+terminal_output
+
--[no]incompatible_package_group_includes_double_slash default: "true"If enabled, when outputting package_group's packages attribute, the leading // will not be omitted.
Tags:
+terminal_output, incompatible_change
+
--[no]infer_universe_scope default: "false"If set and --universe_scope is unset, then a value of --universe_scope will be inferred as the list of unique target patterns in the query expression. Note that the --universe_scope value inferred for a query expression that uses universe-scoped functions (e.g.allrdeps) may not be what you want, so you should use this option only if you know what you are doing. See https://bazel.build/reference/query#sky-query for details and examples. If --universe_scope is set, then this option's value is ignored. Note: this option applies only to query (i.e. not cquery).
Tags:
+loading_and_analysis
+
--[no]line_terminator_null default: "false"Whether each format is terminated with \0 instead of newline.
+Tags:
+terminal_output
+
--[no]nodep_deps default: "true"If enabled, deps from "nodep" attributes will be included in the dependency graph over which the query operates. A common example of a "nodep" attribute is "visibility". Run and parse the output of info build-language to learn about all the "nodep" attributes in the build language.
Tags:
+build_file_semantics
+
--output=<a string> default: "text"The format in which the aquery results should be printed. Allowed values for aquery are: text, textproto, proto, streamed_proto, jsonproto.
+Tags:
+terminal_output
+
--output_file=<a string> default: ""When specified, query results will be written directly to this file, and nothing will be printed to Bazel's standard output stream (stdout). In benchmarks, this is generally faster than <code>bazel query > file</code>.
+Tags:
+terminal_output
+
--[no]proto:default_values default: "true"If true, attributes whose value is not explicitly specified in the BUILD file are included; otherwise they are omitted. This option is applicable to --output=proto
+Tags:
+terminal_output
+
--[no]proto:definition_stack default: "false"Populate the definition_stack proto field, which records for each rule instance the Starlark call stack at the moment the rule's class was defined.
+Tags:
+terminal_output
+
--[no]proto:flatten_selects default: "true"If enabled, configurable attributes created by select() are flattened. For list types the flattened representation is a list containing each value of the select map exactly once. Scalar types are flattened to null.
+Tags:
+build_file_semantics
+
--[no]proto:include_attribute_source_aspects default: "false"Populate the source_aspect_name proto field of each Attribute with the source aspect that the attribute came from (empty string if it did not).
+Tags:
+terminal_output
+
--[no]proto:include_starlark_rule_env default: "true"Use the starlark environment in the value of the generated $internal_attr_hash attribute. This ensures that the starlark rule definition (and its transitive imports) are part of this identifier.
+Tags:
+terminal_output
+
--[no]proto:include_synthetic_attribute_hash default: "false"Whether or not to calculate and populate the $internal_attr_hash attribute.
+Tags:
+terminal_output
+
--[no]proto:instantiation_stack default: "false"Populate the instantiation call stack of each rule. Note that this requires the stack to be present
+Tags:
+terminal_output
+
--[no]proto:locations default: "true"Whether to output location information in proto output at all.
+Tags:
+terminal_output
+
--proto:output_rule_attrs=<comma-separated list of options> default: "all"Comma separated list of attributes to include in output. Defaults to all attributes. Set to empty string to not output any attribute. This option is applicable to --output=proto.
+Tags:
+terminal_output
+
--[no]proto:rule_classes default: "false"Populate the rule_class_key field of each rule; and for the first rule with a given rule_class_key, also populate its rule_class_info proto field. The rule_class_key field uniquely identifies a rule class, and the rule_class_info field is a Stardoc-format rule class API definition.
+Tags:
+terminal_output
+
--[no]proto:rule_inputs_and_outputs default: "true"Whether or not to populate the rule_input and rule_output fields.
+Tags:
+terminal_output
+
--query_file=<a string> default: ""If set, query will read the query from the file named here, rather than on the command line. It is an error to specify a file here as well as a command-line query.
+Tags:
+changes_inputs
+
--[no]relative_locations default: "false"If true, the location of BUILD files in xml and proto outputs will be relative. By default, the location output is an absolute path and will not be consistent across machines. You can set this option to true to have a consistent result across machines.
+Tags:
+terminal_output
+
--[no]skyframe_state default: "false"Without performing extra analysis, dump the current Action Graph from Skyframe. Note: Specifying a target with --skyframe_state is currently not supported. This flag is only available with --output=proto or --output=textproto.
+Tags:
+terminal_output
+
--[no]tool_deps default: "true"Query: If disabled, dependencies on 'exec configuration' will not be included in the dependency graph over which the query operates. An 'exec configuration' dependency edge, such as the one from any 'proto_library' rule to the Protocol Compiler, usually points to a tool executed during the build rather than a part of the same 'target' program. +Cquery: If disabled, filters out all configured targets which cross an execution transition from the top-level target that discovered this configured target. That means if the top-level target is in the target configuration, only configured targets also in the target configuration will be returned. If the top-level target is in the exec configuration, only exec configured targets will be returned. This option will NOT exclude resolved toolchains.
+Tags:
+build_file_semantics
+
--universe_scope=<comma-separated list of options> default: ""A comma-separated set of target patterns (additive and subtractive). The query may be performed in the universe defined by the transitive closure of the specified targets. This option is used for the query and cquery commands. +For cquery, the input to this option is the targets all answers are built under and so this option may affect configurations and transitions. If this option is not specified, the top-level targets are assumed to be the targets parsed from the query expression. Note: For cquery, not specifying this option may cause the build to break if targets parsed from the query expression are not buildable with top-level options.
+Tags:
+loading_and_analysis
+
--[no]experimental_persistent_aar_extractor default: "false"Enable persistent aar extractor by using workers.
+Tags:
+execution, experimental
+
--[no]experimental_remotable_source_manifests default: "false"Whether to make source manifest actions remotable
+Tags:
+loading_and_analysis, execution, experimental
+
--[no]experimental_split_coverage_postprocessing default: "false"If true, then Bazel will run coverage postprocessing for test in a new spawn.
+Tags:
+execution, experimental
+
--[no]experimental_strict_fileset_output default: "false"If this option is enabled, filesets will treat all output artifacts as regular files. They will not traverse directories or be sensitive to symlinks.
+Tags:
+execution, experimental
+
--[no]incompatible_modify_execution_info_additive default: "true"When enabled, passing multiple --modify_execution_info flags is additive. When disabled, only the last flag is taken into account.
+Tags:
+execution, affects_outputs, loading_and_analysis, incompatible_change
+
--modify_execution_info=<regex=[+-]key,regex=[+-]key,...> multiple uses are accumulatedAdd or remove keys from an action's execution info based on action mnemonic. Applies only to actions which support execution info. Many common actions support execution info, e.g. Genrule, CppCompile, Javac, StarlarkAction, TestRunner. When specifying multiple values, order matters because many regexes may apply to the same mnemonic.
+Syntax: "regex=[+-]key,regex=[+-]key,...".
+Examples: +'.=+x,.=-y,.=+z' adds 'x' and 'z' to, and removes 'y' from, the execution info for all actions. +'Genrule=+requires-x' adds 'requires-x' to the execution info for all Genrule actions. +'(?!Genrule).=-requires-x' removes 'requires-x' from the execution info for all non-Genrule actions.
+Tags:
+execution, affects_outputs, loading_and_analysis
+
--persistent_android_dex_desugarEnable persistent Android dex and desugar actions by using workers.
+Expands to:
+
--internal_persistent_android_dex_desugar
+
--strategy=Desugar=worker
+
--strategy=DexBuilder=worker
+
Tags:
+host_machine_resource_optimizations, execution
+
--persistent_android_resource_processorEnable persistent Android resource processor by using workers.
+Expands to:
+
--internal_persistent_busybox_tools
+
--strategy=AaptPackage=worker
+
--strategy=AndroidResourceParser=worker
+
--strategy=AndroidResourceValidator=worker
+
--strategy=AndroidResourceCompiler=worker
+
--strategy=RClassGenerator=worker
+
--strategy=AndroidResourceLink=worker
+
--strategy=AndroidAapt2=worker
+
--strategy=AndroidAssetMerger=worker
+
--strategy=AndroidResourceMerger=worker
+
--strategy=AndroidCompiledResourceMerger=worker
+
--strategy=ManifestMerger=worker
+
--strategy=AndroidManifestMerger=worker
+
--strategy=Aapt2Optimize=worker
+
--strategy=AARGenerator=worker
+
--strategy=ProcessDatabinding=worker
+
--strategy=GenerateDataBindingBaseClasses=worker
+
Tags:
+host_machine_resource_optimizations, execution
+
--persistent_multiplex_android_dex_desugarEnable persistent multiplexed Android dex and desugar actions by using workers.
+Expands to:
+
--persistent_android_dex_desugar
+
--internal_persistent_multiplex_android_dex_desugar
+
Tags:
+host_machine_resource_optimizations, execution
+
--persistent_multiplex_android_resource_processorEnable persistent multiplexed Android resource processor by using workers.
+Expands to:
+
--persistent_android_resource_processor
+
--modify_execution_info=AaptPackage=+supports-multiplex-workers
+
--modify_execution_info=AndroidResourceParser=+supports-multiplex-workers
+
--modify_execution_info=AndroidResourceValidator=+supports-multiplex-workers
+
--modify_execution_info=AndroidResourceCompiler=+supports-multiplex-workers
+
--modify_execution_info=RClassGenerator=+supports-multiplex-workers
+
--modify_execution_info=AndroidResourceLink=+supports-multiplex-workers
+
--modify_execution_info=AndroidAapt2=+supports-multiplex-workers
+
--modify_execution_info=AndroidAssetMerger=+supports-multiplex-workers
+
--modify_execution_info=AndroidResourceMerger=+supports-multiplex-workers
+
--modify_execution_info=AndroidCompiledResourceMerger=+supports-multiplex-workers
+
--modify_execution_info=ManifestMerger=+supports-multiplex-workers
+
--modify_execution_info=AndroidManifestMerger=+supports-multiplex-workers
+
--modify_execution_info=Aapt2Optimize=+supports-multiplex-workers
+
--modify_execution_info=AARGenerator=+supports-multiplex-workers
+
Tags:
+host_machine_resource_optimizations, execution
+
--persistent_multiplex_android_toolsEnable persistent and multiplexed Android tools (dexing, desugaring, resource processing).
+Expands to:
+
--internal_persistent_multiplex_busybox_tools
+
--persistent_multiplex_android_resource_processor
+
--persistent_multiplex_android_dex_desugar
+
Tags:
+host_machine_resource_optimizations, execution
+
--[no]use_target_platform_for_tests default: "false"If true, use the target platform for running tests rather than the test exec group.
+Tags:
+execution
+
--android_compiler=<a string> default: see descriptionThe Android target compiler.
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state
+
--android_manifest_merger=<legacy, android or force_android> default: "android"Selects the manifest merger to use for android_binary rules. Flag to help the transition to the Android manifest merger from the legacy merger.
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state
+
--android_platforms=<a build target label> default: ""Sets the platforms that android_binary targets use. If multiple platforms are specified, then the binary is a fat APKs, which contains native binaries for each specified target platform.
+Tags:
+changes_inputs, loading_and_analysis, loses_incremental_state
+
--cc_output_directory_tag=<a string> default: ""Specifies a suffix to be added to the configuration directory.
+Tags:
+affects_outputs
+
--compiler=<a string> default: see descriptionThe C++ compiler to use for compiling the target.
+Tags:
+loading_and_analysis, execution
+
--coverage_output_generator=<a build target label> default: "@bazel_tools//tools/test:lcov_merger"Location of the binary that is used to postprocess raw coverage reports. This must be a binary target. Defaults to '//tools/test:lcov_merger'.
+Tags:
+changes_inputs, affects_outputs, loading_and_analysis
+
--coverage_report_generator=<a build target label> default: "@bazel_tools//tools/test:coverage_report_generator"Location of the binary that is used to generate coverage reports. This must be a binary target. Defaults to '//tools/test:coverage_report_generator'.
+Tags:
+changes_inputs, affects_outputs, loading_and_analysis
+
--coverage_support=<a build target label> default: "@bazel_tools//tools/test:coverage_support"Location of support files that are required on the inputs of every test action that collects code coverage. Defaults to '//tools/test:coverage_support'.
+Tags:
+changes_inputs, affects_outputs, loading_and_analysis
+
--custom_malloc=<a build target label> default: see descriptionSpecifies a custom malloc implementation. This setting overrides malloc attributes in build rules.
+Tags:
+changes_inputs, affects_outputs
+
--[no]experimental_include_xcode_execution_requirements default: "false"If set, add a "requires-xcode:{version}" execution requirement to every Xcode action. If the Xcode version has a hyphenated label, also add a "requires-xcode-label:{version_label}" execution requirement.
+Tags:
+loses_incremental_state, loading_and_analysis, execution, experimental
+
--[no]experimental_prefer_mutual_xcode default: "true"If true, use the most recent Xcode that is available both locally and remotely. If false, or if there are no mutual available versions, use the local Xcode version selected via xcode-select.
+Tags:
+loses_incremental_state, experimental
+
--extra_execution_platforms=<comma-separated list of options> default: ""The platforms that are available as execution platforms to run actions. Platforms can be specified by exact target, or as a target pattern. These platforms will be considered before those declared in the WORKSPACE file by register_execution_platforms(). This option may only be set once; later instances will override earlier flag settings.
+Tags:
+execution
+
--extra_toolchains=<comma-separated list of options> multiple uses are accumulatedThe toolchain rules to be considered during toolchain resolution. Toolchains can be specified by exact target, or as a target pattern. These toolchains will be considered before those declared in the WORKSPACE file by register_toolchains().
+Tags:
+affects_outputs, changes_inputs, loading_and_analysis
+
--grte_top=<a label> default: see descriptionA label to a checked-in libc library. The default value is selected by the crosstool toolchain, and you almost never need to override it.
+Tags:
+action_command_lines, affects_outputs
+
--host_compiler=<a string> default: see descriptionNo-op flag. Will be removed in a future release.
+Tags:
+loading_and_analysis, execution
+
--host_grte_top=<a label> default: see descriptionIf specified, this setting overrides the libc top-level directory (--grte_top) for the exec configuration.
+Tags:
+action_command_lines, affects_outputs
+
--host_platform=<a build target label> default: "@bazel_tools//tools:host_platform"The label of a platform rule that describes the host system.
+Tags:
+affects_outputs, changes_inputs, loading_and_analysis
+
--[no]incompatible_bazel_test_exec_run_under default: "true"If enabled, "bazel test --run_under=//:runner" builds "//:runner" in the exec configuration. If disabled, it builds "//:runner" in the target configuration. Bazel executes tests on exec machines, so the former is more correct. This doesn't affect "bazel run", which always builds "`--run_under=//foo" in the target configuration.
+Tags:
+affects_outputs, incompatible_change
+
--[no]incompatible_builtin_objc_strip_action default: "true"Whether to emit a strip action as part of objc linking.
+Tags:
+action_command_lines, incompatible_change
+
--[no]incompatible_dont_enable_host_nonhost_crosstool_features default: "true"If true, Bazel will not enable 'host' and 'nonhost' features in the c++ toolchain (see https://github.com/bazelbuild/bazel/issues/7407 for more information).
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]incompatible_enable_apple_toolchain_resolution default: "false"Use toolchain resolution to select the Apple SDK for apple rules (Starlark and native)
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]incompatible_remove_legacy_whole_archive default: "true"If true, Bazel will not link library dependencies as whole archive by default (see https://github.com/bazelbuild/bazel/issues/7362 for migration instructions).
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]incompatible_strip_executable_safely default: "false"If true, strip action for executables will use flag -x, which does not break dynamic symbol resolution.
+Tags:
+action_command_lines, incompatible_change
+
Use interface shared objects if supported by the toolchain. All ELF toolchains currently support this setting.
+Tags:
+loading_and_analysis, affects_outputs, affects_outputs
+
--ios_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionSpecifies the version of the iOS SDK to use to build iOS applications. If unspecified, uses the default iOS SDK version from 'xcode_version'.
+Tags:
+loses_incremental_state
+
--macos_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionSpecifies the version of the macOS SDK to use to build macOS applications. If unspecified, uses the default macOS SDK version from 'xcode_version'.
+Tags:
+loses_incremental_state
+
--minimum_os_version=<a string> default: see descriptionThe minimum OS version which your compilation targets.
+Tags:
+loading_and_analysis, affects_outputs
+
--platform_mappings=<a main workspace-relative path> default: ""The location of a mapping file that describes which platform to use if none is set or which flags to set when a platform already exists. Must be relative to the main workspace root. Defaults to 'platform_mappings' (a file directly under the workspace root).
+Tags:
+affects_outputs, changes_inputs, loading_and_analysis, non_configurable
+
--platforms=<a build target label> default: ""The labels of the platform rules describing the target platforms for the current command.
+Tags:
+affects_outputs, changes_inputs, loading_and_analysis
+
--python_path=<a string> default: see descriptionThe absolute path of the Python interpreter invoked to run Python targets on the target platform. Deprecated; disabled by --incompatible_use_python_toolchains.
+Tags:
+loading_and_analysis, affects_outputs
+
--tvos_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionSpecifies the version of the tvOS SDK to use to build tvOS applications. If unspecified, uses the default tvOS SDK version from 'xcode_version'.
+Tags:
+loses_incremental_state
+
--[no]use_platforms_in_apple_crosstool_transition default: "false"Makes apple_crosstool_transition fall back to using the value of --platforms flag instead of legacy --cpu when needed.
Tags:
+loading_and_analysis
+
--watchos_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionSpecifies the version of the watchOS SDK to use to build watchOS applications. If unspecified, uses the default watchOS SDK version from 'xcode_version'.
+Tags:
+loses_incremental_state
+
--xcode_version=<a string> default: see descriptionIf specified, uses Xcode of the given version for relevant build actions. If unspecified, uses the executor default version of Xcode.
+Tags:
+loses_incremental_state
+
--xcode_version_config=<a build target label> default: "@bazel_tools//tools/cpp:host_xcodes"The label of the xcode_config rule to be used for selecting the Xcode version in the build configuration.
+Tags:
+loses_incremental_state, loading_and_analysis
+
--[no]apple_generate_dsym default: "false"Whether to generate debug symbol(.dSYM) file(s).
+Tags:
+affects_outputs, action_command_lines
+
--[no]build_runfile_links default: "true"If true, build runfiles symlink forests for all targets. If false, write them only when required by a local action, test or run command.
+Tags:
+affects_outputs
+
--[no]build_runfile_manifests default: "true"If true, write runfiles manifests for all targets. If false, omit them. Local tests will fail to run when false.
+Tags:
+affects_outputs
+
--[no]build_test_dwp default: "false"If enabled, when building C++ tests statically and with fission the .dwp file for the test binary will be automatically built as well.
+Tags:
+loading_and_analysis, affects_outputs
+
--cc_proto_library_header_suffixes=<comma-separated set of options> default: ".pb.h"Sets the suffixes of header files that a cc_proto_library creates.
+Tags:
+affects_outputs, loading_and_analysis
+
--cc_proto_library_source_suffixes=<comma-separated set of options> default: ".pb.cc"Sets the suffixes of source files that a cc_proto_library creates.
+Tags:
+affects_outputs, loading_and_analysis
+
--[no]experimental_proto_descriptor_sets_include_source_info default: "false"Run extra actions for alternative Java api versions in a proto_library.
+Tags:
+affects_outputs, loading_and_analysis, experimental
+
--[no]experimental_save_feature_state default: "false"Save the state of enabled and requested feautres as an output of compilation.
+Tags:
+affects_outputs, experimental
+
--fission=<a set of compilation modes> default: "no"Specifies which compilation modes use fission for C++ compilations and links. May be any combination of {'fastbuild', 'dbg', 'opt'} or the special values 'yes' to enable all modes and 'no' to disable all modes.
+Tags:
+loading_and_analysis, action_command_lines, affects_outputs
+
--[no]incompatible_always_include_files_in_data default: "true"If true, native rules add <code>DefaultInfo.files</code> of data dependencies to their runfiles, which matches the recommended behavior for Starlark rules (https://bazel.build/extending/rules#runfiles_features_to_avoid).
+Tags:
+affects_outputs, incompatible_change
+
--[no]incompatible_compact_repo_mapping_manifest default: "false"If enabled, the <binary>.repo_mapping file emits a module extension's repo mapping only once instead of once for each repo generated by the extension that contributes runfiles.
+Tags:
+affects_outputs, incompatible_change
+
--incompatible_disable_select_on=<comma-separated set of options> default: ""List of flags for which the use in select() is disabled.
+Tags:
+loading_and_analysis, incompatible_change, non_configurable
+
--[no]incompatible_filegroup_runfiles_for_data default: "true"If true, runfiles of targets listed in the srcs attribute are available to targets that consume the filegroup as a data dependency.
+Tags:
+incompatible_change
+
--[no]objc_generate_linkmap default: "false"Specifies whether to generate a linkmap file.
+Tags:
+affects_outputs
+
--[no]save_temps default: "false"If set, temporary outputs from gcc will be saved. These include .s files (assembler code), .i files (preprocessed C) and .ii files (preprocessed C++).
+Tags:
+affects_outputs
+
--action_env=<a 'name[=value]' assignment with an optional value part or the special syntax '=name' to unset a variable> multiple uses are accumulatedSpecifies the set of environment variables available to actions with target configuration. Variables can be either specified by <code>name</code>, in which case +the value will be taken from the invocation environment, by the <code>name=value</code> pair which sets the value independent of the invocation environment, or by <code>=name</code>, which unsets the variable of that name. This option can be used multiple times; for options given for the same variable, the latest wins, options for different variables accumulate. +<br> +Note that unless <code>--incompatible_repo_env_ignores_action_env</code> is true, all <code>name=value</code> pairs will be available to repository rules.
+Tags:
+action_command_lines
+
--allowed_cpu_values=<comma-separated set of options> default: ""Allowed values for the --cpu flag.
+Tags:
+changes_inputs, affects_outputs
+
--[no]android_databinding_use_androidx default: "true"Generate AndroidX-compatible data-binding files. This is only used with databinding v2. This flag is a no-op.
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state, experimental
+
--[no]android_databinding_use_v3_4_args default: "true"Use android databinding v2 with 3.4.0 argument. This flag is a no-op.
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state, experimental
+
--android_dynamic_mode=<off, default or fully> default: "off"Determines whether C++ deps of Android rules will be linked dynamically when a cc_binary does not explicitly create a shared library. 'default' means bazel will choose whether to link dynamically. 'fully' means all libraries will be linked dynamically. 'off' means that all libraries will be linked in mostly static mode.
+Tags:
+affects_outputs, loading_and_analysis
+
--android_manifest_merger_order=<alphabetical, alphabetical_by_configuration or dependency> default: "alphabetical"Sets the order of manifests passed to the manifest merger for Android binaries. ALPHABETICAL means manifests are sorted by path relative to the execroot. ALPHABETICAL_BY_CONFIGURATION means manifests are sorted by paths relative to the configuration directory within the output directory. DEPENDENCY means manifests are ordered with each library's manifest coming before the manifests of its dependencies.
+Tags:
+action_command_lines, execution
+
--[no]android_resource_shrinking default: "false"Enables resource shrinking for android_binary APKs that use ProGuard.
+Tags:
+affects_outputs, loading_and_analysis
+
--[no]build_python_zip default: "auto"Build python executable zip; on on Windows, off on other platforms
+Tags:
+affects_outputs
+
--catalyst_cpus=<comma-separated list of options> multiple uses are accumulatedComma-separated list of architectures for which to build Apple Catalyst binaries.
+Tags:
+loses_incremental_state, loading_and_analysis
+
--[no]collect_code_coverage default: "false"If specified, Bazel will instrument code (using offline instrumentation where possible) and will collect coverage information during tests. Only targets that match --instrumentation_filter will be affected. Usually this option should not be specified directly - 'bazel coverage' command should be used instead.
+Tags:
+affects_outputs
+
--compilation_mode=<fastbuild, dbg or opt> [-c] default: "fastbuild"Specify the mode the binary will be built in. Values: 'fastbuild', 'dbg', 'opt'.
+Tags:
+affects_outputs, action_command_lines
+
--conlyopt=<a string> multiple uses are accumulatedAdditional option to pass to gcc when compiling C source files.
+Tags:
+action_command_lines, affects_outputs
+
--copt=<a string> multiple uses are accumulatedAdditional options to pass to gcc.
+Tags:
+action_command_lines, affects_outputs
+
--cpu=<a string> default: ""Deprecated: this flag is not used internally by Blaze although there are legacy platform mappings to allow for backwards compatibility. Do not use this flag, instead use --platforms with an appropriate platform definition.
+Tags:
+changes_inputs, affects_outputs
+
--cs_fdo_absolute_path=<a string> default: see descriptionUse CSFDO profile information to optimize compilation. Specify the absolute path name of the zip file containing the profile file, a raw or an indexed LLVM profile file.
+Tags:
+affects_outputs
+
--cs_fdo_instrument=<a string> default: see descriptionGenerate binaries with context sensitive FDO instrumentation. With Clang/LLVM compiler, it also accepts the directory name under which the raw profile file(s) will be dumped at runtime.
+Tags:
+affects_outputs
+
--cs_fdo_profile=<a build target label> default: see descriptionThe cs_fdo_profile representing the context sensitive profile to be used for optimization.
+Tags:
+affects_outputs
+
--cxxopt=<a string> multiple uses are accumulatedAdditional option to pass to gcc when compiling C++ source files.
+Tags:
+action_command_lines, affects_outputs
+
--define=<a 'name=value' assignment> multiple uses are accumulatedEach --define option specifies an assignment for a build variable. In case of multiple values for a variable, the last one wins.
+Tags:
+changes_inputs, affects_outputs
+
--dynamic_mode=<off, default or fully> default: "default"Determines whether C++ binaries will be linked dynamically. 'default' means Bazel will choose whether to link dynamically. 'fully' means all libraries will be linked dynamically. 'off' means that all libraries will be linked in mostly static mode.
+Tags:
+loading_and_analysis, affects_outputs
+
--[no]enable_propeller_optimize_absolute_paths default: "true"If set, any use of absolute paths for propeller optimize will raise an error.
+Tags:
+affects_outputs
+
--[no]enable_remaining_fdo_absolute_paths default: "true"If set, any use of absolute paths for FDO will raise an error.
+Tags:
+affects_outputs
+
--[no]enable_runfiles default: "auto"Enable runfiles symlink tree; By default, it's off on Windows, on on other platforms.
+Tags:
+affects_outputs
+
--exec_aspects=<comma-separated list of options> multiple uses are accumulatedComma-separated list of aspects to be applied to exec-configured targets, regardless of whether or not they are top-level targets. This is an experimental feature and is subject to change.
+Tags:
+loading_and_analysis
+
--experimental_action_listener=<a build target label> multiple uses are accumulatedDeprecated in favor of aspects. Use action_listener to attach an extra_action to existing build actions.
+Tags:
+execution, experimental
+
--[no]experimental_android_compress_java_resources default: "false"Compress Java resources in APKs
+Tags:
+affects_outputs, loading_and_analysis, experimental
+
--[no]experimental_android_databinding_v2 default: "true"Use android databinding v2. This flag is a no-op.
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state, experimental
+
--[no]experimental_android_resource_shrinking default: "false"Enables resource shrinking for android_binary APKs that use ProGuard.
+Tags:
+affects_outputs, loading_and_analysis, experimental
+
--[no]experimental_android_rewrite_dexes_with_rex default: "false"use rex tool to rewrite dex files
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state, experimental
+
--[no]experimental_collect_code_coverage_for_generated_files default: "false"If specified, Bazel will also generate collect coverage information for generated files.
+Tags:
+affects_outputs, experimental
+
--experimental_objc_fastbuild_options=<comma-separated list of options> default: "-O0,-DDEBUG=1"Uses these strings as objc fastbuild compiler options.
+Tags:
+action_command_lines
+
--[no]experimental_omitfp default: "false"If true, use libunwind for stack unwinding, and compile with -fomit-frame-pointer and -fasynchronous-unwind-tables.
+Tags:
+action_command_lines, affects_outputs, experimental
+
--experimental_output_paths=<off or strip> default: "off"Which model to use for where in the output tree rules write their outputs, particularly for multi-platform / multi-configuration builds. This is highly experimental. See https://github.com/bazelbuild/bazel/issues/6526 for details. Starlark actions canopt into path mapping by adding the key 'supports-path-mapping' to the 'execution_requirements' dict.
+Tags:
+loses_incremental_state, bazel_internal_configuration, affects_outputs, execution
+
--experimental_override_platform_cpu_name=<a 'label=value' assignment> multiple uses are accumulatedEach entry should be of the form label=value where label refers to a platform and values is the desired shortname to override the platform's CPU name in $(TARGET_CPU) make variable and output path. Only used when --experimental_platform_in_output_dir, --incompatible_target_cpu_from_platform or --incompatible_bep_cpu_from_platform is true. Has highest naming priority.
+Tags:
+affects_outputs, experimental
+
--[no]experimental_platform_in_output_dir default: "false"If true, a shortname for the target platform is used in the output directory name instead of the CPU. If auto, this is only applied for the exec configuration. The exact scheme is experimental and subject to change: First, in the rare case the --platforms option does not have exactly one value, a hash of the platforms option is used. Next, if any shortname for the current platform was registered by --experimental_override_name_platform_in_output_dir, then that shortname is used. Then, if --experimental_use_platforms_in_output_dir_legacy_heuristic is set, use a shortname based off the current platform Label. Finally, a hash of the platform option is used as a last resort.
+Tags:
+affects_outputs, experimental
+
--[no]experimental_py_binaries_include_label default: "false"py_binary targets include their label even when stamping is disabled.
+Tags:
+affects_outputs, experimental
+
--[no]experimental_use_llvm_covmap default: "false"If specified, Bazel will generate llvm-cov coverage map information rather than gcov when collect_code_coverage is enabled.
+Tags:
+changes_inputs, affects_outputs, loading_and_analysis, experimental
+
--[no]experimental_use_platforms_in_output_dir_legacy_heuristic default: "true"Please only use this flag as part of a suggested migration or testing strategy. Note that the heuristic has known deficiencies and it is suggested to migrate to relying on just --experimental_override_name_platform_in_output_dir.
+Tags:
+affects_outputs, experimental
+
--fdo_instrument=<a string> default: see descriptionGenerate binaries with FDO instrumentation. With Clang/LLVM compiler, it also accepts the directory name under which the raw profile file(s) will be dumped at runtime.
+Tags:
+affects_outputs
+
--fdo_optimize=<a string> default: see descriptionUse FDO profile information to optimize compilation. Specify the name of a zip file containing a .gcda file tree, an afdo file containing an auto profile, or an LLVM profile file. This flag also accepts files specified as labels (e.g. //foo/bar:file.afdo - you may need to add an exports_files directive to the corresponding package) and labels pointing to fdo_profile targets. This flag will be superseded by the fdo_profile rule.
Tags:
+affects_outputs
+
--fdo_prefetch_hints=<a build target label> default: see descriptionUse cache prefetch hints.
+Tags:
+affects_outputs
+
--fdo_profile=<a build target label> default: see descriptionThe fdo_profile representing the profile to be used for optimization.
+Tags:
+affects_outputs
+
--features=<a string> multiple uses are accumulatedThe given features will be enabled or disabled by default for targets built in the target configuration. Specifying -<feature> will disable the feature. Negative features always override positive ones. See also --host_features
+Tags:
+changes_inputs, affects_outputs
+
--[no]force_pic default: "false"If enabled, all C++ compilations produce position-independent code ("-fPIC"), links prefer PIC pre-built libraries over non-PIC libraries, and links produce position-independent executables ("-pie").
+Tags:
+loading_and_analysis, affects_outputs
+
--host_action_env=<a 'name[=value]' assignment with an optional value part or the special syntax '=name' to unset a variable> multiple uses are accumulatedSpecifies the set of environment variables available to actions with execution configurations. Variables can be either specified by name, in which case the value will be taken from the invocation environment, by the name=value pair which sets the value independent of the invocation environment, or by <code>=name</code>, which unsets the variable of that name. This option can be used multiple times; for options given for the same variable, the latest wins, options for different variables accumulate.
+Tags:
+action_command_lines
+
--host_compilation_mode=<fastbuild, dbg or opt> default: "opt"Specify the mode the tools used during the build will be built in. Values: 'fastbuild', 'dbg', 'opt'.
+Tags:
+affects_outputs, action_command_lines
+
--host_conlyopt=<a string> multiple uses are accumulatedAdditional option to pass to the C compiler when compiling C (but not C++) source files in the exec configurations.
+Tags:
+action_command_lines, affects_outputs
+
--host_copt=<a string> multiple uses are accumulatedAdditional options to pass to the C compiler for tools built in the exec configurations.
+Tags:
+action_command_lines, affects_outputs
+
--host_cpu=<a string> default: ""The host CPU.
+Tags:
+changes_inputs, affects_outputs
+
--host_cxxopt=<a string> multiple uses are accumulatedAdditional options to pass to C++ compiler for tools built in the exec configurations.
+Tags:
+action_command_lines, affects_outputs
+
--host_features=<a string> multiple uses are accumulatedThe given features will be enabled or disabled by default for targets built in the exec configuration. Specifying -<feature> will disable the feature. Negative features always override positive ones.
+Tags:
+changes_inputs, affects_outputs
+
--host_linkopt=<a string> multiple uses are accumulatedAdditional option to pass to linker when linking tools in the exec configurations.
+Tags:
+action_command_lines, affects_outputs
+
--host_macos_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionMinimum compatible macOS version for host targets. If unspecified, uses 'macos_sdk_version'.
+Tags:
+loses_incremental_state
+
--host_per_file_copt=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths followed by an @ and a comma separated list of options> multiple uses are accumulatedAdditional options to selectively pass to the C/C++ compiler when compiling certain files in the exec configurations. This option can be passed multiple times. Syntax: regex_filter@option_1,option_2,...,option_n. Where regex_filter stands for a list of include and exclude regular expression patterns (Also see --instrumentation_filter). option_1 to option_n stand for arbitrary command line options. If an option contains a comma it has to be quoted with a backslash. Options can contain @. Only the first @ is used to split the string. Example: --host_per_file_copt=//foo/.*.cc,-//foo/bar.cc@-O0 adds the -O0 command line option to the gcc command line of all cc files in //foo/ except bar.cc.
+Tags:
+action_command_lines, affects_outputs
+
--[no]incompatible_auto_exec_groups default: "false"When enabled, an exec groups is automatically created for each toolchain used by a rule. For this to work rule needs to specify toolchain parameter on its actions. For more information, see https://github.com/bazelbuild/bazel/issues/17134.
Tags:
+affects_outputs, incompatible_change
+
--[no]incompatible_merge_genfiles_directory default: "true"If true, the genfiles directory is folded into the bin directory.
+Tags:
+affects_outputs, incompatible_change
+
--[no]incompatible_target_cpu_from_platform default: "true"If specified, the value of the cpu constraint (@platforms//cpu:cpu) of the target platform is used to set the $(TARGET_CPU) make variable.
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]instrument_test_targets default: "false"When coverage is enabled, specifies whether to consider instrumenting test rules. When set, test rules included by --instrumentation_filter are instrumented. Otherwise, test rules are always excluded from coverage instrumentation.
+Tags:
+affects_outputs
+
--instrumentation_filter=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths> default: "-/javatests[/:],-/test/java[/:]"When coverage is enabled, only rules with names included by the specified regex-based filter will be instrumented. Rules prefixed with '-' are excluded instead. Note that only non-test rules are instrumented unless --instrument_test_targets is enabled.
+Tags:
+affects_outputs
+
--ios_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionMinimum compatible iOS version for target simulators and devices. If unspecified, uses 'ios_sdk_version'.
+Tags:
+loses_incremental_state
+
--ios_multi_cpus=<comma-separated list of options> multiple uses are accumulatedComma-separated list of architectures to build an ios_application with. The result is a universal binary containing all specified architectures.
+Tags:
+loses_incremental_state, loading_and_analysis
+
--[no]legacy_whole_archive default: "true"Deprecated, superseded by --incompatible_remove_legacy_whole_archive (see https://github.com/bazelbuild/bazel/issues/7362 for details). When on, use --whole-archive for cc_binary rules that have linkshared=True and either linkstatic=True or '-static' in linkopts. This is for backwards compatibility only. A better alternative is to use alwayslink=1 where required.
+Tags:
+action_command_lines, affects_outputs, deprecated
+
--linkopt=<a string> multiple uses are accumulatedAdditional option to pass to gcc when linking.
+Tags:
+action_command_lines, affects_outputs
+
--ltobackendopt=<a string> multiple uses are accumulatedAdditional option to pass to the LTO backend step (under --features=thin_lto).
+Tags:
+action_command_lines, affects_outputs
+
--ltoindexopt=<a string> multiple uses are accumulatedAdditional option to pass to the LTO indexing step (under --features=thin_lto).
+Tags:
+action_command_lines, affects_outputs
+
--macos_cpus=<comma-separated list of options> multiple uses are accumulatedComma-separated list of architectures for which to build Apple macOS binaries.
+Tags:
+loses_incremental_state, loading_and_analysis
+
--macos_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionMinimum compatible macOS version for targets. If unspecified, uses 'macos_sdk_version'.
+Tags:
+loses_incremental_state
+
--memprof_profile=<a build target label> default: see descriptionUse memprof profile.
+Tags:
+affects_outputs
+
--[no]objc_debug_with_GLIBCXX default: "false"If set, and compilation mode is set to 'dbg', define GLIBCXX_DEBUG, GLIBCXX_DEBUG_PEDANTIC and GLIBCPP_CONCEPT_CHECKS.
+Tags:
+action_command_lines
+
--[no]objc_enable_binary_stripping default: "false"Whether to perform symbol and dead-code strippings on linked binaries. Binary strippings will be performed if both this flag and --compilation_mode=opt are specified.
+Tags:
+action_command_lines
+
--objccopt=<a string> multiple uses are accumulatedAdditional options to pass to gcc when compiling Objective-C/C++ source files.
+Tags:
+action_command_lines
+
--per_file_copt=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths followed by an @ and a comma separated list of options> multiple uses are accumulatedAdditional options to selectively pass to gcc when compiling certain files. This option can be passed multiple times. Syntax: regex_filter@option_1,option_2,...,option_n. Where regex_filter stands for a list of include and exclude regular expression patterns (Also see --instrumentation_filter). option_1 to option_n stand for arbitrary command line options. If an option contains a comma it has to be quoted with a backslash. Options can contain @. Only the first @ is used to split the string. Example: --per_file_copt=//foo/.*.cc,-//foo/bar.cc@-O0 adds the -O0 command line option to the gcc command line of all cc files in //foo/ except bar.cc.
+Tags:
+action_command_lines, affects_outputs
+
--per_file_ltobackendopt=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths followed by an @ and a comma separated list of options> multiple uses are accumulatedAdditional options to selectively pass to LTO backend (under --features=thin_lto) when compiling certain backend objects. This option can be passed multiple times. Syntax: regex_filter@option_1,option_2,...,option_n. Where regex_filter stands for a list of include and exclude regular expression patterns. option_1 to option_n stand for arbitrary command line options. If an option contains a comma it has to be quoted with a backslash. Options can contain @. Only the first @ is used to split the string. Example: --per_file_ltobackendopt=//foo/.*.o,-//foo/bar.o@-O0 adds the -O0 command line option to the LTO backend command line of all o files in //foo/ except bar.o.
+Tags:
+action_command_lines, affects_outputs
+
--platform_suffix=<a string> default: see descriptionSpecifies a suffix to be added to the configuration directory.
+Tags:
+loses_incremental_state, affects_outputs, loading_and_analysis
+
--propeller_optimize=<a build target label> default: see descriptionUse Propeller profile information to optimize the build target.A propeller profile must consist of at least one of two files, a cc profile and a ld profile. This flag accepts a build label which must refer to the propeller profile input files. For example, the BUILD file that defines the label, in a/b/BUILD:propeller_optimize( name = "propeller_profile", cc_profile = "propeller_cc_profile.txt", ld_profile = "propeller_ld_profile.txt",)An exports_files directive may have to be added to the corresponding package to make these files visible to Bazel. The option must be used as: --propeller_optimize=//a/b:propeller_profile
+Tags:
+action_command_lines, affects_outputs
+
--propeller_optimize_absolute_cc_profile=<a string> default: see descriptionAbsolute path name of cc_profile file for Propeller Optimized builds.
+Tags:
+affects_outputs
+
--propeller_optimize_absolute_ld_profile=<a string> default: see descriptionAbsolute path name of ld_profile file for Propeller Optimized builds.
+Tags:
+affects_outputs
+
--run_under=<a prefix in front of command> default: see descriptionPrefix to insert before the executables for the 'test' and 'run' commands. If the value is 'foo -bar', and the execution command line is 'test_binary -baz', then the final command line is 'foo -bar test_binary -baz'.This can also be a label to an executable target. Some examples are: 'valgrind', 'strace', 'strace -c', 'valgrind --quiet --num-callers=20', '//package:target', '//package:target --options'.
+Tags:
+action_command_lines
+
If true, native libraries that contain identical functionality will be shared among different targets
+Tags:
+loading_and_analysis, affects_outputs
+
--[no]stamp default: "false"Stamp binaries with the date, username, hostname, workspace information, etc.
+Tags:
+affects_outputs
+
--strip=<always, sometimes or never> default: "sometimes"Specifies whether to strip binaries and shared libraries (using "-Wl,--strip-debug"). The default value of 'sometimes' means strip iff --compilation_mode=fastbuild.
+Tags:
+affects_outputs
+
--stripopt=<a string> multiple uses are accumulatedAdditional options to pass to strip when generating a '<name>.stripped' binary.
+Tags:
+action_command_lines, affects_outputs
+
--tvos_cpus=<comma-separated list of options> multiple uses are accumulatedComma-separated list of architectures for which to build Apple tvOS binaries.
+Tags:
+loses_incremental_state, loading_and_analysis
+
--tvos_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionMinimum compatible tvOS version for target simulators and devices. If unspecified, uses 'tvos_sdk_version'.
+Tags:
+loses_incremental_state
+
--visionos_cpus=<comma-separated list of options> multiple uses are accumulatedComma-separated list of architectures for which to build Apple visionOS binaries.
+Tags:
+loses_incremental_state, loading_and_analysis
+
--watchos_cpus=<comma-separated list of options> multiple uses are accumulatedComma-separated list of architectures for which to build Apple watchOS binaries.
+Tags:
+loses_incremental_state, loading_and_analysis
+
--watchos_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionMinimum compatible watchOS version for target simulators and devices. If unspecified, uses 'watchos_sdk_version'.
+Tags:
+loses_incremental_state
+
--xbinary_fdo=<a build target label> default: see descriptionUse XbinaryFDO profile information to optimize compilation. Specify the name of default cross binary profile. When the option is used together with --fdo_instrument/--fdo_optimize/--fdo_profile, those options will always prevail as if xbinary_fdo is never specified.
+Tags:
+affects_outputs
+
--[no]check_visibility default: "true"If disabled, visibility errors in target dependencies are demoted to warnings.
+Tags:
+build_file_semantics, non_configurable
+
--[no]desugar_for_android default: "true"Whether to desugar Java 8 bytecode before dexing.
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state
+
--[no]desugar_java8_libs default: "false"Whether to include supported Java 8 libraries in apps for legacy devices.
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state, experimental
+
--[no]enforce_constraints default: "true"Checks the environments each target is compatible with and reports errors if any target has dependencies that don't support the same environments
+Tags:
+build_file_semantics
+
--[no]experimental_check_desugar_deps default: "true"Whether to double-check correct desugaring at Android binary level.
+Tags:
+eagerness_to_exit, loading_and_analysis, experimental
+
--[no]experimental_enforce_transitive_visibility default: "false"If true, enable package()s to set the transitive_visibility attribute to restrict which packages may depend on them.
+Tags:
+build_file_semantics, experimental
+
--experimental_one_version_enforcement=<off, warning or error> default: "OFF"When enabled, enforce that a java_binary rule can't contain more than one version of the same class file on the classpath. This enforcement can break the build, or can just result in warnings.
+Tags:
+loading_and_analysis
+
--experimental_strict_java_deps=<off, warn, error, strict or default> default: "default"If true, checks that a Java target explicitly declares all directly used targets as dependencies.
+Tags:
+build_file_semantics, eagerness_to_exit
+
--[no]incompatible_check_testonly_for_output_files default: "false"If enabled, check testonly for prerequisite targets that are output files by looking up the testonly of the generating rule. This matches visibility checking.
+Tags:
+build_file_semantics, incompatible_change
+
--[no]incompatible_disable_native_android_rules default: "false"If enabled, direct usage of the native Android rules is disabled. Please use the Starlark Android rules from https://github.com/bazelbuild/rules_android
+Tags:
+eagerness_to_exit, incompatible_change
+
--[no]incompatible_disable_native_apple_binary_rule default: "false"No-op. Kept here for backwards compatibility.
+Tags:
+eagerness_to_exit, incompatible_change
+
--[no]one_version_enforcement_on_java_tests default: "true"When enabled, and with experimental_one_version_enforcement set to a non-NONE value, enforce one version on java_test targets. This flag can be disabled to improve incremental test performance at the expense of missing potential one version violations.
+Tags:
+loading_and_analysis
+
--python_native_rules_allowlist=<a build target label> default: see descriptionAn allowlist (package_group target) to use when enforcing --incompatible_python_disallow_native_rules.
+Tags:
+loading_and_analysis
+
--[no]strict_filesets default: "false"If this option is enabled, filesets crossing package boundaries are reported as errors.
+Tags:
+build_file_semantics, eagerness_to_exit
+
--strict_proto_deps=<off, warn, error, strict or default> default: "error"Unless OFF, checks that a proto_library target explicitly declares all directly used targets as dependencies.
+Tags:
+build_file_semantics, eagerness_to_exit, incompatible_change
+
--strict_public_imports=<off, warn, error, strict or default> default: "off"Unless OFF, checks that a proto_library target explicitly declares all targets used in 'import public' as exported.
+Tags:
+build_file_semantics, eagerness_to_exit, incompatible_change
+
--[no]strict_system_includes default: "false"If true, headers found through system include paths (-isystem) are also required to be declared.
+Tags:
+loading_and_analysis, eagerness_to_exit
+
--target_environment=<a build target label> multiple uses are accumulatedDeclares this build's target environment. Must be a label reference to an "environment" rule. If specified, all top-level targets must be compatible with this environment.
+Tags:
+changes_inputs
+
--apk_signing_method=<v1, v2, v1_v2 or v4> default: "v1_v2"Implementation to use to sign APKs
+Tags:
+action_command_lines, affects_outputs, loading_and_analysis
+
--[no]device_debug_entitlements default: "true"If set, and compilation mode is not 'opt', objc apps will include debug entitlements when signing.
+Tags:
+changes_inputs
+
--ios_signing_cert_name=<a string> default: see descriptionCertificate name to use for iOS signing. If not set will fall back to provisioning profile. May be the certificate's keychain identity preference or (substring) of the certificate's common name, as per codesign's man page (SIGNING IDENTITIES).
+Tags:
+action_command_lines
+
--[no]incompatible_disallow_sdk_frameworks_attributes default: "false"If true, disallow sdk_frameworks and weak_sdk_frameworks attributes in objc_library andobjc_import.
+Tags:
+build_file_semantics, incompatible_change
+
--[no]incompatible_objc_alwayslink_by_default default: "false"If true, make the default value true for alwayslink attributes in objc_library and objc_import.
+Tags:
+build_file_semantics, incompatible_change
+
--[no]incompatible_python_disallow_native_rules default: "false"When true, an error occurs when using the builtin py_* rules; instead the rule_python rules should be used. See https://github.com/bazelbuild/bazel/issues/17773 for more information and migration instructions.
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]allow_analysis_failures default: "false"If true, an analysis failure of a rule target results in the target's propagation of an instance of AnalysisFailureInfo containing the error description, instead of resulting in a build failure.
+Tags:
+loading_and_analysis, experimental
+
--analysis_testing_deps_limit=<an integer> default: "2000"Sets the maximum number of transitive dependencies through a rule attribute with a for_analysis_testing configuration transition. Exceeding this limit will result in a rule error.
+Tags:
+loading_and_analysis
+
--[no]break_build_on_parallel_dex2oat_failure default: "false"If true dex2oat action failures will cause the build to break instead of executing dex2oat during test runtime.
+Tags:
+loading_and_analysis, experimental
+
--default_test_resources=<a resource name followed by equal and 1 float or 4 float, e.g memory=10,30,60,100> multiple uses are accumulatedOverride the default resources amount for tests. The expected format is <resource>=<value>. If a single positive number is specified as <value> it will override the default resources for all test sizes. If 4 comma-separated numbers are specified, they will override the resource amount for respectively the small, medium, large, enormous test sizes. Values can also be HOST_RAM/HOST_CPU, optionally followed by [-|]<float> (eg. memory=HOST_RAM.1,HOST_RAM*.2,HOST_RAM*.3,HOST_RAM*.4). The default test resources specified by this flag are overridden by explicit resources specified in tags.
+--[no]experimental_android_use_parallel_dex2oat default: "false"Use dex2oat in parallel to possibly speed up android_test.
+Tags:
+loading_and_analysis, host_machine_resource_optimizations, experimental
+
--[no]ios_memleaks default: "false"Enable checking for memory leaks in ios_test targets.
+Tags:
+action_command_lines
+
--ios_simulator_device=<a string> default: see descriptionThe device to simulate when running an iOS application in the simulator, e.g. 'iPhone 6'. You can get a list of devices by running 'xcrun simctl list devicetypes' on the machine the simulator will be run on.
+Tags:
+test_runner
+
--ios_simulator_version=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionThe version of iOS to run on the simulator when running or testing. This is ignored for ios_test rules if a target device is specified in the rule.
+Tags:
+test_runner
+
--runs_per_test=<a positive integer or test_regex@runs. This flag may be passed more than once> multiple uses are accumulatedSpecifies number of times to run each test. If any of those attempts fail for any reason, the whole test is considered failed. Normally the value specified is just an integer. Example: --runs_per_test=3 will run all tests 3 times. Alternate syntax: regex_filter@runs_per_test. Where runs_per_test stands for an integer value and regex_filter stands for a list of include and exclude regular expression patterns (Also see --instrumentation_filter). Example: --runs_per_test=//foo/.,-//foo/bar/.@3 runs all tests in //foo/ except those under foo/bar three times. This option can be passed multiple times. The most recently passed argument that matches takes precedence. If nothing matches, the test is only run once.
+--test_env=<a 'name[=value]' assignment with an optional value part or the special syntax '=name' to unset a variable> multiple uses are accumulatedSpecifies additional environment variables to be injected into the test runner environment. Variables can be either specified by <code>name</code>, in which case its value will be read from the Bazel client environment, or by the <code>name=value</code> pair. Previously set variables can be unset via <code>=name</code>. This option can be used multiple times to specify several variables. Used only by the 'bazel test' command.
+Tags:
+test_runner
+
--test_timeout=<a single integer or comma-separated list of 4 integers> default: "-1"Override the default test timeout values for test timeouts (in secs). If a single positive integer value is specified it will override all categories. If 4 comma-separated integers are specified, they will override the timeouts for short, moderate, long and eternal (in that order). In either form, a value of -1 tells blaze to use its default timeouts for that category.
+--[no]zip_undeclared_test_outputs default: "false"If true, undeclared test outputs will be archived in a zip file.
+Tags:
+test_runner
+
--[no]experimental_filter_library_jar_with_program_jar default: "false"Filter the ProGuard ProgramJar to remove any classes also present in the LibraryJar.
+Tags:
+action_command_lines, experimental
+
--[no]experimental_inmemory_dotd_files default: "true"If enabled, C++ .d files will be passed through in memory directly from the remote build nodes instead of being written to disk.
+Tags:
+loading_and_analysis, execution, affects_outputs, experimental
+
--[no]experimental_inmemory_jdeps_files default: "true"If enabled, the dependency (.jdeps) files generated from Java compilations will be passed through in memory directly from the remote build nodes instead of being written to disk.
+Tags:
+loading_and_analysis, execution, affects_outputs, experimental
+
--[no]experimental_retain_test_configuration_across_testonly default: "false"When enabled, --trim_test_configuration will not trim the test configuration for rules marked testonly=1. This is meant to reduce action conflict issues when non-test rules depend on cc_test rules. No effect if --trim_test_configuration is false.
+Tags:
+loading_and_analysis, loses_incremental_state, experimental
+
--[no]experimental_unsupported_and_brittle_include_scanning default: "false"Whether to narrow inputs to C/C++ compilation by parsing #include lines from input files. This can improve performance and incrementality by decreasing the size of compilation input trees. However, it can also break builds because the include scanner does not fully implement C preprocessor semantics. In particular, it does not understand dynamic #include directives and ignores preprocessor conditional logic. Use at your own risk. Any issues relating to this flag that are filed will be closed.
+Tags:
+loading_and_analysis, execution, changes_inputs, experimental
+
--[no]incremental_dexing default: "true"Does most of the work for dexing separately for each Jar file.
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state
+
--[no]objc_use_dotd_pruning default: "true"If set, .d files emitted by clang will be used to prune the set of inputs passed into objc compiles.
+Tags:
+changes_inputs, loading_and_analysis
+
--[no]process_headers_in_dependencies default: "false"When building a target //a:a, process headers in all targets that //a:a depends on (if header processing is enabled for the toolchain).
+Tags:
+execution
+
--[no]trim_test_configuration default: "true"When enabled, test-related options will be cleared below the top level of the build. When this flag is active, tests cannot be built as dependencies of non-test rules, but changes to test-related options will not cause non-test rules to be re-analyzed.
+Tags:
+loading_and_analysis, loses_incremental_state
+
--toolchain_resolution_debug=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths> default: "-.*"Print debug information during toolchain resolution. The flag takes a regex, which is checked against toolchain types and specific targets to see which to debug. Multiple regexes may be separated by commas, and then each regex is checked separately. Note: The output of this flag is very complex and will likely only be useful to experts in toolchain resolution.
+Tags:
+terminal_output
+
--[no]verbose_visibility_errors default: "false"If enabled, visibility errors include additional diagnostic information.
+Tags:
+build_file_semantics, non_configurable
+
--flag_alias=<a 'name=value' flag alias> multiple uses are accumulatedSets a shorthand name for a Starlark flag. It takes a single key-value pair in the form "<key>=<value>" as an argument.
+Tags:
+changes_inputs, non_configurable
+
--[no]incompatible_default_to_explicit_init_py default: "false"This flag changes the default behavior so that init.py files are no longer automatically created in the runfiles of Python targets. Precisely, when a py_binary or py_test target has legacy_create_init set to "auto" (the default), it is treated as false if and only if this flag is set. See https://github.com/bazelbuild/bazel/issues/10076.
+Tags:
+affects_outputs, incompatible_change
+
--[no]cache_test_results [-t] default: "auto"If set to 'auto', Bazel reruns a test if and only if: (1) Bazel detects changes in the test or its dependencies, (2) the test is marked as external, (3) multiple test runs were requested with --runs_per_test, or(4) the test previously failed. If set to 'yes', Bazel caches all test results except for tests marked as external. If set to 'no', Bazel does not cache any test results.
+--[no]experimental_cancel_concurrent_tests default: "never"If 'on_failed' or 'on_passed, then Blaze will cancel concurrently running tests on the first run with that result. This is only useful in combination with --runs_per_test_detects_flakes.
+Tags:
+affects_outputs, loading_and_analysis, experimental
+
--[no]experimental_fetch_all_coverage_outputs default: "false"If true, then Bazel fetches the entire coverage data directory for each test during a coverage run.
+Tags:
+affects_outputs, loading_and_analysis, experimental
+
--[no]experimental_generate_llvm_lcov default: "false"If true, coverage for clang will generate an LCOV report.
+Tags:
+affects_outputs, loading_and_analysis, experimental
+
--experimental_java_classpath=<off, javabuilder, bazel or bazel_no_fallback> default: "bazel"Enables reduced classpaths for Java compilations.
+--[no]experimental_run_android_lint_on_java_rules default: "false"Whether to validate java_* sources.
+Tags:
+affects_outputs, experimental
+
--[no]explicit_java_test_deps default: "false"Explicitly specify a dependency to JUnit or Hamcrest in a java_test instead of accidentally obtaining from the TestRunner's deps. Only works for bazel right now.
+--host_java_launcher=<a build target label> default: see descriptionThe Java launcher used by tools that are executed during a build.
+--host_javacopt=<a string> multiple uses are accumulatedAdditional options to pass to javac when building tools that are executed during a build.
+--host_jvmopt=<a string> multiple uses are accumulatedAdditional options to pass to the Java VM when building tools that are executed during the build. These options will get added to the VM startup options of each java_binary target.
+--[no]incompatible_check_sharding_support default: "true"If true, Bazel will fail a sharded test if the test runner does not indicate that it supports sharding by touching the file at the path in TEST_SHARD_STATUS_FILE. If false, a test runner that does not support sharding will lead to all tests running in each shard.
+Tags:
+incompatible_change
+
--[no]incompatible_exclusive_test_sandboxed default: "true"If true, exclusive tests will run with sandboxed strategy. Add 'local' tag to force an exclusive test run locally
+Tags:
+incompatible_change
+
--[no]incompatible_strict_action_env default: "false"If true, Bazel uses an environment with a static value for PATH and does not inherit LD_LIBRARY_PATH. Use --action_env=ENV_VARIABLE if you want to inherit specific environment variables from the client, but note that doing so can prevent cross-user caching if a shared cache is used.
+Tags:
+loading_and_analysis, incompatible_change
+
--j2objc_translation_flags=<comma-separated list of options> multiple uses are accumulatedAdditional options to pass to the J2ObjC tool.
+--java_debugCauses the Java virtual machine of a java test to wait for a connection from a JDWP-compliant debugger (such as jdb) before starting the test. Implies -test_output=streamed.
+Expands to:
+
--test_arg=--wrapper_script_flag=--debug
+
--test_output=streamed
+
--test_strategy=exclusive
+
--test_timeout=9999
+
--nocache_test_results
+
--[no]java_deps default: "true"Generate dependency information (for now, compile-time classpath) per Java target.
+--[no]java_header_compilation default: "true"Compile ijars directly from source.
+--java_language_version=<a string> default: ""The Java language version
+--java_launcher=<a build target label> default: see descriptionThe Java launcher to use when building Java binaries. If this flag is set to the empty string, the JDK launcher is used. The "launcher" attribute overrides this flag.
+--java_runtime_version=<a string> default: "local_jdk"The Java runtime version
+--javacopt=<a string> multiple uses are accumulatedAdditional options to pass to javac.
+--jvmopt=<a string> multiple uses are accumulatedAdditional options to pass to the Java VM. These options will get added to the VM startup options of each java_binary target.
+--legacy_main_dex_list_generator=<a build target label> default: see descriptionSpecifies a binary to use to generate the list of classes that must be in the main dex when compiling legacy multidex.
+--optimizing_dexer=<a build target label> default: see descriptionSpecifies a binary to use to do dexing without sharding.
+--plugin=<a build target label> multiple uses are accumulatedPlugins to use in the build. Currently works with java_plugin.
+--proguard_top=<a build target label> default: see descriptionSpecifies which version of ProGuard to use for code removal when building a Java binary.
+--proto_compiler=<a build target label> default: "@bazel_tools//tools/proto:protoc"The label of the proto-compiler.
+Tags:
+affects_outputs, loading_and_analysis
+
--[no]proto_profile default: "true"Whether to pass profile_path to the proto compiler.
+Tags:
+affects_outputs, loading_and_analysis
+
--proto_profile_path=<a build target label> default: see descriptionThe profile to pass to the proto compiler as profile_path. If unset, but --proto_profile is true (the default), infers the path from --fdo_optimize.
+Tags:
+affects_outputs, loading_and_analysis
+
--proto_toolchain_for_cc=<a build target label> default: "@bazel_tools//tools/proto:cc_toolchain"Label of proto_lang_toolchain() which describes how to compile C++ protos
+Tags:
+affects_outputs, loading_and_analysis
+
--proto_toolchain_for_j2objc=<a build target label> default: "@bazel_tools//tools/j2objc:j2objc_proto_toolchain"Label of proto_lang_toolchain() which describes how to compile j2objc protos
+Tags:
+affects_outputs, loading_and_analysis
+
--proto_toolchain_for_java=<a build target label> default: "@bazel_tools//tools/proto:java_toolchain"Label of proto_lang_toolchain() which describes how to compile Java protos
+Tags:
+affects_outputs, loading_and_analysis
+
--proto_toolchain_for_javalite=<a build target label> default: "@bazel_tools//tools/proto:javalite_toolchain"Label of proto_lang_toolchain() which describes how to compile JavaLite protos
+Tags:
+affects_outputs, loading_and_analysis
+
--protocopt=<a string> multiple uses are accumulatedAdditional options to pass to the protobuf compiler.
+Tags:
+affects_outputs
+
--[no]runs_per_test_detects_flakes default: "false"If true, any shard in which at least one run/attempt passes and at least one run/attempt fails gets a FLAKY status.
+--shell_executable=<a path> default: see descriptionAbsolute path to the shell executable for Bazel to use. If this is unset, but the BAZEL_SH environment variable is set on the first Bazel invocation (that starts up a Bazel server), Bazel uses that. If neither is set, Bazel uses a hard-coded default path depending on the operating system it runs on (Windows: c:/msys64/usr/bin/bash.exe, FreeBSD: /usr/local/bin/bash, all others: /bin/bash). Note that using a shell that is not compatible with bash may lead to build failures or runtime failures of the generated binaries.
+Tags:
+loading_and_analysis
+
--test_arg=<a string> multiple uses are accumulatedSpecifies additional options and arguments that should be passed to the test executable. Can be used multiple times to specify several arguments. If multiple tests are executed, each of them will receive identical arguments. Used only by the 'bazel test' command.
+--test_filter=<a string> default: see descriptionSpecifies a filter to forward to the test framework. Used to limit the tests run. Note that this does not affect which targets are built.
+--test_result_expiration=<an integer> default: "-1"This option is deprecated and has no effect.
+--[no]test_runner_fail_fast default: "false"Forwards fail fast option to the test runner. The test runner should stop execution upon first failure.
+--test_sharding_strategy=<explicit, disabled or forced=k where k is the number of shards to enforce> default: "explicit"Specify strategy for test sharding: 'explicit' to only use sharding if the 'shard_count' BUILD attribute is present. 'disabled' to never use test sharding. 'forced=k' to enforce 'k' shards for testing regardless of the 'shard_count' BUILD attribute.
+--tool_java_language_version=<a string> default: ""The Java language version used to execute the tools that are needed during a build
+--tool_java_runtime_version=<a string> default: "remotejdk_11"The Java runtime version used to execute tools during the build
+--[no]use_ijars default: "true"If enabled, this option causes Java compilation to use interface jars. This will result in faster incremental compilation, but error messages can be different.
+If set, allow at least one action to run even if the resource is not enough or unavailable.
+Tags:
+execution
+
--[no]check_up_to_date default: "false"Don't perform the build, just check if it is up-to-date. If all targets are up-to-date, the build completes successfully. If any step needs to be executed an error is reported and the build fails.
+Tags:
+execution
+
--dynamic_local_execution_delay=<an integer> default: "1000"How many milliseconds should local execution be delayed, if remote execution was faster during a build at least once?
+Tags:
+execution, host_machine_resource_optimizations
+
--dynamic_local_strategy=<a '[name=]value1[,..,valueN]' assignment> multiple uses are accumulatedThe local strategies, in order, to use for the given mnemonic - the first applicable strategy is used. For example, worker,sandboxed runs actions that support persistent workers using the worker strategy, and all others using the sandboxed strategy. If no mnemonic is given, the list of strategies is used as the fallback for all mnemonics. The default fallback list is worker,sandboxed, orworker,sandboxed,standalone if experimental_local_lockfree_output is set. Takes [mnemonic=]local_strategy[,local_strategy,...]
Tags:
+execution, host_machine_resource_optimizations
+
--dynamic_remote_strategy=<a '[name=]value1[,..,valueN]' assignment> multiple uses are accumulatedThe remote strategies, in order, to use for the given mnemonic - the first applicable strategy is used. If no mnemonic is given, the list of strategies is used as the fallback for all mnemonics. The default fallback list is remote, so this flag usually does not need to be set explicitly. Takes [mnemonic=]remote_strategy[,remote_strategy,...]
Tags:
+execution, host_machine_resource_optimizations
+
--[no]experimental_async_execution default: "false"If set to true, Bazel is allowed to run action in a virtual thread. The number of actions in flight is still capped with --jobs.
+Tags:
+host_machine_resource_optimizations, execution, incompatible_change
+
--experimental_async_execution_max_concurrent_actions=<an integer> default: "5000"The number of maximum concurrent actions to run with async execution. If the value is less than --jobs, it is clamped to --jobs.
+Tags:
+host_machine_resource_optimizations, execution
+
--experimental_docker_image=<a string> default: ""Specify a Docker image name (e.g. "ubuntu:latest") that should be used to execute a sandboxed action when using the docker strategy and the action itself doesn't already have a container-image attribute in its remote_execution_properties in the platform description. The value of this flag is passed verbatim to 'docker run', so it supports the same syntax and mechanisms as Docker itself.
+Tags:
+execution
+
--[no]experimental_docker_use_customized_images default: "true"If enabled, injects the uid and gid of the current user into the Docker image before using it. This is required if your build / tests depend on the user having a name and home directory inside the container. This is on by default, but you can disable it in case the automatic image customization feature doesn't work in your case or you know that you don't need it.
+Tags:
+execution
+
--[no]experimental_dynamic_exclude_tools default: "true"When set, targets that are build "for tool" are not subject to dynamic execution. Such targets are extremely unlikely to be built incrementally and thus not worth spending local cycles on.
+Tags:
+execution, host_machine_resource_optimizations
+
--experimental_dynamic_local_load_factor=<a double> default: "0"Controls how much load from dynamic execution to put on the local machine. This flag adjusts how many actions in dynamic execution we will schedule concurrently. It is based on the number of CPUs Blaze thinks is available, which can be controlled with the --local_resources=cpu= flag. +If this flag is 0, all actions are scheduled locally immediately. If > 0, the amount of actions scheduled locally is limited by the number of CPUs available. If < 1, the load factor is used to reduce the number of locally scheduled actions when the number of actions waiting to schedule is high. This lessens the load on the local machine in the clean build case, where the local machine does not contribute much.
+Tags:
+execution, host_machine_resource_optimizations
+
--experimental_dynamic_slow_remote_time=<An immutable length of time.> default: "0"If >0, the time a dynamically run action must run remote-only before we prioritize its local execution to avoid remote timeouts. This may hide some problems on the remote execution system. Do not turn this on without monitoring of remote execution issues.
+Tags:
+execution, host_machine_resource_optimizations
+
--[no]experimental_enable_docker_sandbox default: "false"Enable Docker-based sandboxing. This option has no effect if Docker is not installed.
+Tags:
+execution
+
--[no]experimental_inmemory_sandbox_stashes default: "false"If set to true, the contents of stashed sandboxes for reuse_sandbox_directories will be tracked in memory. This reduces the amount of I/O needed during reuse. Depending on the build this flag may improve wall time. Depending on the build as well this flag may use a significant amount of additional memory.
+Tags:
+host_machine_resource_optimizations, execution
+
--experimental_sandbox_async_tree_delete_idle_threads=<an integer, or a keyword ("auto", "HOST_CPUS", "HOST_RAM"), optionally followed by an operation ([-|*]<float>) eg. "auto", "HOST_CPUS*.5"> default: "4"If 0, sandboxes are deleted as soon as actions finish, blocking action completion. If greater than 0, sandboxes are deleted asynchronously in the background without blocking action completion. Asynchronous deletion uses a single thread while a command is running, but ramps up to as many threads as the value of this flag once the server becomes idle. Set to auto to use as many threads as the number of CPUs. A server shutdown blocks on any pending asynchronous deletions.
Tags:
+host_machine_resource_optimizations, execution
+
--experimental_sandbox_enforce_resources_regexp=<a valid Java regular expression> default: ""If true, actions whose mnemonic matches the input regex will have their resources request enforced as limits, overriding the value of --experimental_sandbox_limits, if the resource type supports it. For example a test that declares cpu:3 and resources:memory:10, will run with at most 3 cpus and 10 megabytes of memory.
+Tags:
+execution
+
--experimental_sandbox_limits=<a named double, 'name=value', where value is an integer, or a keyword ("auto", "HOST_CPUS", "HOST_RAM"), optionally followed by an operation ([-|*]<float>) eg. "auto", "HOST_CPUS*.5"> multiple uses are accumulatedIf > 0, each Linux sandbox will be limited to the given amount for the specified resource. Requires --incompatible_use_new_cgroup_implementation and overrides --experimental_sandbox_memory_limit_mb. Requires cgroups v1 or v2 and permissions for the users to the cgroups dir.
+Tags:
+execution
+
--experimental_sandbox_memory_limit_mb=<an integer number of MBs, or "HOST_RAM", optionally followed by [-|*]<float>.> default: "0"If > 0, each Linux sandbox will be limited to the given amount of memory (in MB). Requires cgroups v1 or v2 and permissions for the users to the cgroups dir.
+Tags:
+execution
+
--[no]experimental_shrink_worker_pool default: "false"If enabled, could shrink worker pool if worker memory pressure is high. This flag works only when flag experimental_total_worker_memory_limit_mb is enabled.
+Tags:
+execution, host_machine_resource_optimizations
+
--experimental_total_worker_memory_limit_mb=<an integer number of MBs, or "HOST_RAM", optionally followed by [-|*]<float>.> default: "0"If this limit is greater than zero idle workers might be killed if the total memory usage of all workers exceed the limit.
+Tags:
+execution, host_machine_resource_optimizations
+
--[no]experimental_use_hermetic_linux_sandbox default: "false"If set to true, do not mount root, only mount whats provided with sandbox_add_mount_pair. Input files will be hardlinked to the sandbox instead of symlinked to from the sandbox. If action input files are located on a filesystem different from the sandbox, then the input files will be copied instead.
+Tags:
+execution
+
--[no]experimental_use_windows_sandbox default: "false"Use Windows sandbox to run actions. If "yes", the binary provided by --experimental_windows_sandbox_path must be valid and correspond to a supported version of sandboxfs. If "auto", the binary may be missing or not compatible.
+Tags:
+execution
+
--experimental_windows_sandbox_path=<a string> default: "BazelSandbox.exe"Path to the Windows sandbox binary to use when --experimental_use_windows_sandbox is true. If a bare name, use the first binary of that name found in the PATH.
+Tags:
+execution
+
--experimental_worker_allowlist=<comma-separated set of options> default: see descriptionIf non-empty, only allow using persistent workers with the given worker key mnemonic.
+Tags:
+execution, host_machine_resource_optimizations
+
--[no]experimental_worker_cancellation default: "false"If enabled, Bazel may send cancellation requests to workers that support them.
+Tags:
+execution
+
--experimental_worker_memory_limit_mb=<an integer number of MBs, or "HOST_RAM", optionally followed by [-|*]<float>.> default: "0"If this limit is greater than zero, workers might be killed if the memory usage of the worker exceeds the limit. If not used together with dynamic execution and --experimental_dynamic_ignore_local_signals=9, this may crash your build.
Tags:
+execution, host_machine_resource_optimizations
+
--experimental_worker_metrics_poll_interval=<An immutable length of time.> default: "5s"The interval between collecting worker metrics and possibly attempting evictions. Cannot effectively be less than 1s for performance reasons.
+Tags:
+execution, host_machine_resource_optimizations
+
--[no]experimental_worker_multiplex_sandboxing default: "false"If enabled, multiplex workers with a 'supports-multiplex-sandboxing' execution requirement will run in a sandboxed environment, using a separate sandbox directory per work request. Multiplex workers with the execution requirement are always sandboxed when running under the dynamic execution strategy, irrespective of this flag.
+Tags:
+execution
+
--[no]experimental_worker_sandbox_hardening default: "false"If enabled, workers are run in a hardened sandbox, if the implementation allows it. If hardening is enabled then tmp directories are distinct for different workers.
+Tags:
+execution
+
--experimental_worker_sandbox_inmemory_tracking=<a string> multiple uses are accumulatedA worker key mnemonic for which the contents of the sandbox directory are tracked in memory. This may improve build performance at the cost of additional memory usage. Only affects sandboxed workers. May be specified multiple times for different mnemonics.
+Tags:
+execution
+
--[no]experimental_worker_strict_flagfiles default: "false"If enabled, actions arguments for workers that do not follow the worker specification will cause an error. Worker arguments must have exactly one @flagfile argument as the last of its list of arguments.
+Tags:
+execution
+
--genrule_strategy=<comma-separated list of options> default: ""Specify how to execute genrules. This flag will be phased out. Instead, use --spawn_strategy=<value> to control all actions or --strategy=Genrule=<value> to control genrules only.
+Tags:
+execution
+
--[no]incompatible_use_new_cgroup_implementation default: "true"If true, use the new implementation for cgroups. The old implementation only supports the memory controller and ignores the value of --experimental_sandbox_limits.
+Tags:
+execution
+
--[no]internal_spawn_scheduler default: "true"Placeholder option so that we can tell in Blaze whether the spawn scheduler was enabled.
+Tags:
+execution, host_machine_resource_optimizations
+
--jobs=<an integer, or a keyword ("auto", "HOST_CPUS", "HOST_RAM"), optionally followed by an operation ([-|*]<float>) eg. "auto", "HOST_CPUS*.5"> [-j] default: "auto"The number of concurrent jobs to run. Takes an integer, or a keyword ("auto", "HOST_CPUS", "HOST_RAM"), optionally followed by an operation ([-|]<float>) eg. "auto", "HOST_CPUS.5". Values must be between 1 and 5000. Values above 2500 may cause memory issues. "auto" calculates a reasonable default based on host resources.
+Tags:
+host_machine_resource_optimizations, execution
+
--[no]keep_going [-k] default: "false"Continue as much as possible after an error. While the target that failed and those that depend on it cannot be analyzed, other prerequisites of these targets can be.
+Tags:
+eagerness_to_exit
+
--loading_phase_threads=<an integer, or a keyword ("auto", "HOST_CPUS", "HOST_RAM"), optionally followed by an operation ([-|*]<float>) eg. "auto", "HOST_CPUS*.5"> default: "auto"Number of parallel threads to use for the loading/analysis phase.Takes an integer, or a keyword ("auto", "HOST_CPUS", "HOST_RAM"), optionally followed by an operation ([-|]<float>) eg. "auto", "HOST_CPUS.5". "auto" sets a reasonable default based on host resources. Must be at least 1.
+Tags:
+bazel_internal_configuration
+
--[no]reuse_sandbox_directories default: "true"If set to true, directories used by sandboxed non-worker execution may be reused to avoid unnecessary setup costs.
+Tags:
+host_machine_resource_optimizations, execution
+
--sandbox_base=<a string> default: ""Lets the sandbox create its sandbox directories underneath this path. Specify a path on tmpfs (like /run/shm) to possibly improve performance a lot when your build / tests have many input files. Note: You need enough RAM and free space on the tmpfs to hold output and intermediate files generated by running actions.
+Tags:
+host_machine_resource_optimizations, execution
+
--[no]sandbox_enable_loopback_device default: "true"If true, a loopback device will be set up in the linux-sandbox network namespace for local actions.
+Tags:
+execution
+
--[no]sandbox_explicit_pseudoterminal default: "false"Explicitly enable the creation of pseudoterminals for sandboxed actions. Some linux distributions require setting the group id of the process to 'tty' inside the sandbox in order for pseudoterminals to function. If this is causing issues, this flag can be disabled to enable other groups to be used.
+Tags:
+execution
+
--sandbox_tmpfs_path=<an absolute path> multiple uses are accumulatedFor sandboxed actions, mount an empty, writable directory at this absolute path (if supported by the sandboxing implementation, ignored otherwise).
+Tags:
+host_machine_resource_optimizations, execution
+
--[no]skip_incompatible_explicit_targets default: "false"Skip incompatible targets that are explicitly listed on the command line. By default, building such targets results in an error but they are silently skipped when this option is enabled. See: https://bazel.build/extending/platforms#skipping-incompatible-targets
+Tags:
+loading_and_analysis
+
--spawn_strategy=<comma-separated list of options> default: ""Specify how spawn actions are executed by default. Accepts a comma-separated list of strategies from highest to lowest priority. For each action Bazel picks the strategy with the highest priority that can execute the action. The default value is "remote,worker,sandboxed,local". See https://blog.bazel.build/2019/06/19/list-strategy.html for details.
+Tags:
+execution
+
--strategy=<a '[name=]value1[,..,valueN]' assignment> multiple uses are accumulatedSpecify how to distribute compilation of other spawn actions. Accepts a comma-separated list of strategies from highest to lowest priority. For each action Bazel picks the strategy with the highest priority that can execute the action. The default value is "remote,worker,sandboxed,local". This flag overrides the values set by --spawn_strategy (and --genrule_strategy if used with mnemonic Genrule). See https://blog.bazel.build/2019/06/19/list-strategy.html for details.
+Tags:
+execution
+
--strategy_regexp=<a '<RegexFilter>=value[,value]' assignment> multiple uses are accumulatedOverride which spawn strategy should be used to execute spawn actions that have descriptions matching a certain regex_filter. See --per_file_copt for details onregex_filter matching. The last regex_filter that matches the description is used. This option overrides other flags for specifying strategy. Example: --strategy_regexp=//foo..cc,-//foo/bar=local means to run actions using local strategy if their descriptions match //foo..cc but not //foo/bar. Example: --strategy_regexp='Compiling.*/bar=local --strategy_regexp=Compiling=sandboxed will run 'Compiling //foo/bar/baz' with the 'local' strategy, but reversing the order would run it with 'sandboxed'.
+Tags:
+execution
+
--worker_extra_flag=<a 'name=value' assignment> multiple uses are accumulatedExtra command-flags that will be passed to worker processes in addition to --persistent_worker, keyed by mnemonic (e.g. --worker_extra_flag=Javac=--debug.
+Tags:
+execution, host_machine_resource_optimizations
+
--worker_max_instances=<[name=]value, where value is an integer, or a keyword ("auto", "HOST_CPUS", "HOST_RAM"), optionally followed by an operation ([-|*]<float>) eg. "auto", "HOST_CPUS*.5"> multiple uses are accumulatedHow many instances of each kind of persistent worker may be launched if you use the 'worker' strategy. May be specified as [name=value] to give a different value per mnemonic. The limit is based on worker keys, which are differentiated based on mnemonic, but also on startup flags and environment, so there can in some cases be more workers per mnemonic than this flag specifies. Takes an integer, or a keyword ("auto", "HOST_CPUS", "HOST_RAM"), optionally followed by an operation ([-|]<float>) eg. "auto", "HOST_CPUS.5". 'auto' calculates a reasonable default based on machine capacity. "=value" sets a default for unspecified mnemonics.
+Tags:
+execution, host_machine_resource_optimizations
+
--worker_max_multiplex_instances=<[name=]value, where value is an integer, or a keyword ("auto", "HOST_CPUS", "HOST_RAM"), optionally followed by an operation ([-|*]<float>) eg. "auto", "HOST_CPUS*.5"> multiple uses are accumulatedHow many WorkRequests a multiplex worker process may receive in parallel if you use the 'worker' strategy with --worker_multiplex. May be specified as [name=value] to give a different value per mnemonic. The limit is based on worker keys, which are differentiated based on mnemonic, but also on startup flags and environment, so there can in some cases be more workers per mnemonic than this flag specifies. Takes an integer, or a keyword ("auto", "HOST_CPUS", "HOST_RAM"), optionally followed by an operation ([-|]<float>) eg. "auto", "HOST_CPUS.5". 'auto' calculates a reasonable default based on machine capacity. "=value" sets a default for unspecified mnemonics.
+Tags:
+execution, host_machine_resource_optimizations
+
--[no]worker_multiplex default: "true"If enabled, workers will use multiplexing if they support it.
+Tags:
+execution, host_machine_resource_optimizations
+
--[no]worker_quit_after_build default: "false"If enabled, all workers quit after a build is done.
+Tags:
+execution, host_machine_resource_optimizations
+
--[no]worker_sandboxing default: "false"If enabled, singleplex workers will run in a sandboxed environment. Singleplex workers are always sandboxed when running under the dynamic execution strategy, irrespective of this flag.
+Tags:
+execution
+
--[no]worker_verbose default: "false"If enabled, prints verbose messages when workers are started, shutdown, ...
+--[no]build default: "true"Execute the build; this is the usual behaviour. Specifying --nobuild causes the build to stop before executing the build actions, returning zero iff the package loading and analysis phases completed successfully; this mode is useful for testing those phases.
+Tags:
+execution, affects_outputs
+
--[no]experimental_use_validation_aspect default: "false"Whether to run validation actions using aspect (for parallelism with tests).
+Tags:
+execution, affects_outputs
+
--output_groups=<comma-separated list of options> multiple uses are accumulatedA list of comma-separated output group names, each of which optionally prefixed by a + or a -. A group prefixed by + is added to the default set of output groups, while a group prefixed by - is removed from the default set. If at least one group is not prefixed, the default set of output groups is omitted. For example, --output_groups=+foo,+bar builds the union of the default set, foo, and bar, while --output_groups=foo,bar overrides the default set such that only foo and bar are built.
+Tags:
+execution, affects_outputs
+
--[no]run_validations default: "true"Whether to run validation actions as part of the build. See https://bazel.build/extending/rules#validation_actions
+Tags:
+execution, affects_outputs
+
--serialized_frontier_profile=<a string> default: ""Dump a profile of serialized frontier bytes. Specifies the output path.
+Tags:
+bazel_monitoring
+
--aspects=<comma-separated list of options> multiple uses are accumulatedComma-separated list of aspects to be applied to top-level targets. In the list, if aspect some_aspect specifies required aspect providers via required_aspect_providers, some_aspect will run after every aspect that was mentioned before it in the aspects list whose advertised providers satisfy some_aspect required aspect providers. Moreover, some_aspect will run after all its required aspects specified by requires attribute. some_aspect will then have access to the values of those aspects' providers. <bzl-file-label>%<aspect_name>, for example '//tools:my_def.bzl%my_aspect', where 'my_aspect' is a top-level value from a file tools/my_def.bzl
+--bep_maximum_open_remote_upload_files=<an integer> default: "-1"Maximum number of open files allowed during BEP artifact upload.
+Tags:
+affects_outputs
+
--[no]experimental_convenience_symlinks default: "normal"This flag controls how the convenience symlinks (the symlinks that appear in the workspace after the build) will be managed. Possible values: +normal (default): Each kind of convenience symlink will be created or deleted, as determined by the build. +clean: All symlinks will be unconditionally deleted. +ignore: Symlinks will not be created or cleaned up. +log_only: Generate log messages as if 'normal' were passed, but don't actually perform any filesystem operations (useful for tools). +Note that only symlinks whose names are generated by the current value of --symlink_prefix can be affected; if the prefix changes, any pre-existing symlinks will be left alone.
+Tags:
+affects_outputs
+
--[no]experimental_convenience_symlinks_bep_event default: "true"This flag controls whether or not we will post the build eventConvenienceSymlinksIdentified to the BuildEventProtocol. If the value is true, the BuildEventProtocol will have an entry for convenienceSymlinksIdentified, listing all of the convenience symlinks created in your workspace. If false, then the convenienceSymlinksIdentified entry in the BuildEventProtocol will be empty.
+Tags:
+affects_outputs
+
--remote_download_allDownloads all remote outputs to the local machine. This flag is an alias for --remote_download_outputs=all.
+Expands to:
+
--remote_download_outputs=all
+
Tags:
+affects_outputs
+
--remote_download_minimalDoes not download any remote build outputs to the local machine. This flag is an alias for --remote_download_outputs=minimal.
+Expands to:
+
--remote_download_outputs=minimal
+
Tags:
+affects_outputs
+
--remote_download_outputs=<all, minimal or toplevel> default: "toplevel"If set to 'minimal' doesn't download any remote build outputs to the local machine, except the ones required by local actions. If set to 'toplevel' behaves like 'minimal' except that it also downloads outputs of top level targets to the local machine. Both options can significantly reduce build times if network bandwidth is a bottleneck.
+Tags:
+affects_outputs
+
--remote_download_symlink_template=<a string> default: ""Instead of downloading remote build outputs to the local machine, create symbolic links. The target of the symbolic links can be specified in the form of a template string. This template string may contain {hash} and {size_bytes} that expand to the hash of the object and the size in bytes, respectively. These symbolic links may, for example, point to a FUSE file system that loads objects from the CAS on demand.
+Tags:
+affects_outputs
+
--remote_download_toplevelOnly downloads remote outputs of top level targets to the local machine. This flag is an alias for --remote_download_outputs=toplevel.
+Expands to:
+
--remote_download_outputs=toplevel
+
Tags:
+affects_outputs
+
--symlink_prefix=<a string> default: see descriptionThe prefix that is prepended to any of the convenience symlinks that are created after a build. If omitted, the default value is the name of the build tool followed by a hyphen. If '/' is passed, then no symlinks are created and no warning is emitted. Warning: the special functionality for '/' will be deprecated soon; use --experimental_convenience_symlinks=ignore instead.
+Tags:
+affects_outputs
+
--[no]experimental_docker_privileged default: "false"If enabled, Bazel will pass the --privileged flag to 'docker run' when running actions. This might be required by your build, but it might also result in reduced hermeticity.
+Tags:
+execution
+
--[no]experimental_sandboxfs_map_symlink_targets default: "false"No-op
+Tags:
+host_machine_resource_optimizations, execution
+
--sandbox_add_mount_pair=<a single path or a 'source:target' pair> multiple uses are accumulatedAdd additional path pair to mount in sandbox.
+Tags:
+execution
+
--sandbox_block_path=<a string> multiple uses are accumulatedFor sandboxed actions, disallow access to this path.
+Tags:
+execution
+
--[no]sandbox_default_allow_network default: "true"Allow network access by default for actions; this may not work with all sandboxing implementations.
+Tags:
+execution
+
--[no]sandbox_fake_hostname default: "false"Change the current hostname to 'localhost' for sandboxed actions.
+Tags:
+execution
+
--[no]sandbox_fake_username default: "false"Change the current username to 'nobody' for sandboxed actions.
+Tags:
+execution
+
--sandbox_writable_path=<a string> multiple uses are accumulatedFor sandboxed actions, make an existing directory writable in the sandbox (if supported by the sandboxing implementation, ignored otherwise).
+Tags:
+execution
+
--[no]incompatible_config_setting_private_default_visibility default: "false"If incompatible_enforce_config_setting_visibility=false, this is a noop. Else, if this flag is false, any config_setting without an explicit visibility attribute is //visibility:public. If this flag is true, config_setting follows the same visibility logic as all other rules. See https://github.com/bazelbuild/bazel/issues/12933.
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]incompatible_enforce_config_setting_visibility default: "true"If true, enforce config_setting visibility restrictions. If false, every config_setting is visible to every target. See https://github.com/bazelbuild/bazel/issues/12932.
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]check_tests_up_to_date default: "false"Don't run tests, just check if they are up-to-date. If all tests results are up-to-date, the testing completes successfully. If any test needs to be built or executed, an error is reported and the testing fails. This option implies --check_up_to_date behavior.
+Tags:
+execution
+
--flaky_test_attempts=<a positive integer, the string "default", or test_regex@attempts. This flag may be passed more than once> multiple uses are accumulatedEach test will be retried up to the specified number of times in case of any test failure. Tests that required more than one attempt to pass are marked as 'FLAKY' in the test summary. Normally the value specified is just an integer or the string 'default'. If an integer, then all tests will be run up to N times. If 'default', then only a single test attempt will be made for regular tests and three for tests marked explicitly as flaky by their rule (flaky=1 attribute). Alternate syntax: regex_filter@flaky_test_attempts. Where flaky_test_attempts is as above and regex_filter stands for a list of include and exclude regular expression patterns (Also see --runs_per_test). Example: --flaky_test_attempts=//foo/.,-//foo/bar/.@3 deflakes all tests in //foo/ except those under foo/bar three times. This option can be passed multiple times. The most recently passed argument that matches takes precedence. If nothing matches, behavior is as if 'default' above.
+Tags:
+execution
+
--local_test_jobs=<an integer, or a keyword ("auto", "HOST_CPUS", "HOST_RAM"), optionally followed by an operation ([-|*]<float>) eg. "auto", "HOST_CPUS*.5"> default: "auto"The max number of local test jobs to run concurrently. Takes an integer, or a keyword ("auto", "HOST_CPUS", "HOST_RAM"), optionally followed by an operation ([-|]<float>) eg. "auto", "HOST_CPUS.5". 0 means local resources will limit the number of local test jobs to run concurrently instead. Setting this greater than the value for --jobs is ineffectual.
+Tags:
+execution
+
--[no]test_keep_going default: "true"When disabled, any non-passing test will cause the entire build to stop. By default all tests are run, even if some do not pass.
+Tags:
+execution
+
--test_strategy=<a string> default: ""Specifies which strategy to use when running tests.
+Tags:
+execution
+
--test_tmpdir=<a path> default: see descriptionSpecifies the base temporary directory for 'bazel test' to use.
+--cache_computed_file_digests=<a long integer> default: "50000"If greater than 0, configures Bazel to cache file digests in memory based on their metadata instead of recomputing the digests from disk every time they are needed. Setting this to 0 ensures correctness because not all file changes can be noted from file metadata. When not 0, the number indicates the size of the cache as the number of file digests to be cached.
+--experimental_active_directories=<comma-separated list of options> default: ""Active directories for Skyfocus and remote analysis caching. Specify as comma-separated workspace root-relative paths. This is a stateful flag. Defining one persists it for subsequent invocations, until it is redefined with a new set.
+Tags:
+host_machine_resource_optimizations
+
--[no]experimental_cpu_load_scheduling default: "false"Enables the experimental local execution scheduling based on CPU load, not estimation of actions one by one. Experimental scheduling have showed the large benefit on a large local builds on a powerful machines with the large number of cores. Reccommended to use with --local_resources=cpu=HOST_CPUS
+Tags:
+execution
+
--experimental_dynamic_ignore_local_signals=<a comma-separated list of signal numbers> default: see descriptionTakes a list of OS signal numbers. If a local branch of dynamic execution gets killed with any of these signals, the remote branch will be allowed to finish instead. For persistent workers, this only affects signals that kill the worker process.
+Tags:
+execution
+
--[no]experimental_enable_skyfocus default: "false"If true, enable the use of --experimental_active_directories to reduce Bazel's memory footprint for incremental builds. This feature is known as Skyfocus.
+Tags:
+host_machine_resource_optimizations
+
--local_cpu_resources=<an integer, or "HOST_CPUS", optionally followed by [-|*]<float>.> default: "HOST_CPUS"Explicitly set the total number of local CPU cores available to Bazel to spend on build actions executed locally. Takes an integer, or "HOST_CPUS", optionally followed by [-|]<float> (eg. HOST_CPUS.5 to use half the available CPU cores). By default, ("HOST_CPUS"), Bazel will query system configuration to estimate the number of CPU cores available.
+Tags:
+host_machine_resource_optimizations
+
--local_extra_resources=<a named float, 'name=value'> multiple uses are accumulatedSet the number of extra resources available to Bazel. Takes in a string-float pair. Can be used multiple times to specify multiple types of extra resources. Bazel will limit concurrently running actions based on the available extra resources and the extra resources required. Tests can declare the amount of extra resources they need by using a tag of the "resources:<resoucename>:<amount>" format. Available CPU, RAM and resources cannot be set with this flag.
+Tags:
+host_machine_resource_optimizations
+
--local_ram_resources=<an integer number of MBs, or "HOST_RAM", optionally followed by [-|*]<float>.> default: "HOST_RAM*.67"Explicitly set the total amount of local host RAM (in MB) available to Bazel to spend on build actions executed locally. Takes an integer, or "HOST_RAM", optionally followed by [-|]<float> (eg. HOST_RAM.5 to use half the available RAM). By default, ("HOST_RAM*.67"), Bazel will query system configuration to estimate the amount of RAM available and will use 67% of it.
+Tags:
+host_machine_resource_optimizations
+
--local_resources=<a named double, 'name=value', where value is an integer, or a keyword ("auto", "HOST_CPUS", "HOST_RAM"), optionally followed by an operation ([-|*]<float>) eg. "auto", "HOST_CPUS*.5"> multiple uses are accumulatedSet the number of resources available to Bazel. Takes in an assignment to a float or HOST_RAM/HOST_CPUS, optionally followed by [-|]<float> (eg. memory=HOST_RAM.5 to use half the available RAM). Can be used multiple times to specify multiple types of resources. Bazel will limit concurrently running actions based on the available resources and the resources required. Tests can declare the amount of resources they need by using a tag of the "resources:<resource name>:<amount>" format. Overrides resources specified by --local_{cpu|ram|extra}_resources.
+Tags:
+host_machine_resource_optimizations
+
--build_event_upload_max_retries=<an integer> default: "4"The maximum number of times Bazel should retry uploading a build event.
+Tags:
+bazel_internal_configuration
+
--[no]debug_spawn_scheduler default: "false"--[no]experimental_bep_target_summary default: "false"Whether to publish TargetSummary events.
+--[no]experimental_build_event_expand_filesets default: "false"If true, expand Filesets in the BEP when presenting output files.
+Tags:
+affects_outputs
+
--experimental_build_event_output_group_mode=<an output group name followed by an OutputGroupFileMode, e.g. default=both> multiple uses are accumulatedSpecify how an output group's files will be represented in TargetComplete/AspectComplete BEP events. Values are an assignment of an output group name to one of 'NAMED_SET_OF_FILES_ONLY', 'INLINE_ONLY', or 'BOTH'. The default value is 'NAMED_SET_OF_FILES_ONLY'. If an output group is repeated, the final value to appear is used. The default value sets the mode for coverage artifacts to BOTH: --experimental_build_event_output_group_mode=baseline.lcov=both
+Tags:
+affects_outputs
+
--experimental_build_event_upload_retry_minimum_delay=<An immutable length of time.> default: "1s"Initial, minimum delay for exponential backoff retries when BEP upload fails. (exponent: 1.6)
+Tags:
+bazel_internal_configuration
+
--experimental_build_event_upload_strategy=<a string> default: see descriptionSelects how to upload artifacts referenced in the build event protocol. In Bazel the valid options include 'local' and 'remote'. The default value is 'local'.
+Tags:
+affects_outputs
+
--[no]experimental_docker_verbose default: "false"If enabled, Bazel will print more verbose messages about the Docker sandbox strategy.
+Tags:
+execution
+
--experimental_frontier_violation_check=<strict, warn or disabled_for_testing> default: "strict"Strategies to handle potential incorrectness from changes beyond the frontier (i.e. outside the active directories)
+Tags:
+eagerness_to_exit
+
--[no]experimental_frontier_violation_verbose default: "false"If true, Bazel will print instructions for fixing Skycache violations
+Tags:
+terminal_output
+
--[no]experimental_materialize_param_files_directly default: "false"If materializing param files, do so with direct writes to disk.
+Tags:
+execution
+
--[no]experimental_run_bep_event_include_residue default: "false"Whether to include the command-line residue in run build events which could contain the residue. By default, the residue is not included in run command build events that could contain the residue.
+Tags:
+affects_outputs
+
--experimental_skyfocus_dump_keys=<none, count or verbose> default: "none"For debugging Skyfocus. Dump the focused SkyKeys (roots, leafs, focused deps, focused rdeps).
+Tags:
+terminal_output
+
--[no]experimental_skyfocus_dump_post_gc_stats default: "false"For debugging Skyfocus. If enabled, trigger manual GC before/after focusing to report heap sizes reductions. This will increase the Skyfocus latency.
+Tags:
+terminal_output
+
--[no]experimental_stream_log_file_uploads default: "false"Stream log file uploads directly to the remote storage rather than writing them to disk.
+Tags:
+affects_outputs
+
--explain=<a path> default: see descriptionCauses the build system to explain each executed step of the build. The explanation is written to the specified log file.
+Tags:
+affects_outputs
+
--[no]ignore_unsupported_sandboxing default: "false"Do not print a warning when sandboxed execution is not supported on this system.
+Tags:
+terminal_output
+
--[no]legacy_important_outputs default: "false"Use this to suppress generation of the legacy important_outputs field in the TargetComplete event. important_outputs are required for Bazel to ResultStore/BTX integration.
+Tags:
+affects_outputs
+
--[no]materialize_param_files default: "false"Writes intermediate parameter files to output tree even when using remote action execution or caching. Useful when debugging actions. This is implied by --subcommands and --verbose_failures.
+Tags:
+execution
+
--max_config_changes_to_show=<an integer> default: "3"When discarding the analysis cache due to a change in the build options, displays up to the given number of changed option names. If the number given is -1, all changed options will be displayed.
+Tags:
+terminal_output
+
--max_test_output_bytes=<an integer> default: "-1"Specifies maximum per-test-log size that can be emitted when --test_output is 'errors' or 'all'. Useful for avoiding overwhelming the output with excessively noisy test output. The test header is included in the log size. Negative values imply no limit. Output is all or nothing.
+Tags:
+test_runner, terminal_output, execution
+
--output_filter=<a valid Java regular expression> default: see descriptionOnly shows warnings and action outputs for rules with a name matching the provided regular expression.
+Tags:
+affects_outputs
+
--progress_report_interval=<an integer in 0-3600 range> default: "0"The number of seconds to wait between reports on still running jobs. The default value 0 means the first report will be printed after 10 seconds, then 30 seconds and after that progress is reported once every minute. When --curses is enabled, progress is reported every second.
+Tags:
+affects_outputs
+
--remote_analysis_json_log=<a string> default: see descriptionIf set, a JSON file is written to this location that contains a detailed log of the behavior of remote analysis caching. It's interpreted as a path relative to the current working directory.
+Tags:
+bazel_monitoring
+
--remote_print_execution_messages=<failure, success or all> default: "failure"Choose when to print remote execution messages. Valid values are failure, to print only on failures, success to print only on successes and all to print always.
Tags:
+terminal_output
+
--[no]sandbox_debug default: "false"Enables debugging features for the sandboxing feature. This includes two things: first, the sandbox root contents are left untouched after a build; and second, prints extra debugging information on execution. This can help developers of Bazel or Starlark rules with debugging failures due to missing input files, etc.
+Tags:
+terminal_output
+
--show_result=<an integer> default: "1"Show the results of the build. For each target, state whether or not it was brought up-to-date, and if so, a list of output files that were built. The printed files are convenient strings for copy+pasting to the shell, to execute them. +This option requires an integer argument, which is the threshold number of targets above which result information is not printed. Thus zero causes suppression of the message and MAX_INT causes printing of the result to occur always. The default is one. +If nothing was built for a target its results may be omitted to keep the output under the threshold.
+Tags:
+affects_outputs
+
--[no]subcommands [-s] default: "false"Display the subcommands executed during a build. Related flags: --execution_log_json_file, --execution_log_binary_file (for logging subcommands to a file in a tool-friendly format).
+Tags:
+terminal_output
+
--test_output=<summary, errors, all or streamed> default: "summary"Specifies desired output mode. Valid values are 'summary' to output only test status summary, 'errors' to also print test logs for failed tests, 'all' to print logs for all tests and 'streamed' to output logs for all tests in real time (this will force tests to be executed locally one at a time regardless of --test_strategy value).
+Tags:
+test_runner, terminal_output, execution
+
--test_summary=<short, terse, detailed, none or testcase> default: "short"Specifies the desired format of the test summary. Valid values are 'short' to print information only about tests executed, 'terse', to print information only about unsuccessful tests that were run, 'detailed' to print detailed information about failed test cases, 'testcase' to print summary in test case resolution, do not print detailed information about failed test cases and 'none' to omit the summary.
+Tags:
+terminal_output
+
--[no]verbose_failures default: "false"If a command fails, print out the full command line.
+Tags:
+terminal_output
+
--aspects_parameters=<a 'name=value' assignment> multiple uses are accumulatedSpecifies the values of the command-line aspects parameters. Each parameter value is specified via <param_name>=<param_value>, for example 'my_param=my_val' where 'my_param' is a parameter of some aspect in --aspects list or required by an aspect in the list. This option can be used multiple times. However, it is not allowed to assign values to the same parameter more than once.
+Tags:
+loading_and_analysis
+
--target_pattern_file=<a string> default: ""If set, build will read patterns from the file named here, rather than on the command line. It is an error to specify a file here as well as command-line patterns.
+Tags:
+changes_inputs
+
--experimental_circuit_breaker_strategy=<failure> default: see descriptionSpecifies the strategy for the circuit breaker to use. Available strategies are "failure". On invalid value for the option the behavior same as the option is not set.
+Tags:
+execution
+
--experimental_remote_cache_compression_threshold=<an integer> default: "100"The minimum blob size required to compress/decompress with zstd. Ineffectual unless --remote_cache_compression is set.
+--experimental_remote_cache_eviction_retries=<an integer> default: "5"The maximum number of attempts to retry if the build encountered a transient remote cache error that would otherwise fail the build. Applies for example when artifacts are evicted from the remote cache, or in certain cache failure conditions. A new invocation id will be generated for each attempt.
+Tags:
+execution
+
--[no]experimental_remote_cache_lease_extension default: "false"If set to true, Bazel will extend the lease for outputs of remote actions during the build by sending FindMissingBlobs calls periodically to remote cache. The frequency is based on the value of --experimental_remote_cache_ttl.
--experimental_remote_cache_ttl=<An immutable length of time.> default: "3h"The guaranteed minimal TTL of blobs in the remote cache after their digests are recently referenced e.g. by an ActionResult or FindMissingBlobs. Bazel does several optimizations based on the blobs' TTL e.g. doesn't repeatedly call GetActionResult in an incremental build. The value should be set slightly less than the real TTL since there is a gap between when the server returns the digests and when Bazel receives them.
+Tags:
+execution
+
--experimental_remote_capture_corrupted_outputs=<a path> default: see descriptionA path to a directory where the corrupted outputs will be captured to.
+--[no]experimental_remote_discard_merkle_trees default: "true"If set to true, discard in-memory copies of the input root's Merkle tree and associated input mappings during calls to GetActionResult() and Execute(). This reduces memory usage significantly, but does require Bazel to recompute them upon remote cache misses and retries.
+--experimental_remote_downloader=<a string> default: see descriptionA Remote Asset API endpoint URI, to be used as a remote download proxy. The supported schemas are grpc, grpcs (grpc with TLS enabled) and unix (local UNIX sockets). If no schema is provided Bazel will default to grpcs. See: https://github.com/bazelbuild/remote-apis/blob/master/build/bazel/remote/asset/v1/remote_asset.proto
+--[no]experimental_remote_downloader_local_fallback default: "false"Whether to fall back to the local downloader if remote downloader fails.
+--[no]experimental_remote_downloader_propagate_credentials default: "false"Whether to propagate credentials from netrc and credential helper to the remote downloader server. The server implementation needs to support the new http_header_url:<url-index>:<header-key> qualifier where the <url-index> is a 0-based position of the URL inside the FetchBlobRequest's uris field. The URL-specific headers should take precedence over the global headers.
--[no]experimental_remote_execution_keepalive default: "false"Whether to use keepalive for remote execution calls.
+--experimental_remote_failure_rate_threshold=<an integer in 0-100 range> default: "10"Sets the allowed number of failure rate in percentage for a specific time window after which it stops calling to the remote cache/executor. By default the value is 10. Setting this to 0 means no limitation.
+Tags:
+execution
+
--experimental_remote_failure_window_interval=<An immutable length of time.> default: "60s"The interval in which the failure rate of the remote requests are computed. On zero or negative value the failure duration is computed the whole duration of the execution.Following units can be used: Days (d), hours (h), minutes (m), seconds (s), and milliseconds (ms). If the unit is omitted, the value is interpreted as seconds.
+Tags:
+execution
+
--[no]experimental_remote_mark_tool_inputs default: "false"If set to true, Bazel will mark inputs as tool inputs for the remote executor. This can be used to implement remote persistent workers.
+--[no]experimental_remote_merkle_tree_cache default: "false"If set to true, Merkle tree calculations will be memoized to improve the remote cache hit checking speed. The memory foot print of the cache is controlled by --experimental_remote_merkle_tree_cache_size.
+--experimental_remote_merkle_tree_cache_size=<a long integer> default: "1000"The number of Merkle trees to memoize to improve the remote cache hit checking speed. Even though the cache is automatically pruned according to Java's handling of soft references, out-of-memory errors can occur if set too high. If set to 0 the cache size is unlimited. Optimal value varies depending on project's size. Default to 1000.
+--experimental_remote_output_service=<a string> default: see descriptionHOST or HOST:PORT of a remote output service endpoint. The supported schemas are grpc, grpcs (grpc with TLS enabled) and unix (local UNIX sockets). If no schema is provided Bazel will default to grpcs. Specify grpc:// or unix: schema to disable TLS.
+--experimental_remote_output_service_output_path_prefix=<a string> default: ""The path under which the contents of output directories managed by the --experimental_remote_output_service are placed. The actual output directory used by a build will be a descendant of this path and determined by the output service.
+--[no]experimental_remote_require_cached default: "false"If set to true, enforce that all actions that can run remotely are cached, or else fail the build. This is useful to troubleshoot non-determinism issues as it allows checking whether actions that should be cached are actually cached without spuriously injecting new results into the cache.
+--experimental_remote_scrubbing_config=<Converts to a Scrubber> default: see descriptionEnables remote cache key scrubbing with the supplied configuration file, which must be a protocol buffer in text format (see src/main/protobuf/remote_scrubbing.proto).
+This feature is intended to facilitate sharing a remote/disk cache between actions executing on different platforms but targeting the same platform. It should be used with extreme care, as improper settings may cause accidental sharing of cache entries and result in incorrect builds.
+Scrubbing does not affect how an action is executed, only how its remote/disk cache key is computed for the purpose of retrieving or storing an action result. Scrubbed actions are incompatible with remote execution, and will always be executed locally instead.
+Modifying the scrubbing configuration does not invalidate outputs present in the local filesystem or internal caches; a clean build is required to reexecute affected actions.
+In order to successfully use this feature, you likely want to set a custom --host_platform together with --experimental_platform_in_output_dir (to normalize output prefixes) and --incompatible_strict_action_env (to normalize environment variables).
+--[no]guard_against_concurrent_changes default: "lite"Set this to 'full' to enable checking the ctime of all input files of an action before uploading it to a remote cache. There may be cases where the Linux kernel delays writing of files, which could cause false positives. The default is 'lite', which only checks source files in the main repository. Setting this to 'off' disables all checks. This is not recommended, as the cache may be polluted when a source file is changed while an action that takes it as an input is executing.
+Tags:
+execution
+
--[no]remote_accept_cached default: "true"Whether to accept remotely cached action results.
+--remote_build_event_upload=<all or minimal> default: "minimal"If set to 'all', all local outputs referenced by BEP are uploaded to remote cache. +If set to 'minimal', local outputs referenced by BEP are not uploaded to the remote cache, except for files that are important to the consumers of BEP (e.g. test logs and timing profile). bytestream:// scheme is always used for the uri of files even if they are missing from remote cache. +Default to 'minimal'.
+--remote_bytestream_uri_prefix=<a string> default: see descriptionThe hostname and instance name to be used in bytestream:// URIs that are written into build event streams. This option can be set when builds are performed using a proxy, which causes the values of --remote_executor and --remote_instance_name to no longer correspond to the canonical name of the remote execution service. When not set, it will default to "${hostname}/${instance_name}".
+--remote_cache=<a string> default: see descriptionA URI of a caching endpoint. The supported schemas are http, https, grpc, grpcs (grpc with TLS enabled) and unix (local UNIX sockets). If no schema is provided Bazel will default to grpcs. Specify grpc://, http:// or unix: schema to disable TLS. See https://bazel.build/remote/caching
+--[no]remote_cache_async default: "true"If true, uploading of action results to a disk or remote cache will happen in the background instead of blocking the completion of an action. Some actions are incompatible with background uploads, and may still block even when this flag is set.
+--[no]remote_cache_compression default: "false"If enabled, compress/decompress cache blobs with zstd when their size is at least --experimental_remote_cache_compression_threshold.
+--remote_cache_header=<a 'name=value' assignment> multiple uses are accumulatedSpecify a header that will be included in cache requests: --remote_cache_header=Name=Value. Multiple headers can be passed by specifying the flag multiple times. Multiple values for the same name will be converted to a comma-separated list.
+--remote_default_exec_properties=<a 'name=value' assignment> multiple uses are accumulatedSet the default exec properties to be used as the remote execution platform if an execution platform does not already set exec_properties.
+Tags:
+affects_outputs
+
--remote_default_platform_properties=<a string> default: ""Set the default platform properties to be set for the remote execution API, if the execution platform does not already set remote_execution_properties. This value will also be used if the host platform is selected as the execution platform for remote execution.
+--remote_download_regex=<a valid Java regular expression> multiple uses are accumulatedForce remote build outputs whose path matches this pattern to be downloaded, irrespective of --remote_download_outputs. Multiple patterns may be specified by repeating this flag.
+Tags:
+affects_outputs
+
--remote_downloader_header=<a 'name=value' assignment> multiple uses are accumulatedSpecify a header that will be included in remote downloader requests: --remote_downloader_header=Name=Value. Multiple headers can be passed by specifying the flag multiple times. Multiple values for the same name will be converted to a comma-separated list.
+--remote_exec_header=<a 'name=value' assignment> multiple uses are accumulatedSpecify a header that will be included in execution requests: --remote_exec_header=Name=Value. Multiple headers can be passed by specifying the flag multiple times. Multiple values for the same name will be converted to a comma-separated list.
+--remote_execution_priority=<an integer> default: "0"The relative priority of actions to be executed remotely. The semantics of the particular priority values are server-dependent.
+--remote_executor=<a string> default: see descriptionHOST or HOST:PORT of a remote execution endpoint. The supported schemas are grpc, grpcs (grpc with TLS enabled) and unix (local UNIX sockets). If no schema is provided Bazel will default to grpcs. Specify grpc:// or unix: schema to disable TLS.
+--remote_grpc_log=<a path> default: see descriptionIf specified, a path to a file to log gRPC call related details. This log consists of a sequence of serialized com.google.devtools.build.lib.remote.logging.RemoteExecutionLog.LogEntry protobufs with each message prefixed by a varint denoting the size of the following serialized protobuf message, as performed by the method LogEntry.writeDelimitedTo(OutputStream).
+--remote_header=<a 'name=value' assignment> multiple uses are accumulatedSpecify a header that will be included in requests: --remote_header=Name=Value. Multiple headers can be passed by specifying the flag multiple times. Multiple values for the same name will be converted to a comma-separated list.
+--remote_instance_name=<a string> default: ""Value to pass as instance_name in the remote execution API.
+--[no]remote_local_fallback default: "false"Whether to fall back to standalone local execution strategy if remote execution fails.
+--remote_local_fallback_strategy=<a string> default: "local"Deprecated. See https://github.com/bazelbuild/bazel/issues/7480 for details.
+--remote_max_connections=<an integer> default: "100"Limit the max number of concurrent connections to remote cache/executor. By default the value is 100. Setting this to 0 means no limitation.
+For HTTP remote cache, one TCP connection could handle one request at one time, so Bazel could make up to --remote_max_connections concurrent requests.
+For gRPC remote cache/executor, one gRPC channel could usually handle 100+ concurrent requests, so Bazel could make around --remote_max_connections * 100 concurrent requests.
Tags:
+host_machine_resource_optimizations
+
--remote_proxy=<a string> default: see descriptionConnect to the remote cache through a proxy. Currently this flag can only be used to configure a Unix domain socket (unix:/path/to/socket).
+--remote_result_cache_priority=<an integer> default: "0"The relative priority of remote actions to be stored in remote cache. The semantics of the particular priority values are server-dependent.
+--remote_retries=<an integer> default: "5"The maximum number of attempts to retry a transient error. If set to 0, retries are disabled.
+--remote_retry_max_delay=<An immutable length of time.> default: "5s"The maximum backoff delay between remote retry attempts. Following units can be used: Days (d), hours (h), minutes (m), seconds (s), and milliseconds (ms). If the unit is omitted, the value is interpreted as seconds.
+--remote_timeout=<An immutable length of time.> default: "60s"The maximum amount of time to wait for remote execution and cache calls. For the REST cache, this is both the connect and the read timeout. Following units can be used: Days (d), hours (h), minutes (m), seconds (s), and milliseconds (ms). If the unit is omitted, the value is interpreted as seconds.
+--[no]remote_upload_local_results default: "true"Whether to upload locally executed action results to the remote cache if the remote cache supports it and the user is authorized to do so.
+--[no]remote_verify_downloads default: "true"If set to true, Bazel will compute the hash sum of all remote downloads and discard the remotely cached values if they don't match the expected value.
+--[no]allow_analysis_cache_discard default: "true"If discarding the analysis cache due to a change in the build system, setting this option to false will cause bazel to exit, rather than continuing with the build. This option has no effect when 'discard_analysis_cache' is also set.
+Tags:
+eagerness_to_exit
+
--auto_output_filter=<none, all, packages or subpackages> default: "none"If --output_filter is not specified, then the value for this option is used create a filter automatically. Allowed values are 'none' (filter nothing / show everything), 'all' (filter everything / show nothing), 'packages' (include output from rules in packages mentioned on the Blaze command line), and 'subpackages' (like 'packages', but also include subpackages). For the 'packages' and 'subpackages' values //java/foo and //javatests/foo are treated as one package)'.
+--[no]build_manual_tests default: "false"Forces test targets tagged 'manual' to be built. 'manual' tests are excluded from processing. This option forces them to be built (but not executed).
+--build_tag_filters=<comma-separated list of options> default: ""Specifies a comma-separated list of tags. Each tag can be optionally preceded with '-' to specify excluded tags. Only those targets will be built that contain at least one included tag and do not contain any excluded tags. This option does not affect the set of tests executed with the 'test' command; those are be governed by the test filtering options, for example '--test_tag_filters'
+--[no]build_tests_only default: "false"If specified, only *_test and test_suite rules will be built and other targets specified on the command line will be ignored. By default everything that was requested will be built.
+--combined_report=<none or lcov> default: "lcov"Specifies desired cumulative coverage report type. At this point only LCOV is supported.
+--[no]compile_one_dependency default: "false"Compile a single dependency of the argument files. This is useful for syntax checking source files in IDEs, for example, by rebuilding a single target that depends on the source file to detect errors as early as possible in the edit/build/test cycle. This argument affects the way all non-flag arguments are interpreted; instead of being targets to build they are source filenames. For each source filename an arbitrary target that depends on it will be built.
+--deleted_packages=<comma-separated list of package names> multiple uses are accumulatedA comma-separated list of names of packages which the build system will consider non-existent, even if they are visible somewhere on the package path. +Use this option when deleting a subpackage 'x/y' of an existing package 'x'. For example, after deleting x/y/BUILD in your client, the build system may complain if it encounters a label '//x:y/z' if that is still provided by another package_path entry. Specifying --deleted_packages x/y avoids this problem.
+--[no]discard_analysis_cache default: "false"Discard the analysis cache immediately after the analysis phase completes. Reduces memory usage by ~10%, but makes further incremental builds slower.
+--disk_cache=<a path> default: see descriptionA path to a directory where Bazel can read and write actions and action outputs. If the directory does not exist, it will be created.
+--embed_label=<a one-line string> default: ""Embed source control revision or release label in binary
+--execution_log_binary_file=<a path> default: see descriptionLog the executed spawns into this file as length-delimited SpawnExec protos, according to src/main/protobuf/spawn.proto. Prefer --execution_log_compact_file, which is significantly smaller and cheaper to produce. Related flags: --execution_log_compact_file (compact format; mutually exclusive), --execution_log_json_file (text JSON format; mutually exclusive), --execution_log_sort (whether to sort the execution log), --subcommands (for displaying subcommands in terminal output).
+--execution_log_compact_file=<a path> default: see descriptionLog the executed spawns into this file as length-delimited ExecLogEntry protos, according to src/main/protobuf/spawn.proto. The entire file is zstd compressed. Related flags: --execution_log_binary_file (binary protobuf format; mutually exclusive), --execution_log_json_file (text JSON format; mutually exclusive), --subcommands (for displaying subcommands in terminal output).
+--execution_log_json_file=<a path> default: see descriptionLog the executed spawns into this file as newline-delimited JSON representations of SpawnExec protos, according to src/main/protobuf/spawn.proto. Prefer --execution_log_compact_file, which is significantly smaller and cheaper to produce. Related flags: --execution_log_compact_file (compact format; mutually exclusive), --execution_log_binary_file (binary protobuf format; mutually exclusive), --execution_log_sort (whether to sort the execution log), --subcommands (for displaying subcommands in terminal output).
+--[no]execution_log_sort default: "true"Whether to sort the execution log, making it easier to compare logs across invocations. Set to false to avoid potentially significant CPU and memory usage at the end of the invocation, at the cost of producing the log in nondeterministic execution order. Only applies to the binary and JSON formats; the compact format is never sorted.
+--[no]expand_test_suites default: "true"Expand test_suite targets into their constituent tests before analysis. When this flag is turned on (the default), negative target patterns will apply to the tests belonging to the test suite, otherwise they will not. Turning off this flag is useful when top-level aspects are applied at command line: then they can analyze test_suite targets.
+Tags:
+loading_and_analysis
+
--experimental_disk_cache_gc_idle_delay=<An immutable length of time.> default: "5m"How long the server must remain idle before a garbage collection of the disk cache occurs. To specify the garbage collection policy, set --experimental_disk_cache_gc_max_size and/or --experimental_disk_cache_gc_max_age.
+--experimental_disk_cache_gc_max_age=<An immutable length of time.> default: "0"If set to a positive value, the disk cache will be periodically garbage collected to remove entries older than this age. If set in conjunction with --experimental_disk_cache_gc_max_size, both criteria are applied. Garbage collection occurrs in the background once the server has become idle, as determined by the --experimental_disk_cache_gc_idle_delay flag.
+--experimental_disk_cache_gc_max_size=<a size in bytes, optionally followed by a K, M, G or T multiplier> default: "0"If set to a positive value, the disk cache will be periodically garbage collected to stay under this size. If set in conjunction with --experimental_disk_cache_gc_max_age, both criteria are applied. Garbage collection occurrs in the background once the server has become idle, as determined by the --experimental_disk_cache_gc_idle_delay flag.
+--experimental_extra_action_filter=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths> default: ""Deprecated in favor of aspects. Filters set of targets to schedule extra_actions for.
+--[no]experimental_extra_action_top_level_only default: "false"Deprecated in favor of aspects. Only schedules extra_actions for top level targets.
+--experimental_spawn_schedulerEnable dynamic execution by running actions locally and remotely in parallel. Bazel spawns each action locally and remotely and picks the one that completes first. If an action supports workers, the local action will be run in the persistent worker mode. To enable dynamic execution for an individual action mnemonic, use the --internal_spawn_scheduler and --strategy=<mnemonic>=dynamic flags instead.
Expands to:
+
--internal_spawn_scheduler
+
--spawn_strategy=dynamic
+
--[no]fetch default: "true"Allows the command to fetch external dependencies. If set to false, the command will utilize any cached version of the dependency, and if none exists, the command will result in failure.
+--local_termination_grace_seconds=<an integer> default: "15"Time to wait between terminating a local process due to timeout and forcefully shutting it down.
+--package_path=<colon-separated list of options> default: "%workspace%"A colon-separated list of where to look for packages. Elements beginning with '%workspace%' are relative to the enclosing workspace. If omitted or empty, the default is the output of 'bazel info default-package-path'.
+--[no]show_loading_progress default: "true"If enabled, causes Bazel to print "Loading package:" messages.
+--test_lang_filters=<comma-separated list of options> default: ""Specifies a comma-separated list of test languages. Each language can be optionally preceded with '-' to specify excluded languages. Only those test targets will be found that are written in the specified languages. The name used for each language should be the same as the language prefix in the *_test rule, e.g. one of 'cc', 'java', 'py', etc. This option affects --build_tests_only behavior and the test command.
+--test_size_filters=<comma-separated list of values: small, medium, large, or enormous> default: ""Specifies a comma-separated list of test sizes. Each size can be optionally preceded with '-' to specify excluded sizes. Only those test targets will be found that contain at least one included size and do not contain any excluded sizes. This option affects --build_tests_only behavior and the test command.
+--test_tag_filters=<comma-separated list of options> default: ""Specifies a comma-separated list of test tags. Each tag can be optionally preceded with '-' to specify excluded tags. Only those test targets will be found that contain at least one included tag and do not contain any excluded tags. This option affects --build_tests_only behavior and the test command.
+--test_timeout_filters=<comma-separated list of values: short, moderate, long, or eternal> default: ""Specifies a comma-separated list of test timeouts. Each timeout can be optionally preceded with '-' to specify excluded timeouts. Only those test targets will be found that contain at least one included timeout and do not contain any excluded timeouts. This option affects --build_tests_only behavior and the test command.
+--workspace_status_command=<path> default: ""A command invoked at the beginning of the build to provide status information about the workspace in the form of key/value pairs. See the User's Manual for the full specification. Also see tools/buildstamp/get_workspace_status for an example.
+--[no]experimental_persistent_aar_extractor default: "false"Enable persistent aar extractor by using workers.
+Tags:
+execution, experimental
+
--[no]experimental_remotable_source_manifests default: "false"Whether to make source manifest actions remotable
+Tags:
+loading_and_analysis, execution, experimental
+
--[no]experimental_split_coverage_postprocessing default: "false"If true, then Bazel will run coverage postprocessing for test in a new spawn.
+Tags:
+execution, experimental
+
--[no]experimental_strict_fileset_output default: "false"If this option is enabled, filesets will treat all output artifacts as regular files. They will not traverse directories or be sensitive to symlinks.
+Tags:
+execution, experimental
+
--[no]incompatible_modify_execution_info_additive default: "true"When enabled, passing multiple --modify_execution_info flags is additive. When disabled, only the last flag is taken into account.
+Tags:
+execution, affects_outputs, loading_and_analysis, incompatible_change
+
--modify_execution_info=<regex=[+-]key,regex=[+-]key,...> multiple uses are accumulatedAdd or remove keys from an action's execution info based on action mnemonic. Applies only to actions which support execution info. Many common actions support execution info, e.g. Genrule, CppCompile, Javac, StarlarkAction, TestRunner. When specifying multiple values, order matters because many regexes may apply to the same mnemonic.
+Syntax: "regex=[+-]key,regex=[+-]key,...".
+Examples: +'.=+x,.=-y,.=+z' adds 'x' and 'z' to, and removes 'y' from, the execution info for all actions. +'Genrule=+requires-x' adds 'requires-x' to the execution info for all Genrule actions. +'(?!Genrule).=-requires-x' removes 'requires-x' from the execution info for all non-Genrule actions.
+Tags:
+execution, affects_outputs, loading_and_analysis
+
--persistent_android_dex_desugarEnable persistent Android dex and desugar actions by using workers.
+Expands to:
+
--internal_persistent_android_dex_desugar
+
--strategy=Desugar=worker
+
--strategy=DexBuilder=worker
+
Tags:
+host_machine_resource_optimizations, execution
+
--persistent_android_resource_processorEnable persistent Android resource processor by using workers.
+Expands to:
+
--internal_persistent_busybox_tools
+
--strategy=AaptPackage=worker
+
--strategy=AndroidResourceParser=worker
+
--strategy=AndroidResourceValidator=worker
+
--strategy=AndroidResourceCompiler=worker
+
--strategy=RClassGenerator=worker
+
--strategy=AndroidResourceLink=worker
+
--strategy=AndroidAapt2=worker
+
--strategy=AndroidAssetMerger=worker
+
--strategy=AndroidResourceMerger=worker
+
--strategy=AndroidCompiledResourceMerger=worker
+
--strategy=ManifestMerger=worker
+
--strategy=AndroidManifestMerger=worker
+
--strategy=Aapt2Optimize=worker
+
--strategy=AARGenerator=worker
+
--strategy=ProcessDatabinding=worker
+
--strategy=GenerateDataBindingBaseClasses=worker
+
Tags:
+host_machine_resource_optimizations, execution
+
--persistent_multiplex_android_dex_desugarEnable persistent multiplexed Android dex and desugar actions by using workers.
+Expands to:
+
--persistent_android_dex_desugar
+
--internal_persistent_multiplex_android_dex_desugar
+
Tags:
+host_machine_resource_optimizations, execution
+
--persistent_multiplex_android_resource_processorEnable persistent multiplexed Android resource processor by using workers.
+Expands to:
+
--persistent_android_resource_processor
+
--modify_execution_info=AaptPackage=+supports-multiplex-workers
+
--modify_execution_info=AndroidResourceParser=+supports-multiplex-workers
+
--modify_execution_info=AndroidResourceValidator=+supports-multiplex-workers
+
--modify_execution_info=AndroidResourceCompiler=+supports-multiplex-workers
+
--modify_execution_info=RClassGenerator=+supports-multiplex-workers
+
--modify_execution_info=AndroidResourceLink=+supports-multiplex-workers
+
--modify_execution_info=AndroidAapt2=+supports-multiplex-workers
+
--modify_execution_info=AndroidAssetMerger=+supports-multiplex-workers
+
--modify_execution_info=AndroidResourceMerger=+supports-multiplex-workers
+
--modify_execution_info=AndroidCompiledResourceMerger=+supports-multiplex-workers
+
--modify_execution_info=ManifestMerger=+supports-multiplex-workers
+
--modify_execution_info=AndroidManifestMerger=+supports-multiplex-workers
+
--modify_execution_info=Aapt2Optimize=+supports-multiplex-workers
+
--modify_execution_info=AARGenerator=+supports-multiplex-workers
+
Tags:
+host_machine_resource_optimizations, execution
+
--persistent_multiplex_android_toolsEnable persistent and multiplexed Android tools (dexing, desugaring, resource processing).
+Expands to:
+
--internal_persistent_multiplex_busybox_tools
+
--persistent_multiplex_android_resource_processor
+
--persistent_multiplex_android_dex_desugar
+
Tags:
+host_machine_resource_optimizations, execution
+
--[no]use_target_platform_for_tests default: "false"If true, use the target platform for running tests rather than the test exec group.
+Tags:
+execution
+
--android_compiler=<a string> default: see descriptionThe Android target compiler.
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state
+
--android_manifest_merger=<legacy, android or force_android> default: "android"Selects the manifest merger to use for android_binary rules. Flag to help the transition to the Android manifest merger from the legacy merger.
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state
+
--android_platforms=<a build target label> default: ""Sets the platforms that android_binary targets use. If multiple platforms are specified, then the binary is a fat APKs, which contains native binaries for each specified target platform.
+Tags:
+changes_inputs, loading_and_analysis, loses_incremental_state
+
--cc_output_directory_tag=<a string> default: ""Specifies a suffix to be added to the configuration directory.
+Tags:
+affects_outputs
+
--compiler=<a string> default: see descriptionThe C++ compiler to use for compiling the target.
+Tags:
+loading_and_analysis, execution
+
--coverage_output_generator=<a build target label> default: "@bazel_tools//tools/test:lcov_merger"Location of the binary that is used to postprocess raw coverage reports. This must be a binary target. Defaults to '//tools/test:lcov_merger'.
+Tags:
+changes_inputs, affects_outputs, loading_and_analysis
+
--coverage_report_generator=<a build target label> default: "@bazel_tools//tools/test:coverage_report_generator"Location of the binary that is used to generate coverage reports. This must be a binary target. Defaults to '//tools/test:coverage_report_generator'.
+Tags:
+changes_inputs, affects_outputs, loading_and_analysis
+
--coverage_support=<a build target label> default: "@bazel_tools//tools/test:coverage_support"Location of support files that are required on the inputs of every test action that collects code coverage. Defaults to '//tools/test:coverage_support'.
+Tags:
+changes_inputs, affects_outputs, loading_and_analysis
+
--custom_malloc=<a build target label> default: see descriptionSpecifies a custom malloc implementation. This setting overrides malloc attributes in build rules.
+Tags:
+changes_inputs, affects_outputs
+
--[no]experimental_include_xcode_execution_requirements default: "false"If set, add a "requires-xcode:{version}" execution requirement to every Xcode action. If the Xcode version has a hyphenated label, also add a "requires-xcode-label:{version_label}" execution requirement.
+Tags:
+loses_incremental_state, loading_and_analysis, execution, experimental
+
--[no]experimental_prefer_mutual_xcode default: "true"If true, use the most recent Xcode that is available both locally and remotely. If false, or if there are no mutual available versions, use the local Xcode version selected via xcode-select.
+Tags:
+loses_incremental_state, experimental
+
--extra_execution_platforms=<comma-separated list of options> default: ""The platforms that are available as execution platforms to run actions. Platforms can be specified by exact target, or as a target pattern. These platforms will be considered before those declared in the WORKSPACE file by register_execution_platforms(). This option may only be set once; later instances will override earlier flag settings.
+Tags:
+execution
+
--extra_toolchains=<comma-separated list of options> multiple uses are accumulatedThe toolchain rules to be considered during toolchain resolution. Toolchains can be specified by exact target, or as a target pattern. These toolchains will be considered before those declared in the WORKSPACE file by register_toolchains().
+Tags:
+affects_outputs, changes_inputs, loading_and_analysis
+
--grte_top=<a label> default: see descriptionA label to a checked-in libc library. The default value is selected by the crosstool toolchain, and you almost never need to override it.
+Tags:
+action_command_lines, affects_outputs
+
--host_compiler=<a string> default: see descriptionNo-op flag. Will be removed in a future release.
+Tags:
+loading_and_analysis, execution
+
--host_grte_top=<a label> default: see descriptionIf specified, this setting overrides the libc top-level directory (--grte_top) for the exec configuration.
+Tags:
+action_command_lines, affects_outputs
+
--host_platform=<a build target label> default: "@bazel_tools//tools:host_platform"The label of a platform rule that describes the host system.
+Tags:
+affects_outputs, changes_inputs, loading_and_analysis
+
--[no]incompatible_bazel_test_exec_run_under default: "true"If enabled, "bazel test --run_under=//:runner" builds "//:runner" in the exec configuration. If disabled, it builds "//:runner" in the target configuration. Bazel executes tests on exec machines, so the former is more correct. This doesn't affect "bazel run", which always builds "`--run_under=//foo" in the target configuration.
+Tags:
+affects_outputs, incompatible_change
+
--[no]incompatible_builtin_objc_strip_action default: "true"Whether to emit a strip action as part of objc linking.
+Tags:
+action_command_lines, incompatible_change
+
--[no]incompatible_dont_enable_host_nonhost_crosstool_features default: "true"If true, Bazel will not enable 'host' and 'nonhost' features in the c++ toolchain (see https://github.com/bazelbuild/bazel/issues/7407 for more information).
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]incompatible_enable_apple_toolchain_resolution default: "false"Use toolchain resolution to select the Apple SDK for apple rules (Starlark and native)
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]incompatible_remove_legacy_whole_archive default: "true"If true, Bazel will not link library dependencies as whole archive by default (see https://github.com/bazelbuild/bazel/issues/7362 for migration instructions).
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]incompatible_strip_executable_safely default: "false"If true, strip action for executables will use flag -x, which does not break dynamic symbol resolution.
+Tags:
+action_command_lines, incompatible_change
+
Use interface shared objects if supported by the toolchain. All ELF toolchains currently support this setting.
+Tags:
+loading_and_analysis, affects_outputs, affects_outputs
+
--ios_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionSpecifies the version of the iOS SDK to use to build iOS applications. If unspecified, uses the default iOS SDK version from 'xcode_version'.
+Tags:
+loses_incremental_state
+
--macos_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionSpecifies the version of the macOS SDK to use to build macOS applications. If unspecified, uses the default macOS SDK version from 'xcode_version'.
+Tags:
+loses_incremental_state
+
--minimum_os_version=<a string> default: see descriptionThe minimum OS version which your compilation targets.
+Tags:
+loading_and_analysis, affects_outputs
+
--platform_mappings=<a main workspace-relative path> default: ""The location of a mapping file that describes which platform to use if none is set or which flags to set when a platform already exists. Must be relative to the main workspace root. Defaults to 'platform_mappings' (a file directly under the workspace root).
+Tags:
+affects_outputs, changes_inputs, loading_and_analysis, non_configurable
+
--platforms=<a build target label> default: ""The labels of the platform rules describing the target platforms for the current command.
+Tags:
+affects_outputs, changes_inputs, loading_and_analysis
+
--python_path=<a string> default: see descriptionThe absolute path of the Python interpreter invoked to run Python targets on the target platform. Deprecated; disabled by --incompatible_use_python_toolchains.
+Tags:
+loading_and_analysis, affects_outputs
+
--tvos_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionSpecifies the version of the tvOS SDK to use to build tvOS applications. If unspecified, uses the default tvOS SDK version from 'xcode_version'.
+Tags:
+loses_incremental_state
+
--[no]use_platforms_in_apple_crosstool_transition default: "false"Makes apple_crosstool_transition fall back to using the value of --platforms flag instead of legacy --cpu when needed.
Tags:
+loading_and_analysis
+
--watchos_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionSpecifies the version of the watchOS SDK to use to build watchOS applications. If unspecified, uses the default watchOS SDK version from 'xcode_version'.
+Tags:
+loses_incremental_state
+
--xcode_version=<a string> default: see descriptionIf specified, uses Xcode of the given version for relevant build actions. If unspecified, uses the executor default version of Xcode.
+Tags:
+loses_incremental_state
+
--xcode_version_config=<a build target label> default: "@bazel_tools//tools/cpp:host_xcodes"The label of the xcode_config rule to be used for selecting the Xcode version in the build configuration.
+Tags:
+loses_incremental_state, loading_and_analysis
+
--[no]apple_generate_dsym default: "false"Whether to generate debug symbol(.dSYM) file(s).
+Tags:
+affects_outputs, action_command_lines
+
--[no]build_runfile_links default: "true"If true, build runfiles symlink forests for all targets. If false, write them only when required by a local action, test or run command.
+Tags:
+affects_outputs
+
--[no]build_runfile_manifests default: "true"If true, write runfiles manifests for all targets. If false, omit them. Local tests will fail to run when false.
+Tags:
+affects_outputs
+
--[no]build_test_dwp default: "false"If enabled, when building C++ tests statically and with fission the .dwp file for the test binary will be automatically built as well.
+Tags:
+loading_and_analysis, affects_outputs
+
--cc_proto_library_header_suffixes=<comma-separated set of options> default: ".pb.h"Sets the suffixes of header files that a cc_proto_library creates.
+Tags:
+affects_outputs, loading_and_analysis
+
--cc_proto_library_source_suffixes=<comma-separated set of options> default: ".pb.cc"Sets the suffixes of source files that a cc_proto_library creates.
+Tags:
+affects_outputs, loading_and_analysis
+
--[no]experimental_proto_descriptor_sets_include_source_info default: "false"Run extra actions for alternative Java api versions in a proto_library.
+Tags:
+affects_outputs, loading_and_analysis, experimental
+
--[no]experimental_save_feature_state default: "false"Save the state of enabled and requested feautres as an output of compilation.
+Tags:
+affects_outputs, experimental
+
--fission=<a set of compilation modes> default: "no"Specifies which compilation modes use fission for C++ compilations and links. May be any combination of {'fastbuild', 'dbg', 'opt'} or the special values 'yes' to enable all modes and 'no' to disable all modes.
+Tags:
+loading_and_analysis, action_command_lines, affects_outputs
+
--[no]incompatible_always_include_files_in_data default: "true"If true, native rules add <code>DefaultInfo.files</code> of data dependencies to their runfiles, which matches the recommended behavior for Starlark rules (https://bazel.build/extending/rules#runfiles_features_to_avoid).
+Tags:
+affects_outputs, incompatible_change
+
--[no]incompatible_compact_repo_mapping_manifest default: "false"If enabled, the <binary>.repo_mapping file emits a module extension's repo mapping only once instead of once for each repo generated by the extension that contributes runfiles.
+Tags:
+affects_outputs, incompatible_change
+
--incompatible_disable_select_on=<comma-separated set of options> default: ""List of flags for which the use in select() is disabled.
+Tags:
+loading_and_analysis, incompatible_change, non_configurable
+
--[no]incompatible_filegroup_runfiles_for_data default: "true"If true, runfiles of targets listed in the srcs attribute are available to targets that consume the filegroup as a data dependency.
+Tags:
+incompatible_change
+
--[no]objc_generate_linkmap default: "false"Specifies whether to generate a linkmap file.
+Tags:
+affects_outputs
+
--[no]save_temps default: "false"If set, temporary outputs from gcc will be saved. These include .s files (assembler code), .i files (preprocessed C) and .ii files (preprocessed C++).
+Tags:
+affects_outputs
+
--action_env=<a 'name[=value]' assignment with an optional value part or the special syntax '=name' to unset a variable> multiple uses are accumulatedSpecifies the set of environment variables available to actions with target configuration. Variables can be either specified by <code>name</code>, in which case +the value will be taken from the invocation environment, by the <code>name=value</code> pair which sets the value independent of the invocation environment, or by <code>=name</code>, which unsets the variable of that name. This option can be used multiple times; for options given for the same variable, the latest wins, options for different variables accumulate. +<br> +Note that unless <code>--incompatible_repo_env_ignores_action_env</code> is true, all <code>name=value</code> pairs will be available to repository rules.
+Tags:
+action_command_lines
+
--allowed_cpu_values=<comma-separated set of options> default: ""Allowed values for the --cpu flag.
+Tags:
+changes_inputs, affects_outputs
+
--[no]android_databinding_use_androidx default: "true"Generate AndroidX-compatible data-binding files. This is only used with databinding v2. This flag is a no-op.
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state, experimental
+
--[no]android_databinding_use_v3_4_args default: "true"Use android databinding v2 with 3.4.0 argument. This flag is a no-op.
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state, experimental
+
--android_dynamic_mode=<off, default or fully> default: "off"Determines whether C++ deps of Android rules will be linked dynamically when a cc_binary does not explicitly create a shared library. 'default' means bazel will choose whether to link dynamically. 'fully' means all libraries will be linked dynamically. 'off' means that all libraries will be linked in mostly static mode.
+Tags:
+affects_outputs, loading_and_analysis
+
--android_manifest_merger_order=<alphabetical, alphabetical_by_configuration or dependency> default: "alphabetical"Sets the order of manifests passed to the manifest merger for Android binaries. ALPHABETICAL means manifests are sorted by path relative to the execroot. ALPHABETICAL_BY_CONFIGURATION means manifests are sorted by paths relative to the configuration directory within the output directory. DEPENDENCY means manifests are ordered with each library's manifest coming before the manifests of its dependencies.
+Tags:
+action_command_lines, execution
+
--[no]android_resource_shrinking default: "false"Enables resource shrinking for android_binary APKs that use ProGuard.
+Tags:
+affects_outputs, loading_and_analysis
+
--[no]build_python_zip default: "auto"Build python executable zip; on on Windows, off on other platforms
+Tags:
+affects_outputs
+
--catalyst_cpus=<comma-separated list of options> multiple uses are accumulatedComma-separated list of architectures for which to build Apple Catalyst binaries.
+Tags:
+loses_incremental_state, loading_and_analysis
+
--[no]collect_code_coverage default: "false"If specified, Bazel will instrument code (using offline instrumentation where possible) and will collect coverage information during tests. Only targets that match --instrumentation_filter will be affected. Usually this option should not be specified directly - 'bazel coverage' command should be used instead.
+Tags:
+affects_outputs
+
--compilation_mode=<fastbuild, dbg or opt> [-c] default: "fastbuild"Specify the mode the binary will be built in. Values: 'fastbuild', 'dbg', 'opt'.
+Tags:
+affects_outputs, action_command_lines
+
--conlyopt=<a string> multiple uses are accumulatedAdditional option to pass to gcc when compiling C source files.
+Tags:
+action_command_lines, affects_outputs
+
--copt=<a string> multiple uses are accumulatedAdditional options to pass to gcc.
+Tags:
+action_command_lines, affects_outputs
+
--cpu=<a string> default: ""Deprecated: this flag is not used internally by Blaze although there are legacy platform mappings to allow for backwards compatibility. Do not use this flag, instead use --platforms with an appropriate platform definition.
+Tags:
+changes_inputs, affects_outputs
+
--cs_fdo_absolute_path=<a string> default: see descriptionUse CSFDO profile information to optimize compilation. Specify the absolute path name of the zip file containing the profile file, a raw or an indexed LLVM profile file.
+Tags:
+affects_outputs
+
--cs_fdo_instrument=<a string> default: see descriptionGenerate binaries with context sensitive FDO instrumentation. With Clang/LLVM compiler, it also accepts the directory name under which the raw profile file(s) will be dumped at runtime.
+Tags:
+affects_outputs
+
--cs_fdo_profile=<a build target label> default: see descriptionThe cs_fdo_profile representing the context sensitive profile to be used for optimization.
+Tags:
+affects_outputs
+
--cxxopt=<a string> multiple uses are accumulatedAdditional option to pass to gcc when compiling C++ source files.
+Tags:
+action_command_lines, affects_outputs
+
--define=<a 'name=value' assignment> multiple uses are accumulatedEach --define option specifies an assignment for a build variable. In case of multiple values for a variable, the last one wins.
+Tags:
+changes_inputs, affects_outputs
+
--dynamic_mode=<off, default or fully> default: "default"Determines whether C++ binaries will be linked dynamically. 'default' means Bazel will choose whether to link dynamically. 'fully' means all libraries will be linked dynamically. 'off' means that all libraries will be linked in mostly static mode.
+Tags:
+loading_and_analysis, affects_outputs
+
--[no]enable_propeller_optimize_absolute_paths default: "true"If set, any use of absolute paths for propeller optimize will raise an error.
+Tags:
+affects_outputs
+
--[no]enable_remaining_fdo_absolute_paths default: "true"If set, any use of absolute paths for FDO will raise an error.
+Tags:
+affects_outputs
+
--[no]enable_runfiles default: "auto"Enable runfiles symlink tree; By default, it's off on Windows, on on other platforms.
+Tags:
+affects_outputs
+
--exec_aspects=<comma-separated list of options> multiple uses are accumulatedComma-separated list of aspects to be applied to exec-configured targets, regardless of whether or not they are top-level targets. This is an experimental feature and is subject to change.
+Tags:
+loading_and_analysis
+
--experimental_action_listener=<a build target label> multiple uses are accumulatedDeprecated in favor of aspects. Use action_listener to attach an extra_action to existing build actions.
+Tags:
+execution, experimental
+
--[no]experimental_android_compress_java_resources default: "false"Compress Java resources in APKs
+Tags:
+affects_outputs, loading_and_analysis, experimental
+
--[no]experimental_android_databinding_v2 default: "true"Use android databinding v2. This flag is a no-op.
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state, experimental
+
--[no]experimental_android_resource_shrinking default: "false"Enables resource shrinking for android_binary APKs that use ProGuard.
+Tags:
+affects_outputs, loading_and_analysis, experimental
+
--[no]experimental_android_rewrite_dexes_with_rex default: "false"use rex tool to rewrite dex files
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state, experimental
+
--[no]experimental_collect_code_coverage_for_generated_files default: "false"If specified, Bazel will also generate collect coverage information for generated files.
+Tags:
+affects_outputs, experimental
+
--experimental_objc_fastbuild_options=<comma-separated list of options> default: "-O0,-DDEBUG=1"Uses these strings as objc fastbuild compiler options.
+Tags:
+action_command_lines
+
--[no]experimental_omitfp default: "false"If true, use libunwind for stack unwinding, and compile with -fomit-frame-pointer and -fasynchronous-unwind-tables.
+Tags:
+action_command_lines, affects_outputs, experimental
+
--experimental_output_paths=<off or strip> default: "off"Which model to use for where in the output tree rules write their outputs, particularly for multi-platform / multi-configuration builds. This is highly experimental. See https://github.com/bazelbuild/bazel/issues/6526 for details. Starlark actions canopt into path mapping by adding the key 'supports-path-mapping' to the 'execution_requirements' dict.
+Tags:
+loses_incremental_state, bazel_internal_configuration, affects_outputs, execution
+
--experimental_override_platform_cpu_name=<a 'label=value' assignment> multiple uses are accumulatedEach entry should be of the form label=value where label refers to a platform and values is the desired shortname to override the platform's CPU name in $(TARGET_CPU) make variable and output path. Only used when --experimental_platform_in_output_dir, --incompatible_target_cpu_from_platform or --incompatible_bep_cpu_from_platform is true. Has highest naming priority.
+Tags:
+affects_outputs, experimental
+
--[no]experimental_platform_in_output_dir default: "false"If true, a shortname for the target platform is used in the output directory name instead of the CPU. If auto, this is only applied for the exec configuration. The exact scheme is experimental and subject to change: First, in the rare case the --platforms option does not have exactly one value, a hash of the platforms option is used. Next, if any shortname for the current platform was registered by --experimental_override_name_platform_in_output_dir, then that shortname is used. Then, if --experimental_use_platforms_in_output_dir_legacy_heuristic is set, use a shortname based off the current platform Label. Finally, a hash of the platform option is used as a last resort.
+Tags:
+affects_outputs, experimental
+
--[no]experimental_py_binaries_include_label default: "false"py_binary targets include their label even when stamping is disabled.
+Tags:
+affects_outputs, experimental
+
--[no]experimental_use_llvm_covmap default: "false"If specified, Bazel will generate llvm-cov coverage map information rather than gcov when collect_code_coverage is enabled.
+Tags:
+changes_inputs, affects_outputs, loading_and_analysis, experimental
+
--[no]experimental_use_platforms_in_output_dir_legacy_heuristic default: "true"Please only use this flag as part of a suggested migration or testing strategy. Note that the heuristic has known deficiencies and it is suggested to migrate to relying on just --experimental_override_name_platform_in_output_dir.
+Tags:
+affects_outputs, experimental
+
--fdo_instrument=<a string> default: see descriptionGenerate binaries with FDO instrumentation. With Clang/LLVM compiler, it also accepts the directory name under which the raw profile file(s) will be dumped at runtime.
+Tags:
+affects_outputs
+
--fdo_optimize=<a string> default: see descriptionUse FDO profile information to optimize compilation. Specify the name of a zip file containing a .gcda file tree, an afdo file containing an auto profile, or an LLVM profile file. This flag also accepts files specified as labels (e.g. //foo/bar:file.afdo - you may need to add an exports_files directive to the corresponding package) and labels pointing to fdo_profile targets. This flag will be superseded by the fdo_profile rule.
Tags:
+affects_outputs
+
--fdo_prefetch_hints=<a build target label> default: see descriptionUse cache prefetch hints.
+Tags:
+affects_outputs
+
--fdo_profile=<a build target label> default: see descriptionThe fdo_profile representing the profile to be used for optimization.
+Tags:
+affects_outputs
+
--features=<a string> multiple uses are accumulatedThe given features will be enabled or disabled by default for targets built in the target configuration. Specifying -<feature> will disable the feature. Negative features always override positive ones. See also --host_features
+Tags:
+changes_inputs, affects_outputs
+
--[no]force_pic default: "false"If enabled, all C++ compilations produce position-independent code ("-fPIC"), links prefer PIC pre-built libraries over non-PIC libraries, and links produce position-independent executables ("-pie").
+Tags:
+loading_and_analysis, affects_outputs
+
--host_action_env=<a 'name[=value]' assignment with an optional value part or the special syntax '=name' to unset a variable> multiple uses are accumulatedSpecifies the set of environment variables available to actions with execution configurations. Variables can be either specified by name, in which case the value will be taken from the invocation environment, by the name=value pair which sets the value independent of the invocation environment, or by <code>=name</code>, which unsets the variable of that name. This option can be used multiple times; for options given for the same variable, the latest wins, options for different variables accumulate.
+Tags:
+action_command_lines
+
--host_compilation_mode=<fastbuild, dbg or opt> default: "opt"Specify the mode the tools used during the build will be built in. Values: 'fastbuild', 'dbg', 'opt'.
+Tags:
+affects_outputs, action_command_lines
+
--host_conlyopt=<a string> multiple uses are accumulatedAdditional option to pass to the C compiler when compiling C (but not C++) source files in the exec configurations.
+Tags:
+action_command_lines, affects_outputs
+
--host_copt=<a string> multiple uses are accumulatedAdditional options to pass to the C compiler for tools built in the exec configurations.
+Tags:
+action_command_lines, affects_outputs
+
--host_cpu=<a string> default: ""The host CPU.
+Tags:
+changes_inputs, affects_outputs
+
--host_cxxopt=<a string> multiple uses are accumulatedAdditional options to pass to C++ compiler for tools built in the exec configurations.
+Tags:
+action_command_lines, affects_outputs
+
--host_features=<a string> multiple uses are accumulatedThe given features will be enabled or disabled by default for targets built in the exec configuration. Specifying -<feature> will disable the feature. Negative features always override positive ones.
+Tags:
+changes_inputs, affects_outputs
+
--host_linkopt=<a string> multiple uses are accumulatedAdditional option to pass to linker when linking tools in the exec configurations.
+Tags:
+action_command_lines, affects_outputs
+
--host_macos_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionMinimum compatible macOS version for host targets. If unspecified, uses 'macos_sdk_version'.
+Tags:
+loses_incremental_state
+
--host_per_file_copt=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths followed by an @ and a comma separated list of options> multiple uses are accumulatedAdditional options to selectively pass to the C/C++ compiler when compiling certain files in the exec configurations. This option can be passed multiple times. Syntax: regex_filter@option_1,option_2,...,option_n. Where regex_filter stands for a list of include and exclude regular expression patterns (Also see --instrumentation_filter). option_1 to option_n stand for arbitrary command line options. If an option contains a comma it has to be quoted with a backslash. Options can contain @. Only the first @ is used to split the string. Example: --host_per_file_copt=//foo/.*.cc,-//foo/bar.cc@-O0 adds the -O0 command line option to the gcc command line of all cc files in //foo/ except bar.cc.
+Tags:
+action_command_lines, affects_outputs
+
--[no]incompatible_auto_exec_groups default: "false"When enabled, an exec groups is automatically created for each toolchain used by a rule. For this to work rule needs to specify toolchain parameter on its actions. For more information, see https://github.com/bazelbuild/bazel/issues/17134.
Tags:
+affects_outputs, incompatible_change
+
--[no]incompatible_merge_genfiles_directory default: "true"If true, the genfiles directory is folded into the bin directory.
+Tags:
+affects_outputs, incompatible_change
+
--[no]incompatible_target_cpu_from_platform default: "true"If specified, the value of the cpu constraint (@platforms//cpu:cpu) of the target platform is used to set the $(TARGET_CPU) make variable.
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]instrument_test_targets default: "false"When coverage is enabled, specifies whether to consider instrumenting test rules. When set, test rules included by --instrumentation_filter are instrumented. Otherwise, test rules are always excluded from coverage instrumentation.
+Tags:
+affects_outputs
+
--instrumentation_filter=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths> default: "-/javatests[/:],-/test/java[/:]"When coverage is enabled, only rules with names included by the specified regex-based filter will be instrumented. Rules prefixed with '-' are excluded instead. Note that only non-test rules are instrumented unless --instrument_test_targets is enabled.
+Tags:
+affects_outputs
+
--ios_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionMinimum compatible iOS version for target simulators and devices. If unspecified, uses 'ios_sdk_version'.
+Tags:
+loses_incremental_state
+
--ios_multi_cpus=<comma-separated list of options> multiple uses are accumulatedComma-separated list of architectures to build an ios_application with. The result is a universal binary containing all specified architectures.
+Tags:
+loses_incremental_state, loading_and_analysis
+
--[no]legacy_whole_archive default: "true"Deprecated, superseded by --incompatible_remove_legacy_whole_archive (see https://github.com/bazelbuild/bazel/issues/7362 for details). When on, use --whole-archive for cc_binary rules that have linkshared=True and either linkstatic=True or '-static' in linkopts. This is for backwards compatibility only. A better alternative is to use alwayslink=1 where required.
+Tags:
+action_command_lines, affects_outputs, deprecated
+
--linkopt=<a string> multiple uses are accumulatedAdditional option to pass to gcc when linking.
+Tags:
+action_command_lines, affects_outputs
+
--ltobackendopt=<a string> multiple uses are accumulatedAdditional option to pass to the LTO backend step (under --features=thin_lto).
+Tags:
+action_command_lines, affects_outputs
+
--ltoindexopt=<a string> multiple uses are accumulatedAdditional option to pass to the LTO indexing step (under --features=thin_lto).
+Tags:
+action_command_lines, affects_outputs
+
--macos_cpus=<comma-separated list of options> multiple uses are accumulatedComma-separated list of architectures for which to build Apple macOS binaries.
+Tags:
+loses_incremental_state, loading_and_analysis
+
--macos_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionMinimum compatible macOS version for targets. If unspecified, uses 'macos_sdk_version'.
+Tags:
+loses_incremental_state
+
--memprof_profile=<a build target label> default: see descriptionUse memprof profile.
+Tags:
+affects_outputs
+
--[no]objc_debug_with_GLIBCXX default: "false"If set, and compilation mode is set to 'dbg', define GLIBCXX_DEBUG, GLIBCXX_DEBUG_PEDANTIC and GLIBCPP_CONCEPT_CHECKS.
+Tags:
+action_command_lines
+
--[no]objc_enable_binary_stripping default: "false"Whether to perform symbol and dead-code strippings on linked binaries. Binary strippings will be performed if both this flag and --compilation_mode=opt are specified.
+Tags:
+action_command_lines
+
--objccopt=<a string> multiple uses are accumulatedAdditional options to pass to gcc when compiling Objective-C/C++ source files.
+Tags:
+action_command_lines
+
--per_file_copt=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths followed by an @ and a comma separated list of options> multiple uses are accumulatedAdditional options to selectively pass to gcc when compiling certain files. This option can be passed multiple times. Syntax: regex_filter@option_1,option_2,...,option_n. Where regex_filter stands for a list of include and exclude regular expression patterns (Also see --instrumentation_filter). option_1 to option_n stand for arbitrary command line options. If an option contains a comma it has to be quoted with a backslash. Options can contain @. Only the first @ is used to split the string. Example: --per_file_copt=//foo/.*.cc,-//foo/bar.cc@-O0 adds the -O0 command line option to the gcc command line of all cc files in //foo/ except bar.cc.
+Tags:
+action_command_lines, affects_outputs
+
--per_file_ltobackendopt=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths followed by an @ and a comma separated list of options> multiple uses are accumulatedAdditional options to selectively pass to LTO backend (under --features=thin_lto) when compiling certain backend objects. This option can be passed multiple times. Syntax: regex_filter@option_1,option_2,...,option_n. Where regex_filter stands for a list of include and exclude regular expression patterns. option_1 to option_n stand for arbitrary command line options. If an option contains a comma it has to be quoted with a backslash. Options can contain @. Only the first @ is used to split the string. Example: --per_file_ltobackendopt=//foo/.*.o,-//foo/bar.o@-O0 adds the -O0 command line option to the LTO backend command line of all o files in //foo/ except bar.o.
+Tags:
+action_command_lines, affects_outputs
+
--platform_suffix=<a string> default: see descriptionSpecifies a suffix to be added to the configuration directory.
+Tags:
+loses_incremental_state, affects_outputs, loading_and_analysis
+
--propeller_optimize=<a build target label> default: see descriptionUse Propeller profile information to optimize the build target.A propeller profile must consist of at least one of two files, a cc profile and a ld profile. This flag accepts a build label which must refer to the propeller profile input files. For example, the BUILD file that defines the label, in a/b/BUILD:propeller_optimize( name = "propeller_profile", cc_profile = "propeller_cc_profile.txt", ld_profile = "propeller_ld_profile.txt",)An exports_files directive may have to be added to the corresponding package to make these files visible to Bazel. The option must be used as: --propeller_optimize=//a/b:propeller_profile
+Tags:
+action_command_lines, affects_outputs
+
--propeller_optimize_absolute_cc_profile=<a string> default: see descriptionAbsolute path name of cc_profile file for Propeller Optimized builds.
+Tags:
+affects_outputs
+
--propeller_optimize_absolute_ld_profile=<a string> default: see descriptionAbsolute path name of ld_profile file for Propeller Optimized builds.
+Tags:
+affects_outputs
+
--run_under=<a prefix in front of command> default: see descriptionPrefix to insert before the executables for the 'test' and 'run' commands. If the value is 'foo -bar', and the execution command line is 'test_binary -baz', then the final command line is 'foo -bar test_binary -baz'.This can also be a label to an executable target. Some examples are: 'valgrind', 'strace', 'strace -c', 'valgrind --quiet --num-callers=20', '//package:target', '//package:target --options'.
+Tags:
+action_command_lines
+
If true, native libraries that contain identical functionality will be shared among different targets
+Tags:
+loading_and_analysis, affects_outputs
+
--[no]stamp default: "false"Stamp binaries with the date, username, hostname, workspace information, etc.
+Tags:
+affects_outputs
+
--strip=<always, sometimes or never> default: "sometimes"Specifies whether to strip binaries and shared libraries (using "-Wl,--strip-debug"). The default value of 'sometimes' means strip iff --compilation_mode=fastbuild.
+Tags:
+affects_outputs
+
--stripopt=<a string> multiple uses are accumulatedAdditional options to pass to strip when generating a '<name>.stripped' binary.
+Tags:
+action_command_lines, affects_outputs
+
--tvos_cpus=<comma-separated list of options> multiple uses are accumulatedComma-separated list of architectures for which to build Apple tvOS binaries.
+Tags:
+loses_incremental_state, loading_and_analysis
+
--tvos_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionMinimum compatible tvOS version for target simulators and devices. If unspecified, uses 'tvos_sdk_version'.
+Tags:
+loses_incremental_state
+
--visionos_cpus=<comma-separated list of options> multiple uses are accumulatedComma-separated list of architectures for which to build Apple visionOS binaries.
+Tags:
+loses_incremental_state, loading_and_analysis
+
--watchos_cpus=<comma-separated list of options> multiple uses are accumulatedComma-separated list of architectures for which to build Apple watchOS binaries.
+Tags:
+loses_incremental_state, loading_and_analysis
+
--watchos_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionMinimum compatible watchOS version for target simulators and devices. If unspecified, uses 'watchos_sdk_version'.
+Tags:
+loses_incremental_state
+
--xbinary_fdo=<a build target label> default: see descriptionUse XbinaryFDO profile information to optimize compilation. Specify the name of default cross binary profile. When the option is used together with --fdo_instrument/--fdo_optimize/--fdo_profile, those options will always prevail as if xbinary_fdo is never specified.
+Tags:
+affects_outputs
+
--[no]check_visibility default: "true"If disabled, visibility errors in target dependencies are demoted to warnings.
+Tags:
+build_file_semantics, non_configurable
+
--[no]desugar_for_android default: "true"Whether to desugar Java 8 bytecode before dexing.
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state
+
--[no]desugar_java8_libs default: "false"Whether to include supported Java 8 libraries in apps for legacy devices.
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state, experimental
+
--[no]enforce_constraints default: "true"Checks the environments each target is compatible with and reports errors if any target has dependencies that don't support the same environments
+Tags:
+build_file_semantics
+
--[no]experimental_check_desugar_deps default: "true"Whether to double-check correct desugaring at Android binary level.
+Tags:
+eagerness_to_exit, loading_and_analysis, experimental
+
--[no]experimental_enforce_transitive_visibility default: "false"If true, enable package()s to set the transitive_visibility attribute to restrict which packages may depend on them.
+Tags:
+build_file_semantics, experimental
+
--experimental_one_version_enforcement=<off, warning or error> default: "OFF"When enabled, enforce that a java_binary rule can't contain more than one version of the same class file on the classpath. This enforcement can break the build, or can just result in warnings.
+Tags:
+loading_and_analysis
+
--experimental_strict_java_deps=<off, warn, error, strict or default> default: "default"If true, checks that a Java target explicitly declares all directly used targets as dependencies.
+Tags:
+build_file_semantics, eagerness_to_exit
+
--[no]incompatible_check_testonly_for_output_files default: "false"If enabled, check testonly for prerequisite targets that are output files by looking up the testonly of the generating rule. This matches visibility checking.
+Tags:
+build_file_semantics, incompatible_change
+
--[no]incompatible_disable_native_android_rules default: "false"If enabled, direct usage of the native Android rules is disabled. Please use the Starlark Android rules from https://github.com/bazelbuild/rules_android
+Tags:
+eagerness_to_exit, incompatible_change
+
--[no]incompatible_disable_native_apple_binary_rule default: "false"No-op. Kept here for backwards compatibility.
+Tags:
+eagerness_to_exit, incompatible_change
+
--[no]one_version_enforcement_on_java_tests default: "true"When enabled, and with experimental_one_version_enforcement set to a non-NONE value, enforce one version on java_test targets. This flag can be disabled to improve incremental test performance at the expense of missing potential one version violations.
+Tags:
+loading_and_analysis
+
--python_native_rules_allowlist=<a build target label> default: see descriptionAn allowlist (package_group target) to use when enforcing --incompatible_python_disallow_native_rules.
+Tags:
+loading_and_analysis
+
--[no]strict_filesets default: "false"If this option is enabled, filesets crossing package boundaries are reported as errors.
+Tags:
+build_file_semantics, eagerness_to_exit
+
--strict_proto_deps=<off, warn, error, strict or default> default: "error"Unless OFF, checks that a proto_library target explicitly declares all directly used targets as dependencies.
+Tags:
+build_file_semantics, eagerness_to_exit, incompatible_change
+
--strict_public_imports=<off, warn, error, strict or default> default: "off"Unless OFF, checks that a proto_library target explicitly declares all targets used in 'import public' as exported.
+Tags:
+build_file_semantics, eagerness_to_exit, incompatible_change
+
--[no]strict_system_includes default: "false"If true, headers found through system include paths (-isystem) are also required to be declared.
+Tags:
+loading_and_analysis, eagerness_to_exit
+
--target_environment=<a build target label> multiple uses are accumulatedDeclares this build's target environment. Must be a label reference to an "environment" rule. If specified, all top-level targets must be compatible with this environment.
+Tags:
+changes_inputs
+
--apk_signing_method=<v1, v2, v1_v2 or v4> default: "v1_v2"Implementation to use to sign APKs
+Tags:
+action_command_lines, affects_outputs, loading_and_analysis
+
--[no]device_debug_entitlements default: "true"If set, and compilation mode is not 'opt', objc apps will include debug entitlements when signing.
+Tags:
+changes_inputs
+
--ios_signing_cert_name=<a string> default: see descriptionCertificate name to use for iOS signing. If not set will fall back to provisioning profile. May be the certificate's keychain identity preference or (substring) of the certificate's common name, as per codesign's man page (SIGNING IDENTITIES).
+Tags:
+action_command_lines
+
--[no]incompatible_disallow_sdk_frameworks_attributes default: "false"If true, disallow sdk_frameworks and weak_sdk_frameworks attributes in objc_library andobjc_import.
+Tags:
+build_file_semantics, incompatible_change
+
--[no]incompatible_objc_alwayslink_by_default default: "false"If true, make the default value true for alwayslink attributes in objc_library and objc_import.
+Tags:
+build_file_semantics, incompatible_change
+
--[no]incompatible_python_disallow_native_rules default: "false"When true, an error occurs when using the builtin py_* rules; instead the rule_python rules should be used. See https://github.com/bazelbuild/bazel/issues/17773 for more information and migration instructions.
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]allow_analysis_failures default: "false"If true, an analysis failure of a rule target results in the target's propagation of an instance of AnalysisFailureInfo containing the error description, instead of resulting in a build failure.
+Tags:
+loading_and_analysis, experimental
+
--analysis_testing_deps_limit=<an integer> default: "2000"Sets the maximum number of transitive dependencies through a rule attribute with a for_analysis_testing configuration transition. Exceeding this limit will result in a rule error.
+Tags:
+loading_and_analysis
+
--[no]break_build_on_parallel_dex2oat_failure default: "false"If true dex2oat action failures will cause the build to break instead of executing dex2oat during test runtime.
+Tags:
+loading_and_analysis, experimental
+
--default_test_resources=<a resource name followed by equal and 1 float or 4 float, e.g memory=10,30,60,100> multiple uses are accumulatedOverride the default resources amount for tests. The expected format is <resource>=<value>. If a single positive number is specified as <value> it will override the default resources for all test sizes. If 4 comma-separated numbers are specified, they will override the resource amount for respectively the small, medium, large, enormous test sizes. Values can also be HOST_RAM/HOST_CPU, optionally followed by [-|]<float> (eg. memory=HOST_RAM.1,HOST_RAM*.2,HOST_RAM*.3,HOST_RAM*.4). The default test resources specified by this flag are overridden by explicit resources specified in tags.
+--[no]experimental_android_use_parallel_dex2oat default: "false"Use dex2oat in parallel to possibly speed up android_test.
+Tags:
+loading_and_analysis, host_machine_resource_optimizations, experimental
+
--[no]ios_memleaks default: "false"Enable checking for memory leaks in ios_test targets.
+Tags:
+action_command_lines
+
--ios_simulator_device=<a string> default: see descriptionThe device to simulate when running an iOS application in the simulator, e.g. 'iPhone 6'. You can get a list of devices by running 'xcrun simctl list devicetypes' on the machine the simulator will be run on.
+Tags:
+test_runner
+
--ios_simulator_version=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionThe version of iOS to run on the simulator when running or testing. This is ignored for ios_test rules if a target device is specified in the rule.
+Tags:
+test_runner
+
--runs_per_test=<a positive integer or test_regex@runs. This flag may be passed more than once> multiple uses are accumulatedSpecifies number of times to run each test. If any of those attempts fail for any reason, the whole test is considered failed. Normally the value specified is just an integer. Example: --runs_per_test=3 will run all tests 3 times. Alternate syntax: regex_filter@runs_per_test. Where runs_per_test stands for an integer value and regex_filter stands for a list of include and exclude regular expression patterns (Also see --instrumentation_filter). Example: --runs_per_test=//foo/.,-//foo/bar/.@3 runs all tests in //foo/ except those under foo/bar three times. This option can be passed multiple times. The most recently passed argument that matches takes precedence. If nothing matches, the test is only run once.
+--test_env=<a 'name[=value]' assignment with an optional value part or the special syntax '=name' to unset a variable> multiple uses are accumulatedSpecifies additional environment variables to be injected into the test runner environment. Variables can be either specified by <code>name</code>, in which case its value will be read from the Bazel client environment, or by the <code>name=value</code> pair. Previously set variables can be unset via <code>=name</code>. This option can be used multiple times to specify several variables. Used only by the 'bazel test' command.
+Tags:
+test_runner
+
--test_timeout=<a single integer or comma-separated list of 4 integers> default: "-1"Override the default test timeout values for test timeouts (in secs). If a single positive integer value is specified it will override all categories. If 4 comma-separated integers are specified, they will override the timeouts for short, moderate, long and eternal (in that order). In either form, a value of -1 tells blaze to use its default timeouts for that category.
+--[no]zip_undeclared_test_outputs default: "false"If true, undeclared test outputs will be archived in a zip file.
+Tags:
+test_runner
+
--[no]experimental_filter_library_jar_with_program_jar default: "false"Filter the ProGuard ProgramJar to remove any classes also present in the LibraryJar.
+Tags:
+action_command_lines, experimental
+
--[no]experimental_inmemory_dotd_files default: "true"If enabled, C++ .d files will be passed through in memory directly from the remote build nodes instead of being written to disk.
+Tags:
+loading_and_analysis, execution, affects_outputs, experimental
+
--[no]experimental_inmemory_jdeps_files default: "true"If enabled, the dependency (.jdeps) files generated from Java compilations will be passed through in memory directly from the remote build nodes instead of being written to disk.
+Tags:
+loading_and_analysis, execution, affects_outputs, experimental
+
--[no]experimental_retain_test_configuration_across_testonly default: "false"When enabled, --trim_test_configuration will not trim the test configuration for rules marked testonly=1. This is meant to reduce action conflict issues when non-test rules depend on cc_test rules. No effect if --trim_test_configuration is false.
+Tags:
+loading_and_analysis, loses_incremental_state, experimental
+
--[no]experimental_unsupported_and_brittle_include_scanning default: "false"Whether to narrow inputs to C/C++ compilation by parsing #include lines from input files. This can improve performance and incrementality by decreasing the size of compilation input trees. However, it can also break builds because the include scanner does not fully implement C preprocessor semantics. In particular, it does not understand dynamic #include directives and ignores preprocessor conditional logic. Use at your own risk. Any issues relating to this flag that are filed will be closed.
+Tags:
+loading_and_analysis, execution, changes_inputs, experimental
+
--[no]incremental_dexing default: "true"Does most of the work for dexing separately for each Jar file.
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state
+
--[no]objc_use_dotd_pruning default: "true"If set, .d files emitted by clang will be used to prune the set of inputs passed into objc compiles.
+Tags:
+changes_inputs, loading_and_analysis
+
--[no]process_headers_in_dependencies default: "false"When building a target //a:a, process headers in all targets that //a:a depends on (if header processing is enabled for the toolchain).
+Tags:
+execution
+
--[no]trim_test_configuration default: "true"When enabled, test-related options will be cleared below the top level of the build. When this flag is active, tests cannot be built as dependencies of non-test rules, but changes to test-related options will not cause non-test rules to be re-analyzed.
+Tags:
+loading_and_analysis, loses_incremental_state
+
--toolchain_resolution_debug=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths> default: "-.*"Print debug information during toolchain resolution. The flag takes a regex, which is checked against toolchain types and specific targets to see which to debug. Multiple regexes may be separated by commas, and then each regex is checked separately. Note: The output of this flag is very complex and will likely only be useful to experts in toolchain resolution.
+Tags:
+terminal_output
+
--[no]verbose_visibility_errors default: "false"If enabled, visibility errors include additional diagnostic information.
+Tags:
+build_file_semantics, non_configurable
+
--flag_alias=<a 'name=value' flag alias> multiple uses are accumulatedSets a shorthand name for a Starlark flag. It takes a single key-value pair in the form "<key>=<value>" as an argument.
+Tags:
+changes_inputs, non_configurable
+
--[no]incompatible_default_to_explicit_init_py default: "false"This flag changes the default behavior so that init.py files are no longer automatically created in the runfiles of Python targets. Precisely, when a py_binary or py_test target has legacy_create_init set to "auto" (the default), it is treated as false if and only if this flag is set. See https://github.com/bazelbuild/bazel/issues/10076.
+Tags:
+affects_outputs, incompatible_change
+
--[no]cache_test_results [-t] default: "auto"If set to 'auto', Bazel reruns a test if and only if: (1) Bazel detects changes in the test or its dependencies, (2) the test is marked as external, (3) multiple test runs were requested with --runs_per_test, or(4) the test previously failed. If set to 'yes', Bazel caches all test results except for tests marked as external. If set to 'no', Bazel does not cache any test results.
+--[no]experimental_cancel_concurrent_tests default: "never"If 'on_failed' or 'on_passed, then Blaze will cancel concurrently running tests on the first run with that result. This is only useful in combination with --runs_per_test_detects_flakes.
+Tags:
+affects_outputs, loading_and_analysis, experimental
+
--[no]experimental_fetch_all_coverage_outputs default: "false"If true, then Bazel fetches the entire coverage data directory for each test during a coverage run.
+Tags:
+affects_outputs, loading_and_analysis, experimental
+
--[no]experimental_generate_llvm_lcov default: "false"If true, coverage for clang will generate an LCOV report.
+Tags:
+affects_outputs, loading_and_analysis, experimental
+
--experimental_java_classpath=<off, javabuilder, bazel or bazel_no_fallback> default: "bazel"Enables reduced classpaths for Java compilations.
+--[no]experimental_run_android_lint_on_java_rules default: "false"Whether to validate java_* sources.
+Tags:
+affects_outputs, experimental
+
--[no]explicit_java_test_deps default: "false"Explicitly specify a dependency to JUnit or Hamcrest in a java_test instead of accidentally obtaining from the TestRunner's deps. Only works for bazel right now.
+--host_java_launcher=<a build target label> default: see descriptionThe Java launcher used by tools that are executed during a build.
+--host_javacopt=<a string> multiple uses are accumulatedAdditional options to pass to javac when building tools that are executed during a build.
+--host_jvmopt=<a string> multiple uses are accumulatedAdditional options to pass to the Java VM when building tools that are executed during the build. These options will get added to the VM startup options of each java_binary target.
+--[no]incompatible_check_sharding_support default: "true"If true, Bazel will fail a sharded test if the test runner does not indicate that it supports sharding by touching the file at the path in TEST_SHARD_STATUS_FILE. If false, a test runner that does not support sharding will lead to all tests running in each shard.
+Tags:
+incompatible_change
+
--[no]incompatible_exclusive_test_sandboxed default: "true"If true, exclusive tests will run with sandboxed strategy. Add 'local' tag to force an exclusive test run locally
+Tags:
+incompatible_change
+
--[no]incompatible_strict_action_env default: "false"If true, Bazel uses an environment with a static value for PATH and does not inherit LD_LIBRARY_PATH. Use --action_env=ENV_VARIABLE if you want to inherit specific environment variables from the client, but note that doing so can prevent cross-user caching if a shared cache is used.
+Tags:
+loading_and_analysis, incompatible_change
+
--j2objc_translation_flags=<comma-separated list of options> multiple uses are accumulatedAdditional options to pass to the J2ObjC tool.
+--java_debugCauses the Java virtual machine of a java test to wait for a connection from a JDWP-compliant debugger (such as jdb) before starting the test. Implies -test_output=streamed.
+Expands to:
+
--test_arg=--wrapper_script_flag=--debug
+
--test_output=streamed
+
--test_strategy=exclusive
+
--test_timeout=9999
+
--nocache_test_results
+
--[no]java_deps default: "true"Generate dependency information (for now, compile-time classpath) per Java target.
+--[no]java_header_compilation default: "true"Compile ijars directly from source.
+--java_language_version=<a string> default: ""The Java language version
+--java_launcher=<a build target label> default: see descriptionThe Java launcher to use when building Java binaries. If this flag is set to the empty string, the JDK launcher is used. The "launcher" attribute overrides this flag.
+--java_runtime_version=<a string> default: "local_jdk"The Java runtime version
+--javacopt=<a string> multiple uses are accumulatedAdditional options to pass to javac.
+--jvmopt=<a string> multiple uses are accumulatedAdditional options to pass to the Java VM. These options will get added to the VM startup options of each java_binary target.
+--legacy_main_dex_list_generator=<a build target label> default: see descriptionSpecifies a binary to use to generate the list of classes that must be in the main dex when compiling legacy multidex.
+--optimizing_dexer=<a build target label> default: see descriptionSpecifies a binary to use to do dexing without sharding.
+--plugin=<a build target label> multiple uses are accumulatedPlugins to use in the build. Currently works with java_plugin.
+--proguard_top=<a build target label> default: see descriptionSpecifies which version of ProGuard to use for code removal when building a Java binary.
+--proto_compiler=<a build target label> default: "@bazel_tools//tools/proto:protoc"The label of the proto-compiler.
+Tags:
+affects_outputs, loading_and_analysis
+
--[no]proto_profile default: "true"Whether to pass profile_path to the proto compiler.
+Tags:
+affects_outputs, loading_and_analysis
+
--proto_profile_path=<a build target label> default: see descriptionThe profile to pass to the proto compiler as profile_path. If unset, but --proto_profile is true (the default), infers the path from --fdo_optimize.
+Tags:
+affects_outputs, loading_and_analysis
+
--proto_toolchain_for_cc=<a build target label> default: "@bazel_tools//tools/proto:cc_toolchain"Label of proto_lang_toolchain() which describes how to compile C++ protos
+Tags:
+affects_outputs, loading_and_analysis
+
--proto_toolchain_for_j2objc=<a build target label> default: "@bazel_tools//tools/j2objc:j2objc_proto_toolchain"Label of proto_lang_toolchain() which describes how to compile j2objc protos
+Tags:
+affects_outputs, loading_and_analysis
+
--proto_toolchain_for_java=<a build target label> default: "@bazel_tools//tools/proto:java_toolchain"Label of proto_lang_toolchain() which describes how to compile Java protos
+Tags:
+affects_outputs, loading_and_analysis
+
--proto_toolchain_for_javalite=<a build target label> default: "@bazel_tools//tools/proto:javalite_toolchain"Label of proto_lang_toolchain() which describes how to compile JavaLite protos
+Tags:
+affects_outputs, loading_and_analysis
+
--protocopt=<a string> multiple uses are accumulatedAdditional options to pass to the protobuf compiler.
+Tags:
+affects_outputs
+
--[no]runs_per_test_detects_flakes default: "false"If true, any shard in which at least one run/attempt passes and at least one run/attempt fails gets a FLAKY status.
+--shell_executable=<a path> default: see descriptionAbsolute path to the shell executable for Bazel to use. If this is unset, but the BAZEL_SH environment variable is set on the first Bazel invocation (that starts up a Bazel server), Bazel uses that. If neither is set, Bazel uses a hard-coded default path depending on the operating system it runs on (Windows: c:/msys64/usr/bin/bash.exe, FreeBSD: /usr/local/bin/bash, all others: /bin/bash). Note that using a shell that is not compatible with bash may lead to build failures or runtime failures of the generated binaries.
+Tags:
+loading_and_analysis
+
--test_arg=<a string> multiple uses are accumulatedSpecifies additional options and arguments that should be passed to the test executable. Can be used multiple times to specify several arguments. If multiple tests are executed, each of them will receive identical arguments. Used only by the 'bazel test' command.
+--test_filter=<a string> default: see descriptionSpecifies a filter to forward to the test framework. Used to limit the tests run. Note that this does not affect which targets are built.
+--test_result_expiration=<an integer> default: "-1"This option is deprecated and has no effect.
+--[no]test_runner_fail_fast default: "false"Forwards fail fast option to the test runner. The test runner should stop execution upon first failure.
+--test_sharding_strategy=<explicit, disabled or forced=k where k is the number of shards to enforce> default: "explicit"Specify strategy for test sharding: 'explicit' to only use sharding if the 'shard_count' BUILD attribute is present. 'disabled' to never use test sharding. 'forced=k' to enforce 'k' shards for testing regardless of the 'shard_count' BUILD attribute.
+--tool_java_language_version=<a string> default: ""The Java language version used to execute the tools that are needed during a build
+--tool_java_runtime_version=<a string> default: "remotejdk_11"The Java runtime version used to execute tools during the build
+--[no]use_ijars default: "true"If enabled, this option causes Java compilation to use interface jars. This will result in faster incremental compilation, but error messages can be different.
+Inherits all options from build.
+ +--[no]canonicalize_policy default: "false"Output the canonical policy, after expansion and filtering. To keep the output clean, the canonicalized command arguments will NOT be shown when this option is set to true. Note that the command specified by --for_command affects the filtered policy, and if none is specified, the default command is 'build'.
+Tags:
+affects_outputs, terminal_output
+
--[no]experimental_include_default_values default: "true"Whether Starlark options set to their default values are included in the output.
+Tags:
+affects_outputs, terminal_output
+
--[no]incompatible_config_setting_private_default_visibility default: "false"If incompatible_enforce_config_setting_visibility=false, this is a noop. Else, if this flag is false, any config_setting without an explicit visibility attribute is //visibility:public. If this flag is true, config_setting follows the same visibility logic as all other rules. See https://github.com/bazelbuild/bazel/issues/12933.
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]incompatible_enforce_config_setting_visibility default: "true"If true, enforce config_setting visibility restrictions. If false, every config_setting is visible to every target. See https://github.com/bazelbuild/bazel/issues/12932.
+Tags:
+loading_and_analysis, incompatible_change
+
--for_command=<a string> default: "build"The command for which the options should be canonicalized.
+Tags:
+affects_outputs, terminal_output
+
--invocation_policy=<a string> default: ""Applies an invocation policy to the options to be canonicalized.
+Tags:
+affects_outputs, terminal_output
+
--deleted_packages=<comma-separated list of package names> multiple uses are accumulatedA comma-separated list of names of packages which the build system will consider non-existent, even if they are visible somewhere on the package path. +Use this option when deleting a subpackage 'x/y' of an existing package 'x'. For example, after deleting x/y/BUILD in your client, the build system may complain if it encounters a label '//x:y/z' if that is still provided by another package_path entry. Specifying --deleted_packages x/y avoids this problem.
+--[no]fetch default: "true"Allows the command to fetch external dependencies. If set to false, the command will utilize any cached version of the dependency, and if none exists, the command will result in failure.
+--package_path=<colon-separated list of options> default: "%workspace%"A colon-separated list of where to look for packages. Elements beginning with '%workspace%' are relative to the enclosing workspace. If omitted or empty, the default is the output of 'bazel info default-package-path'.
+--[no]show_loading_progress default: "true"If enabled, causes Bazel to print "Loading package:" messages.
+Inherits all options from build.
+ +--[no]async default: "false"If true, output cleaning is asynchronous. When this command completes, it will be safe to execute new commands in the same client, even though the deletion may continue in the background.
+Tags:
+host_machine_resource_optimizations
+
--[no]expunge default: "false"If true, clean removes the entire working tree for this bazel instance, which includes all bazel-created temporary and build output files, and stops the bazel server if it is running.
+Tags:
+host_machine_resource_optimizations
+
--expunge_asyncIf specified, clean asynchronously removes the entire working tree for this bazel instance, which includes all bazel-created temporary and build output files, and stops the bazel server if it is running. When this command completes, it will be safe to execute new commands in the same client, even though the deletion may continue in the background.
+Expands to:
+
--expunge
+
--async
+
Tags:
+host_machine_resource_optimizations
+
Inherits all options from test.
+ + +Inherits all options from test.
+ +--aspect_deps=<off, conservative or precise> default: "conservative"How to resolve aspect dependencies when the output format is one of {xml,proto,record}. 'off' means no aspect dependencies are resolved, 'conservative' (the default) means all declared aspect dependencies are added regardless of whether they are given the rule class of direct dependencies, 'precise' means that only those aspects are added that are possibly active given the rule class of the direct dependencies. Note that precise mode requires loading other packages to evaluate a single target thus making it slower than the other modes. Also note that even precise mode is not completely precise: the decision whether to compute an aspect is decided in the analysis phase, which is not run during 'bazel query'.
+Tags:
+build_file_semantics
+
--[no]consistent_labels default: "false"If enabled, every query command emits labels as if by the Starlark <code>str</code> function applied to a <code>Label</code> instance. This is useful for tools that need to match the output of different query commands and/or labels emitted by rules. If not enabled, output formatters are free to emit apparent repository names (relative to the main repository) instead to make the output more readable.
+Tags:
+terminal_output
+
--[no]experimental_explicit_aspects default: "false"aquery, cquery: whether to include aspect-generated actions in the output. query: no-op (aspects are always followed).
+Tags:
+terminal_output
+
--[no]graph:factored default: "true"If true, then the graph will be emitted 'factored', i.e. topologically-equivalent nodes will be merged together and their labels concatenated. This option is only applicable to --output=graph.
+Tags:
+terminal_output
+
--graph:node_limit=<an integer> default: "512"The maximum length of the label string for a graph node in the output. Longer labels will be truncated; -1 means no truncation. This option is only applicable to --output=graph.
+Tags:
+terminal_output
+
--[no]implicit_deps default: "true"If enabled, implicit dependencies will be included in the dependency graph over which the query operates. An implicit dependency is one that is not explicitly specified in the BUILD file but added by bazel. For cquery, this option controls filtering resolved toolchains.
+Tags:
+build_file_semantics
+
--[no]include_aspects default: "true"aquery, cquery: whether to include aspect-generated actions in the output. query: no-op (aspects are always followed).
+Tags:
+terminal_output
+
--[no]incompatible_package_group_includes_double_slash default: "true"If enabled, when outputting package_group's packages attribute, the leading // will not be omitted.
Tags:
+terminal_output, incompatible_change
+
--[no]infer_universe_scope default: "false"If set and --universe_scope is unset, then a value of --universe_scope will be inferred as the list of unique target patterns in the query expression. Note that the --universe_scope value inferred for a query expression that uses universe-scoped functions (e.g.allrdeps) may not be what you want, so you should use this option only if you know what you are doing. See https://bazel.build/reference/query#sky-query for details and examples. If --universe_scope is set, then this option's value is ignored. Note: this option applies only to query (i.e. not cquery).
Tags:
+loading_and_analysis
+
--[no]line_terminator_null default: "false"Whether each format is terminated with \0 instead of newline.
+Tags:
+terminal_output
+
--[no]nodep_deps default: "true"If enabled, deps from "nodep" attributes will be included in the dependency graph over which the query operates. A common example of a "nodep" attribute is "visibility". Run and parse the output of info build-language to learn about all the "nodep" attributes in the build language.
Tags:
+build_file_semantics
+
--output=<a string> default: "label"The format in which the cquery results should be printed. Allowed values for cquery are: label, label_kind, textproto, transitions, proto, streamed_proto, jsonproto. If you select 'transitions', you also have to specify the --transitions=(lite|full) option.
+Tags:
+terminal_output
+
--output_file=<a string> default: ""When specified, query results will be written directly to this file, and nothing will be printed to Bazel's standard output stream (stdout). In benchmarks, this is generally faster than <code>bazel query > file</code>.
+Tags:
+terminal_output
+
--[no]proto:default_values default: "true"If true, attributes whose value is not explicitly specified in the BUILD file are included; otherwise they are omitted. This option is applicable to --output=proto
+Tags:
+terminal_output
+
--[no]proto:definition_stack default: "false"Populate the definition_stack proto field, which records for each rule instance the Starlark call stack at the moment the rule's class was defined.
+Tags:
+terminal_output
+
--[no]proto:flatten_selects default: "true"If enabled, configurable attributes created by select() are flattened. For list types the flattened representation is a list containing each value of the select map exactly once. Scalar types are flattened to null.
+Tags:
+build_file_semantics
+
--[no]proto:include_attribute_source_aspects default: "false"Populate the source_aspect_name proto field of each Attribute with the source aspect that the attribute came from (empty string if it did not).
+Tags:
+terminal_output
+
--[no]proto:include_configurations default: "true"if enabled, proto output will include information about configurations. When disabled,cquery proto output format resembles query output format.
+Tags:
+affects_outputs
+
--[no]proto:include_starlark_rule_env default: "true"Use the starlark environment in the value of the generated $internal_attr_hash attribute. This ensures that the starlark rule definition (and its transitive imports) are part of this identifier.
+Tags:
+terminal_output
+
--[no]proto:include_synthetic_attribute_hash default: "false"Whether or not to calculate and populate the $internal_attr_hash attribute.
+Tags:
+terminal_output
+
--[no]proto:instantiation_stack default: "false"Populate the instantiation call stack of each rule. Note that this requires the stack to be present
+Tags:
+terminal_output
+
--[no]proto:locations default: "true"Whether to output location information in proto output at all.
+Tags:
+terminal_output
+
--proto:output_rule_attrs=<comma-separated list of options> default: "all"Comma separated list of attributes to include in output. Defaults to all attributes. Set to empty string to not output any attribute. This option is applicable to --output=proto.
+Tags:
+terminal_output
+
--[no]proto:rule_classes default: "false"Populate the rule_class_key field of each rule; and for the first rule with a given rule_class_key, also populate its rule_class_info proto field. The rule_class_key field uniquely identifies a rule class, and the rule_class_info field is a Stardoc-format rule class API definition.
+Tags:
+terminal_output
+
--[no]proto:rule_inputs_and_outputs default: "true"Whether or not to populate the rule_input and rule_output fields.
+Tags:
+terminal_output
+
--query_file=<a string> default: ""If set, query will read the query from the file named here, rather than on the command line. It is an error to specify a file here as well as a command-line query.
+Tags:
+changes_inputs
+
--[no]relative_locations default: "false"If true, the location of BUILD files in xml and proto outputs will be relative. By default, the location output is an absolute path and will not be consistent across machines. You can set this option to true to have a consistent result across machines.
+Tags:
+terminal_output
+
--show_config_fragments=<off, direct or transitive> default: "off"Shows the configuration fragments required by a rule and its transitive dependencies. This can be useful for evaluating how much a configured target graph can be trimmed.
+Tags:
+affects_outputs
+
--starlark:expr=<a string> default: ""A Starlark expression to format each configured target in cquery's --output=starlark mode. The configured target is bound to 'target'. If neither --starlark:expr nor --starlark:file is specified, this option will default to 'str(target.label)'. It is an error to specify both --starlark:expr and --starlark:file.
+Tags:
+terminal_output
+
--starlark:file=<a string> default: ""The name of a file that defines a Starlark function called 'format', of one argument, that is applied to each configured target to format it as a string. It is an error to specify both --starlark:expr and --starlark:file. See help for --output=starlark for additional detail.
+Tags:
+terminal_output
+
--[no]tool_deps default: "true"Query: If disabled, dependencies on 'exec configuration' will not be included in the dependency graph over which the query operates. An 'exec configuration' dependency edge, such as the one from any 'proto_library' rule to the Protocol Compiler, usually points to a tool executed during the build rather than a part of the same 'target' program. +Cquery: If disabled, filters out all configured targets which cross an execution transition from the top-level target that discovered this configured target. That means if the top-level target is in the target configuration, only configured targets also in the target configuration will be returned. If the top-level target is in the exec configuration, only exec configured targets will be returned. This option will NOT exclude resolved toolchains.
+Tags:
+build_file_semantics
+
--transitions=<full, lite or none> default: "none"The format in which cquery will print transition information.
+Tags:
+affects_outputs
+
--universe_scope=<comma-separated list of options> default: ""A comma-separated set of target patterns (additive and subtractive). The query may be performed in the universe defined by the transitive closure of the specified targets. This option is used for the query and cquery commands. +For cquery, the input to this option is the targets all answers are built under and so this option may affect configurations and transitions. If this option is not specified, the top-level targets are assumed to be the targets parsed from the query expression. Note: For cquery, not specifying this option may cause the build to break if targets parsed from the query expression are not buildable with top-level options.
+Tags:
+loading_and_analysis
+
--[no]experimental_persistent_aar_extractor default: "false"Enable persistent aar extractor by using workers.
+Tags:
+execution, experimental
+
--[no]experimental_remotable_source_manifests default: "false"Whether to make source manifest actions remotable
+Tags:
+loading_and_analysis, execution, experimental
+
--[no]experimental_split_coverage_postprocessing default: "false"If true, then Bazel will run coverage postprocessing for test in a new spawn.
+Tags:
+execution, experimental
+
--[no]experimental_strict_fileset_output default: "false"If this option is enabled, filesets will treat all output artifacts as regular files. They will not traverse directories or be sensitive to symlinks.
+Tags:
+execution, experimental
+
--[no]incompatible_modify_execution_info_additive default: "true"When enabled, passing multiple --modify_execution_info flags is additive. When disabled, only the last flag is taken into account.
+Tags:
+execution, affects_outputs, loading_and_analysis, incompatible_change
+
--modify_execution_info=<regex=[+-]key,regex=[+-]key,...> multiple uses are accumulatedAdd or remove keys from an action's execution info based on action mnemonic. Applies only to actions which support execution info. Many common actions support execution info, e.g. Genrule, CppCompile, Javac, StarlarkAction, TestRunner. When specifying multiple values, order matters because many regexes may apply to the same mnemonic.
+Syntax: "regex=[+-]key,regex=[+-]key,...".
+Examples: +'.=+x,.=-y,.=+z' adds 'x' and 'z' to, and removes 'y' from, the execution info for all actions. +'Genrule=+requires-x' adds 'requires-x' to the execution info for all Genrule actions. +'(?!Genrule).=-requires-x' removes 'requires-x' from the execution info for all non-Genrule actions.
+Tags:
+execution, affects_outputs, loading_and_analysis
+
--persistent_android_dex_desugarEnable persistent Android dex and desugar actions by using workers.
+Expands to:
+
--internal_persistent_android_dex_desugar
+
--strategy=Desugar=worker
+
--strategy=DexBuilder=worker
+
Tags:
+host_machine_resource_optimizations, execution
+
--persistent_android_resource_processorEnable persistent Android resource processor by using workers.
+Expands to:
+
--internal_persistent_busybox_tools
+
--strategy=AaptPackage=worker
+
--strategy=AndroidResourceParser=worker
+
--strategy=AndroidResourceValidator=worker
+
--strategy=AndroidResourceCompiler=worker
+
--strategy=RClassGenerator=worker
+
--strategy=AndroidResourceLink=worker
+
--strategy=AndroidAapt2=worker
+
--strategy=AndroidAssetMerger=worker
+
--strategy=AndroidResourceMerger=worker
+
--strategy=AndroidCompiledResourceMerger=worker
+
--strategy=ManifestMerger=worker
+
--strategy=AndroidManifestMerger=worker
+
--strategy=Aapt2Optimize=worker
+
--strategy=AARGenerator=worker
+
--strategy=ProcessDatabinding=worker
+
--strategy=GenerateDataBindingBaseClasses=worker
+
Tags:
+host_machine_resource_optimizations, execution
+
--persistent_multiplex_android_dex_desugarEnable persistent multiplexed Android dex and desugar actions by using workers.
+Expands to:
+
--persistent_android_dex_desugar
+
--internal_persistent_multiplex_android_dex_desugar
+
Tags:
+host_machine_resource_optimizations, execution
+
--persistent_multiplex_android_resource_processorEnable persistent multiplexed Android resource processor by using workers.
+Expands to:
+
--persistent_android_resource_processor
+
--modify_execution_info=AaptPackage=+supports-multiplex-workers
+
--modify_execution_info=AndroidResourceParser=+supports-multiplex-workers
+
--modify_execution_info=AndroidResourceValidator=+supports-multiplex-workers
+
--modify_execution_info=AndroidResourceCompiler=+supports-multiplex-workers
+
--modify_execution_info=RClassGenerator=+supports-multiplex-workers
+
--modify_execution_info=AndroidResourceLink=+supports-multiplex-workers
+
--modify_execution_info=AndroidAapt2=+supports-multiplex-workers
+
--modify_execution_info=AndroidAssetMerger=+supports-multiplex-workers
+
--modify_execution_info=AndroidResourceMerger=+supports-multiplex-workers
+
--modify_execution_info=AndroidCompiledResourceMerger=+supports-multiplex-workers
+
--modify_execution_info=ManifestMerger=+supports-multiplex-workers
+
--modify_execution_info=AndroidManifestMerger=+supports-multiplex-workers
+
--modify_execution_info=Aapt2Optimize=+supports-multiplex-workers
+
--modify_execution_info=AARGenerator=+supports-multiplex-workers
+
Tags:
+host_machine_resource_optimizations, execution
+
--persistent_multiplex_android_toolsEnable persistent and multiplexed Android tools (dexing, desugaring, resource processing).
+Expands to:
+
--internal_persistent_multiplex_busybox_tools
+
--persistent_multiplex_android_resource_processor
+
--persistent_multiplex_android_dex_desugar
+
Tags:
+host_machine_resource_optimizations, execution
+
--[no]use_target_platform_for_tests default: "false"If true, use the target platform for running tests rather than the test exec group.
+Tags:
+execution
+
--android_compiler=<a string> default: see descriptionThe Android target compiler.
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state
+
--android_manifest_merger=<legacy, android or force_android> default: "android"Selects the manifest merger to use for android_binary rules. Flag to help the transition to the Android manifest merger from the legacy merger.
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state
+
--android_platforms=<a build target label> default: ""Sets the platforms that android_binary targets use. If multiple platforms are specified, then the binary is a fat APKs, which contains native binaries for each specified target platform.
+Tags:
+changes_inputs, loading_and_analysis, loses_incremental_state
+
--cc_output_directory_tag=<a string> default: ""Specifies a suffix to be added to the configuration directory.
+Tags:
+affects_outputs
+
--compiler=<a string> default: see descriptionThe C++ compiler to use for compiling the target.
+Tags:
+loading_and_analysis, execution
+
--coverage_output_generator=<a build target label> default: "@bazel_tools//tools/test:lcov_merger"Location of the binary that is used to postprocess raw coverage reports. This must be a binary target. Defaults to '//tools/test:lcov_merger'.
+Tags:
+changes_inputs, affects_outputs, loading_and_analysis
+
--coverage_report_generator=<a build target label> default: "@bazel_tools//tools/test:coverage_report_generator"Location of the binary that is used to generate coverage reports. This must be a binary target. Defaults to '//tools/test:coverage_report_generator'.
+Tags:
+changes_inputs, affects_outputs, loading_and_analysis
+
--coverage_support=<a build target label> default: "@bazel_tools//tools/test:coverage_support"Location of support files that are required on the inputs of every test action that collects code coverage. Defaults to '//tools/test:coverage_support'.
+Tags:
+changes_inputs, affects_outputs, loading_and_analysis
+
--custom_malloc=<a build target label> default: see descriptionSpecifies a custom malloc implementation. This setting overrides malloc attributes in build rules.
+Tags:
+changes_inputs, affects_outputs
+
--[no]experimental_include_xcode_execution_requirements default: "false"If set, add a "requires-xcode:{version}" execution requirement to every Xcode action. If the Xcode version has a hyphenated label, also add a "requires-xcode-label:{version_label}" execution requirement.
+Tags:
+loses_incremental_state, loading_and_analysis, execution, experimental
+
--[no]experimental_prefer_mutual_xcode default: "true"If true, use the most recent Xcode that is available both locally and remotely. If false, or if there are no mutual available versions, use the local Xcode version selected via xcode-select.
+Tags:
+loses_incremental_state, experimental
+
--extra_execution_platforms=<comma-separated list of options> default: ""The platforms that are available as execution platforms to run actions. Platforms can be specified by exact target, or as a target pattern. These platforms will be considered before those declared in the WORKSPACE file by register_execution_platforms(). This option may only be set once; later instances will override earlier flag settings.
+Tags:
+execution
+
--extra_toolchains=<comma-separated list of options> multiple uses are accumulatedThe toolchain rules to be considered during toolchain resolution. Toolchains can be specified by exact target, or as a target pattern. These toolchains will be considered before those declared in the WORKSPACE file by register_toolchains().
+Tags:
+affects_outputs, changes_inputs, loading_and_analysis
+
--grte_top=<a label> default: see descriptionA label to a checked-in libc library. The default value is selected by the crosstool toolchain, and you almost never need to override it.
+Tags:
+action_command_lines, affects_outputs
+
--host_compiler=<a string> default: see descriptionNo-op flag. Will be removed in a future release.
+Tags:
+loading_and_analysis, execution
+
--host_grte_top=<a label> default: see descriptionIf specified, this setting overrides the libc top-level directory (--grte_top) for the exec configuration.
+Tags:
+action_command_lines, affects_outputs
+
--host_platform=<a build target label> default: "@bazel_tools//tools:host_platform"The label of a platform rule that describes the host system.
+Tags:
+affects_outputs, changes_inputs, loading_and_analysis
+
--[no]incompatible_bazel_test_exec_run_under default: "true"If enabled, "bazel test --run_under=//:runner" builds "//:runner" in the exec configuration. If disabled, it builds "//:runner" in the target configuration. Bazel executes tests on exec machines, so the former is more correct. This doesn't affect "bazel run", which always builds "`--run_under=//foo" in the target configuration.
+Tags:
+affects_outputs, incompatible_change
+
--[no]incompatible_builtin_objc_strip_action default: "true"Whether to emit a strip action as part of objc linking.
+Tags:
+action_command_lines, incompatible_change
+
--[no]incompatible_dont_enable_host_nonhost_crosstool_features default: "true"If true, Bazel will not enable 'host' and 'nonhost' features in the c++ toolchain (see https://github.com/bazelbuild/bazel/issues/7407 for more information).
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]incompatible_enable_apple_toolchain_resolution default: "false"Use toolchain resolution to select the Apple SDK for apple rules (Starlark and native)
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]incompatible_remove_legacy_whole_archive default: "true"If true, Bazel will not link library dependencies as whole archive by default (see https://github.com/bazelbuild/bazel/issues/7362 for migration instructions).
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]incompatible_strip_executable_safely default: "false"If true, strip action for executables will use flag -x, which does not break dynamic symbol resolution.
+Tags:
+action_command_lines, incompatible_change
+
Use interface shared objects if supported by the toolchain. All ELF toolchains currently support this setting.
+Tags:
+loading_and_analysis, affects_outputs, affects_outputs
+
--ios_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionSpecifies the version of the iOS SDK to use to build iOS applications. If unspecified, uses the default iOS SDK version from 'xcode_version'.
+Tags:
+loses_incremental_state
+
--macos_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionSpecifies the version of the macOS SDK to use to build macOS applications. If unspecified, uses the default macOS SDK version from 'xcode_version'.
+Tags:
+loses_incremental_state
+
--minimum_os_version=<a string> default: see descriptionThe minimum OS version which your compilation targets.
+Tags:
+loading_and_analysis, affects_outputs
+
--platform_mappings=<a main workspace-relative path> default: ""The location of a mapping file that describes which platform to use if none is set or which flags to set when a platform already exists. Must be relative to the main workspace root. Defaults to 'platform_mappings' (a file directly under the workspace root).
+Tags:
+affects_outputs, changes_inputs, loading_and_analysis, non_configurable
+
--platforms=<a build target label> default: ""The labels of the platform rules describing the target platforms for the current command.
+Tags:
+affects_outputs, changes_inputs, loading_and_analysis
+
--python_path=<a string> default: see descriptionThe absolute path of the Python interpreter invoked to run Python targets on the target platform. Deprecated; disabled by --incompatible_use_python_toolchains.
+Tags:
+loading_and_analysis, affects_outputs
+
--tvos_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionSpecifies the version of the tvOS SDK to use to build tvOS applications. If unspecified, uses the default tvOS SDK version from 'xcode_version'.
+Tags:
+loses_incremental_state
+
--[no]use_platforms_in_apple_crosstool_transition default: "false"Makes apple_crosstool_transition fall back to using the value of --platforms flag instead of legacy --cpu when needed.
Tags:
+loading_and_analysis
+
--watchos_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionSpecifies the version of the watchOS SDK to use to build watchOS applications. If unspecified, uses the default watchOS SDK version from 'xcode_version'.
+Tags:
+loses_incremental_state
+
--xcode_version=<a string> default: see descriptionIf specified, uses Xcode of the given version for relevant build actions. If unspecified, uses the executor default version of Xcode.
+Tags:
+loses_incremental_state
+
--xcode_version_config=<a build target label> default: "@bazel_tools//tools/cpp:host_xcodes"The label of the xcode_config rule to be used for selecting the Xcode version in the build configuration.
+Tags:
+loses_incremental_state, loading_and_analysis
+
--[no]apple_generate_dsym default: "false"Whether to generate debug symbol(.dSYM) file(s).
+Tags:
+affects_outputs, action_command_lines
+
--[no]build_runfile_links default: "true"If true, build runfiles symlink forests for all targets. If false, write them only when required by a local action, test or run command.
+Tags:
+affects_outputs
+
--[no]build_runfile_manifests default: "true"If true, write runfiles manifests for all targets. If false, omit them. Local tests will fail to run when false.
+Tags:
+affects_outputs
+
--[no]build_test_dwp default: "false"If enabled, when building C++ tests statically and with fission the .dwp file for the test binary will be automatically built as well.
+Tags:
+loading_and_analysis, affects_outputs
+
--cc_proto_library_header_suffixes=<comma-separated set of options> default: ".pb.h"Sets the suffixes of header files that a cc_proto_library creates.
+Tags:
+affects_outputs, loading_and_analysis
+
--cc_proto_library_source_suffixes=<comma-separated set of options> default: ".pb.cc"Sets the suffixes of source files that a cc_proto_library creates.
+Tags:
+affects_outputs, loading_and_analysis
+
--[no]experimental_proto_descriptor_sets_include_source_info default: "false"Run extra actions for alternative Java api versions in a proto_library.
+Tags:
+affects_outputs, loading_and_analysis, experimental
+
--[no]experimental_save_feature_state default: "false"Save the state of enabled and requested feautres as an output of compilation.
+Tags:
+affects_outputs, experimental
+
--fission=<a set of compilation modes> default: "no"Specifies which compilation modes use fission for C++ compilations and links. May be any combination of {'fastbuild', 'dbg', 'opt'} or the special values 'yes' to enable all modes and 'no' to disable all modes.
+Tags:
+loading_and_analysis, action_command_lines, affects_outputs
+
--[no]incompatible_always_include_files_in_data default: "true"If true, native rules add <code>DefaultInfo.files</code> of data dependencies to their runfiles, which matches the recommended behavior for Starlark rules (https://bazel.build/extending/rules#runfiles_features_to_avoid).
+Tags:
+affects_outputs, incompatible_change
+
--[no]incompatible_compact_repo_mapping_manifest default: "false"If enabled, the <binary>.repo_mapping file emits a module extension's repo mapping only once instead of once for each repo generated by the extension that contributes runfiles.
+Tags:
+affects_outputs, incompatible_change
+
--incompatible_disable_select_on=<comma-separated set of options> default: ""List of flags for which the use in select() is disabled.
+Tags:
+loading_and_analysis, incompatible_change, non_configurable
+
--[no]incompatible_filegroup_runfiles_for_data default: "true"If true, runfiles of targets listed in the srcs attribute are available to targets that consume the filegroup as a data dependency.
+Tags:
+incompatible_change
+
--[no]objc_generate_linkmap default: "false"Specifies whether to generate a linkmap file.
+Tags:
+affects_outputs
+
--[no]save_temps default: "false"If set, temporary outputs from gcc will be saved. These include .s files (assembler code), .i files (preprocessed C) and .ii files (preprocessed C++).
+Tags:
+affects_outputs
+
--action_env=<a 'name[=value]' assignment with an optional value part or the special syntax '=name' to unset a variable> multiple uses are accumulatedSpecifies the set of environment variables available to actions with target configuration. Variables can be either specified by <code>name</code>, in which case +the value will be taken from the invocation environment, by the <code>name=value</code> pair which sets the value independent of the invocation environment, or by <code>=name</code>, which unsets the variable of that name. This option can be used multiple times; for options given for the same variable, the latest wins, options for different variables accumulate. +<br> +Note that unless <code>--incompatible_repo_env_ignores_action_env</code> is true, all <code>name=value</code> pairs will be available to repository rules.
+Tags:
+action_command_lines
+
--allowed_cpu_values=<comma-separated set of options> default: ""Allowed values for the --cpu flag.
+Tags:
+changes_inputs, affects_outputs
+
--[no]android_databinding_use_androidx default: "true"Generate AndroidX-compatible data-binding files. This is only used with databinding v2. This flag is a no-op.
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state, experimental
+
--[no]android_databinding_use_v3_4_args default: "true"Use android databinding v2 with 3.4.0 argument. This flag is a no-op.
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state, experimental
+
--android_dynamic_mode=<off, default or fully> default: "off"Determines whether C++ deps of Android rules will be linked dynamically when a cc_binary does not explicitly create a shared library. 'default' means bazel will choose whether to link dynamically. 'fully' means all libraries will be linked dynamically. 'off' means that all libraries will be linked in mostly static mode.
+Tags:
+affects_outputs, loading_and_analysis
+
--android_manifest_merger_order=<alphabetical, alphabetical_by_configuration or dependency> default: "alphabetical"Sets the order of manifests passed to the manifest merger for Android binaries. ALPHABETICAL means manifests are sorted by path relative to the execroot. ALPHABETICAL_BY_CONFIGURATION means manifests are sorted by paths relative to the configuration directory within the output directory. DEPENDENCY means manifests are ordered with each library's manifest coming before the manifests of its dependencies.
+Tags:
+action_command_lines, execution
+
--[no]android_resource_shrinking default: "false"Enables resource shrinking for android_binary APKs that use ProGuard.
+Tags:
+affects_outputs, loading_and_analysis
+
--[no]build_python_zip default: "auto"Build python executable zip; on on Windows, off on other platforms
+Tags:
+affects_outputs
+
--catalyst_cpus=<comma-separated list of options> multiple uses are accumulatedComma-separated list of architectures for which to build Apple Catalyst binaries.
+Tags:
+loses_incremental_state, loading_and_analysis
+
--[no]collect_code_coverage default: "false"If specified, Bazel will instrument code (using offline instrumentation where possible) and will collect coverage information during tests. Only targets that match --instrumentation_filter will be affected. Usually this option should not be specified directly - 'bazel coverage' command should be used instead.
+Tags:
+affects_outputs
+
--compilation_mode=<fastbuild, dbg or opt> [-c] default: "fastbuild"Specify the mode the binary will be built in. Values: 'fastbuild', 'dbg', 'opt'.
+Tags:
+affects_outputs, action_command_lines
+
--conlyopt=<a string> multiple uses are accumulatedAdditional option to pass to gcc when compiling C source files.
+Tags:
+action_command_lines, affects_outputs
+
--copt=<a string> multiple uses are accumulatedAdditional options to pass to gcc.
+Tags:
+action_command_lines, affects_outputs
+
--cpu=<a string> default: ""Deprecated: this flag is not used internally by Blaze although there are legacy platform mappings to allow for backwards compatibility. Do not use this flag, instead use --platforms with an appropriate platform definition.
+Tags:
+changes_inputs, affects_outputs
+
--cs_fdo_absolute_path=<a string> default: see descriptionUse CSFDO profile information to optimize compilation. Specify the absolute path name of the zip file containing the profile file, a raw or an indexed LLVM profile file.
+Tags:
+affects_outputs
+
--cs_fdo_instrument=<a string> default: see descriptionGenerate binaries with context sensitive FDO instrumentation. With Clang/LLVM compiler, it also accepts the directory name under which the raw profile file(s) will be dumped at runtime.
+Tags:
+affects_outputs
+
--cs_fdo_profile=<a build target label> default: see descriptionThe cs_fdo_profile representing the context sensitive profile to be used for optimization.
+Tags:
+affects_outputs
+
--cxxopt=<a string> multiple uses are accumulatedAdditional option to pass to gcc when compiling C++ source files.
+Tags:
+action_command_lines, affects_outputs
+
--define=<a 'name=value' assignment> multiple uses are accumulatedEach --define option specifies an assignment for a build variable. In case of multiple values for a variable, the last one wins.
+Tags:
+changes_inputs, affects_outputs
+
--dynamic_mode=<off, default or fully> default: "default"Determines whether C++ binaries will be linked dynamically. 'default' means Bazel will choose whether to link dynamically. 'fully' means all libraries will be linked dynamically. 'off' means that all libraries will be linked in mostly static mode.
+Tags:
+loading_and_analysis, affects_outputs
+
--[no]enable_propeller_optimize_absolute_paths default: "true"If set, any use of absolute paths for propeller optimize will raise an error.
+Tags:
+affects_outputs
+
--[no]enable_remaining_fdo_absolute_paths default: "true"If set, any use of absolute paths for FDO will raise an error.
+Tags:
+affects_outputs
+
--[no]enable_runfiles default: "auto"Enable runfiles symlink tree; By default, it's off on Windows, on on other platforms.
+Tags:
+affects_outputs
+
--exec_aspects=<comma-separated list of options> multiple uses are accumulatedComma-separated list of aspects to be applied to exec-configured targets, regardless of whether or not they are top-level targets. This is an experimental feature and is subject to change.
+Tags:
+loading_and_analysis
+
--experimental_action_listener=<a build target label> multiple uses are accumulatedDeprecated in favor of aspects. Use action_listener to attach an extra_action to existing build actions.
+Tags:
+execution, experimental
+
--[no]experimental_android_compress_java_resources default: "false"Compress Java resources in APKs
+Tags:
+affects_outputs, loading_and_analysis, experimental
+
--[no]experimental_android_databinding_v2 default: "true"Use android databinding v2. This flag is a no-op.
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state, experimental
+
--[no]experimental_android_resource_shrinking default: "false"Enables resource shrinking for android_binary APKs that use ProGuard.
+Tags:
+affects_outputs, loading_and_analysis, experimental
+
--[no]experimental_android_rewrite_dexes_with_rex default: "false"use rex tool to rewrite dex files
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state, experimental
+
--[no]experimental_collect_code_coverage_for_generated_files default: "false"If specified, Bazel will also generate collect coverage information for generated files.
+Tags:
+affects_outputs, experimental
+
--experimental_objc_fastbuild_options=<comma-separated list of options> default: "-O0,-DDEBUG=1"Uses these strings as objc fastbuild compiler options.
+Tags:
+action_command_lines
+
--[no]experimental_omitfp default: "false"If true, use libunwind for stack unwinding, and compile with -fomit-frame-pointer and -fasynchronous-unwind-tables.
+Tags:
+action_command_lines, affects_outputs, experimental
+
--experimental_output_paths=<off or strip> default: "off"Which model to use for where in the output tree rules write their outputs, particularly for multi-platform / multi-configuration builds. This is highly experimental. See https://github.com/bazelbuild/bazel/issues/6526 for details. Starlark actions canopt into path mapping by adding the key 'supports-path-mapping' to the 'execution_requirements' dict.
+Tags:
+loses_incremental_state, bazel_internal_configuration, affects_outputs, execution
+
--experimental_override_platform_cpu_name=<a 'label=value' assignment> multiple uses are accumulatedEach entry should be of the form label=value where label refers to a platform and values is the desired shortname to override the platform's CPU name in $(TARGET_CPU) make variable and output path. Only used when --experimental_platform_in_output_dir, --incompatible_target_cpu_from_platform or --incompatible_bep_cpu_from_platform is true. Has highest naming priority.
+Tags:
+affects_outputs, experimental
+
--[no]experimental_platform_in_output_dir default: "false"If true, a shortname for the target platform is used in the output directory name instead of the CPU. If auto, this is only applied for the exec configuration. The exact scheme is experimental and subject to change: First, in the rare case the --platforms option does not have exactly one value, a hash of the platforms option is used. Next, if any shortname for the current platform was registered by --experimental_override_name_platform_in_output_dir, then that shortname is used. Then, if --experimental_use_platforms_in_output_dir_legacy_heuristic is set, use a shortname based off the current platform Label. Finally, a hash of the platform option is used as a last resort.
+Tags:
+affects_outputs, experimental
+
--[no]experimental_py_binaries_include_label default: "false"py_binary targets include their label even when stamping is disabled.
+Tags:
+affects_outputs, experimental
+
--[no]experimental_use_llvm_covmap default: "false"If specified, Bazel will generate llvm-cov coverage map information rather than gcov when collect_code_coverage is enabled.
+Tags:
+changes_inputs, affects_outputs, loading_and_analysis, experimental
+
--[no]experimental_use_platforms_in_output_dir_legacy_heuristic default: "true"Please only use this flag as part of a suggested migration or testing strategy. Note that the heuristic has known deficiencies and it is suggested to migrate to relying on just --experimental_override_name_platform_in_output_dir.
+Tags:
+affects_outputs, experimental
+
--fdo_instrument=<a string> default: see descriptionGenerate binaries with FDO instrumentation. With Clang/LLVM compiler, it also accepts the directory name under which the raw profile file(s) will be dumped at runtime.
+Tags:
+affects_outputs
+
--fdo_optimize=<a string> default: see descriptionUse FDO profile information to optimize compilation. Specify the name of a zip file containing a .gcda file tree, an afdo file containing an auto profile, or an LLVM profile file. This flag also accepts files specified as labels (e.g. //foo/bar:file.afdo - you may need to add an exports_files directive to the corresponding package) and labels pointing to fdo_profile targets. This flag will be superseded by the fdo_profile rule.
Tags:
+affects_outputs
+
--fdo_prefetch_hints=<a build target label> default: see descriptionUse cache prefetch hints.
+Tags:
+affects_outputs
+
--fdo_profile=<a build target label> default: see descriptionThe fdo_profile representing the profile to be used for optimization.
+Tags:
+affects_outputs
+
--features=<a string> multiple uses are accumulatedThe given features will be enabled or disabled by default for targets built in the target configuration. Specifying -<feature> will disable the feature. Negative features always override positive ones. See also --host_features
+Tags:
+changes_inputs, affects_outputs
+
--[no]force_pic default: "false"If enabled, all C++ compilations produce position-independent code ("-fPIC"), links prefer PIC pre-built libraries over non-PIC libraries, and links produce position-independent executables ("-pie").
+Tags:
+loading_and_analysis, affects_outputs
+
--host_action_env=<a 'name[=value]' assignment with an optional value part or the special syntax '=name' to unset a variable> multiple uses are accumulatedSpecifies the set of environment variables available to actions with execution configurations. Variables can be either specified by name, in which case the value will be taken from the invocation environment, by the name=value pair which sets the value independent of the invocation environment, or by <code>=name</code>, which unsets the variable of that name. This option can be used multiple times; for options given for the same variable, the latest wins, options for different variables accumulate.
+Tags:
+action_command_lines
+
--host_compilation_mode=<fastbuild, dbg or opt> default: "opt"Specify the mode the tools used during the build will be built in. Values: 'fastbuild', 'dbg', 'opt'.
+Tags:
+affects_outputs, action_command_lines
+
--host_conlyopt=<a string> multiple uses are accumulatedAdditional option to pass to the C compiler when compiling C (but not C++) source files in the exec configurations.
+Tags:
+action_command_lines, affects_outputs
+
--host_copt=<a string> multiple uses are accumulatedAdditional options to pass to the C compiler for tools built in the exec configurations.
+Tags:
+action_command_lines, affects_outputs
+
--host_cpu=<a string> default: ""The host CPU.
+Tags:
+changes_inputs, affects_outputs
+
--host_cxxopt=<a string> multiple uses are accumulatedAdditional options to pass to C++ compiler for tools built in the exec configurations.
+Tags:
+action_command_lines, affects_outputs
+
--host_features=<a string> multiple uses are accumulatedThe given features will be enabled or disabled by default for targets built in the exec configuration. Specifying -<feature> will disable the feature. Negative features always override positive ones.
+Tags:
+changes_inputs, affects_outputs
+
--host_linkopt=<a string> multiple uses are accumulatedAdditional option to pass to linker when linking tools in the exec configurations.
+Tags:
+action_command_lines, affects_outputs
+
--host_macos_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionMinimum compatible macOS version for host targets. If unspecified, uses 'macos_sdk_version'.
+Tags:
+loses_incremental_state
+
--host_per_file_copt=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths followed by an @ and a comma separated list of options> multiple uses are accumulatedAdditional options to selectively pass to the C/C++ compiler when compiling certain files in the exec configurations. This option can be passed multiple times. Syntax: regex_filter@option_1,option_2,...,option_n. Where regex_filter stands for a list of include and exclude regular expression patterns (Also see --instrumentation_filter). option_1 to option_n stand for arbitrary command line options. If an option contains a comma it has to be quoted with a backslash. Options can contain @. Only the first @ is used to split the string. Example: --host_per_file_copt=//foo/.*.cc,-//foo/bar.cc@-O0 adds the -O0 command line option to the gcc command line of all cc files in //foo/ except bar.cc.
+Tags:
+action_command_lines, affects_outputs
+
--[no]incompatible_auto_exec_groups default: "false"When enabled, an exec groups is automatically created for each toolchain used by a rule. For this to work rule needs to specify toolchain parameter on its actions. For more information, see https://github.com/bazelbuild/bazel/issues/17134.
Tags:
+affects_outputs, incompatible_change
+
--[no]incompatible_merge_genfiles_directory default: "true"If true, the genfiles directory is folded into the bin directory.
+Tags:
+affects_outputs, incompatible_change
+
--[no]incompatible_target_cpu_from_platform default: "true"If specified, the value of the cpu constraint (@platforms//cpu:cpu) of the target platform is used to set the $(TARGET_CPU) make variable.
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]instrument_test_targets default: "false"When coverage is enabled, specifies whether to consider instrumenting test rules. When set, test rules included by --instrumentation_filter are instrumented. Otherwise, test rules are always excluded from coverage instrumentation.
+Tags:
+affects_outputs
+
--instrumentation_filter=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths> default: "-/javatests[/:],-/test/java[/:]"When coverage is enabled, only rules with names included by the specified regex-based filter will be instrumented. Rules prefixed with '-' are excluded instead. Note that only non-test rules are instrumented unless --instrument_test_targets is enabled.
+Tags:
+affects_outputs
+
--ios_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionMinimum compatible iOS version for target simulators and devices. If unspecified, uses 'ios_sdk_version'.
+Tags:
+loses_incremental_state
+
--ios_multi_cpus=<comma-separated list of options> multiple uses are accumulatedComma-separated list of architectures to build an ios_application with. The result is a universal binary containing all specified architectures.
+Tags:
+loses_incremental_state, loading_and_analysis
+
--[no]legacy_whole_archive default: "true"Deprecated, superseded by --incompatible_remove_legacy_whole_archive (see https://github.com/bazelbuild/bazel/issues/7362 for details). When on, use --whole-archive for cc_binary rules that have linkshared=True and either linkstatic=True or '-static' in linkopts. This is for backwards compatibility only. A better alternative is to use alwayslink=1 where required.
+Tags:
+action_command_lines, affects_outputs, deprecated
+
--linkopt=<a string> multiple uses are accumulatedAdditional option to pass to gcc when linking.
+Tags:
+action_command_lines, affects_outputs
+
--ltobackendopt=<a string> multiple uses are accumulatedAdditional option to pass to the LTO backend step (under --features=thin_lto).
+Tags:
+action_command_lines, affects_outputs
+
--ltoindexopt=<a string> multiple uses are accumulatedAdditional option to pass to the LTO indexing step (under --features=thin_lto).
+Tags:
+action_command_lines, affects_outputs
+
--macos_cpus=<comma-separated list of options> multiple uses are accumulatedComma-separated list of architectures for which to build Apple macOS binaries.
+Tags:
+loses_incremental_state, loading_and_analysis
+
--macos_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionMinimum compatible macOS version for targets. If unspecified, uses 'macos_sdk_version'.
+Tags:
+loses_incremental_state
+
--memprof_profile=<a build target label> default: see descriptionUse memprof profile.
+Tags:
+affects_outputs
+
--[no]objc_debug_with_GLIBCXX default: "false"If set, and compilation mode is set to 'dbg', define GLIBCXX_DEBUG, GLIBCXX_DEBUG_PEDANTIC and GLIBCPP_CONCEPT_CHECKS.
+Tags:
+action_command_lines
+
--[no]objc_enable_binary_stripping default: "false"Whether to perform symbol and dead-code strippings on linked binaries. Binary strippings will be performed if both this flag and --compilation_mode=opt are specified.
+Tags:
+action_command_lines
+
--objccopt=<a string> multiple uses are accumulatedAdditional options to pass to gcc when compiling Objective-C/C++ source files.
+Tags:
+action_command_lines
+
--per_file_copt=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths followed by an @ and a comma separated list of options> multiple uses are accumulatedAdditional options to selectively pass to gcc when compiling certain files. This option can be passed multiple times. Syntax: regex_filter@option_1,option_2,...,option_n. Where regex_filter stands for a list of include and exclude regular expression patterns (Also see --instrumentation_filter). option_1 to option_n stand for arbitrary command line options. If an option contains a comma it has to be quoted with a backslash. Options can contain @. Only the first @ is used to split the string. Example: --per_file_copt=//foo/.*.cc,-//foo/bar.cc@-O0 adds the -O0 command line option to the gcc command line of all cc files in //foo/ except bar.cc.
+Tags:
+action_command_lines, affects_outputs
+
--per_file_ltobackendopt=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths followed by an @ and a comma separated list of options> multiple uses are accumulatedAdditional options to selectively pass to LTO backend (under --features=thin_lto) when compiling certain backend objects. This option can be passed multiple times. Syntax: regex_filter@option_1,option_2,...,option_n. Where regex_filter stands for a list of include and exclude regular expression patterns. option_1 to option_n stand for arbitrary command line options. If an option contains a comma it has to be quoted with a backslash. Options can contain @. Only the first @ is used to split the string. Example: --per_file_ltobackendopt=//foo/.*.o,-//foo/bar.o@-O0 adds the -O0 command line option to the LTO backend command line of all o files in //foo/ except bar.o.
+Tags:
+action_command_lines, affects_outputs
+
--platform_suffix=<a string> default: see descriptionSpecifies a suffix to be added to the configuration directory.
+Tags:
+loses_incremental_state, affects_outputs, loading_and_analysis
+
--propeller_optimize=<a build target label> default: see descriptionUse Propeller profile information to optimize the build target.A propeller profile must consist of at least one of two files, a cc profile and a ld profile. This flag accepts a build label which must refer to the propeller profile input files. For example, the BUILD file that defines the label, in a/b/BUILD:propeller_optimize( name = "propeller_profile", cc_profile = "propeller_cc_profile.txt", ld_profile = "propeller_ld_profile.txt",)An exports_files directive may have to be added to the corresponding package to make these files visible to Bazel. The option must be used as: --propeller_optimize=//a/b:propeller_profile
+Tags:
+action_command_lines, affects_outputs
+
--propeller_optimize_absolute_cc_profile=<a string> default: see descriptionAbsolute path name of cc_profile file for Propeller Optimized builds.
+Tags:
+affects_outputs
+
--propeller_optimize_absolute_ld_profile=<a string> default: see descriptionAbsolute path name of ld_profile file for Propeller Optimized builds.
+Tags:
+affects_outputs
+
--run_under=<a prefix in front of command> default: see descriptionPrefix to insert before the executables for the 'test' and 'run' commands. If the value is 'foo -bar', and the execution command line is 'test_binary -baz', then the final command line is 'foo -bar test_binary -baz'.This can also be a label to an executable target. Some examples are: 'valgrind', 'strace', 'strace -c', 'valgrind --quiet --num-callers=20', '//package:target', '//package:target --options'.
+Tags:
+action_command_lines
+
If true, native libraries that contain identical functionality will be shared among different targets
+Tags:
+loading_and_analysis, affects_outputs
+
--[no]stamp default: "false"Stamp binaries with the date, username, hostname, workspace information, etc.
+Tags:
+affects_outputs
+
--strip=<always, sometimes or never> default: "sometimes"Specifies whether to strip binaries and shared libraries (using "-Wl,--strip-debug"). The default value of 'sometimes' means strip iff --compilation_mode=fastbuild.
+Tags:
+affects_outputs
+
--stripopt=<a string> multiple uses are accumulatedAdditional options to pass to strip when generating a '<name>.stripped' binary.
+Tags:
+action_command_lines, affects_outputs
+
--tvos_cpus=<comma-separated list of options> multiple uses are accumulatedComma-separated list of architectures for which to build Apple tvOS binaries.
+Tags:
+loses_incremental_state, loading_and_analysis
+
--tvos_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionMinimum compatible tvOS version for target simulators and devices. If unspecified, uses 'tvos_sdk_version'.
+Tags:
+loses_incremental_state
+
--visionos_cpus=<comma-separated list of options> multiple uses are accumulatedComma-separated list of architectures for which to build Apple visionOS binaries.
+Tags:
+loses_incremental_state, loading_and_analysis
+
--watchos_cpus=<comma-separated list of options> multiple uses are accumulatedComma-separated list of architectures for which to build Apple watchOS binaries.
+Tags:
+loses_incremental_state, loading_and_analysis
+
--watchos_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionMinimum compatible watchOS version for target simulators and devices. If unspecified, uses 'watchos_sdk_version'.
+Tags:
+loses_incremental_state
+
--xbinary_fdo=<a build target label> default: see descriptionUse XbinaryFDO profile information to optimize compilation. Specify the name of default cross binary profile. When the option is used together with --fdo_instrument/--fdo_optimize/--fdo_profile, those options will always prevail as if xbinary_fdo is never specified.
+Tags:
+affects_outputs
+
--[no]check_visibility default: "true"If disabled, visibility errors in target dependencies are demoted to warnings.
+Tags:
+build_file_semantics, non_configurable
+
--[no]desugar_for_android default: "true"Whether to desugar Java 8 bytecode before dexing.
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state
+
--[no]desugar_java8_libs default: "false"Whether to include supported Java 8 libraries in apps for legacy devices.
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state, experimental
+
--[no]enforce_constraints default: "true"Checks the environments each target is compatible with and reports errors if any target has dependencies that don't support the same environments
+Tags:
+build_file_semantics
+
--[no]experimental_check_desugar_deps default: "true"Whether to double-check correct desugaring at Android binary level.
+Tags:
+eagerness_to_exit, loading_and_analysis, experimental
+
--[no]experimental_enforce_transitive_visibility default: "false"If true, enable package()s to set the transitive_visibility attribute to restrict which packages may depend on them.
+Tags:
+build_file_semantics, experimental
+
--experimental_one_version_enforcement=<off, warning or error> default: "OFF"When enabled, enforce that a java_binary rule can't contain more than one version of the same class file on the classpath. This enforcement can break the build, or can just result in warnings.
+Tags:
+loading_and_analysis
+
--experimental_strict_java_deps=<off, warn, error, strict or default> default: "default"If true, checks that a Java target explicitly declares all directly used targets as dependencies.
+Tags:
+build_file_semantics, eagerness_to_exit
+
--[no]incompatible_check_testonly_for_output_files default: "false"If enabled, check testonly for prerequisite targets that are output files by looking up the testonly of the generating rule. This matches visibility checking.
+Tags:
+build_file_semantics, incompatible_change
+
--[no]incompatible_disable_native_android_rules default: "false"If enabled, direct usage of the native Android rules is disabled. Please use the Starlark Android rules from https://github.com/bazelbuild/rules_android
+Tags:
+eagerness_to_exit, incompatible_change
+
--[no]incompatible_disable_native_apple_binary_rule default: "false"No-op. Kept here for backwards compatibility.
+Tags:
+eagerness_to_exit, incompatible_change
+
--[no]one_version_enforcement_on_java_tests default: "true"When enabled, and with experimental_one_version_enforcement set to a non-NONE value, enforce one version on java_test targets. This flag can be disabled to improve incremental test performance at the expense of missing potential one version violations.
+Tags:
+loading_and_analysis
+
--python_native_rules_allowlist=<a build target label> default: see descriptionAn allowlist (package_group target) to use when enforcing --incompatible_python_disallow_native_rules.
+Tags:
+loading_and_analysis
+
--[no]strict_filesets default: "false"If this option is enabled, filesets crossing package boundaries are reported as errors.
+Tags:
+build_file_semantics, eagerness_to_exit
+
--strict_proto_deps=<off, warn, error, strict or default> default: "error"Unless OFF, checks that a proto_library target explicitly declares all directly used targets as dependencies.
+Tags:
+build_file_semantics, eagerness_to_exit, incompatible_change
+
--strict_public_imports=<off, warn, error, strict or default> default: "off"Unless OFF, checks that a proto_library target explicitly declares all targets used in 'import public' as exported.
+Tags:
+build_file_semantics, eagerness_to_exit, incompatible_change
+
--[no]strict_system_includes default: "false"If true, headers found through system include paths (-isystem) are also required to be declared.
+Tags:
+loading_and_analysis, eagerness_to_exit
+
--target_environment=<a build target label> multiple uses are accumulatedDeclares this build's target environment. Must be a label reference to an "environment" rule. If specified, all top-level targets must be compatible with this environment.
+Tags:
+changes_inputs
+
--apk_signing_method=<v1, v2, v1_v2 or v4> default: "v1_v2"Implementation to use to sign APKs
+Tags:
+action_command_lines, affects_outputs, loading_and_analysis
+
--[no]device_debug_entitlements default: "true"If set, and compilation mode is not 'opt', objc apps will include debug entitlements when signing.
+Tags:
+changes_inputs
+
--ios_signing_cert_name=<a string> default: see descriptionCertificate name to use for iOS signing. If not set will fall back to provisioning profile. May be the certificate's keychain identity preference or (substring) of the certificate's common name, as per codesign's man page (SIGNING IDENTITIES).
+Tags:
+action_command_lines
+
--[no]incompatible_disallow_sdk_frameworks_attributes default: "false"If true, disallow sdk_frameworks and weak_sdk_frameworks attributes in objc_library andobjc_import.
+Tags:
+build_file_semantics, incompatible_change
+
--[no]incompatible_objc_alwayslink_by_default default: "false"If true, make the default value true for alwayslink attributes in objc_library and objc_import.
+Tags:
+build_file_semantics, incompatible_change
+
--[no]incompatible_python_disallow_native_rules default: "false"When true, an error occurs when using the builtin py_* rules; instead the rule_python rules should be used. See https://github.com/bazelbuild/bazel/issues/17773 for more information and migration instructions.
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]allow_analysis_failures default: "false"If true, an analysis failure of a rule target results in the target's propagation of an instance of AnalysisFailureInfo containing the error description, instead of resulting in a build failure.
+Tags:
+loading_and_analysis, experimental
+
--analysis_testing_deps_limit=<an integer> default: "2000"Sets the maximum number of transitive dependencies through a rule attribute with a for_analysis_testing configuration transition. Exceeding this limit will result in a rule error.
+Tags:
+loading_and_analysis
+
--[no]break_build_on_parallel_dex2oat_failure default: "false"If true dex2oat action failures will cause the build to break instead of executing dex2oat during test runtime.
+Tags:
+loading_and_analysis, experimental
+
--default_test_resources=<a resource name followed by equal and 1 float or 4 float, e.g memory=10,30,60,100> multiple uses are accumulatedOverride the default resources amount for tests. The expected format is <resource>=<value>. If a single positive number is specified as <value> it will override the default resources for all test sizes. If 4 comma-separated numbers are specified, they will override the resource amount for respectively the small, medium, large, enormous test sizes. Values can also be HOST_RAM/HOST_CPU, optionally followed by [-|]<float> (eg. memory=HOST_RAM.1,HOST_RAM*.2,HOST_RAM*.3,HOST_RAM*.4). The default test resources specified by this flag are overridden by explicit resources specified in tags.
+--[no]experimental_android_use_parallel_dex2oat default: "false"Use dex2oat in parallel to possibly speed up android_test.
+Tags:
+loading_and_analysis, host_machine_resource_optimizations, experimental
+
--[no]ios_memleaks default: "false"Enable checking for memory leaks in ios_test targets.
+Tags:
+action_command_lines
+
--ios_simulator_device=<a string> default: see descriptionThe device to simulate when running an iOS application in the simulator, e.g. 'iPhone 6'. You can get a list of devices by running 'xcrun simctl list devicetypes' on the machine the simulator will be run on.
+Tags:
+test_runner
+
--ios_simulator_version=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionThe version of iOS to run on the simulator when running or testing. This is ignored for ios_test rules if a target device is specified in the rule.
+Tags:
+test_runner
+
--runs_per_test=<a positive integer or test_regex@runs. This flag may be passed more than once> multiple uses are accumulatedSpecifies number of times to run each test. If any of those attempts fail for any reason, the whole test is considered failed. Normally the value specified is just an integer. Example: --runs_per_test=3 will run all tests 3 times. Alternate syntax: regex_filter@runs_per_test. Where runs_per_test stands for an integer value and regex_filter stands for a list of include and exclude regular expression patterns (Also see --instrumentation_filter). Example: --runs_per_test=//foo/.,-//foo/bar/.@3 runs all tests in //foo/ except those under foo/bar three times. This option can be passed multiple times. The most recently passed argument that matches takes precedence. If nothing matches, the test is only run once.
+--test_env=<a 'name[=value]' assignment with an optional value part or the special syntax '=name' to unset a variable> multiple uses are accumulatedSpecifies additional environment variables to be injected into the test runner environment. Variables can be either specified by <code>name</code>, in which case its value will be read from the Bazel client environment, or by the <code>name=value</code> pair. Previously set variables can be unset via <code>=name</code>. This option can be used multiple times to specify several variables. Used only by the 'bazel test' command.
+Tags:
+test_runner
+
--test_timeout=<a single integer or comma-separated list of 4 integers> default: "-1"Override the default test timeout values for test timeouts (in secs). If a single positive integer value is specified it will override all categories. If 4 comma-separated integers are specified, they will override the timeouts for short, moderate, long and eternal (in that order). In either form, a value of -1 tells blaze to use its default timeouts for that category.
+--[no]zip_undeclared_test_outputs default: "false"If true, undeclared test outputs will be archived in a zip file.
+Tags:
+test_runner
+
--[no]experimental_filter_library_jar_with_program_jar default: "false"Filter the ProGuard ProgramJar to remove any classes also present in the LibraryJar.
+Tags:
+action_command_lines, experimental
+
--[no]experimental_inmemory_dotd_files default: "true"If enabled, C++ .d files will be passed through in memory directly from the remote build nodes instead of being written to disk.
+Tags:
+loading_and_analysis, execution, affects_outputs, experimental
+
--[no]experimental_inmemory_jdeps_files default: "true"If enabled, the dependency (.jdeps) files generated from Java compilations will be passed through in memory directly from the remote build nodes instead of being written to disk.
+Tags:
+loading_and_analysis, execution, affects_outputs, experimental
+
--[no]experimental_retain_test_configuration_across_testonly default: "false"When enabled, --trim_test_configuration will not trim the test configuration for rules marked testonly=1. This is meant to reduce action conflict issues when non-test rules depend on cc_test rules. No effect if --trim_test_configuration is false.
+Tags:
+loading_and_analysis, loses_incremental_state, experimental
+
--[no]experimental_unsupported_and_brittle_include_scanning default: "false"Whether to narrow inputs to C/C++ compilation by parsing #include lines from input files. This can improve performance and incrementality by decreasing the size of compilation input trees. However, it can also break builds because the include scanner does not fully implement C preprocessor semantics. In particular, it does not understand dynamic #include directives and ignores preprocessor conditional logic. Use at your own risk. Any issues relating to this flag that are filed will be closed.
+Tags:
+loading_and_analysis, execution, changes_inputs, experimental
+
--[no]incremental_dexing default: "true"Does most of the work for dexing separately for each Jar file.
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state
+
--[no]objc_use_dotd_pruning default: "true"If set, .d files emitted by clang will be used to prune the set of inputs passed into objc compiles.
+Tags:
+changes_inputs, loading_and_analysis
+
--[no]process_headers_in_dependencies default: "false"When building a target //a:a, process headers in all targets that //a:a depends on (if header processing is enabled for the toolchain).
+Tags:
+execution
+
--[no]trim_test_configuration default: "true"When enabled, test-related options will be cleared below the top level of the build. When this flag is active, tests cannot be built as dependencies of non-test rules, but changes to test-related options will not cause non-test rules to be re-analyzed.
+Tags:
+loading_and_analysis, loses_incremental_state
+
--toolchain_resolution_debug=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths> default: "-.*"Print debug information during toolchain resolution. The flag takes a regex, which is checked against toolchain types and specific targets to see which to debug. Multiple regexes may be separated by commas, and then each regex is checked separately. Note: The output of this flag is very complex and will likely only be useful to experts in toolchain resolution.
+Tags:
+terminal_output
+
--[no]verbose_visibility_errors default: "false"If enabled, visibility errors include additional diagnostic information.
+Tags:
+build_file_semantics, non_configurable
+
--flag_alias=<a 'name=value' flag alias> multiple uses are accumulatedSets a shorthand name for a Starlark flag. It takes a single key-value pair in the form "<key>=<value>" as an argument.
+Tags:
+changes_inputs, non_configurable
+
--[no]incompatible_default_to_explicit_init_py default: "false"This flag changes the default behavior so that init.py files are no longer automatically created in the runfiles of Python targets. Precisely, when a py_binary or py_test target has legacy_create_init set to "auto" (the default), it is treated as false if and only if this flag is set. See https://github.com/bazelbuild/bazel/issues/10076.
+Tags:
+affects_outputs, incompatible_change
+
--[no]cache_test_results [-t] default: "auto"If set to 'auto', Bazel reruns a test if and only if: (1) Bazel detects changes in the test or its dependencies, (2) the test is marked as external, (3) multiple test runs were requested with --runs_per_test, or(4) the test previously failed. If set to 'yes', Bazel caches all test results except for tests marked as external. If set to 'no', Bazel does not cache any test results.
+--[no]experimental_cancel_concurrent_tests default: "never"If 'on_failed' or 'on_passed, then Blaze will cancel concurrently running tests on the first run with that result. This is only useful in combination with --runs_per_test_detects_flakes.
+Tags:
+affects_outputs, loading_and_analysis, experimental
+
--[no]experimental_fetch_all_coverage_outputs default: "false"If true, then Bazel fetches the entire coverage data directory for each test during a coverage run.
+Tags:
+affects_outputs, loading_and_analysis, experimental
+
--[no]experimental_generate_llvm_lcov default: "false"If true, coverage for clang will generate an LCOV report.
+Tags:
+affects_outputs, loading_and_analysis, experimental
+
--experimental_java_classpath=<off, javabuilder, bazel or bazel_no_fallback> default: "bazel"Enables reduced classpaths for Java compilations.
+--[no]experimental_run_android_lint_on_java_rules default: "false"Whether to validate java_* sources.
+Tags:
+affects_outputs, experimental
+
--[no]explicit_java_test_deps default: "false"Explicitly specify a dependency to JUnit or Hamcrest in a java_test instead of accidentally obtaining from the TestRunner's deps. Only works for bazel right now.
+--host_java_launcher=<a build target label> default: see descriptionThe Java launcher used by tools that are executed during a build.
+--host_javacopt=<a string> multiple uses are accumulatedAdditional options to pass to javac when building tools that are executed during a build.
+--host_jvmopt=<a string> multiple uses are accumulatedAdditional options to pass to the Java VM when building tools that are executed during the build. These options will get added to the VM startup options of each java_binary target.
+--[no]incompatible_check_sharding_support default: "true"If true, Bazel will fail a sharded test if the test runner does not indicate that it supports sharding by touching the file at the path in TEST_SHARD_STATUS_FILE. If false, a test runner that does not support sharding will lead to all tests running in each shard.
+Tags:
+incompatible_change
+
--[no]incompatible_exclusive_test_sandboxed default: "true"If true, exclusive tests will run with sandboxed strategy. Add 'local' tag to force an exclusive test run locally
+Tags:
+incompatible_change
+
--[no]incompatible_strict_action_env default: "false"If true, Bazel uses an environment with a static value for PATH and does not inherit LD_LIBRARY_PATH. Use --action_env=ENV_VARIABLE if you want to inherit specific environment variables from the client, but note that doing so can prevent cross-user caching if a shared cache is used.
+Tags:
+loading_and_analysis, incompatible_change
+
--j2objc_translation_flags=<comma-separated list of options> multiple uses are accumulatedAdditional options to pass to the J2ObjC tool.
+--java_debugCauses the Java virtual machine of a java test to wait for a connection from a JDWP-compliant debugger (such as jdb) before starting the test. Implies -test_output=streamed.
+Expands to:
+
--test_arg=--wrapper_script_flag=--debug
+
--test_output=streamed
+
--test_strategy=exclusive
+
--test_timeout=9999
+
--nocache_test_results
+
--[no]java_deps default: "true"Generate dependency information (for now, compile-time classpath) per Java target.
+--[no]java_header_compilation default: "true"Compile ijars directly from source.
+--java_language_version=<a string> default: ""The Java language version
+--java_launcher=<a build target label> default: see descriptionThe Java launcher to use when building Java binaries. If this flag is set to the empty string, the JDK launcher is used. The "launcher" attribute overrides this flag.
+--java_runtime_version=<a string> default: "local_jdk"The Java runtime version
+--javacopt=<a string> multiple uses are accumulatedAdditional options to pass to javac.
+--jvmopt=<a string> multiple uses are accumulatedAdditional options to pass to the Java VM. These options will get added to the VM startup options of each java_binary target.
+--legacy_main_dex_list_generator=<a build target label> default: see descriptionSpecifies a binary to use to generate the list of classes that must be in the main dex when compiling legacy multidex.
+--optimizing_dexer=<a build target label> default: see descriptionSpecifies a binary to use to do dexing without sharding.
+--plugin=<a build target label> multiple uses are accumulatedPlugins to use in the build. Currently works with java_plugin.
+--proguard_top=<a build target label> default: see descriptionSpecifies which version of ProGuard to use for code removal when building a Java binary.
+--proto_compiler=<a build target label> default: "@bazel_tools//tools/proto:protoc"The label of the proto-compiler.
+Tags:
+affects_outputs, loading_and_analysis
+
--[no]proto_profile default: "true"Whether to pass profile_path to the proto compiler.
+Tags:
+affects_outputs, loading_and_analysis
+
--proto_profile_path=<a build target label> default: see descriptionThe profile to pass to the proto compiler as profile_path. If unset, but --proto_profile is true (the default), infers the path from --fdo_optimize.
+Tags:
+affects_outputs, loading_and_analysis
+
--proto_toolchain_for_cc=<a build target label> default: "@bazel_tools//tools/proto:cc_toolchain"Label of proto_lang_toolchain() which describes how to compile C++ protos
+Tags:
+affects_outputs, loading_and_analysis
+
--proto_toolchain_for_j2objc=<a build target label> default: "@bazel_tools//tools/j2objc:j2objc_proto_toolchain"Label of proto_lang_toolchain() which describes how to compile j2objc protos
+Tags:
+affects_outputs, loading_and_analysis
+
--proto_toolchain_for_java=<a build target label> default: "@bazel_tools//tools/proto:java_toolchain"Label of proto_lang_toolchain() which describes how to compile Java protos
+Tags:
+affects_outputs, loading_and_analysis
+
--proto_toolchain_for_javalite=<a build target label> default: "@bazel_tools//tools/proto:javalite_toolchain"Label of proto_lang_toolchain() which describes how to compile JavaLite protos
+Tags:
+affects_outputs, loading_and_analysis
+
--protocopt=<a string> multiple uses are accumulatedAdditional options to pass to the protobuf compiler.
+Tags:
+affects_outputs
+
--[no]runs_per_test_detects_flakes default: "false"If true, any shard in which at least one run/attempt passes and at least one run/attempt fails gets a FLAKY status.
+--shell_executable=<a path> default: see descriptionAbsolute path to the shell executable for Bazel to use. If this is unset, but the BAZEL_SH environment variable is set on the first Bazel invocation (that starts up a Bazel server), Bazel uses that. If neither is set, Bazel uses a hard-coded default path depending on the operating system it runs on (Windows: c:/msys64/usr/bin/bash.exe, FreeBSD: /usr/local/bin/bash, all others: /bin/bash). Note that using a shell that is not compatible with bash may lead to build failures or runtime failures of the generated binaries.
+Tags:
+loading_and_analysis
+
--test_arg=<a string> multiple uses are accumulatedSpecifies additional options and arguments that should be passed to the test executable. Can be used multiple times to specify several arguments. If multiple tests are executed, each of them will receive identical arguments. Used only by the 'bazel test' command.
+--test_filter=<a string> default: see descriptionSpecifies a filter to forward to the test framework. Used to limit the tests run. Note that this does not affect which targets are built.
+--test_result_expiration=<an integer> default: "-1"This option is deprecated and has no effect.
+--[no]test_runner_fail_fast default: "false"Forwards fail fast option to the test runner. The test runner should stop execution upon first failure.
+--test_sharding_strategy=<explicit, disabled or forced=k where k is the number of shards to enforce> default: "explicit"Specify strategy for test sharding: 'explicit' to only use sharding if the 'shard_count' BUILD attribute is present. 'disabled' to never use test sharding. 'forced=k' to enforce 'k' shards for testing regardless of the 'shard_count' BUILD attribute.
+--tool_java_language_version=<a string> default: ""The Java language version used to execute the tools that are needed during a build
+--tool_java_runtime_version=<a string> default: "remotejdk_11"The Java runtime version used to execute tools during the build
+--[no]use_ijars default: "true"If enabled, this option causes Java compilation to use interface jars. This will result in faster incremental compilation, but error messages can be different.
+--[no]action_cache default: "false"Dump action cache content.
+Tags:
+bazel_monitoring
+
--memory=<memory mode> default: see descriptionDump the memory use of the given Skyframe node.
+Tags:
+bazel_monitoring
+
--[no]packages default: "false"Dump package cache content.
+Tags:
+bazel_monitoring
+
--[no]rule_classes default: "false"Dump rule classes.
+Tags:
+bazel_monitoring
+
--[no]rules default: "false"Dump rules, including counts and memory usage (if memory is tracked).
+Tags:
+bazel_monitoring
+
--skyframe=<off, summary, count, value, deps, rdeps, function_graph, active_directories or active_directories_frontier_deps> default: "off"Dump the Skyframe graph.
+Tags:
+bazel_monitoring
+
--skykey_filter=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths> default: ".*"Regex filter of SkyKey names to output. Only used with --skyframe=deps, rdeps, function_graph.
+Tags:
+bazel_monitoring
+
--skylark_memory=<a string> default: see descriptionDumps a pprof-compatible memory profile to the specified path. To learn more please see https://github.com/google/pprof.
+Tags:
+bazel_monitoring
+
Inherits all options from test.
+ +--[no]all default: "false"Fetches all external repositories necessary for building any target or repository. This is the default if no other flags and arguments are provided. Only works when --enable_bzlmod is on.
+Tags:
+changes_inputs
+
--[no]keep_going [-k] default: "false"Continue as much as possible after an error. While the target that failed and those that depend on it cannot be analyzed, other prerequisites of these targets can be.
+Tags:
+eagerness_to_exit
+
--loading_phase_threads=<an integer, or a keyword ("auto", "HOST_CPUS", "HOST_RAM"), optionally followed by an operation ([-|*]<float>) eg. "auto", "HOST_CPUS*.5"> default: "auto"Number of parallel threads to use for the loading/analysis phase.Takes an integer, or a keyword ("auto", "HOST_CPUS", "HOST_RAM"), optionally followed by an operation ([-|]<float>) eg. "auto", "HOST_CPUS.5". "auto" sets a reasonable default based on host resources. Must be at least 1.
+Tags:
+bazel_internal_configuration
+
--[no]incompatible_config_setting_private_default_visibility default: "false"If incompatible_enforce_config_setting_visibility=false, this is a noop. Else, if this flag is false, any config_setting without an explicit visibility attribute is //visibility:public. If this flag is true, config_setting follows the same visibility logic as all other rules. See https://github.com/bazelbuild/bazel/issues/12933.
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]incompatible_enforce_config_setting_visibility default: "true"If true, enforce config_setting visibility restrictions. If false, every config_setting is visible to every target. See https://github.com/bazelbuild/bazel/issues/12932.
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]configure default: "false"Only fetches repositories marked as 'configure' for system-configuration purpose. Only works when --enable_bzlmod is on.
+Tags:
+changes_inputs
+
--[no]force default: "false"Ignore existing repository if any and force fetch the repository again. Only works when --enable_bzlmod is on.
+Tags:
+changes_inputs
+
--repo=<a string> multiple uses are accumulatedOnly fetches the specified repository, which can be either {@apparent_repo_name} or {@@canonical_repo_name}. Only works when --enable_bzlmod is on.
+Tags:
+changes_inputs
+
--deleted_packages=<comma-separated list of package names> multiple uses are accumulatedA comma-separated list of names of packages which the build system will consider non-existent, even if they are visible somewhere on the package path. +Use this option when deleting a subpackage 'x/y' of an existing package 'x'. For example, after deleting x/y/BUILD in your client, the build system may complain if it encounters a label '//x:y/z' if that is still provided by another package_path entry. Specifying --deleted_packages x/y avoids this problem.
+--[no]fetch default: "true"Allows the command to fetch external dependencies. If set to false, the command will utilize any cached version of the dependency, and if none exists, the command will result in failure.
+--package_path=<colon-separated list of options> default: "%workspace%"A colon-separated list of where to look for packages. Elements beginning with '%workspace%' are relative to the enclosing workspace. If omitted or empty, the default is the output of 'bazel info default-package-path'.
+--[no]show_loading_progress default: "true"If enabled, causes Bazel to print "Loading package:" messages.
+--[no]experimental_persistent_aar_extractor default: "false"Enable persistent aar extractor by using workers.
+Tags:
+execution, experimental
+
--[no]experimental_remotable_source_manifests default: "false"Whether to make source manifest actions remotable
+Tags:
+loading_and_analysis, execution, experimental
+
--[no]experimental_split_coverage_postprocessing default: "false"If true, then Bazel will run coverage postprocessing for test in a new spawn.
+Tags:
+execution, experimental
+
--[no]experimental_strict_fileset_output default: "false"If this option is enabled, filesets will treat all output artifacts as regular files. They will not traverse directories or be sensitive to symlinks.
+Tags:
+execution, experimental
+
--[no]incompatible_modify_execution_info_additive default: "true"When enabled, passing multiple --modify_execution_info flags is additive. When disabled, only the last flag is taken into account.
+Tags:
+execution, affects_outputs, loading_and_analysis, incompatible_change
+
--modify_execution_info=<regex=[+-]key,regex=[+-]key,...> multiple uses are accumulatedAdd or remove keys from an action's execution info based on action mnemonic. Applies only to actions which support execution info. Many common actions support execution info, e.g. Genrule, CppCompile, Javac, StarlarkAction, TestRunner. When specifying multiple values, order matters because many regexes may apply to the same mnemonic.
+Syntax: "regex=[+-]key,regex=[+-]key,...".
+Examples: +'.=+x,.=-y,.=+z' adds 'x' and 'z' to, and removes 'y' from, the execution info for all actions. +'Genrule=+requires-x' adds 'requires-x' to the execution info for all Genrule actions. +'(?!Genrule).=-requires-x' removes 'requires-x' from the execution info for all non-Genrule actions.
+Tags:
+execution, affects_outputs, loading_and_analysis
+
--persistent_android_dex_desugarEnable persistent Android dex and desugar actions by using workers.
+Expands to:
+
--internal_persistent_android_dex_desugar
+
--strategy=Desugar=worker
+
--strategy=DexBuilder=worker
+
Tags:
+host_machine_resource_optimizations, execution
+
--persistent_android_resource_processorEnable persistent Android resource processor by using workers.
+Expands to:
+
--internal_persistent_busybox_tools
+
--strategy=AaptPackage=worker
+
--strategy=AndroidResourceParser=worker
+
--strategy=AndroidResourceValidator=worker
+
--strategy=AndroidResourceCompiler=worker
+
--strategy=RClassGenerator=worker
+
--strategy=AndroidResourceLink=worker
+
--strategy=AndroidAapt2=worker
+
--strategy=AndroidAssetMerger=worker
+
--strategy=AndroidResourceMerger=worker
+
--strategy=AndroidCompiledResourceMerger=worker
+
--strategy=ManifestMerger=worker
+
--strategy=AndroidManifestMerger=worker
+
--strategy=Aapt2Optimize=worker
+
--strategy=AARGenerator=worker
+
--strategy=ProcessDatabinding=worker
+
--strategy=GenerateDataBindingBaseClasses=worker
+
Tags:
+host_machine_resource_optimizations, execution
+
--persistent_multiplex_android_dex_desugarEnable persistent multiplexed Android dex and desugar actions by using workers.
+Expands to:
+
--persistent_android_dex_desugar
+
--internal_persistent_multiplex_android_dex_desugar
+
Tags:
+host_machine_resource_optimizations, execution
+
--persistent_multiplex_android_resource_processorEnable persistent multiplexed Android resource processor by using workers.
+Expands to:
+
--persistent_android_resource_processor
+
--modify_execution_info=AaptPackage=+supports-multiplex-workers
+
--modify_execution_info=AndroidResourceParser=+supports-multiplex-workers
+
--modify_execution_info=AndroidResourceValidator=+supports-multiplex-workers
+
--modify_execution_info=AndroidResourceCompiler=+supports-multiplex-workers
+
--modify_execution_info=RClassGenerator=+supports-multiplex-workers
+
--modify_execution_info=AndroidResourceLink=+supports-multiplex-workers
+
--modify_execution_info=AndroidAapt2=+supports-multiplex-workers
+
--modify_execution_info=AndroidAssetMerger=+supports-multiplex-workers
+
--modify_execution_info=AndroidResourceMerger=+supports-multiplex-workers
+
--modify_execution_info=AndroidCompiledResourceMerger=+supports-multiplex-workers
+
--modify_execution_info=ManifestMerger=+supports-multiplex-workers
+
--modify_execution_info=AndroidManifestMerger=+supports-multiplex-workers
+
--modify_execution_info=Aapt2Optimize=+supports-multiplex-workers
+
--modify_execution_info=AARGenerator=+supports-multiplex-workers
+
Tags:
+host_machine_resource_optimizations, execution
+
--persistent_multiplex_android_toolsEnable persistent and multiplexed Android tools (dexing, desugaring, resource processing).
+Expands to:
+
--internal_persistent_multiplex_busybox_tools
+
--persistent_multiplex_android_resource_processor
+
--persistent_multiplex_android_dex_desugar
+
Tags:
+host_machine_resource_optimizations, execution
+
--[no]use_target_platform_for_tests default: "false"If true, use the target platform for running tests rather than the test exec group.
+Tags:
+execution
+
--android_compiler=<a string> default: see descriptionThe Android target compiler.
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state
+
--android_manifest_merger=<legacy, android or force_android> default: "android"Selects the manifest merger to use for android_binary rules. Flag to help the transition to the Android manifest merger from the legacy merger.
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state
+
--android_platforms=<a build target label> default: ""Sets the platforms that android_binary targets use. If multiple platforms are specified, then the binary is a fat APKs, which contains native binaries for each specified target platform.
+Tags:
+changes_inputs, loading_and_analysis, loses_incremental_state
+
--cc_output_directory_tag=<a string> default: ""Specifies a suffix to be added to the configuration directory.
+Tags:
+affects_outputs
+
--compiler=<a string> default: see descriptionThe C++ compiler to use for compiling the target.
+Tags:
+loading_and_analysis, execution
+
--coverage_output_generator=<a build target label> default: "@bazel_tools//tools/test:lcov_merger"Location of the binary that is used to postprocess raw coverage reports. This must be a binary target. Defaults to '//tools/test:lcov_merger'.
+Tags:
+changes_inputs, affects_outputs, loading_and_analysis
+
--coverage_report_generator=<a build target label> default: "@bazel_tools//tools/test:coverage_report_generator"Location of the binary that is used to generate coverage reports. This must be a binary target. Defaults to '//tools/test:coverage_report_generator'.
+Tags:
+changes_inputs, affects_outputs, loading_and_analysis
+
--coverage_support=<a build target label> default: "@bazel_tools//tools/test:coverage_support"Location of support files that are required on the inputs of every test action that collects code coverage. Defaults to '//tools/test:coverage_support'.
+Tags:
+changes_inputs, affects_outputs, loading_and_analysis
+
--custom_malloc=<a build target label> default: see descriptionSpecifies a custom malloc implementation. This setting overrides malloc attributes in build rules.
+Tags:
+changes_inputs, affects_outputs
+
--[no]experimental_include_xcode_execution_requirements default: "false"If set, add a "requires-xcode:{version}" execution requirement to every Xcode action. If the Xcode version has a hyphenated label, also add a "requires-xcode-label:{version_label}" execution requirement.
+Tags:
+loses_incremental_state, loading_and_analysis, execution, experimental
+
--[no]experimental_prefer_mutual_xcode default: "true"If true, use the most recent Xcode that is available both locally and remotely. If false, or if there are no mutual available versions, use the local Xcode version selected via xcode-select.
+Tags:
+loses_incremental_state, experimental
+
--extra_execution_platforms=<comma-separated list of options> default: ""The platforms that are available as execution platforms to run actions. Platforms can be specified by exact target, or as a target pattern. These platforms will be considered before those declared in the WORKSPACE file by register_execution_platforms(). This option may only be set once; later instances will override earlier flag settings.
+Tags:
+execution
+
--extra_toolchains=<comma-separated list of options> multiple uses are accumulatedThe toolchain rules to be considered during toolchain resolution. Toolchains can be specified by exact target, or as a target pattern. These toolchains will be considered before those declared in the WORKSPACE file by register_toolchains().
+Tags:
+affects_outputs, changes_inputs, loading_and_analysis
+
--grte_top=<a label> default: see descriptionA label to a checked-in libc library. The default value is selected by the crosstool toolchain, and you almost never need to override it.
+Tags:
+action_command_lines, affects_outputs
+
--host_compiler=<a string> default: see descriptionNo-op flag. Will be removed in a future release.
+Tags:
+loading_and_analysis, execution
+
--host_grte_top=<a label> default: see descriptionIf specified, this setting overrides the libc top-level directory (--grte_top) for the exec configuration.
+Tags:
+action_command_lines, affects_outputs
+
--host_platform=<a build target label> default: "@bazel_tools//tools:host_platform"The label of a platform rule that describes the host system.
+Tags:
+affects_outputs, changes_inputs, loading_and_analysis
+
--[no]incompatible_bazel_test_exec_run_under default: "true"If enabled, "bazel test --run_under=//:runner" builds "//:runner" in the exec configuration. If disabled, it builds "//:runner" in the target configuration. Bazel executes tests on exec machines, so the former is more correct. This doesn't affect "bazel run", which always builds "`--run_under=//foo" in the target configuration.
+Tags:
+affects_outputs, incompatible_change
+
--[no]incompatible_builtin_objc_strip_action default: "true"Whether to emit a strip action as part of objc linking.
+Tags:
+action_command_lines, incompatible_change
+
--[no]incompatible_dont_enable_host_nonhost_crosstool_features default: "true"If true, Bazel will not enable 'host' and 'nonhost' features in the c++ toolchain (see https://github.com/bazelbuild/bazel/issues/7407 for more information).
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]incompatible_enable_apple_toolchain_resolution default: "false"Use toolchain resolution to select the Apple SDK for apple rules (Starlark and native)
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]incompatible_remove_legacy_whole_archive default: "true"If true, Bazel will not link library dependencies as whole archive by default (see https://github.com/bazelbuild/bazel/issues/7362 for migration instructions).
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]incompatible_strip_executable_safely default: "false"If true, strip action for executables will use flag -x, which does not break dynamic symbol resolution.
+Tags:
+action_command_lines, incompatible_change
+
Use interface shared objects if supported by the toolchain. All ELF toolchains currently support this setting.
+Tags:
+loading_and_analysis, affects_outputs, affects_outputs
+
--ios_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionSpecifies the version of the iOS SDK to use to build iOS applications. If unspecified, uses the default iOS SDK version from 'xcode_version'.
+Tags:
+loses_incremental_state
+
--macos_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionSpecifies the version of the macOS SDK to use to build macOS applications. If unspecified, uses the default macOS SDK version from 'xcode_version'.
+Tags:
+loses_incremental_state
+
--minimum_os_version=<a string> default: see descriptionThe minimum OS version which your compilation targets.
+Tags:
+loading_and_analysis, affects_outputs
+
--platform_mappings=<a main workspace-relative path> default: ""The location of a mapping file that describes which platform to use if none is set or which flags to set when a platform already exists. Must be relative to the main workspace root. Defaults to 'platform_mappings' (a file directly under the workspace root).
+Tags:
+affects_outputs, changes_inputs, loading_and_analysis, non_configurable
+
--platforms=<a build target label> default: ""The labels of the platform rules describing the target platforms for the current command.
+Tags:
+affects_outputs, changes_inputs, loading_and_analysis
+
--python_path=<a string> default: see descriptionThe absolute path of the Python interpreter invoked to run Python targets on the target platform. Deprecated; disabled by --incompatible_use_python_toolchains.
+Tags:
+loading_and_analysis, affects_outputs
+
--tvos_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionSpecifies the version of the tvOS SDK to use to build tvOS applications. If unspecified, uses the default tvOS SDK version from 'xcode_version'.
+Tags:
+loses_incremental_state
+
--[no]use_platforms_in_apple_crosstool_transition default: "false"Makes apple_crosstool_transition fall back to using the value of --platforms flag instead of legacy --cpu when needed.
Tags:
+loading_and_analysis
+
--watchos_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionSpecifies the version of the watchOS SDK to use to build watchOS applications. If unspecified, uses the default watchOS SDK version from 'xcode_version'.
+Tags:
+loses_incremental_state
+
--xcode_version=<a string> default: see descriptionIf specified, uses Xcode of the given version for relevant build actions. If unspecified, uses the executor default version of Xcode.
+Tags:
+loses_incremental_state
+
--xcode_version_config=<a build target label> default: "@bazel_tools//tools/cpp:host_xcodes"The label of the xcode_config rule to be used for selecting the Xcode version in the build configuration.
+Tags:
+loses_incremental_state, loading_and_analysis
+
--[no]apple_generate_dsym default: "false"Whether to generate debug symbol(.dSYM) file(s).
+Tags:
+affects_outputs, action_command_lines
+
--[no]build_runfile_links default: "true"If true, build runfiles symlink forests for all targets. If false, write them only when required by a local action, test or run command.
+Tags:
+affects_outputs
+
--[no]build_runfile_manifests default: "true"If true, write runfiles manifests for all targets. If false, omit them. Local tests will fail to run when false.
+Tags:
+affects_outputs
+
--[no]build_test_dwp default: "false"If enabled, when building C++ tests statically and with fission the .dwp file for the test binary will be automatically built as well.
+Tags:
+loading_and_analysis, affects_outputs
+
--cc_proto_library_header_suffixes=<comma-separated set of options> default: ".pb.h"Sets the suffixes of header files that a cc_proto_library creates.
+Tags:
+affects_outputs, loading_and_analysis
+
--cc_proto_library_source_suffixes=<comma-separated set of options> default: ".pb.cc"Sets the suffixes of source files that a cc_proto_library creates.
+Tags:
+affects_outputs, loading_and_analysis
+
--[no]experimental_proto_descriptor_sets_include_source_info default: "false"Run extra actions for alternative Java api versions in a proto_library.
+Tags:
+affects_outputs, loading_and_analysis, experimental
+
--[no]experimental_save_feature_state default: "false"Save the state of enabled and requested feautres as an output of compilation.
+Tags:
+affects_outputs, experimental
+
--fission=<a set of compilation modes> default: "no"Specifies which compilation modes use fission for C++ compilations and links. May be any combination of {'fastbuild', 'dbg', 'opt'} or the special values 'yes' to enable all modes and 'no' to disable all modes.
+Tags:
+loading_and_analysis, action_command_lines, affects_outputs
+
--[no]incompatible_always_include_files_in_data default: "true"If true, native rules add <code>DefaultInfo.files</code> of data dependencies to their runfiles, which matches the recommended behavior for Starlark rules (https://bazel.build/extending/rules#runfiles_features_to_avoid).
+Tags:
+affects_outputs, incompatible_change
+
--[no]incompatible_compact_repo_mapping_manifest default: "false"If enabled, the <binary>.repo_mapping file emits a module extension's repo mapping only once instead of once for each repo generated by the extension that contributes runfiles.
+Tags:
+affects_outputs, incompatible_change
+
--incompatible_disable_select_on=<comma-separated set of options> default: ""List of flags for which the use in select() is disabled.
+Tags:
+loading_and_analysis, incompatible_change, non_configurable
+
--[no]incompatible_filegroup_runfiles_for_data default: "true"If true, runfiles of targets listed in the srcs attribute are available to targets that consume the filegroup as a data dependency.
+Tags:
+incompatible_change
+
--[no]objc_generate_linkmap default: "false"Specifies whether to generate a linkmap file.
+Tags:
+affects_outputs
+
--[no]save_temps default: "false"If set, temporary outputs from gcc will be saved. These include .s files (assembler code), .i files (preprocessed C) and .ii files (preprocessed C++).
+Tags:
+affects_outputs
+
--action_env=<a 'name[=value]' assignment with an optional value part or the special syntax '=name' to unset a variable> multiple uses are accumulatedSpecifies the set of environment variables available to actions with target configuration. Variables can be either specified by <code>name</code>, in which case +the value will be taken from the invocation environment, by the <code>name=value</code> pair which sets the value independent of the invocation environment, or by <code>=name</code>, which unsets the variable of that name. This option can be used multiple times; for options given for the same variable, the latest wins, options for different variables accumulate. +<br> +Note that unless <code>--incompatible_repo_env_ignores_action_env</code> is true, all <code>name=value</code> pairs will be available to repository rules.
+Tags:
+action_command_lines
+
--allowed_cpu_values=<comma-separated set of options> default: ""Allowed values for the --cpu flag.
+Tags:
+changes_inputs, affects_outputs
+
--[no]android_databinding_use_androidx default: "true"Generate AndroidX-compatible data-binding files. This is only used with databinding v2. This flag is a no-op.
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state, experimental
+
--[no]android_databinding_use_v3_4_args default: "true"Use android databinding v2 with 3.4.0 argument. This flag is a no-op.
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state, experimental
+
--android_dynamic_mode=<off, default or fully> default: "off"Determines whether C++ deps of Android rules will be linked dynamically when a cc_binary does not explicitly create a shared library. 'default' means bazel will choose whether to link dynamically. 'fully' means all libraries will be linked dynamically. 'off' means that all libraries will be linked in mostly static mode.
+Tags:
+affects_outputs, loading_and_analysis
+
--android_manifest_merger_order=<alphabetical, alphabetical_by_configuration or dependency> default: "alphabetical"Sets the order of manifests passed to the manifest merger for Android binaries. ALPHABETICAL means manifests are sorted by path relative to the execroot. ALPHABETICAL_BY_CONFIGURATION means manifests are sorted by paths relative to the configuration directory within the output directory. DEPENDENCY means manifests are ordered with each library's manifest coming before the manifests of its dependencies.
+Tags:
+action_command_lines, execution
+
--[no]android_resource_shrinking default: "false"Enables resource shrinking for android_binary APKs that use ProGuard.
+Tags:
+affects_outputs, loading_and_analysis
+
--[no]build_python_zip default: "auto"Build python executable zip; on on Windows, off on other platforms
+Tags:
+affects_outputs
+
--catalyst_cpus=<comma-separated list of options> multiple uses are accumulatedComma-separated list of architectures for which to build Apple Catalyst binaries.
+Tags:
+loses_incremental_state, loading_and_analysis
+
--[no]collect_code_coverage default: "false"If specified, Bazel will instrument code (using offline instrumentation where possible) and will collect coverage information during tests. Only targets that match --instrumentation_filter will be affected. Usually this option should not be specified directly - 'bazel coverage' command should be used instead.
+Tags:
+affects_outputs
+
--compilation_mode=<fastbuild, dbg or opt> [-c] default: "fastbuild"Specify the mode the binary will be built in. Values: 'fastbuild', 'dbg', 'opt'.
+Tags:
+affects_outputs, action_command_lines
+
--conlyopt=<a string> multiple uses are accumulatedAdditional option to pass to gcc when compiling C source files.
+Tags:
+action_command_lines, affects_outputs
+
--copt=<a string> multiple uses are accumulatedAdditional options to pass to gcc.
+Tags:
+action_command_lines, affects_outputs
+
--cpu=<a string> default: ""Deprecated: this flag is not used internally by Blaze although there are legacy platform mappings to allow for backwards compatibility. Do not use this flag, instead use --platforms with an appropriate platform definition.
+Tags:
+changes_inputs, affects_outputs
+
--cs_fdo_absolute_path=<a string> default: see descriptionUse CSFDO profile information to optimize compilation. Specify the absolute path name of the zip file containing the profile file, a raw or an indexed LLVM profile file.
+Tags:
+affects_outputs
+
--cs_fdo_instrument=<a string> default: see descriptionGenerate binaries with context sensitive FDO instrumentation. With Clang/LLVM compiler, it also accepts the directory name under which the raw profile file(s) will be dumped at runtime.
+Tags:
+affects_outputs
+
--cs_fdo_profile=<a build target label> default: see descriptionThe cs_fdo_profile representing the context sensitive profile to be used for optimization.
+Tags:
+affects_outputs
+
--cxxopt=<a string> multiple uses are accumulatedAdditional option to pass to gcc when compiling C++ source files.
+Tags:
+action_command_lines, affects_outputs
+
--define=<a 'name=value' assignment> multiple uses are accumulatedEach --define option specifies an assignment for a build variable. In case of multiple values for a variable, the last one wins.
+Tags:
+changes_inputs, affects_outputs
+
--dynamic_mode=<off, default or fully> default: "default"Determines whether C++ binaries will be linked dynamically. 'default' means Bazel will choose whether to link dynamically. 'fully' means all libraries will be linked dynamically. 'off' means that all libraries will be linked in mostly static mode.
+Tags:
+loading_and_analysis, affects_outputs
+
--[no]enable_propeller_optimize_absolute_paths default: "true"If set, any use of absolute paths for propeller optimize will raise an error.
+Tags:
+affects_outputs
+
--[no]enable_remaining_fdo_absolute_paths default: "true"If set, any use of absolute paths for FDO will raise an error.
+Tags:
+affects_outputs
+
--[no]enable_runfiles default: "auto"Enable runfiles symlink tree; By default, it's off on Windows, on on other platforms.
+Tags:
+affects_outputs
+
--exec_aspects=<comma-separated list of options> multiple uses are accumulatedComma-separated list of aspects to be applied to exec-configured targets, regardless of whether or not they are top-level targets. This is an experimental feature and is subject to change.
+Tags:
+loading_and_analysis
+
--experimental_action_listener=<a build target label> multiple uses are accumulatedDeprecated in favor of aspects. Use action_listener to attach an extra_action to existing build actions.
+Tags:
+execution, experimental
+
--[no]experimental_android_compress_java_resources default: "false"Compress Java resources in APKs
+Tags:
+affects_outputs, loading_and_analysis, experimental
+
--[no]experimental_android_databinding_v2 default: "true"Use android databinding v2. This flag is a no-op.
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state, experimental
+
--[no]experimental_android_resource_shrinking default: "false"Enables resource shrinking for android_binary APKs that use ProGuard.
+Tags:
+affects_outputs, loading_and_analysis, experimental
+
--[no]experimental_android_rewrite_dexes_with_rex default: "false"use rex tool to rewrite dex files
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state, experimental
+
--[no]experimental_collect_code_coverage_for_generated_files default: "false"If specified, Bazel will also generate collect coverage information for generated files.
+Tags:
+affects_outputs, experimental
+
--experimental_objc_fastbuild_options=<comma-separated list of options> default: "-O0,-DDEBUG=1"Uses these strings as objc fastbuild compiler options.
+Tags:
+action_command_lines
+
--[no]experimental_omitfp default: "false"If true, use libunwind for stack unwinding, and compile with -fomit-frame-pointer and -fasynchronous-unwind-tables.
+Tags:
+action_command_lines, affects_outputs, experimental
+
--experimental_output_paths=<off or strip> default: "off"Which model to use for where in the output tree rules write their outputs, particularly for multi-platform / multi-configuration builds. This is highly experimental. See https://github.com/bazelbuild/bazel/issues/6526 for details. Starlark actions canopt into path mapping by adding the key 'supports-path-mapping' to the 'execution_requirements' dict.
+Tags:
+loses_incremental_state, bazel_internal_configuration, affects_outputs, execution
+
--experimental_override_platform_cpu_name=<a 'label=value' assignment> multiple uses are accumulatedEach entry should be of the form label=value where label refers to a platform and values is the desired shortname to override the platform's CPU name in $(TARGET_CPU) make variable and output path. Only used when --experimental_platform_in_output_dir, --incompatible_target_cpu_from_platform or --incompatible_bep_cpu_from_platform is true. Has highest naming priority.
+Tags:
+affects_outputs, experimental
+
--[no]experimental_platform_in_output_dir default: "false"If true, a shortname for the target platform is used in the output directory name instead of the CPU. If auto, this is only applied for the exec configuration. The exact scheme is experimental and subject to change: First, in the rare case the --platforms option does not have exactly one value, a hash of the platforms option is used. Next, if any shortname for the current platform was registered by --experimental_override_name_platform_in_output_dir, then that shortname is used. Then, if --experimental_use_platforms_in_output_dir_legacy_heuristic is set, use a shortname based off the current platform Label. Finally, a hash of the platform option is used as a last resort.
+Tags:
+affects_outputs, experimental
+
--[no]experimental_py_binaries_include_label default: "false"py_binary targets include their label even when stamping is disabled.
+Tags:
+affects_outputs, experimental
+
--[no]experimental_use_llvm_covmap default: "false"If specified, Bazel will generate llvm-cov coverage map information rather than gcov when collect_code_coverage is enabled.
+Tags:
+changes_inputs, affects_outputs, loading_and_analysis, experimental
+
--[no]experimental_use_platforms_in_output_dir_legacy_heuristic default: "true"Please only use this flag as part of a suggested migration or testing strategy. Note that the heuristic has known deficiencies and it is suggested to migrate to relying on just --experimental_override_name_platform_in_output_dir.
+Tags:
+affects_outputs, experimental
+
--fdo_instrument=<a string> default: see descriptionGenerate binaries with FDO instrumentation. With Clang/LLVM compiler, it also accepts the directory name under which the raw profile file(s) will be dumped at runtime.
+Tags:
+affects_outputs
+
--fdo_optimize=<a string> default: see descriptionUse FDO profile information to optimize compilation. Specify the name of a zip file containing a .gcda file tree, an afdo file containing an auto profile, or an LLVM profile file. This flag also accepts files specified as labels (e.g. //foo/bar:file.afdo - you may need to add an exports_files directive to the corresponding package) and labels pointing to fdo_profile targets. This flag will be superseded by the fdo_profile rule.
Tags:
+affects_outputs
+
--fdo_prefetch_hints=<a build target label> default: see descriptionUse cache prefetch hints.
+Tags:
+affects_outputs
+
--fdo_profile=<a build target label> default: see descriptionThe fdo_profile representing the profile to be used for optimization.
+Tags:
+affects_outputs
+
--features=<a string> multiple uses are accumulatedThe given features will be enabled or disabled by default for targets built in the target configuration. Specifying -<feature> will disable the feature. Negative features always override positive ones. See also --host_features
+Tags:
+changes_inputs, affects_outputs
+
--[no]force_pic default: "false"If enabled, all C++ compilations produce position-independent code ("-fPIC"), links prefer PIC pre-built libraries over non-PIC libraries, and links produce position-independent executables ("-pie").
+Tags:
+loading_and_analysis, affects_outputs
+
--host_action_env=<a 'name[=value]' assignment with an optional value part or the special syntax '=name' to unset a variable> multiple uses are accumulatedSpecifies the set of environment variables available to actions with execution configurations. Variables can be either specified by name, in which case the value will be taken from the invocation environment, by the name=value pair which sets the value independent of the invocation environment, or by <code>=name</code>, which unsets the variable of that name. This option can be used multiple times; for options given for the same variable, the latest wins, options for different variables accumulate.
+Tags:
+action_command_lines
+
--host_compilation_mode=<fastbuild, dbg or opt> default: "opt"Specify the mode the tools used during the build will be built in. Values: 'fastbuild', 'dbg', 'opt'.
+Tags:
+affects_outputs, action_command_lines
+
--host_conlyopt=<a string> multiple uses are accumulatedAdditional option to pass to the C compiler when compiling C (but not C++) source files in the exec configurations.
+Tags:
+action_command_lines, affects_outputs
+
--host_copt=<a string> multiple uses are accumulatedAdditional options to pass to the C compiler for tools built in the exec configurations.
+Tags:
+action_command_lines, affects_outputs
+
--host_cpu=<a string> default: ""The host CPU.
+Tags:
+changes_inputs, affects_outputs
+
--host_cxxopt=<a string> multiple uses are accumulatedAdditional options to pass to C++ compiler for tools built in the exec configurations.
+Tags:
+action_command_lines, affects_outputs
+
--host_features=<a string> multiple uses are accumulatedThe given features will be enabled or disabled by default for targets built in the exec configuration. Specifying -<feature> will disable the feature. Negative features always override positive ones.
+Tags:
+changes_inputs, affects_outputs
+
--host_linkopt=<a string> multiple uses are accumulatedAdditional option to pass to linker when linking tools in the exec configurations.
+Tags:
+action_command_lines, affects_outputs
+
--host_macos_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionMinimum compatible macOS version for host targets. If unspecified, uses 'macos_sdk_version'.
+Tags:
+loses_incremental_state
+
--host_per_file_copt=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths followed by an @ and a comma separated list of options> multiple uses are accumulatedAdditional options to selectively pass to the C/C++ compiler when compiling certain files in the exec configurations. This option can be passed multiple times. Syntax: regex_filter@option_1,option_2,...,option_n. Where regex_filter stands for a list of include and exclude regular expression patterns (Also see --instrumentation_filter). option_1 to option_n stand for arbitrary command line options. If an option contains a comma it has to be quoted with a backslash. Options can contain @. Only the first @ is used to split the string. Example: --host_per_file_copt=//foo/.*.cc,-//foo/bar.cc@-O0 adds the -O0 command line option to the gcc command line of all cc files in //foo/ except bar.cc.
+Tags:
+action_command_lines, affects_outputs
+
--[no]incompatible_auto_exec_groups default: "false"When enabled, an exec groups is automatically created for each toolchain used by a rule. For this to work rule needs to specify toolchain parameter on its actions. For more information, see https://github.com/bazelbuild/bazel/issues/17134.
Tags:
+affects_outputs, incompatible_change
+
--[no]incompatible_merge_genfiles_directory default: "true"If true, the genfiles directory is folded into the bin directory.
+Tags:
+affects_outputs, incompatible_change
+
--[no]incompatible_target_cpu_from_platform default: "true"If specified, the value of the cpu constraint (@platforms//cpu:cpu) of the target platform is used to set the $(TARGET_CPU) make variable.
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]instrument_test_targets default: "false"When coverage is enabled, specifies whether to consider instrumenting test rules. When set, test rules included by --instrumentation_filter are instrumented. Otherwise, test rules are always excluded from coverage instrumentation.
+Tags:
+affects_outputs
+
--instrumentation_filter=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths> default: "-/javatests[/:],-/test/java[/:]"When coverage is enabled, only rules with names included by the specified regex-based filter will be instrumented. Rules prefixed with '-' are excluded instead. Note that only non-test rules are instrumented unless --instrument_test_targets is enabled.
+Tags:
+affects_outputs
+
--ios_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionMinimum compatible iOS version for target simulators and devices. If unspecified, uses 'ios_sdk_version'.
+Tags:
+loses_incremental_state
+
--ios_multi_cpus=<comma-separated list of options> multiple uses are accumulatedComma-separated list of architectures to build an ios_application with. The result is a universal binary containing all specified architectures.
+Tags:
+loses_incremental_state, loading_and_analysis
+
--[no]legacy_whole_archive default: "true"Deprecated, superseded by --incompatible_remove_legacy_whole_archive (see https://github.com/bazelbuild/bazel/issues/7362 for details). When on, use --whole-archive for cc_binary rules that have linkshared=True and either linkstatic=True or '-static' in linkopts. This is for backwards compatibility only. A better alternative is to use alwayslink=1 where required.
+Tags:
+action_command_lines, affects_outputs, deprecated
+
--linkopt=<a string> multiple uses are accumulatedAdditional option to pass to gcc when linking.
+Tags:
+action_command_lines, affects_outputs
+
--ltobackendopt=<a string> multiple uses are accumulatedAdditional option to pass to the LTO backend step (under --features=thin_lto).
+Tags:
+action_command_lines, affects_outputs
+
--ltoindexopt=<a string> multiple uses are accumulatedAdditional option to pass to the LTO indexing step (under --features=thin_lto).
+Tags:
+action_command_lines, affects_outputs
+
--macos_cpus=<comma-separated list of options> multiple uses are accumulatedComma-separated list of architectures for which to build Apple macOS binaries.
+Tags:
+loses_incremental_state, loading_and_analysis
+
--macos_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionMinimum compatible macOS version for targets. If unspecified, uses 'macos_sdk_version'.
+Tags:
+loses_incremental_state
+
--memprof_profile=<a build target label> default: see descriptionUse memprof profile.
+Tags:
+affects_outputs
+
--[no]objc_debug_with_GLIBCXX default: "false"If set, and compilation mode is set to 'dbg', define GLIBCXX_DEBUG, GLIBCXX_DEBUG_PEDANTIC and GLIBCPP_CONCEPT_CHECKS.
+Tags:
+action_command_lines
+
--[no]objc_enable_binary_stripping default: "false"Whether to perform symbol and dead-code strippings on linked binaries. Binary strippings will be performed if both this flag and --compilation_mode=opt are specified.
+Tags:
+action_command_lines
+
--objccopt=<a string> multiple uses are accumulatedAdditional options to pass to gcc when compiling Objective-C/C++ source files.
+Tags:
+action_command_lines
+
--per_file_copt=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths followed by an @ and a comma separated list of options> multiple uses are accumulatedAdditional options to selectively pass to gcc when compiling certain files. This option can be passed multiple times. Syntax: regex_filter@option_1,option_2,...,option_n. Where regex_filter stands for a list of include and exclude regular expression patterns (Also see --instrumentation_filter). option_1 to option_n stand for arbitrary command line options. If an option contains a comma it has to be quoted with a backslash. Options can contain @. Only the first @ is used to split the string. Example: --per_file_copt=//foo/.*.cc,-//foo/bar.cc@-O0 adds the -O0 command line option to the gcc command line of all cc files in //foo/ except bar.cc.
+Tags:
+action_command_lines, affects_outputs
+
--per_file_ltobackendopt=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths followed by an @ and a comma separated list of options> multiple uses are accumulatedAdditional options to selectively pass to LTO backend (under --features=thin_lto) when compiling certain backend objects. This option can be passed multiple times. Syntax: regex_filter@option_1,option_2,...,option_n. Where regex_filter stands for a list of include and exclude regular expression patterns. option_1 to option_n stand for arbitrary command line options. If an option contains a comma it has to be quoted with a backslash. Options can contain @. Only the first @ is used to split the string. Example: --per_file_ltobackendopt=//foo/.*.o,-//foo/bar.o@-O0 adds the -O0 command line option to the LTO backend command line of all o files in //foo/ except bar.o.
+Tags:
+action_command_lines, affects_outputs
+
--platform_suffix=<a string> default: see descriptionSpecifies a suffix to be added to the configuration directory.
+Tags:
+loses_incremental_state, affects_outputs, loading_and_analysis
+
--propeller_optimize=<a build target label> default: see descriptionUse Propeller profile information to optimize the build target.A propeller profile must consist of at least one of two files, a cc profile and a ld profile. This flag accepts a build label which must refer to the propeller profile input files. For example, the BUILD file that defines the label, in a/b/BUILD:propeller_optimize( name = "propeller_profile", cc_profile = "propeller_cc_profile.txt", ld_profile = "propeller_ld_profile.txt",)An exports_files directive may have to be added to the corresponding package to make these files visible to Bazel. The option must be used as: --propeller_optimize=//a/b:propeller_profile
+Tags:
+action_command_lines, affects_outputs
+
--propeller_optimize_absolute_cc_profile=<a string> default: see descriptionAbsolute path name of cc_profile file for Propeller Optimized builds.
+Tags:
+affects_outputs
+
--propeller_optimize_absolute_ld_profile=<a string> default: see descriptionAbsolute path name of ld_profile file for Propeller Optimized builds.
+Tags:
+affects_outputs
+
--run_under=<a prefix in front of command> default: see descriptionPrefix to insert before the executables for the 'test' and 'run' commands. If the value is 'foo -bar', and the execution command line is 'test_binary -baz', then the final command line is 'foo -bar test_binary -baz'.This can also be a label to an executable target. Some examples are: 'valgrind', 'strace', 'strace -c', 'valgrind --quiet --num-callers=20', '//package:target', '//package:target --options'.
+Tags:
+action_command_lines
+
If true, native libraries that contain identical functionality will be shared among different targets
+Tags:
+loading_and_analysis, affects_outputs
+
--[no]stamp default: "false"Stamp binaries with the date, username, hostname, workspace information, etc.
+Tags:
+affects_outputs
+
--strip=<always, sometimes or never> default: "sometimes"Specifies whether to strip binaries and shared libraries (using "-Wl,--strip-debug"). The default value of 'sometimes' means strip iff --compilation_mode=fastbuild.
+Tags:
+affects_outputs
+
--stripopt=<a string> multiple uses are accumulatedAdditional options to pass to strip when generating a '<name>.stripped' binary.
+Tags:
+action_command_lines, affects_outputs
+
--tvos_cpus=<comma-separated list of options> multiple uses are accumulatedComma-separated list of architectures for which to build Apple tvOS binaries.
+Tags:
+loses_incremental_state, loading_and_analysis
+
--tvos_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionMinimum compatible tvOS version for target simulators and devices. If unspecified, uses 'tvos_sdk_version'.
+Tags:
+loses_incremental_state
+
--visionos_cpus=<comma-separated list of options> multiple uses are accumulatedComma-separated list of architectures for which to build Apple visionOS binaries.
+Tags:
+loses_incremental_state, loading_and_analysis
+
--watchos_cpus=<comma-separated list of options> multiple uses are accumulatedComma-separated list of architectures for which to build Apple watchOS binaries.
+Tags:
+loses_incremental_state, loading_and_analysis
+
--watchos_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionMinimum compatible watchOS version for target simulators and devices. If unspecified, uses 'watchos_sdk_version'.
+Tags:
+loses_incremental_state
+
--xbinary_fdo=<a build target label> default: see descriptionUse XbinaryFDO profile information to optimize compilation. Specify the name of default cross binary profile. When the option is used together with --fdo_instrument/--fdo_optimize/--fdo_profile, those options will always prevail as if xbinary_fdo is never specified.
+Tags:
+affects_outputs
+
--[no]check_visibility default: "true"If disabled, visibility errors in target dependencies are demoted to warnings.
+Tags:
+build_file_semantics, non_configurable
+
--[no]desugar_for_android default: "true"Whether to desugar Java 8 bytecode before dexing.
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state
+
--[no]desugar_java8_libs default: "false"Whether to include supported Java 8 libraries in apps for legacy devices.
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state, experimental
+
--[no]enforce_constraints default: "true"Checks the environments each target is compatible with and reports errors if any target has dependencies that don't support the same environments
+Tags:
+build_file_semantics
+
--[no]experimental_check_desugar_deps default: "true"Whether to double-check correct desugaring at Android binary level.
+Tags:
+eagerness_to_exit, loading_and_analysis, experimental
+
--[no]experimental_enforce_transitive_visibility default: "false"If true, enable package()s to set the transitive_visibility attribute to restrict which packages may depend on them.
+Tags:
+build_file_semantics, experimental
+
--experimental_one_version_enforcement=<off, warning or error> default: "OFF"When enabled, enforce that a java_binary rule can't contain more than one version of the same class file on the classpath. This enforcement can break the build, or can just result in warnings.
+Tags:
+loading_and_analysis
+
--experimental_strict_java_deps=<off, warn, error, strict or default> default: "default"If true, checks that a Java target explicitly declares all directly used targets as dependencies.
+Tags:
+build_file_semantics, eagerness_to_exit
+
--[no]incompatible_check_testonly_for_output_files default: "false"If enabled, check testonly for prerequisite targets that are output files by looking up the testonly of the generating rule. This matches visibility checking.
+Tags:
+build_file_semantics, incompatible_change
+
--[no]incompatible_disable_native_android_rules default: "false"If enabled, direct usage of the native Android rules is disabled. Please use the Starlark Android rules from https://github.com/bazelbuild/rules_android
+Tags:
+eagerness_to_exit, incompatible_change
+
--[no]incompatible_disable_native_apple_binary_rule default: "false"No-op. Kept here for backwards compatibility.
+Tags:
+eagerness_to_exit, incompatible_change
+
--[no]one_version_enforcement_on_java_tests default: "true"When enabled, and with experimental_one_version_enforcement set to a non-NONE value, enforce one version on java_test targets. This flag can be disabled to improve incremental test performance at the expense of missing potential one version violations.
+Tags:
+loading_and_analysis
+
--python_native_rules_allowlist=<a build target label> default: see descriptionAn allowlist (package_group target) to use when enforcing --incompatible_python_disallow_native_rules.
+Tags:
+loading_and_analysis
+
--[no]strict_filesets default: "false"If this option is enabled, filesets crossing package boundaries are reported as errors.
+Tags:
+build_file_semantics, eagerness_to_exit
+
--strict_proto_deps=<off, warn, error, strict or default> default: "error"Unless OFF, checks that a proto_library target explicitly declares all directly used targets as dependencies.
+Tags:
+build_file_semantics, eagerness_to_exit, incompatible_change
+
--strict_public_imports=<off, warn, error, strict or default> default: "off"Unless OFF, checks that a proto_library target explicitly declares all targets used in 'import public' as exported.
+Tags:
+build_file_semantics, eagerness_to_exit, incompatible_change
+
--[no]strict_system_includes default: "false"If true, headers found through system include paths (-isystem) are also required to be declared.
+Tags:
+loading_and_analysis, eagerness_to_exit
+
--target_environment=<a build target label> multiple uses are accumulatedDeclares this build's target environment. Must be a label reference to an "environment" rule. If specified, all top-level targets must be compatible with this environment.
+Tags:
+changes_inputs
+
--apk_signing_method=<v1, v2, v1_v2 or v4> default: "v1_v2"Implementation to use to sign APKs
+Tags:
+action_command_lines, affects_outputs, loading_and_analysis
+
--[no]device_debug_entitlements default: "true"If set, and compilation mode is not 'opt', objc apps will include debug entitlements when signing.
+Tags:
+changes_inputs
+
--ios_signing_cert_name=<a string> default: see descriptionCertificate name to use for iOS signing. If not set will fall back to provisioning profile. May be the certificate's keychain identity preference or (substring) of the certificate's common name, as per codesign's man page (SIGNING IDENTITIES).
+Tags:
+action_command_lines
+
--[no]incompatible_disallow_sdk_frameworks_attributes default: "false"If true, disallow sdk_frameworks and weak_sdk_frameworks attributes in objc_library andobjc_import.
+Tags:
+build_file_semantics, incompatible_change
+
--[no]incompatible_objc_alwayslink_by_default default: "false"If true, make the default value true for alwayslink attributes in objc_library and objc_import.
+Tags:
+build_file_semantics, incompatible_change
+
--[no]incompatible_python_disallow_native_rules default: "false"When true, an error occurs when using the builtin py_* rules; instead the rule_python rules should be used. See https://github.com/bazelbuild/bazel/issues/17773 for more information and migration instructions.
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]allow_analysis_failures default: "false"If true, an analysis failure of a rule target results in the target's propagation of an instance of AnalysisFailureInfo containing the error description, instead of resulting in a build failure.
+Tags:
+loading_and_analysis, experimental
+
--analysis_testing_deps_limit=<an integer> default: "2000"Sets the maximum number of transitive dependencies through a rule attribute with a for_analysis_testing configuration transition. Exceeding this limit will result in a rule error.
+Tags:
+loading_and_analysis
+
--[no]break_build_on_parallel_dex2oat_failure default: "false"If true dex2oat action failures will cause the build to break instead of executing dex2oat during test runtime.
+Tags:
+loading_and_analysis, experimental
+
--default_test_resources=<a resource name followed by equal and 1 float or 4 float, e.g memory=10,30,60,100> multiple uses are accumulatedOverride the default resources amount for tests. The expected format is <resource>=<value>. If a single positive number is specified as <value> it will override the default resources for all test sizes. If 4 comma-separated numbers are specified, they will override the resource amount for respectively the small, medium, large, enormous test sizes. Values can also be HOST_RAM/HOST_CPU, optionally followed by [-|]<float> (eg. memory=HOST_RAM.1,HOST_RAM*.2,HOST_RAM*.3,HOST_RAM*.4). The default test resources specified by this flag are overridden by explicit resources specified in tags.
+--[no]experimental_android_use_parallel_dex2oat default: "false"Use dex2oat in parallel to possibly speed up android_test.
+Tags:
+loading_and_analysis, host_machine_resource_optimizations, experimental
+
--[no]ios_memleaks default: "false"Enable checking for memory leaks in ios_test targets.
+Tags:
+action_command_lines
+
--ios_simulator_device=<a string> default: see descriptionThe device to simulate when running an iOS application in the simulator, e.g. 'iPhone 6'. You can get a list of devices by running 'xcrun simctl list devicetypes' on the machine the simulator will be run on.
+Tags:
+test_runner
+
--ios_simulator_version=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionThe version of iOS to run on the simulator when running or testing. This is ignored for ios_test rules if a target device is specified in the rule.
+Tags:
+test_runner
+
--runs_per_test=<a positive integer or test_regex@runs. This flag may be passed more than once> multiple uses are accumulatedSpecifies number of times to run each test. If any of those attempts fail for any reason, the whole test is considered failed. Normally the value specified is just an integer. Example: --runs_per_test=3 will run all tests 3 times. Alternate syntax: regex_filter@runs_per_test. Where runs_per_test stands for an integer value and regex_filter stands for a list of include and exclude regular expression patterns (Also see --instrumentation_filter). Example: --runs_per_test=//foo/.,-//foo/bar/.@3 runs all tests in //foo/ except those under foo/bar three times. This option can be passed multiple times. The most recently passed argument that matches takes precedence. If nothing matches, the test is only run once.
+--test_env=<a 'name[=value]' assignment with an optional value part or the special syntax '=name' to unset a variable> multiple uses are accumulatedSpecifies additional environment variables to be injected into the test runner environment. Variables can be either specified by <code>name</code>, in which case its value will be read from the Bazel client environment, or by the <code>name=value</code> pair. Previously set variables can be unset via <code>=name</code>. This option can be used multiple times to specify several variables. Used only by the 'bazel test' command.
+Tags:
+test_runner
+
--test_timeout=<a single integer or comma-separated list of 4 integers> default: "-1"Override the default test timeout values for test timeouts (in secs). If a single positive integer value is specified it will override all categories. If 4 comma-separated integers are specified, they will override the timeouts for short, moderate, long and eternal (in that order). In either form, a value of -1 tells blaze to use its default timeouts for that category.
+--[no]zip_undeclared_test_outputs default: "false"If true, undeclared test outputs will be archived in a zip file.
+Tags:
+test_runner
+
--[no]experimental_filter_library_jar_with_program_jar default: "false"Filter the ProGuard ProgramJar to remove any classes also present in the LibraryJar.
+Tags:
+action_command_lines, experimental
+
--[no]experimental_inmemory_dotd_files default: "true"If enabled, C++ .d files will be passed through in memory directly from the remote build nodes instead of being written to disk.
+Tags:
+loading_and_analysis, execution, affects_outputs, experimental
+
--[no]experimental_inmemory_jdeps_files default: "true"If enabled, the dependency (.jdeps) files generated from Java compilations will be passed through in memory directly from the remote build nodes instead of being written to disk.
+Tags:
+loading_and_analysis, execution, affects_outputs, experimental
+
--[no]experimental_retain_test_configuration_across_testonly default: "false"When enabled, --trim_test_configuration will not trim the test configuration for rules marked testonly=1. This is meant to reduce action conflict issues when non-test rules depend on cc_test rules. No effect if --trim_test_configuration is false.
+Tags:
+loading_and_analysis, loses_incremental_state, experimental
+
--[no]experimental_unsupported_and_brittle_include_scanning default: "false"Whether to narrow inputs to C/C++ compilation by parsing #include lines from input files. This can improve performance and incrementality by decreasing the size of compilation input trees. However, it can also break builds because the include scanner does not fully implement C preprocessor semantics. In particular, it does not understand dynamic #include directives and ignores preprocessor conditional logic. Use at your own risk. Any issues relating to this flag that are filed will be closed.
+Tags:
+loading_and_analysis, execution, changes_inputs, experimental
+
--[no]incremental_dexing default: "true"Does most of the work for dexing separately for each Jar file.
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state
+
--[no]objc_use_dotd_pruning default: "true"If set, .d files emitted by clang will be used to prune the set of inputs passed into objc compiles.
+Tags:
+changes_inputs, loading_and_analysis
+
--[no]process_headers_in_dependencies default: "false"When building a target //a:a, process headers in all targets that //a:a depends on (if header processing is enabled for the toolchain).
+Tags:
+execution
+
--[no]trim_test_configuration default: "true"When enabled, test-related options will be cleared below the top level of the build. When this flag is active, tests cannot be built as dependencies of non-test rules, but changes to test-related options will not cause non-test rules to be re-analyzed.
+Tags:
+loading_and_analysis, loses_incremental_state
+
--toolchain_resolution_debug=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths> default: "-.*"Print debug information during toolchain resolution. The flag takes a regex, which is checked against toolchain types and specific targets to see which to debug. Multiple regexes may be separated by commas, and then each regex is checked separately. Note: The output of this flag is very complex and will likely only be useful to experts in toolchain resolution.
+Tags:
+terminal_output
+
--[no]verbose_visibility_errors default: "false"If enabled, visibility errors include additional diagnostic information.
+Tags:
+build_file_semantics, non_configurable
+
--flag_alias=<a 'name=value' flag alias> multiple uses are accumulatedSets a shorthand name for a Starlark flag. It takes a single key-value pair in the form "<key>=<value>" as an argument.
+Tags:
+changes_inputs, non_configurable
+
--[no]incompatible_default_to_explicit_init_py default: "false"This flag changes the default behavior so that init.py files are no longer automatically created in the runfiles of Python targets. Precisely, when a py_binary or py_test target has legacy_create_init set to "auto" (the default), it is treated as false if and only if this flag is set. See https://github.com/bazelbuild/bazel/issues/10076.
+Tags:
+affects_outputs, incompatible_change
+
--[no]cache_test_results [-t] default: "auto"If set to 'auto', Bazel reruns a test if and only if: (1) Bazel detects changes in the test or its dependencies, (2) the test is marked as external, (3) multiple test runs were requested with --runs_per_test, or(4) the test previously failed. If set to 'yes', Bazel caches all test results except for tests marked as external. If set to 'no', Bazel does not cache any test results.
+--[no]experimental_cancel_concurrent_tests default: "never"If 'on_failed' or 'on_passed, then Blaze will cancel concurrently running tests on the first run with that result. This is only useful in combination with --runs_per_test_detects_flakes.
+Tags:
+affects_outputs, loading_and_analysis, experimental
+
--[no]experimental_fetch_all_coverage_outputs default: "false"If true, then Bazel fetches the entire coverage data directory for each test during a coverage run.
+Tags:
+affects_outputs, loading_and_analysis, experimental
+
--[no]experimental_generate_llvm_lcov default: "false"If true, coverage for clang will generate an LCOV report.
+Tags:
+affects_outputs, loading_and_analysis, experimental
+
--experimental_java_classpath=<off, javabuilder, bazel or bazel_no_fallback> default: "bazel"Enables reduced classpaths for Java compilations.
+--[no]experimental_run_android_lint_on_java_rules default: "false"Whether to validate java_* sources.
+Tags:
+affects_outputs, experimental
+
--[no]explicit_java_test_deps default: "false"Explicitly specify a dependency to JUnit or Hamcrest in a java_test instead of accidentally obtaining from the TestRunner's deps. Only works for bazel right now.
+--host_java_launcher=<a build target label> default: see descriptionThe Java launcher used by tools that are executed during a build.
+--host_javacopt=<a string> multiple uses are accumulatedAdditional options to pass to javac when building tools that are executed during a build.
+--host_jvmopt=<a string> multiple uses are accumulatedAdditional options to pass to the Java VM when building tools that are executed during the build. These options will get added to the VM startup options of each java_binary target.
+--[no]incompatible_check_sharding_support default: "true"If true, Bazel will fail a sharded test if the test runner does not indicate that it supports sharding by touching the file at the path in TEST_SHARD_STATUS_FILE. If false, a test runner that does not support sharding will lead to all tests running in each shard.
+Tags:
+incompatible_change
+
--[no]incompatible_exclusive_test_sandboxed default: "true"If true, exclusive tests will run with sandboxed strategy. Add 'local' tag to force an exclusive test run locally
+Tags:
+incompatible_change
+
--[no]incompatible_strict_action_env default: "false"If true, Bazel uses an environment with a static value for PATH and does not inherit LD_LIBRARY_PATH. Use --action_env=ENV_VARIABLE if you want to inherit specific environment variables from the client, but note that doing so can prevent cross-user caching if a shared cache is used.
+Tags:
+loading_and_analysis, incompatible_change
+
--j2objc_translation_flags=<comma-separated list of options> multiple uses are accumulatedAdditional options to pass to the J2ObjC tool.
+--java_debugCauses the Java virtual machine of a java test to wait for a connection from a JDWP-compliant debugger (such as jdb) before starting the test. Implies -test_output=streamed.
+Expands to:
+
--test_arg=--wrapper_script_flag=--debug
+
--test_output=streamed
+
--test_strategy=exclusive
+
--test_timeout=9999
+
--nocache_test_results
+
--[no]java_deps default: "true"Generate dependency information (for now, compile-time classpath) per Java target.
+--[no]java_header_compilation default: "true"Compile ijars directly from source.
+--java_language_version=<a string> default: ""The Java language version
+--java_launcher=<a build target label> default: see descriptionThe Java launcher to use when building Java binaries. If this flag is set to the empty string, the JDK launcher is used. The "launcher" attribute overrides this flag.
+--java_runtime_version=<a string> default: "local_jdk"The Java runtime version
+--javacopt=<a string> multiple uses are accumulatedAdditional options to pass to javac.
+--jvmopt=<a string> multiple uses are accumulatedAdditional options to pass to the Java VM. These options will get added to the VM startup options of each java_binary target.
+--legacy_main_dex_list_generator=<a build target label> default: see descriptionSpecifies a binary to use to generate the list of classes that must be in the main dex when compiling legacy multidex.
+--optimizing_dexer=<a build target label> default: see descriptionSpecifies a binary to use to do dexing without sharding.
+--plugin=<a build target label> multiple uses are accumulatedPlugins to use in the build. Currently works with java_plugin.
+--proguard_top=<a build target label> default: see descriptionSpecifies which version of ProGuard to use for code removal when building a Java binary.
+--proto_compiler=<a build target label> default: "@bazel_tools//tools/proto:protoc"The label of the proto-compiler.
+Tags:
+affects_outputs, loading_and_analysis
+
--[no]proto_profile default: "true"Whether to pass profile_path to the proto compiler.
+Tags:
+affects_outputs, loading_and_analysis
+
--proto_profile_path=<a build target label> default: see descriptionThe profile to pass to the proto compiler as profile_path. If unset, but --proto_profile is true (the default), infers the path from --fdo_optimize.
+Tags:
+affects_outputs, loading_and_analysis
+
--proto_toolchain_for_cc=<a build target label> default: "@bazel_tools//tools/proto:cc_toolchain"Label of proto_lang_toolchain() which describes how to compile C++ protos
+Tags:
+affects_outputs, loading_and_analysis
+
--proto_toolchain_for_j2objc=<a build target label> default: "@bazel_tools//tools/j2objc:j2objc_proto_toolchain"Label of proto_lang_toolchain() which describes how to compile j2objc protos
+Tags:
+affects_outputs, loading_and_analysis
+
--proto_toolchain_for_java=<a build target label> default: "@bazel_tools//tools/proto:java_toolchain"Label of proto_lang_toolchain() which describes how to compile Java protos
+Tags:
+affects_outputs, loading_and_analysis
+
--proto_toolchain_for_javalite=<a build target label> default: "@bazel_tools//tools/proto:javalite_toolchain"Label of proto_lang_toolchain() which describes how to compile JavaLite protos
+Tags:
+affects_outputs, loading_and_analysis
+
--protocopt=<a string> multiple uses are accumulatedAdditional options to pass to the protobuf compiler.
+Tags:
+affects_outputs
+
--[no]runs_per_test_detects_flakes default: "false"If true, any shard in which at least one run/attempt passes and at least one run/attempt fails gets a FLAKY status.
+--shell_executable=<a path> default: see descriptionAbsolute path to the shell executable for Bazel to use. If this is unset, but the BAZEL_SH environment variable is set on the first Bazel invocation (that starts up a Bazel server), Bazel uses that. If neither is set, Bazel uses a hard-coded default path depending on the operating system it runs on (Windows: c:/msys64/usr/bin/bash.exe, FreeBSD: /usr/local/bin/bash, all others: /bin/bash). Note that using a shell that is not compatible with bash may lead to build failures or runtime failures of the generated binaries.
+Tags:
+loading_and_analysis
+
--test_arg=<a string> multiple uses are accumulatedSpecifies additional options and arguments that should be passed to the test executable. Can be used multiple times to specify several arguments. If multiple tests are executed, each of them will receive identical arguments. Used only by the 'bazel test' command.
+--test_filter=<a string> default: see descriptionSpecifies a filter to forward to the test framework. Used to limit the tests run. Note that this does not affect which targets are built.
+--test_result_expiration=<an integer> default: "-1"This option is deprecated and has no effect.
+--[no]test_runner_fail_fast default: "false"Forwards fail fast option to the test runner. The test runner should stop execution upon first failure.
+--test_sharding_strategy=<explicit, disabled or forced=k where k is the number of shards to enforce> default: "explicit"Specify strategy for test sharding: 'explicit' to only use sharding if the 'shard_count' BUILD attribute is present. 'disabled' to never use test sharding. 'forced=k' to enforce 'k' shards for testing regardless of the 'shard_count' BUILD attribute.
+--tool_java_language_version=<a string> default: ""The Java language version used to execute the tools that are needed during a build
+--tool_java_runtime_version=<a string> default: "remotejdk_11"The Java runtime version used to execute tools during the build
+--[no]use_ijars default: "true"If enabled, this option causes Java compilation to use interface jars. This will result in faster incremental compilation, but error messages can be different.
+--help_verbosity=<long, medium or short> default: "medium"Select the verbosity of the help command.
+Tags:
+terminal_output
+
--long [-l]Show full description of each option, instead of just its name.
+Expands to:
+
--help_verbosity=long
+
Tags:
+terminal_output
+
--shortShow only the names of the options, not their types or meanings.
+Expands to:
+
--help_verbosity=short
+
Tags:
+terminal_output
+
Inherits all options from build.
+ +--info_output_type=<stdout or response_proto> default: "stdout"If stdout, results are directly printed to the console. If response_proto, the info command results are packed in response extensions.
+Tags:
+affects_outputs, terminal_output
+
--[no]show_make_env default: "false"Include the "Make" environment in the output.
+Tags:
+affects_outputs, terminal_output
+
Inherits all options from build.
+ +--mode=<classic, classic_internal_test_do_not_use or skylark> default: "skylark"Deprecated no-effect flag. Only skylark mode is still supported.
+Tags:
+loading_and_analysis, execution, incompatible_change
+
--adb=<a string> default: ""adb binary to use for the 'mobile-install' command. If unspecified, the one in the Android SDK specified by the --android_sdk_channel command line option (or the default SDK if --android_sdk_channel is not specified) is used.
+Tags:
+changes_inputs
+
--[no]incremental default: "false"Whether to do an incremental install. If true, try to avoid unnecessary additional work by reading the state of the device the code is to be installed on and using that information to avoid unnecessary work. If false (the default), always do a full install.
+Tags:
+loading_and_analysis
+
--[no]split_apks default: "false"Whether to use split apks to install and update the application on the device. Works only with devices with Marshmallow or later
+Tags:
+loading_and_analysis, affects_outputs
+
--adb_arg=<a string> multiple uses are accumulatedExtra arguments to pass to adb. Usually used to designate a device to install to.
+Tags:
+action_command_lines
+
--debug_appWhether to wait for the debugger before starting the app.
+Expands to:
+
--start=DEBUG
+
Tags:
+execution
+
--device=<a string> default: ""The adb device serial number. If not specified, the first device will be used.
+Tags:
+action_command_lines
+
--start=<no, cold, warm or debug> default: "NO"How the app should be started after installing it. Set to WARM to preserve and restore application state on incremental installs.
+Tags:
+execution
+
--start_appWhether to start the app after installing it.
+Expands to:
+
--start=COLD
+
Tags:
+execution
+
--incremental_install_verbosity=<a string> default: ""The verbosity for incremental install. Set to 1 for debug logging.
+Tags:
+bazel_monitoring
+
--[no]experimental_remotable_source_manifests default: "false"Whether to make source manifest actions remotable
+Tags:
+loading_and_analysis, execution, experimental
+
--[no]experimental_strict_fileset_output default: "false"If this option is enabled, filesets will treat all output artifacts as regular files. They will not traverse directories or be sensitive to symlinks.
+Tags:
+execution, experimental
+
--[no]incompatible_modify_execution_info_additive default: "true"When enabled, passing multiple --modify_execution_info flags is additive. When disabled, only the last flag is taken into account.
+Tags:
+execution, affects_outputs, loading_and_analysis, incompatible_change
+
--loading_phase_threads=<an integer, or a keyword ("auto", "HOST_CPUS", "HOST_RAM"), optionally followed by an operation ([-|*]<float>) eg. "auto", "HOST_CPUS*.5"> default: "auto"Number of parallel threads to use for the loading/analysis phase.Takes an integer, or a keyword ("auto", "HOST_CPUS", "HOST_RAM"), optionally followed by an operation ([-|]<float>) eg. "auto", "HOST_CPUS.5". "auto" sets a reasonable default based on host resources. Must be at least 1.
+Tags:
+bazel_internal_configuration
+
--modify_execution_info=<regex=[+-]key,regex=[+-]key,...> multiple uses are accumulatedAdd or remove keys from an action's execution info based on action mnemonic. Applies only to actions which support execution info. Many common actions support execution info, e.g. Genrule, CppCompile, Javac, StarlarkAction, TestRunner. When specifying multiple values, order matters because many regexes may apply to the same mnemonic.
+Syntax: "regex=[+-]key,regex=[+-]key,...".
+Examples: +'.=+x,.=-y,.=+z' adds 'x' and 'z' to, and removes 'y' from, the execution info for all actions. +'Genrule=+requires-x' adds 'requires-x' to the execution info for all Genrule actions. +'(?!Genrule).=-requires-x' removes 'requires-x' from the execution info for all non-Genrule actions.
+Tags:
+execution, affects_outputs, loading_and_analysis
+
--[no]use_target_platform_for_tests default: "false"If true, use the target platform for running tests rather than the test exec group.
+Tags:
+execution
+
--[no]incompatible_bazel_test_exec_run_under default: "true"If enabled, "bazel test --run_under=//:runner" builds "//:runner" in the exec configuration. If disabled, it builds "//:runner" in the target configuration. Bazel executes tests on exec machines, so the former is more correct. This doesn't affect "bazel run", which always builds "`--run_under=//foo" in the target configuration.
+Tags:
+affects_outputs, incompatible_change
+
--[no]build_runfile_links default: "true"If true, build runfiles symlink forests for all targets. If false, write them only when required by a local action, test or run command.
+Tags:
+affects_outputs
+
--[no]build_runfile_manifests default: "true"If true, write runfiles manifests for all targets. If false, omit them. Local tests will fail to run when false.
+Tags:
+affects_outputs
+
--[no]incompatible_always_include_files_in_data default: "true"If true, native rules add <code>DefaultInfo.files</code> of data dependencies to their runfiles, which matches the recommended behavior for Starlark rules (https://bazel.build/extending/rules#runfiles_features_to_avoid).
+Tags:
+affects_outputs, incompatible_change
+
--[no]incompatible_compact_repo_mapping_manifest default: "false"If enabled, the <binary>.repo_mapping file emits a module extension's repo mapping only once instead of once for each repo generated by the extension that contributes runfiles.
+Tags:
+affects_outputs, incompatible_change
+
--incompatible_disable_select_on=<comma-separated set of options> default: ""List of flags for which the use in select() is disabled.
+Tags:
+loading_and_analysis, incompatible_change, non_configurable
+
--[no]incompatible_filegroup_runfiles_for_data default: "true"If true, runfiles of targets listed in the srcs attribute are available to targets that consume the filegroup as a data dependency.
+Tags:
+incompatible_change
+
--action_env=<a 'name[=value]' assignment with an optional value part or the special syntax '=name' to unset a variable> multiple uses are accumulatedSpecifies the set of environment variables available to actions with target configuration. Variables can be either specified by <code>name</code>, in which case +the value will be taken from the invocation environment, by the <code>name=value</code> pair which sets the value independent of the invocation environment, or by <code>=name</code>, which unsets the variable of that name. This option can be used multiple times; for options given for the same variable, the latest wins, options for different variables accumulate. +<br> +Note that unless <code>--incompatible_repo_env_ignores_action_env</code> is true, all <code>name=value</code> pairs will be available to repository rules.
+Tags:
+action_command_lines
+
--allowed_cpu_values=<comma-separated set of options> default: ""Allowed values for the --cpu flag.
+Tags:
+changes_inputs, affects_outputs
+
--[no]collect_code_coverage default: "false"If specified, Bazel will instrument code (using offline instrumentation where possible) and will collect coverage information during tests. Only targets that match --instrumentation_filter will be affected. Usually this option should not be specified directly - 'bazel coverage' command should be used instead.
+Tags:
+affects_outputs
+
--compilation_mode=<fastbuild, dbg or opt> [-c] default: "fastbuild"Specify the mode the binary will be built in. Values: 'fastbuild', 'dbg', 'opt'.
+Tags:
+affects_outputs, action_command_lines
+
--cpu=<a string> default: ""Deprecated: this flag is not used internally by Blaze although there are legacy platform mappings to allow for backwards compatibility. Do not use this flag, instead use --platforms with an appropriate platform definition.
+Tags:
+changes_inputs, affects_outputs
+
--define=<a 'name=value' assignment> multiple uses are accumulatedEach --define option specifies an assignment for a build variable. In case of multiple values for a variable, the last one wins.
+Tags:
+changes_inputs, affects_outputs
+
--[no]enable_runfiles default: "auto"Enable runfiles symlink tree; By default, it's off on Windows, on on other platforms.
+Tags:
+affects_outputs
+
--exec_aspects=<comma-separated list of options> multiple uses are accumulatedComma-separated list of aspects to be applied to exec-configured targets, regardless of whether or not they are top-level targets. This is an experimental feature and is subject to change.
+Tags:
+loading_and_analysis
+
--experimental_action_listener=<a build target label> multiple uses are accumulatedDeprecated in favor of aspects. Use action_listener to attach an extra_action to existing build actions.
+Tags:
+execution, experimental
+
--[no]experimental_collect_code_coverage_for_generated_files default: "false"If specified, Bazel will also generate collect coverage information for generated files.
+Tags:
+affects_outputs, experimental
+
--experimental_output_paths=<off or strip> default: "off"Which model to use for where in the output tree rules write their outputs, particularly for multi-platform / multi-configuration builds. This is highly experimental. See https://github.com/bazelbuild/bazel/issues/6526 for details. Starlark actions canopt into path mapping by adding the key 'supports-path-mapping' to the 'execution_requirements' dict.
+Tags:
+loses_incremental_state, bazel_internal_configuration, affects_outputs, execution
+
--experimental_override_platform_cpu_name=<a 'label=value' assignment> multiple uses are accumulatedEach entry should be of the form label=value where label refers to a platform and values is the desired shortname to override the platform's CPU name in $(TARGET_CPU) make variable and output path. Only used when --experimental_platform_in_output_dir, --incompatible_target_cpu_from_platform or --incompatible_bep_cpu_from_platform is true. Has highest naming priority.
+Tags:
+affects_outputs, experimental
+
--[no]experimental_platform_in_output_dir default: "false"If true, a shortname for the target platform is used in the output directory name instead of the CPU. If auto, this is only applied for the exec configuration. The exact scheme is experimental and subject to change: First, in the rare case the --platforms option does not have exactly one value, a hash of the platforms option is used. Next, if any shortname for the current platform was registered by --experimental_override_name_platform_in_output_dir, then that shortname is used. Then, if --experimental_use_platforms_in_output_dir_legacy_heuristic is set, use a shortname based off the current platform Label. Finally, a hash of the platform option is used as a last resort.
+Tags:
+affects_outputs, experimental
+
--[no]experimental_use_platforms_in_output_dir_legacy_heuristic default: "true"Please only use this flag as part of a suggested migration or testing strategy. Note that the heuristic has known deficiencies and it is suggested to migrate to relying on just --experimental_override_name_platform_in_output_dir.
+Tags:
+affects_outputs, experimental
+
--features=<a string> multiple uses are accumulatedThe given features will be enabled or disabled by default for targets built in the target configuration. Specifying -<feature> will disable the feature. Negative features always override positive ones. See also --host_features
+Tags:
+changes_inputs, affects_outputs
+
--host_action_env=<a 'name[=value]' assignment with an optional value part or the special syntax '=name' to unset a variable> multiple uses are accumulatedSpecifies the set of environment variables available to actions with execution configurations. Variables can be either specified by name, in which case the value will be taken from the invocation environment, by the name=value pair which sets the value independent of the invocation environment, or by <code>=name</code>, which unsets the variable of that name. This option can be used multiple times; for options given for the same variable, the latest wins, options for different variables accumulate.
+Tags:
+action_command_lines
+
--host_compilation_mode=<fastbuild, dbg or opt> default: "opt"Specify the mode the tools used during the build will be built in. Values: 'fastbuild', 'dbg', 'opt'.
+Tags:
+affects_outputs, action_command_lines
+
--host_cpu=<a string> default: ""The host CPU.
+Tags:
+changes_inputs, affects_outputs
+
--host_features=<a string> multiple uses are accumulatedThe given features will be enabled or disabled by default for targets built in the exec configuration. Specifying -<feature> will disable the feature. Negative features always override positive ones.
+Tags:
+changes_inputs, affects_outputs
+
--[no]incompatible_auto_exec_groups default: "false"When enabled, an exec groups is automatically created for each toolchain used by a rule. For this to work rule needs to specify toolchain parameter on its actions. For more information, see https://github.com/bazelbuild/bazel/issues/17134.
Tags:
+affects_outputs, incompatible_change
+
--[no]incompatible_merge_genfiles_directory default: "true"If true, the genfiles directory is folded into the bin directory.
+Tags:
+affects_outputs, incompatible_change
+
--[no]incompatible_target_cpu_from_platform default: "true"If specified, the value of the cpu constraint (@platforms//cpu:cpu) of the target platform is used to set the $(TARGET_CPU) make variable.
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]instrument_test_targets default: "false"When coverage is enabled, specifies whether to consider instrumenting test rules. When set, test rules included by --instrumentation_filter are instrumented. Otherwise, test rules are always excluded from coverage instrumentation.
+Tags:
+affects_outputs
+
--instrumentation_filter=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths> default: "-/javatests[/:],-/test/java[/:]"When coverage is enabled, only rules with names included by the specified regex-based filter will be instrumented. Rules prefixed with '-' are excluded instead. Note that only non-test rules are instrumented unless --instrument_test_targets is enabled.
+Tags:
+affects_outputs
+
--platform_suffix=<a string> default: see descriptionSpecifies a suffix to be added to the configuration directory.
+Tags:
+loses_incremental_state, affects_outputs, loading_and_analysis
+
--run_under=<a prefix in front of command> default: see descriptionPrefix to insert before the executables for the 'test' and 'run' commands. If the value is 'foo -bar', and the execution command line is 'test_binary -baz', then the final command line is 'foo -bar test_binary -baz'.This can also be a label to an executable target. Some examples are: 'valgrind', 'strace', 'strace -c', 'valgrind --quiet --num-callers=20', '//package:target', '//package:target --options'.
+Tags:
+action_command_lines
+
--[no]stamp default: "false"Stamp binaries with the date, username, hostname, workspace information, etc.
+Tags:
+affects_outputs
+
--[no]check_visibility default: "true"If disabled, visibility errors in target dependencies are demoted to warnings.
+Tags:
+build_file_semantics, non_configurable
+
--[no]enforce_constraints default: "true"Checks the environments each target is compatible with and reports errors if any target has dependencies that don't support the same environments
+Tags:
+build_file_semantics
+
--[no]experimental_enforce_transitive_visibility default: "false"If true, enable package()s to set the transitive_visibility attribute to restrict which packages may depend on them.
+Tags:
+build_file_semantics, experimental
+
--[no]incompatible_check_testonly_for_output_files default: "false"If enabled, check testonly for prerequisite targets that are output files by looking up the testonly of the generating rule. This matches visibility checking.
+Tags:
+build_file_semantics, incompatible_change
+
--[no]strict_filesets default: "false"If this option is enabled, filesets crossing package boundaries are reported as errors.
+Tags:
+build_file_semantics, eagerness_to_exit
+
--target_environment=<a build target label> multiple uses are accumulatedDeclares this build's target environment. Must be a label reference to an "environment" rule. If specified, all top-level targets must be compatible with this environment.
+Tags:
+changes_inputs
+
--[no]incompatible_config_setting_private_default_visibility default: "false"If incompatible_enforce_config_setting_visibility=false, this is a noop. Else, if this flag is false, any config_setting without an explicit visibility attribute is //visibility:public. If this flag is true, config_setting follows the same visibility logic as all other rules. See https://github.com/bazelbuild/bazel/issues/12933.
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]incompatible_enforce_config_setting_visibility default: "true"If true, enforce config_setting visibility restrictions. If false, every config_setting is visible to every target. See https://github.com/bazelbuild/bazel/issues/12932.
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]allow_analysis_failures default: "false"If true, an analysis failure of a rule target results in the target's propagation of an instance of AnalysisFailureInfo containing the error description, instead of resulting in a build failure.
+Tags:
+loading_and_analysis, experimental
+
--analysis_testing_deps_limit=<an integer> default: "2000"Sets the maximum number of transitive dependencies through a rule attribute with a for_analysis_testing configuration transition. Exceeding this limit will result in a rule error.
+Tags:
+loading_and_analysis
+
--base_module=<"<root>" for the root module; <module>@<version> for a specific version of a module; <module> for all versions of a module; @<name> for a repo with the given apparent name; or @@<name> for a repo with the given canonical name> default: "<root>"Specify a module relative to which the specified target repos will be interpreted.
+Tags:
+terminal_output
+
--charset=<utf8 or ascii> default: "utf8"Chooses the character set to use for the tree. Only affects text output. Valid values are "utf8" or "ascii". Default is "utf8"
+Tags:
+terminal_output
+
--[no]cycles default: "true"Points out dependency cycles inside the displayed tree.
+Tags:
+terminal_output
+
--depth=<an integer> default: "-1"Maximum display depth of the dependency tree. A depth of 1 displays the direct dependencies, for example. For tree, path and all_paths it defaults to Integer.MAX_VALUE, while for deps and explain it defaults to 1 (only displays direct deps of the root besides the target leaves and their parents).
+Tags:
+terminal_output
+
--extension_filter=<a comma-separated list of <extension>s> default: see descriptionOnly display the usages of these module extensions and the repos generated by them if their respective flags are set. If set, the result graph will only include paths that contain modules using the specified extensions. An empty list disables the filter, effectively specifying all possible extensions.
+Tags:
+terminal_output
+
--extension_info=<hidden, usages, repos or all> default: "hidden"Specify how much detail about extension usages to include in the query result. "Usages" will only show the extensions names, "repos" will also include repos imported with use_repo, and "all" will also show the other repositories generated by extensions.
+Tags:
+terminal_output
+
--extension_usages=<a comma-separated list of <module>s> default: ""Specify modules whose extension usages will be displayed in the show_extension query.
+Tags:
+terminal_output
+
--from=<a comma-separated list of <module>s> default: "<root>"The module(s) starting from which the dependency graph query will be displayed. Check each query’s description for the exact semantics. Defaults to <root>.
+Tags:
+terminal_output
+
--[no]include_builtin default: "false"Include built-in modules in the dependency graph. Disabled by default because it is quite noisy.
+Tags:
+terminal_output
+
--[no]include_unused default: "false"The queries will also take into account and display the unused modules, which are not present in the module resolution graph after selection (due to the Minimal-Version Selection or override rules). This can have different effects for each of the query types i.e. include new paths in the all_paths command, or extra dependants in the explain command.
+Tags:
+terminal_output
+
--output=<text, json or graph> default: "text"The format in which the query results should be printed. Allowed values for query are: text, json, graph
+Tags:
+terminal_output
+
--[no]verbose default: "false"The queries will also display the reason why modules were resolved to their current version (if changed). Defaults to true only for the explain query.
+Tags:
+terminal_output
+
--[no]verbose_visibility_errors default: "false"If enabled, visibility errors include additional diagnostic information.
+Tags:
+build_file_semantics, non_configurable
+
--flag_alias=<a 'name=value' flag alias> multiple uses are accumulatedSets a shorthand name for a Starlark flag. It takes a single key-value pair in the form "<key>=<value>" as an argument.
+Tags:
+changes_inputs, non_configurable
+
--deleted_packages=<comma-separated list of package names> multiple uses are accumulatedA comma-separated list of names of packages which the build system will consider non-existent, even if they are visible somewhere on the package path. +Use this option when deleting a subpackage 'x/y' of an existing package 'x'. For example, after deleting x/y/BUILD in your client, the build system may complain if it encounters a label '//x:y/z' if that is still provided by another package_path entry. Specifying --deleted_packages x/y avoids this problem.
+--[no]fetch default: "true"Allows the command to fetch external dependencies. If set to false, the command will utilize any cached version of the dependency, and if none exists, the command will result in failure.
+--package_path=<colon-separated list of options> default: "%workspace%"A colon-separated list of where to look for packages. Elements beginning with '%workspace%' are relative to the enclosing workspace. If omitted or empty, the default is the output of 'bazel info default-package-path'.
+--[no]show_loading_progress default: "true"If enabled, causes Bazel to print "Loading package:" messages.
+Inherits all options from build.
+ +--print_action_mnemonics=<a string> multiple uses are accumulatedLists which mnemonics to filter print_action data by, no filtering takes place when left empty.
+--[no]experimental_remotable_source_manifests default: "false"Whether to make source manifest actions remotable
+Tags:
+loading_and_analysis, execution, experimental
+
--[no]experimental_strict_fileset_output default: "false"If this option is enabled, filesets will treat all output artifacts as regular files. They will not traverse directories or be sensitive to symlinks.
+Tags:
+execution, experimental
+
--[no]incompatible_modify_execution_info_additive default: "true"When enabled, passing multiple --modify_execution_info flags is additive. When disabled, only the last flag is taken into account.
+Tags:
+execution, affects_outputs, loading_and_analysis, incompatible_change
+
--[no]keep_going [-k] default: "false"Continue as much as possible after an error. While the target that failed and those that depend on it cannot be analyzed, other prerequisites of these targets can be.
+Tags:
+eagerness_to_exit
+
--loading_phase_threads=<an integer, or a keyword ("auto", "HOST_CPUS", "HOST_RAM"), optionally followed by an operation ([-|*]<float>) eg. "auto", "HOST_CPUS*.5"> default: "auto"Number of parallel threads to use for the loading/analysis phase.Takes an integer, or a keyword ("auto", "HOST_CPUS", "HOST_RAM"), optionally followed by an operation ([-|]<float>) eg. "auto", "HOST_CPUS.5". "auto" sets a reasonable default based on host resources. Must be at least 1.
+Tags:
+bazel_internal_configuration
+
--modify_execution_info=<regex=[+-]key,regex=[+-]key,...> multiple uses are accumulatedAdd or remove keys from an action's execution info based on action mnemonic. Applies only to actions which support execution info. Many common actions support execution info, e.g. Genrule, CppCompile, Javac, StarlarkAction, TestRunner. When specifying multiple values, order matters because many regexes may apply to the same mnemonic.
+Syntax: "regex=[+-]key,regex=[+-]key,...".
+Examples: +'.=+x,.=-y,.=+z' adds 'x' and 'z' to, and removes 'y' from, the execution info for all actions. +'Genrule=+requires-x' adds 'requires-x' to the execution info for all Genrule actions. +'(?!Genrule).=-requires-x' removes 'requires-x' from the execution info for all non-Genrule actions.
+Tags:
+execution, affects_outputs, loading_and_analysis
+
--[no]use_target_platform_for_tests default: "false"If true, use the target platform for running tests rather than the test exec group.
+Tags:
+execution
+
--[no]incompatible_bazel_test_exec_run_under default: "true"If enabled, "bazel test --run_under=//:runner" builds "//:runner" in the exec configuration. If disabled, it builds "//:runner" in the target configuration. Bazel executes tests on exec machines, so the former is more correct. This doesn't affect "bazel run", which always builds "`--run_under=//foo" in the target configuration.
+Tags:
+affects_outputs, incompatible_change
+
--[no]build_runfile_links default: "true"If true, build runfiles symlink forests for all targets. If false, write them only when required by a local action, test or run command.
+Tags:
+affects_outputs
+
--[no]build_runfile_manifests default: "true"If true, write runfiles manifests for all targets. If false, omit them. Local tests will fail to run when false.
+Tags:
+affects_outputs
+
--[no]incompatible_always_include_files_in_data default: "true"If true, native rules add <code>DefaultInfo.files</code> of data dependencies to their runfiles, which matches the recommended behavior for Starlark rules (https://bazel.build/extending/rules#runfiles_features_to_avoid).
+Tags:
+affects_outputs, incompatible_change
+
--[no]incompatible_compact_repo_mapping_manifest default: "false"If enabled, the <binary>.repo_mapping file emits a module extension's repo mapping only once instead of once for each repo generated by the extension that contributes runfiles.
+Tags:
+affects_outputs, incompatible_change
+
--incompatible_disable_select_on=<comma-separated set of options> default: ""List of flags for which the use in select() is disabled.
+Tags:
+loading_and_analysis, incompatible_change, non_configurable
+
--[no]incompatible_filegroup_runfiles_for_data default: "true"If true, runfiles of targets listed in the srcs attribute are available to targets that consume the filegroup as a data dependency.
+Tags:
+incompatible_change
+
--action_env=<a 'name[=value]' assignment with an optional value part or the special syntax '=name' to unset a variable> multiple uses are accumulatedSpecifies the set of environment variables available to actions with target configuration. Variables can be either specified by <code>name</code>, in which case +the value will be taken from the invocation environment, by the <code>name=value</code> pair which sets the value independent of the invocation environment, or by <code>=name</code>, which unsets the variable of that name. This option can be used multiple times; for options given for the same variable, the latest wins, options for different variables accumulate. +<br> +Note that unless <code>--incompatible_repo_env_ignores_action_env</code> is true, all <code>name=value</code> pairs will be available to repository rules.
+Tags:
+action_command_lines
+
--allowed_cpu_values=<comma-separated set of options> default: ""Allowed values for the --cpu flag.
+Tags:
+changes_inputs, affects_outputs
+
--[no]collect_code_coverage default: "false"If specified, Bazel will instrument code (using offline instrumentation where possible) and will collect coverage information during tests. Only targets that match --instrumentation_filter will be affected. Usually this option should not be specified directly - 'bazel coverage' command should be used instead.
+Tags:
+affects_outputs
+
--compilation_mode=<fastbuild, dbg or opt> [-c] default: "fastbuild"Specify the mode the binary will be built in. Values: 'fastbuild', 'dbg', 'opt'.
+Tags:
+affects_outputs, action_command_lines
+
--cpu=<a string> default: ""Deprecated: this flag is not used internally by Blaze although there are legacy platform mappings to allow for backwards compatibility. Do not use this flag, instead use --platforms with an appropriate platform definition.
+Tags:
+changes_inputs, affects_outputs
+
--define=<a 'name=value' assignment> multiple uses are accumulatedEach --define option specifies an assignment for a build variable. In case of multiple values for a variable, the last one wins.
+Tags:
+changes_inputs, affects_outputs
+
--[no]enable_runfiles default: "auto"Enable runfiles symlink tree; By default, it's off on Windows, on on other platforms.
+Tags:
+affects_outputs
+
--exec_aspects=<comma-separated list of options> multiple uses are accumulatedComma-separated list of aspects to be applied to exec-configured targets, regardless of whether or not they are top-level targets. This is an experimental feature and is subject to change.
+Tags:
+loading_and_analysis
+
--experimental_action_listener=<a build target label> multiple uses are accumulatedDeprecated in favor of aspects. Use action_listener to attach an extra_action to existing build actions.
+Tags:
+execution, experimental
+
--[no]experimental_collect_code_coverage_for_generated_files default: "false"If specified, Bazel will also generate collect coverage information for generated files.
+Tags:
+affects_outputs, experimental
+
--experimental_output_paths=<off or strip> default: "off"Which model to use for where in the output tree rules write their outputs, particularly for multi-platform / multi-configuration builds. This is highly experimental. See https://github.com/bazelbuild/bazel/issues/6526 for details. Starlark actions canopt into path mapping by adding the key 'supports-path-mapping' to the 'execution_requirements' dict.
+Tags:
+loses_incremental_state, bazel_internal_configuration, affects_outputs, execution
+
--experimental_override_platform_cpu_name=<a 'label=value' assignment> multiple uses are accumulatedEach entry should be of the form label=value where label refers to a platform and values is the desired shortname to override the platform's CPU name in $(TARGET_CPU) make variable and output path. Only used when --experimental_platform_in_output_dir, --incompatible_target_cpu_from_platform or --incompatible_bep_cpu_from_platform is true. Has highest naming priority.
+Tags:
+affects_outputs, experimental
+
--[no]experimental_platform_in_output_dir default: "false"If true, a shortname for the target platform is used in the output directory name instead of the CPU. If auto, this is only applied for the exec configuration. The exact scheme is experimental and subject to change: First, in the rare case the --platforms option does not have exactly one value, a hash of the platforms option is used. Next, if any shortname for the current platform was registered by --experimental_override_name_platform_in_output_dir, then that shortname is used. Then, if --experimental_use_platforms_in_output_dir_legacy_heuristic is set, use a shortname based off the current platform Label. Finally, a hash of the platform option is used as a last resort.
+Tags:
+affects_outputs, experimental
+
--[no]experimental_use_platforms_in_output_dir_legacy_heuristic default: "true"Please only use this flag as part of a suggested migration or testing strategy. Note that the heuristic has known deficiencies and it is suggested to migrate to relying on just --experimental_override_name_platform_in_output_dir.
+Tags:
+affects_outputs, experimental
+
--features=<a string> multiple uses are accumulatedThe given features will be enabled or disabled by default for targets built in the target configuration. Specifying -<feature> will disable the feature. Negative features always override positive ones. See also --host_features
+Tags:
+changes_inputs, affects_outputs
+
--host_action_env=<a 'name[=value]' assignment with an optional value part or the special syntax '=name' to unset a variable> multiple uses are accumulatedSpecifies the set of environment variables available to actions with execution configurations. Variables can be either specified by name, in which case the value will be taken from the invocation environment, by the name=value pair which sets the value independent of the invocation environment, or by <code>=name</code>, which unsets the variable of that name. This option can be used multiple times; for options given for the same variable, the latest wins, options for different variables accumulate.
+Tags:
+action_command_lines
+
--host_compilation_mode=<fastbuild, dbg or opt> default: "opt"Specify the mode the tools used during the build will be built in. Values: 'fastbuild', 'dbg', 'opt'.
+Tags:
+affects_outputs, action_command_lines
+
--host_cpu=<a string> default: ""The host CPU.
+Tags:
+changes_inputs, affects_outputs
+
--host_features=<a string> multiple uses are accumulatedThe given features will be enabled or disabled by default for targets built in the exec configuration. Specifying -<feature> will disable the feature. Negative features always override positive ones.
+Tags:
+changes_inputs, affects_outputs
+
--[no]incompatible_auto_exec_groups default: "false"When enabled, an exec groups is automatically created for each toolchain used by a rule. For this to work rule needs to specify toolchain parameter on its actions. For more information, see https://github.com/bazelbuild/bazel/issues/17134.
Tags:
+affects_outputs, incompatible_change
+
--[no]incompatible_merge_genfiles_directory default: "true"If true, the genfiles directory is folded into the bin directory.
+Tags:
+affects_outputs, incompatible_change
+
--[no]incompatible_target_cpu_from_platform default: "true"If specified, the value of the cpu constraint (@platforms//cpu:cpu) of the target platform is used to set the $(TARGET_CPU) make variable.
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]instrument_test_targets default: "false"When coverage is enabled, specifies whether to consider instrumenting test rules. When set, test rules included by --instrumentation_filter are instrumented. Otherwise, test rules are always excluded from coverage instrumentation.
+Tags:
+affects_outputs
+
--instrumentation_filter=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths> default: "-/javatests[/:],-/test/java[/:]"When coverage is enabled, only rules with names included by the specified regex-based filter will be instrumented. Rules prefixed with '-' are excluded instead. Note that only non-test rules are instrumented unless --instrument_test_targets is enabled.
+Tags:
+affects_outputs
+
--platform_suffix=<a string> default: see descriptionSpecifies a suffix to be added to the configuration directory.
+Tags:
+loses_incremental_state, affects_outputs, loading_and_analysis
+
--run_under=<a prefix in front of command> default: see descriptionPrefix to insert before the executables for the 'test' and 'run' commands. If the value is 'foo -bar', and the execution command line is 'test_binary -baz', then the final command line is 'foo -bar test_binary -baz'.This can also be a label to an executable target. Some examples are: 'valgrind', 'strace', 'strace -c', 'valgrind --quiet --num-callers=20', '//package:target', '//package:target --options'.
+Tags:
+action_command_lines
+
--[no]stamp default: "false"Stamp binaries with the date, username, hostname, workspace information, etc.
+Tags:
+affects_outputs
+
--[no]check_visibility default: "true"If disabled, visibility errors in target dependencies are demoted to warnings.
+Tags:
+build_file_semantics, non_configurable
+
--[no]enforce_constraints default: "true"Checks the environments each target is compatible with and reports errors if any target has dependencies that don't support the same environments
+Tags:
+build_file_semantics
+
--[no]experimental_enforce_transitive_visibility default: "false"If true, enable package()s to set the transitive_visibility attribute to restrict which packages may depend on them.
+Tags:
+build_file_semantics, experimental
+
--[no]incompatible_check_testonly_for_output_files default: "false"If enabled, check testonly for prerequisite targets that are output files by looking up the testonly of the generating rule. This matches visibility checking.
+Tags:
+build_file_semantics, incompatible_change
+
--[no]strict_filesets default: "false"If this option is enabled, filesets crossing package boundaries are reported as errors.
+Tags:
+build_file_semantics, eagerness_to_exit
+
--target_environment=<a build target label> multiple uses are accumulatedDeclares this build's target environment. Must be a label reference to an "environment" rule. If specified, all top-level targets must be compatible with this environment.
+Tags:
+changes_inputs
+
--[no]incompatible_config_setting_private_default_visibility default: "false"If incompatible_enforce_config_setting_visibility=false, this is a noop. Else, if this flag is false, any config_setting without an explicit visibility attribute is //visibility:public. If this flag is true, config_setting follows the same visibility logic as all other rules. See https://github.com/bazelbuild/bazel/issues/12933.
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]incompatible_enforce_config_setting_visibility default: "true"If true, enforce config_setting visibility restrictions. If false, every config_setting is visible to every target. See https://github.com/bazelbuild/bazel/issues/12932.
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]allow_analysis_failures default: "false"If true, an analysis failure of a rule target results in the target's propagation of an instance of AnalysisFailureInfo containing the error description, instead of resulting in a build failure.
+Tags:
+loading_and_analysis, experimental
+
--analysis_testing_deps_limit=<an integer> default: "2000"Sets the maximum number of transitive dependencies through a rule attribute with a for_analysis_testing configuration transition. Exceeding this limit will result in a rule error.
+Tags:
+loading_and_analysis
+
--aspect_deps=<off, conservative or precise> default: "conservative"How to resolve aspect dependencies when the output format is one of {xml,proto,record}. 'off' means no aspect dependencies are resolved, 'conservative' (the default) means all declared aspect dependencies are added regardless of whether they are given the rule class of direct dependencies, 'precise' means that only those aspects are added that are possibly active given the rule class of the direct dependencies. Note that precise mode requires loading other packages to evaluate a single target thus making it slower than the other modes. Also note that even precise mode is not completely precise: the decision whether to compute an aspect is decided in the analysis phase, which is not run during 'bazel query'.
+Tags:
+build_file_semantics
+
--[no]consistent_labels default: "false"If enabled, every query command emits labels as if by the Starlark <code>str</code> function applied to a <code>Label</code> instance. This is useful for tools that need to match the output of different query commands and/or labels emitted by rules. If not enabled, output formatters are free to emit apparent repository names (relative to the main repository) instead to make the output more readable.
+Tags:
+terminal_output
+
--[no]experimental_explicit_aspects default: "false"aquery, cquery: whether to include aspect-generated actions in the output. query: no-op (aspects are always followed).
+Tags:
+terminal_output
+
--[no]experimental_graphless_query default: "auto"If true, uses a Query implementation that does not make a copy of the graph. The new implementation only supports --order_output=no, as well as only a subset of output formatters.
+Tags:
+build_file_semantics, eagerness_to_exit
+
--graph:conditional_edges_limit=<an integer> default: "4"The maximum number of condition labels to show. -1 means no truncation and 0 means no annotation. This option is only applicable to --output=graph.
+Tags:
+terminal_output
+
--[no]graph:factored default: "true"If true, then the graph will be emitted 'factored', i.e. topologically-equivalent nodes will be merged together and their labels concatenated. This option is only applicable to --output=graph.
+Tags:
+terminal_output
+
--graph:node_limit=<an integer> default: "512"The maximum length of the label string for a graph node in the output. Longer labels will be truncated; -1 means no truncation. This option is only applicable to --output=graph.
+Tags:
+terminal_output
+
--[no]implicit_deps default: "true"If enabled, implicit dependencies will be included in the dependency graph over which the query operates. An implicit dependency is one that is not explicitly specified in the BUILD file but added by bazel. For cquery, this option controls filtering resolved toolchains.
+Tags:
+build_file_semantics
+
--[no]include_aspects default: "true"aquery, cquery: whether to include aspect-generated actions in the output. query: no-op (aspects are always followed).
+Tags:
+terminal_output
+
--[no]incompatible_lexicographical_output default: "true"If this option is set, sorts --order_output=auto output in lexicographical order.
+Tags:
+terminal_output, incompatible_change
+
--[no]incompatible_package_group_includes_double_slash default: "true"If enabled, when outputting package_group's packages attribute, the leading // will not be omitted.
Tags:
+terminal_output, incompatible_change
+
--[no]infer_universe_scope default: "false"If set and --universe_scope is unset, then a value of --universe_scope will be inferred as the list of unique target patterns in the query expression. Note that the --universe_scope value inferred for a query expression that uses universe-scoped functions (e.g.allrdeps) may not be what you want, so you should use this option only if you know what you are doing. See https://bazel.build/reference/query#sky-query for details and examples. If --universe_scope is set, then this option's value is ignored. Note: this option applies only to query (i.e. not cquery).
Tags:
+loading_and_analysis
+
--[no]line_terminator_null default: "false"Whether each format is terminated with \0 instead of newline.
+Tags:
+terminal_output
+
--[no]nodep_deps default: "true"If enabled, deps from "nodep" attributes will be included in the dependency graph over which the query operates. A common example of a "nodep" attribute is "visibility". Run and parse the output of info build-language to learn about all the "nodep" attributes in the build language.
Tags:
+build_file_semantics
+
--noorder_resultsOutput the results in dependency-ordered (default) or unordered fashion. The unordered output is faster but only supported when --output is not minrank, maxrank, or graph.
+Expands to:
+
--order_output=no
+
Tags:
+terminal_output
+
--nullWhether each format is terminated with \0 instead of newline.
+Expands to:
+
--line_terminator_null=true
+
Tags:
+terminal_output
+
--order_output=<no, deps, auto or full> default: "auto"Output the results unordered (no), dependency-ordered (deps), or fully ordered (full). The default is 'auto', meaning that results are output either dependency-ordered or fully ordered, depending on the output formatter (dependency-ordered for proto, minrank, maxrank, and graph, fully ordered for all others). When output is fully ordered, nodes are printed in a fully deterministic (total) order. First, all nodes are sorted alphabetically. Then, each node in the list is used as the start of a post-order depth-first search in which outgoing edges to unvisited nodes are traversed in alphabetical order of the successor nodes. Finally, nodes are printed in the reverse of the order in which they were visited.
+Tags:
+terminal_output
+
--order_resultsOutput the results in dependency-ordered (default) or unordered fashion. The unordered output is faster but only supported when --output is not minrank, maxrank, or graph.
+Expands to:
+
--order_output=auto
+
Tags:
+terminal_output
+
--output=<a string> default: "label"The format in which the query results should be printed. Allowed values for query are: build, graph, streamed_jsonproto, label, label_kind, location, maxrank, minrank, package, proto, streamed_proto, xml.
+Tags:
+terminal_output
+
--output_file=<a string> default: ""When specified, query results will be written directly to this file, and nothing will be printed to Bazel's standard output stream (stdout). In benchmarks, this is generally faster than <code>bazel query > file</code>.
+Tags:
+terminal_output
+
--[no]proto:default_values default: "true"If true, attributes whose value is not explicitly specified in the BUILD file are included; otherwise they are omitted. This option is applicable to --output=proto
+Tags:
+terminal_output
+
--[no]proto:definition_stack default: "false"Populate the definition_stack proto field, which records for each rule instance the Starlark call stack at the moment the rule's class was defined.
+Tags:
+terminal_output
+
--[no]proto:flatten_selects default: "true"If enabled, configurable attributes created by select() are flattened. For list types the flattened representation is a list containing each value of the select map exactly once. Scalar types are flattened to null.
+Tags:
+build_file_semantics
+
--[no]proto:include_attribute_source_aspects default: "false"Populate the source_aspect_name proto field of each Attribute with the source aspect that the attribute came from (empty string if it did not).
+Tags:
+terminal_output
+
--[no]proto:include_starlark_rule_env default: "true"Use the starlark environment in the value of the generated $internal_attr_hash attribute. This ensures that the starlark rule definition (and its transitive imports) are part of this identifier.
+Tags:
+terminal_output
+
--[no]proto:include_synthetic_attribute_hash default: "false"Whether or not to calculate and populate the $internal_attr_hash attribute.
+Tags:
+terminal_output
+
--[no]proto:instantiation_stack default: "false"Populate the instantiation call stack of each rule. Note that this requires the stack to be present
+Tags:
+terminal_output
+
--[no]proto:locations default: "true"Whether to output location information in proto output at all.
+Tags:
+terminal_output
+
--proto:output_rule_attrs=<comma-separated list of options> default: "all"Comma separated list of attributes to include in output. Defaults to all attributes. Set to empty string to not output any attribute. This option is applicable to --output=proto.
+Tags:
+terminal_output
+
--[no]proto:rule_classes default: "false"Populate the rule_class_key field of each rule; and for the first rule with a given rule_class_key, also populate its rule_class_info proto field. The rule_class_key field uniquely identifies a rule class, and the rule_class_info field is a Stardoc-format rule class API definition.
+Tags:
+terminal_output
+
--[no]proto:rule_inputs_and_outputs default: "true"Whether or not to populate the rule_input and rule_output fields.
+Tags:
+terminal_output
+
--query_file=<a string> default: ""If set, query will read the query from the file named here, rather than on the command line. It is an error to specify a file here as well as a command-line query.
+Tags:
+changes_inputs
+
--[no]relative_locations default: "false"If true, the location of BUILD files in xml and proto outputs will be relative. By default, the location output is an absolute path and will not be consistent across machines. You can set this option to true to have a consistent result across machines.
+Tags:
+terminal_output
+
--[no]strict_test_suite default: "false"If true, the tests() expression gives an error if it encounters a test_suite containing non-test targets.
+Tags:
+build_file_semantics, eagerness_to_exit
+
--[no]tool_deps default: "true"Query: If disabled, dependencies on 'exec configuration' will not be included in the dependency graph over which the query operates. An 'exec configuration' dependency edge, such as the one from any 'proto_library' rule to the Protocol Compiler, usually points to a tool executed during the build rather than a part of the same 'target' program. +Cquery: If disabled, filters out all configured targets which cross an execution transition from the top-level target that discovered this configured target. That means if the top-level target is in the target configuration, only configured targets also in the target configuration will be returned. If the top-level target is in the exec configuration, only exec configured targets will be returned. This option will NOT exclude resolved toolchains.
+Tags:
+build_file_semantics
+
--universe_scope=<comma-separated list of options> default: ""A comma-separated set of target patterns (additive and subtractive). The query may be performed in the universe defined by the transitive closure of the specified targets. This option is used for the query and cquery commands. +For cquery, the input to this option is the targets all answers are built under and so this option may affect configurations and transitions. If this option is not specified, the top-level targets are assumed to be the targets parsed from the query expression. Note: For cquery, not specifying this option may cause the build to break if targets parsed from the query expression are not buildable with top-level options.
+Tags:
+loading_and_analysis
+
--[no]xml:default_values default: "false"If true, rule attributes whose value is not explicitly specified in the BUILD file are printed; otherwise they are omitted.
+Tags:
+terminal_output
+
--[no]xml:line_numbers default: "true"If true, XML output contains line numbers. Disabling this option may make diffs easier to read. This option is only applicable to --output=xml.
+Tags:
+terminal_output
+
--[no]verbose_visibility_errors default: "false"If enabled, visibility errors include additional diagnostic information.
+Tags:
+build_file_semantics, non_configurable
+
--flag_alias=<a 'name=value' flag alias> multiple uses are accumulatedSets a shorthand name for a Starlark flag. It takes a single key-value pair in the form "<key>=<value>" as an argument.
+Tags:
+changes_inputs, non_configurable
+
--deleted_packages=<comma-separated list of package names> multiple uses are accumulatedA comma-separated list of names of packages which the build system will consider non-existent, even if they are visible somewhere on the package path. +Use this option when deleting a subpackage 'x/y' of an existing package 'x'. For example, after deleting x/y/BUILD in your client, the build system may complain if it encounters a label '//x:y/z' if that is still provided by another package_path entry. Specifying --deleted_packages x/y avoids this problem.
+--[no]fetch default: "true"Allows the command to fetch external dependencies. If set to false, the command will utilize any cached version of the dependency, and if none exists, the command will result in failure.
+--package_path=<colon-separated list of options> default: "%workspace%"A colon-separated list of where to look for packages. Elements beginning with '%workspace%' are relative to the enclosing workspace. If omitted or empty, the default is the output of 'bazel info default-package-path'.
+--[no]show_loading_progress default: "true"If enabled, causes Bazel to print "Loading package:" messages.
+Inherits all options from build.
+ +--[no]portable_paths default: "false"If true, includes paths to replace in ExecRequest to make the resulting paths portable.
+Tags:
+affects_outputs
+
--[no]run default: "true"If false, skip running the command line constructed for the built target. Note that this flag is ignored for all --script_path builds.
+Tags:
+affects_outputs
+
--run_env=<a 'name[=value]' assignment with an optional value part or the special syntax '=name' to unset a variable> multiple uses are accumulatedSpecifies the set of environment variables available to the target to run. Variables can be either specified by name, in which case the value will be taken from the invocation environment, by the <code>name=value</code> pair which sets the value independent of the invocation environment, or by <code>=name</code>, which unsets the variable of that name. This option can be used multiple times; for options given for the same variable, the latest wins, options for different variables accumulate. Note that the executed target will generally see the full environment of the host except for those variables that have been explicitly unset.
+Tags:
+affects_outputs
+
--script_path=<a path> default: see descriptionIf set, write a shell script to the given file which invokes the target. If this option is set, the target is not run from bazel. Use 'bazel run --script_path=foo //foo && ./foo' to invoke target '//foo' This differs from 'bazel run //foo' in that the bazel lock is released and the executable is connected to the terminal's stdin.
+Tags:
+affects_outputs, execution
+
--iff_heap_size_greater_than=<an integer> default: "0"Iff non-zero, then shutdown will only shut down the server if the total memory (in MB) consumed by the JVM exceeds this value.
+Tags:
+loses_incremental_state, eagerness_to_exit
+
Inherits all options from build.
+ +--[no]print_relative_test_log_paths default: "false"If true, when printing the path to a test log, use relative path that makes use of the 'testlogs' convenience symlink. N.B. - A subsequent 'build'/'test'/etc invocation with a different configuration can cause the target of this symlink to change, making the path printed previously no longer useful.
+Tags:
+affects_outputs
+
--[no]test_verbose_timeout_warnings default: "false"If true, print additional warnings when the actual test execution time does not match the timeout defined by the test (whether implied or explicit).
+Tags:
+affects_outputs
+
--[no]verbose_test_summary default: "true"If true, print additional information (timing, number of failed runs, etc) in the test summary.
+Tags:
+affects_outputs
+
Inherits all options from test.
+ +--[no]keep_going [-k] default: "false"Continue as much as possible after an error. While the target that failed and those that depend on it cannot be analyzed, other prerequisites of these targets can be.
+Tags:
+eagerness_to_exit
+
--loading_phase_threads=<an integer, or a keyword ("auto", "HOST_CPUS", "HOST_RAM"), optionally followed by an operation ([-|*]<float>) eg. "auto", "HOST_CPUS*.5"> default: "auto"Number of parallel threads to use for the loading/analysis phase.Takes an integer, or a keyword ("auto", "HOST_CPUS", "HOST_RAM"), optionally followed by an operation ([-|]<float>) eg. "auto", "HOST_CPUS.5". "auto" sets a reasonable default based on host resources. Must be at least 1.
+Tags:
+bazel_internal_configuration
+
--[no]incompatible_config_setting_private_default_visibility default: "false"If incompatible_enforce_config_setting_visibility=false, this is a noop. Else, if this flag is false, any config_setting without an explicit visibility attribute is //visibility:public. If this flag is true, config_setting follows the same visibility logic as all other rules. See https://github.com/bazelbuild/bazel/issues/12933.
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]incompatible_enforce_config_setting_visibility default: "true"If true, enforce config_setting visibility restrictions. If false, every config_setting is visible to every target. See https://github.com/bazelbuild/bazel/issues/12932.
+Tags:
+loading_and_analysis, incompatible_change
+
--repo=<a string> multiple uses are accumulatedOnly vendors the specified repository, which can be either @apparent_repo_name or @@canonical_repo_name. This option can be set multiple times
Tags:
+changes_inputs
+
--deleted_packages=<comma-separated list of package names> multiple uses are accumulatedA comma-separated list of names of packages which the build system will consider non-existent, even if they are visible somewhere on the package path. +Use this option when deleting a subpackage 'x/y' of an existing package 'x'. For example, after deleting x/y/BUILD in your client, the build system may complain if it encounters a label '//x:y/z' if that is still provided by another package_path entry. Specifying --deleted_packages x/y avoids this problem.
+--[no]fetch default: "true"Allows the command to fetch external dependencies. If set to false, the command will utilize any cached version of the dependency, and if none exists, the command will result in failure.
+--package_path=<colon-separated list of options> default: "%workspace%"A colon-separated list of where to look for packages. Elements beginning with '%workspace%' are relative to the enclosing workspace. If omitted or empty, the default is the output of 'bazel info default-package-path'.
+--[no]show_loading_progress default: "true"If enabled, causes Bazel to print "Loading package:" messages.
+--[no]experimental_persistent_aar_extractor default: "false"Enable persistent aar extractor by using workers.
+Tags:
+execution, experimental
+
--[no]experimental_remotable_source_manifests default: "false"Whether to make source manifest actions remotable
+Tags:
+loading_and_analysis, execution, experimental
+
--[no]experimental_split_coverage_postprocessing default: "false"If true, then Bazel will run coverage postprocessing for test in a new spawn.
+Tags:
+execution, experimental
+
--[no]experimental_strict_fileset_output default: "false"If this option is enabled, filesets will treat all output artifacts as regular files. They will not traverse directories or be sensitive to symlinks.
+Tags:
+execution, experimental
+
--[no]incompatible_modify_execution_info_additive default: "true"When enabled, passing multiple --modify_execution_info flags is additive. When disabled, only the last flag is taken into account.
+Tags:
+execution, affects_outputs, loading_and_analysis, incompatible_change
+
--modify_execution_info=<regex=[+-]key,regex=[+-]key,...> multiple uses are accumulatedAdd or remove keys from an action's execution info based on action mnemonic. Applies only to actions which support execution info. Many common actions support execution info, e.g. Genrule, CppCompile, Javac, StarlarkAction, TestRunner. When specifying multiple values, order matters because many regexes may apply to the same mnemonic.
+Syntax: "regex=[+-]key,regex=[+-]key,...".
+Examples: +'.=+x,.=-y,.=+z' adds 'x' and 'z' to, and removes 'y' from, the execution info for all actions. +'Genrule=+requires-x' adds 'requires-x' to the execution info for all Genrule actions. +'(?!Genrule).=-requires-x' removes 'requires-x' from the execution info for all non-Genrule actions.
+Tags:
+execution, affects_outputs, loading_and_analysis
+
--persistent_android_dex_desugarEnable persistent Android dex and desugar actions by using workers.
+Expands to:
+
--internal_persistent_android_dex_desugar
+
--strategy=Desugar=worker
+
--strategy=DexBuilder=worker
+
Tags:
+host_machine_resource_optimizations, execution
+
--persistent_android_resource_processorEnable persistent Android resource processor by using workers.
+Expands to:
+
--internal_persistent_busybox_tools
+
--strategy=AaptPackage=worker
+
--strategy=AndroidResourceParser=worker
+
--strategy=AndroidResourceValidator=worker
+
--strategy=AndroidResourceCompiler=worker
+
--strategy=RClassGenerator=worker
+
--strategy=AndroidResourceLink=worker
+
--strategy=AndroidAapt2=worker
+
--strategy=AndroidAssetMerger=worker
+
--strategy=AndroidResourceMerger=worker
+
--strategy=AndroidCompiledResourceMerger=worker
+
--strategy=ManifestMerger=worker
+
--strategy=AndroidManifestMerger=worker
+
--strategy=Aapt2Optimize=worker
+
--strategy=AARGenerator=worker
+
--strategy=ProcessDatabinding=worker
+
--strategy=GenerateDataBindingBaseClasses=worker
+
Tags:
+host_machine_resource_optimizations, execution
+
--persistent_multiplex_android_dex_desugarEnable persistent multiplexed Android dex and desugar actions by using workers.
+Expands to:
+
--persistent_android_dex_desugar
+
--internal_persistent_multiplex_android_dex_desugar
+
Tags:
+host_machine_resource_optimizations, execution
+
--persistent_multiplex_android_resource_processorEnable persistent multiplexed Android resource processor by using workers.
+Expands to:
+
--persistent_android_resource_processor
+
--modify_execution_info=AaptPackage=+supports-multiplex-workers
+
--modify_execution_info=AndroidResourceParser=+supports-multiplex-workers
+
--modify_execution_info=AndroidResourceValidator=+supports-multiplex-workers
+
--modify_execution_info=AndroidResourceCompiler=+supports-multiplex-workers
+
--modify_execution_info=RClassGenerator=+supports-multiplex-workers
+
--modify_execution_info=AndroidResourceLink=+supports-multiplex-workers
+
--modify_execution_info=AndroidAapt2=+supports-multiplex-workers
+
--modify_execution_info=AndroidAssetMerger=+supports-multiplex-workers
+
--modify_execution_info=AndroidResourceMerger=+supports-multiplex-workers
+
--modify_execution_info=AndroidCompiledResourceMerger=+supports-multiplex-workers
+
--modify_execution_info=ManifestMerger=+supports-multiplex-workers
+
--modify_execution_info=AndroidManifestMerger=+supports-multiplex-workers
+
--modify_execution_info=Aapt2Optimize=+supports-multiplex-workers
+
--modify_execution_info=AARGenerator=+supports-multiplex-workers
+
Tags:
+host_machine_resource_optimizations, execution
+
--persistent_multiplex_android_toolsEnable persistent and multiplexed Android tools (dexing, desugaring, resource processing).
+Expands to:
+
--internal_persistent_multiplex_busybox_tools
+
--persistent_multiplex_android_resource_processor
+
--persistent_multiplex_android_dex_desugar
+
Tags:
+host_machine_resource_optimizations, execution
+
--[no]use_target_platform_for_tests default: "false"If true, use the target platform for running tests rather than the test exec group.
+Tags:
+execution
+
--android_compiler=<a string> default: see descriptionThe Android target compiler.
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state
+
--android_manifest_merger=<legacy, android or force_android> default: "android"Selects the manifest merger to use for android_binary rules. Flag to help the transition to the Android manifest merger from the legacy merger.
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state
+
--android_platforms=<a build target label> default: ""Sets the platforms that android_binary targets use. If multiple platforms are specified, then the binary is a fat APKs, which contains native binaries for each specified target platform.
+Tags:
+changes_inputs, loading_and_analysis, loses_incremental_state
+
--cc_output_directory_tag=<a string> default: ""Specifies a suffix to be added to the configuration directory.
+Tags:
+affects_outputs
+
--compiler=<a string> default: see descriptionThe C++ compiler to use for compiling the target.
+Tags:
+loading_and_analysis, execution
+
--coverage_output_generator=<a build target label> default: "@bazel_tools//tools/test:lcov_merger"Location of the binary that is used to postprocess raw coverage reports. This must be a binary target. Defaults to '//tools/test:lcov_merger'.
+Tags:
+changes_inputs, affects_outputs, loading_and_analysis
+
--coverage_report_generator=<a build target label> default: "@bazel_tools//tools/test:coverage_report_generator"Location of the binary that is used to generate coverage reports. This must be a binary target. Defaults to '//tools/test:coverage_report_generator'.
+Tags:
+changes_inputs, affects_outputs, loading_and_analysis
+
--coverage_support=<a build target label> default: "@bazel_tools//tools/test:coverage_support"Location of support files that are required on the inputs of every test action that collects code coverage. Defaults to '//tools/test:coverage_support'.
+Tags:
+changes_inputs, affects_outputs, loading_and_analysis
+
--custom_malloc=<a build target label> default: see descriptionSpecifies a custom malloc implementation. This setting overrides malloc attributes in build rules.
+Tags:
+changes_inputs, affects_outputs
+
--[no]experimental_include_xcode_execution_requirements default: "false"If set, add a "requires-xcode:{version}" execution requirement to every Xcode action. If the Xcode version has a hyphenated label, also add a "requires-xcode-label:{version_label}" execution requirement.
+Tags:
+loses_incremental_state, loading_and_analysis, execution, experimental
+
--[no]experimental_prefer_mutual_xcode default: "true"If true, use the most recent Xcode that is available both locally and remotely. If false, or if there are no mutual available versions, use the local Xcode version selected via xcode-select.
+Tags:
+loses_incremental_state, experimental
+
--extra_execution_platforms=<comma-separated list of options> default: ""The platforms that are available as execution platforms to run actions. Platforms can be specified by exact target, or as a target pattern. These platforms will be considered before those declared in the WORKSPACE file by register_execution_platforms(). This option may only be set once; later instances will override earlier flag settings.
+Tags:
+execution
+
--extra_toolchains=<comma-separated list of options> multiple uses are accumulatedThe toolchain rules to be considered during toolchain resolution. Toolchains can be specified by exact target, or as a target pattern. These toolchains will be considered before those declared in the WORKSPACE file by register_toolchains().
+Tags:
+affects_outputs, changes_inputs, loading_and_analysis
+
--grte_top=<a label> default: see descriptionA label to a checked-in libc library. The default value is selected by the crosstool toolchain, and you almost never need to override it.
+Tags:
+action_command_lines, affects_outputs
+
--host_compiler=<a string> default: see descriptionNo-op flag. Will be removed in a future release.
+Tags:
+loading_and_analysis, execution
+
--host_grte_top=<a label> default: see descriptionIf specified, this setting overrides the libc top-level directory (--grte_top) for the exec configuration.
+Tags:
+action_command_lines, affects_outputs
+
--host_platform=<a build target label> default: "@bazel_tools//tools:host_platform"The label of a platform rule that describes the host system.
+Tags:
+affects_outputs, changes_inputs, loading_and_analysis
+
--[no]incompatible_bazel_test_exec_run_under default: "true"If enabled, "bazel test --run_under=//:runner" builds "//:runner" in the exec configuration. If disabled, it builds "//:runner" in the target configuration. Bazel executes tests on exec machines, so the former is more correct. This doesn't affect "bazel run", which always builds "`--run_under=//foo" in the target configuration.
+Tags:
+affects_outputs, incompatible_change
+
--[no]incompatible_builtin_objc_strip_action default: "true"Whether to emit a strip action as part of objc linking.
+Tags:
+action_command_lines, incompatible_change
+
--[no]incompatible_dont_enable_host_nonhost_crosstool_features default: "true"If true, Bazel will not enable 'host' and 'nonhost' features in the c++ toolchain (see https://github.com/bazelbuild/bazel/issues/7407 for more information).
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]incompatible_enable_apple_toolchain_resolution default: "false"Use toolchain resolution to select the Apple SDK for apple rules (Starlark and native)
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]incompatible_remove_legacy_whole_archive default: "true"If true, Bazel will not link library dependencies as whole archive by default (see https://github.com/bazelbuild/bazel/issues/7362 for migration instructions).
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]incompatible_strip_executable_safely default: "false"If true, strip action for executables will use flag -x, which does not break dynamic symbol resolution.
+Tags:
+action_command_lines, incompatible_change
+
Use interface shared objects if supported by the toolchain. All ELF toolchains currently support this setting.
+Tags:
+loading_and_analysis, affects_outputs, affects_outputs
+
--ios_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionSpecifies the version of the iOS SDK to use to build iOS applications. If unspecified, uses the default iOS SDK version from 'xcode_version'.
+Tags:
+loses_incremental_state
+
--macos_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionSpecifies the version of the macOS SDK to use to build macOS applications. If unspecified, uses the default macOS SDK version from 'xcode_version'.
+Tags:
+loses_incremental_state
+
--minimum_os_version=<a string> default: see descriptionThe minimum OS version which your compilation targets.
+Tags:
+loading_and_analysis, affects_outputs
+
--platform_mappings=<a main workspace-relative path> default: ""The location of a mapping file that describes which platform to use if none is set or which flags to set when a platform already exists. Must be relative to the main workspace root. Defaults to 'platform_mappings' (a file directly under the workspace root).
+Tags:
+affects_outputs, changes_inputs, loading_and_analysis, non_configurable
+
--platforms=<a build target label> default: ""The labels of the platform rules describing the target platforms for the current command.
+Tags:
+affects_outputs, changes_inputs, loading_and_analysis
+
--python_path=<a string> default: see descriptionThe absolute path of the Python interpreter invoked to run Python targets on the target platform. Deprecated; disabled by --incompatible_use_python_toolchains.
+Tags:
+loading_and_analysis, affects_outputs
+
--tvos_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionSpecifies the version of the tvOS SDK to use to build tvOS applications. If unspecified, uses the default tvOS SDK version from 'xcode_version'.
+Tags:
+loses_incremental_state
+
--[no]use_platforms_in_apple_crosstool_transition default: "false"Makes apple_crosstool_transition fall back to using the value of --platforms flag instead of legacy --cpu when needed.
Tags:
+loading_and_analysis
+
--watchos_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionSpecifies the version of the watchOS SDK to use to build watchOS applications. If unspecified, uses the default watchOS SDK version from 'xcode_version'.
+Tags:
+loses_incremental_state
+
--xcode_version=<a string> default: see descriptionIf specified, uses Xcode of the given version for relevant build actions. If unspecified, uses the executor default version of Xcode.
+Tags:
+loses_incremental_state
+
--xcode_version_config=<a build target label> default: "@bazel_tools//tools/cpp:host_xcodes"The label of the xcode_config rule to be used for selecting the Xcode version in the build configuration.
+Tags:
+loses_incremental_state, loading_and_analysis
+
--[no]apple_generate_dsym default: "false"Whether to generate debug symbol(.dSYM) file(s).
+Tags:
+affects_outputs, action_command_lines
+
--[no]build_runfile_links default: "true"If true, build runfiles symlink forests for all targets. If false, write them only when required by a local action, test or run command.
+Tags:
+affects_outputs
+
--[no]build_runfile_manifests default: "true"If true, write runfiles manifests for all targets. If false, omit them. Local tests will fail to run when false.
+Tags:
+affects_outputs
+
--[no]build_test_dwp default: "false"If enabled, when building C++ tests statically and with fission the .dwp file for the test binary will be automatically built as well.
+Tags:
+loading_and_analysis, affects_outputs
+
--cc_proto_library_header_suffixes=<comma-separated set of options> default: ".pb.h"Sets the suffixes of header files that a cc_proto_library creates.
+Tags:
+affects_outputs, loading_and_analysis
+
--cc_proto_library_source_suffixes=<comma-separated set of options> default: ".pb.cc"Sets the suffixes of source files that a cc_proto_library creates.
+Tags:
+affects_outputs, loading_and_analysis
+
--[no]experimental_proto_descriptor_sets_include_source_info default: "false"Run extra actions for alternative Java api versions in a proto_library.
+Tags:
+affects_outputs, loading_and_analysis, experimental
+
--[no]experimental_save_feature_state default: "false"Save the state of enabled and requested feautres as an output of compilation.
+Tags:
+affects_outputs, experimental
+
--fission=<a set of compilation modes> default: "no"Specifies which compilation modes use fission for C++ compilations and links. May be any combination of {'fastbuild', 'dbg', 'opt'} or the special values 'yes' to enable all modes and 'no' to disable all modes.
+Tags:
+loading_and_analysis, action_command_lines, affects_outputs
+
--[no]incompatible_always_include_files_in_data default: "true"If true, native rules add <code>DefaultInfo.files</code> of data dependencies to their runfiles, which matches the recommended behavior for Starlark rules (https://bazel.build/extending/rules#runfiles_features_to_avoid).
+Tags:
+affects_outputs, incompatible_change
+
--[no]incompatible_compact_repo_mapping_manifest default: "false"If enabled, the <binary>.repo_mapping file emits a module extension's repo mapping only once instead of once for each repo generated by the extension that contributes runfiles.
+Tags:
+affects_outputs, incompatible_change
+
--incompatible_disable_select_on=<comma-separated set of options> default: ""List of flags for which the use in select() is disabled.
+Tags:
+loading_and_analysis, incompatible_change, non_configurable
+
--[no]incompatible_filegroup_runfiles_for_data default: "true"If true, runfiles of targets listed in the srcs attribute are available to targets that consume the filegroup as a data dependency.
+Tags:
+incompatible_change
+
--[no]objc_generate_linkmap default: "false"Specifies whether to generate a linkmap file.
+Tags:
+affects_outputs
+
--[no]save_temps default: "false"If set, temporary outputs from gcc will be saved. These include .s files (assembler code), .i files (preprocessed C) and .ii files (preprocessed C++).
+Tags:
+affects_outputs
+
--action_env=<a 'name[=value]' assignment with an optional value part or the special syntax '=name' to unset a variable> multiple uses are accumulatedSpecifies the set of environment variables available to actions with target configuration. Variables can be either specified by <code>name</code>, in which case +the value will be taken from the invocation environment, by the <code>name=value</code> pair which sets the value independent of the invocation environment, or by <code>=name</code>, which unsets the variable of that name. This option can be used multiple times; for options given for the same variable, the latest wins, options for different variables accumulate. +<br> +Note that unless <code>--incompatible_repo_env_ignores_action_env</code> is true, all <code>name=value</code> pairs will be available to repository rules.
+Tags:
+action_command_lines
+
--allowed_cpu_values=<comma-separated set of options> default: ""Allowed values for the --cpu flag.
+Tags:
+changes_inputs, affects_outputs
+
--[no]android_databinding_use_androidx default: "true"Generate AndroidX-compatible data-binding files. This is only used with databinding v2. This flag is a no-op.
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state, experimental
+
--[no]android_databinding_use_v3_4_args default: "true"Use android databinding v2 with 3.4.0 argument. This flag is a no-op.
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state, experimental
+
--android_dynamic_mode=<off, default or fully> default: "off"Determines whether C++ deps of Android rules will be linked dynamically when a cc_binary does not explicitly create a shared library. 'default' means bazel will choose whether to link dynamically. 'fully' means all libraries will be linked dynamically. 'off' means that all libraries will be linked in mostly static mode.
+Tags:
+affects_outputs, loading_and_analysis
+
--android_manifest_merger_order=<alphabetical, alphabetical_by_configuration or dependency> default: "alphabetical"Sets the order of manifests passed to the manifest merger for Android binaries. ALPHABETICAL means manifests are sorted by path relative to the execroot. ALPHABETICAL_BY_CONFIGURATION means manifests are sorted by paths relative to the configuration directory within the output directory. DEPENDENCY means manifests are ordered with each library's manifest coming before the manifests of its dependencies.
+Tags:
+action_command_lines, execution
+
--[no]android_resource_shrinking default: "false"Enables resource shrinking for android_binary APKs that use ProGuard.
+Tags:
+affects_outputs, loading_and_analysis
+
--[no]build_python_zip default: "auto"Build python executable zip; on on Windows, off on other platforms
+Tags:
+affects_outputs
+
--catalyst_cpus=<comma-separated list of options> multiple uses are accumulatedComma-separated list of architectures for which to build Apple Catalyst binaries.
+Tags:
+loses_incremental_state, loading_and_analysis
+
--[no]collect_code_coverage default: "false"If specified, Bazel will instrument code (using offline instrumentation where possible) and will collect coverage information during tests. Only targets that match --instrumentation_filter will be affected. Usually this option should not be specified directly - 'bazel coverage' command should be used instead.
+Tags:
+affects_outputs
+
--compilation_mode=<fastbuild, dbg or opt> [-c] default: "fastbuild"Specify the mode the binary will be built in. Values: 'fastbuild', 'dbg', 'opt'.
+Tags:
+affects_outputs, action_command_lines
+
--conlyopt=<a string> multiple uses are accumulatedAdditional option to pass to gcc when compiling C source files.
+Tags:
+action_command_lines, affects_outputs
+
--copt=<a string> multiple uses are accumulatedAdditional options to pass to gcc.
+Tags:
+action_command_lines, affects_outputs
+
--cpu=<a string> default: ""Deprecated: this flag is not used internally by Blaze although there are legacy platform mappings to allow for backwards compatibility. Do not use this flag, instead use --platforms with an appropriate platform definition.
+Tags:
+changes_inputs, affects_outputs
+
--cs_fdo_absolute_path=<a string> default: see descriptionUse CSFDO profile information to optimize compilation. Specify the absolute path name of the zip file containing the profile file, a raw or an indexed LLVM profile file.
+Tags:
+affects_outputs
+
--cs_fdo_instrument=<a string> default: see descriptionGenerate binaries with context sensitive FDO instrumentation. With Clang/LLVM compiler, it also accepts the directory name under which the raw profile file(s) will be dumped at runtime.
+Tags:
+affects_outputs
+
--cs_fdo_profile=<a build target label> default: see descriptionThe cs_fdo_profile representing the context sensitive profile to be used for optimization.
+Tags:
+affects_outputs
+
--cxxopt=<a string> multiple uses are accumulatedAdditional option to pass to gcc when compiling C++ source files.
+Tags:
+action_command_lines, affects_outputs
+
--define=<a 'name=value' assignment> multiple uses are accumulatedEach --define option specifies an assignment for a build variable. In case of multiple values for a variable, the last one wins.
+Tags:
+changes_inputs, affects_outputs
+
--dynamic_mode=<off, default or fully> default: "default"Determines whether C++ binaries will be linked dynamically. 'default' means Bazel will choose whether to link dynamically. 'fully' means all libraries will be linked dynamically. 'off' means that all libraries will be linked in mostly static mode.
+Tags:
+loading_and_analysis, affects_outputs
+
--[no]enable_propeller_optimize_absolute_paths default: "true"If set, any use of absolute paths for propeller optimize will raise an error.
+Tags:
+affects_outputs
+
--[no]enable_remaining_fdo_absolute_paths default: "true"If set, any use of absolute paths for FDO will raise an error.
+Tags:
+affects_outputs
+
--[no]enable_runfiles default: "auto"Enable runfiles symlink tree; By default, it's off on Windows, on on other platforms.
+Tags:
+affects_outputs
+
--exec_aspects=<comma-separated list of options> multiple uses are accumulatedComma-separated list of aspects to be applied to exec-configured targets, regardless of whether or not they are top-level targets. This is an experimental feature and is subject to change.
+Tags:
+loading_and_analysis
+
--experimental_action_listener=<a build target label> multiple uses are accumulatedDeprecated in favor of aspects. Use action_listener to attach an extra_action to existing build actions.
+Tags:
+execution, experimental
+
--[no]experimental_android_compress_java_resources default: "false"Compress Java resources in APKs
+Tags:
+affects_outputs, loading_and_analysis, experimental
+
--[no]experimental_android_databinding_v2 default: "true"Use android databinding v2. This flag is a no-op.
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state, experimental
+
--[no]experimental_android_resource_shrinking default: "false"Enables resource shrinking for android_binary APKs that use ProGuard.
+Tags:
+affects_outputs, loading_and_analysis, experimental
+
--[no]experimental_android_rewrite_dexes_with_rex default: "false"use rex tool to rewrite dex files
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state, experimental
+
--[no]experimental_collect_code_coverage_for_generated_files default: "false"If specified, Bazel will also generate collect coverage information for generated files.
+Tags:
+affects_outputs, experimental
+
--experimental_objc_fastbuild_options=<comma-separated list of options> default: "-O0,-DDEBUG=1"Uses these strings as objc fastbuild compiler options.
+Tags:
+action_command_lines
+
--[no]experimental_omitfp default: "false"If true, use libunwind for stack unwinding, and compile with -fomit-frame-pointer and -fasynchronous-unwind-tables.
+Tags:
+action_command_lines, affects_outputs, experimental
+
--experimental_output_paths=<off or strip> default: "off"Which model to use for where in the output tree rules write their outputs, particularly for multi-platform / multi-configuration builds. This is highly experimental. See https://github.com/bazelbuild/bazel/issues/6526 for details. Starlark actions canopt into path mapping by adding the key 'supports-path-mapping' to the 'execution_requirements' dict.
+Tags:
+loses_incremental_state, bazel_internal_configuration, affects_outputs, execution
+
--experimental_override_platform_cpu_name=<a 'label=value' assignment> multiple uses are accumulatedEach entry should be of the form label=value where label refers to a platform and values is the desired shortname to override the platform's CPU name in $(TARGET_CPU) make variable and output path. Only used when --experimental_platform_in_output_dir, --incompatible_target_cpu_from_platform or --incompatible_bep_cpu_from_platform is true. Has highest naming priority.
+Tags:
+affects_outputs, experimental
+
--[no]experimental_platform_in_output_dir default: "false"If true, a shortname for the target platform is used in the output directory name instead of the CPU. If auto, this is only applied for the exec configuration. The exact scheme is experimental and subject to change: First, in the rare case the --platforms option does not have exactly one value, a hash of the platforms option is used. Next, if any shortname for the current platform was registered by --experimental_override_name_platform_in_output_dir, then that shortname is used. Then, if --experimental_use_platforms_in_output_dir_legacy_heuristic is set, use a shortname based off the current platform Label. Finally, a hash of the platform option is used as a last resort.
+Tags:
+affects_outputs, experimental
+
--[no]experimental_py_binaries_include_label default: "false"py_binary targets include their label even when stamping is disabled.
+Tags:
+affects_outputs, experimental
+
--[no]experimental_use_llvm_covmap default: "false"If specified, Bazel will generate llvm-cov coverage map information rather than gcov when collect_code_coverage is enabled.
+Tags:
+changes_inputs, affects_outputs, loading_and_analysis, experimental
+
--[no]experimental_use_platforms_in_output_dir_legacy_heuristic default: "true"Please only use this flag as part of a suggested migration or testing strategy. Note that the heuristic has known deficiencies and it is suggested to migrate to relying on just --experimental_override_name_platform_in_output_dir.
+Tags:
+affects_outputs, experimental
+
--fdo_instrument=<a string> default: see descriptionGenerate binaries with FDO instrumentation. With Clang/LLVM compiler, it also accepts the directory name under which the raw profile file(s) will be dumped at runtime.
+Tags:
+affects_outputs
+
--fdo_optimize=<a string> default: see descriptionUse FDO profile information to optimize compilation. Specify the name of a zip file containing a .gcda file tree, an afdo file containing an auto profile, or an LLVM profile file. This flag also accepts files specified as labels (e.g. //foo/bar:file.afdo - you may need to add an exports_files directive to the corresponding package) and labels pointing to fdo_profile targets. This flag will be superseded by the fdo_profile rule.
Tags:
+affects_outputs
+
--fdo_prefetch_hints=<a build target label> default: see descriptionUse cache prefetch hints.
+Tags:
+affects_outputs
+
--fdo_profile=<a build target label> default: see descriptionThe fdo_profile representing the profile to be used for optimization.
+Tags:
+affects_outputs
+
--features=<a string> multiple uses are accumulatedThe given features will be enabled or disabled by default for targets built in the target configuration. Specifying -<feature> will disable the feature. Negative features always override positive ones. See also --host_features
+Tags:
+changes_inputs, affects_outputs
+
--[no]force_pic default: "false"If enabled, all C++ compilations produce position-independent code ("-fPIC"), links prefer PIC pre-built libraries over non-PIC libraries, and links produce position-independent executables ("-pie").
+Tags:
+loading_and_analysis, affects_outputs
+
--host_action_env=<a 'name[=value]' assignment with an optional value part or the special syntax '=name' to unset a variable> multiple uses are accumulatedSpecifies the set of environment variables available to actions with execution configurations. Variables can be either specified by name, in which case the value will be taken from the invocation environment, by the name=value pair which sets the value independent of the invocation environment, or by <code>=name</code>, which unsets the variable of that name. This option can be used multiple times; for options given for the same variable, the latest wins, options for different variables accumulate.
+Tags:
+action_command_lines
+
--host_compilation_mode=<fastbuild, dbg or opt> default: "opt"Specify the mode the tools used during the build will be built in. Values: 'fastbuild', 'dbg', 'opt'.
+Tags:
+affects_outputs, action_command_lines
+
--host_conlyopt=<a string> multiple uses are accumulatedAdditional option to pass to the C compiler when compiling C (but not C++) source files in the exec configurations.
+Tags:
+action_command_lines, affects_outputs
+
--host_copt=<a string> multiple uses are accumulatedAdditional options to pass to the C compiler for tools built in the exec configurations.
+Tags:
+action_command_lines, affects_outputs
+
--host_cpu=<a string> default: ""The host CPU.
+Tags:
+changes_inputs, affects_outputs
+
--host_cxxopt=<a string> multiple uses are accumulatedAdditional options to pass to C++ compiler for tools built in the exec configurations.
+Tags:
+action_command_lines, affects_outputs
+
--host_features=<a string> multiple uses are accumulatedThe given features will be enabled or disabled by default for targets built in the exec configuration. Specifying -<feature> will disable the feature. Negative features always override positive ones.
+Tags:
+changes_inputs, affects_outputs
+
--host_linkopt=<a string> multiple uses are accumulatedAdditional option to pass to linker when linking tools in the exec configurations.
+Tags:
+action_command_lines, affects_outputs
+
--host_macos_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionMinimum compatible macOS version for host targets. If unspecified, uses 'macos_sdk_version'.
+Tags:
+loses_incremental_state
+
--host_per_file_copt=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths followed by an @ and a comma separated list of options> multiple uses are accumulatedAdditional options to selectively pass to the C/C++ compiler when compiling certain files in the exec configurations. This option can be passed multiple times. Syntax: regex_filter@option_1,option_2,...,option_n. Where regex_filter stands for a list of include and exclude regular expression patterns (Also see --instrumentation_filter). option_1 to option_n stand for arbitrary command line options. If an option contains a comma it has to be quoted with a backslash. Options can contain @. Only the first @ is used to split the string. Example: --host_per_file_copt=//foo/.*.cc,-//foo/bar.cc@-O0 adds the -O0 command line option to the gcc command line of all cc files in //foo/ except bar.cc.
+Tags:
+action_command_lines, affects_outputs
+
--[no]incompatible_auto_exec_groups default: "false"When enabled, an exec groups is automatically created for each toolchain used by a rule. For this to work rule needs to specify toolchain parameter on its actions. For more information, see https://github.com/bazelbuild/bazel/issues/17134.
Tags:
+affects_outputs, incompatible_change
+
--[no]incompatible_merge_genfiles_directory default: "true"If true, the genfiles directory is folded into the bin directory.
+Tags:
+affects_outputs, incompatible_change
+
--[no]incompatible_target_cpu_from_platform default: "true"If specified, the value of the cpu constraint (@platforms//cpu:cpu) of the target platform is used to set the $(TARGET_CPU) make variable.
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]instrument_test_targets default: "false"When coverage is enabled, specifies whether to consider instrumenting test rules. When set, test rules included by --instrumentation_filter are instrumented. Otherwise, test rules are always excluded from coverage instrumentation.
+Tags:
+affects_outputs
+
--instrumentation_filter=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths> default: "-/javatests[/:],-/test/java[/:]"When coverage is enabled, only rules with names included by the specified regex-based filter will be instrumented. Rules prefixed with '-' are excluded instead. Note that only non-test rules are instrumented unless --instrument_test_targets is enabled.
+Tags:
+affects_outputs
+
--ios_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionMinimum compatible iOS version for target simulators and devices. If unspecified, uses 'ios_sdk_version'.
+Tags:
+loses_incremental_state
+
--ios_multi_cpus=<comma-separated list of options> multiple uses are accumulatedComma-separated list of architectures to build an ios_application with. The result is a universal binary containing all specified architectures.
+Tags:
+loses_incremental_state, loading_and_analysis
+
--[no]legacy_whole_archive default: "true"Deprecated, superseded by --incompatible_remove_legacy_whole_archive (see https://github.com/bazelbuild/bazel/issues/7362 for details). When on, use --whole-archive for cc_binary rules that have linkshared=True and either linkstatic=True or '-static' in linkopts. This is for backwards compatibility only. A better alternative is to use alwayslink=1 where required.
+Tags:
+action_command_lines, affects_outputs, deprecated
+
--linkopt=<a string> multiple uses are accumulatedAdditional option to pass to gcc when linking.
+Tags:
+action_command_lines, affects_outputs
+
--ltobackendopt=<a string> multiple uses are accumulatedAdditional option to pass to the LTO backend step (under --features=thin_lto).
+Tags:
+action_command_lines, affects_outputs
+
--ltoindexopt=<a string> multiple uses are accumulatedAdditional option to pass to the LTO indexing step (under --features=thin_lto).
+Tags:
+action_command_lines, affects_outputs
+
--macos_cpus=<comma-separated list of options> multiple uses are accumulatedComma-separated list of architectures for which to build Apple macOS binaries.
+Tags:
+loses_incremental_state, loading_and_analysis
+
--macos_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionMinimum compatible macOS version for targets. If unspecified, uses 'macos_sdk_version'.
+Tags:
+loses_incremental_state
+
--memprof_profile=<a build target label> default: see descriptionUse memprof profile.
+Tags:
+affects_outputs
+
--[no]objc_debug_with_GLIBCXX default: "false"If set, and compilation mode is set to 'dbg', define GLIBCXX_DEBUG, GLIBCXX_DEBUG_PEDANTIC and GLIBCPP_CONCEPT_CHECKS.
+Tags:
+action_command_lines
+
--[no]objc_enable_binary_stripping default: "false"Whether to perform symbol and dead-code strippings on linked binaries. Binary strippings will be performed if both this flag and --compilation_mode=opt are specified.
+Tags:
+action_command_lines
+
--objccopt=<a string> multiple uses are accumulatedAdditional options to pass to gcc when compiling Objective-C/C++ source files.
+Tags:
+action_command_lines
+
--per_file_copt=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths followed by an @ and a comma separated list of options> multiple uses are accumulatedAdditional options to selectively pass to gcc when compiling certain files. This option can be passed multiple times. Syntax: regex_filter@option_1,option_2,...,option_n. Where regex_filter stands for a list of include and exclude regular expression patterns (Also see --instrumentation_filter). option_1 to option_n stand for arbitrary command line options. If an option contains a comma it has to be quoted with a backslash. Options can contain @. Only the first @ is used to split the string. Example: --per_file_copt=//foo/.*.cc,-//foo/bar.cc@-O0 adds the -O0 command line option to the gcc command line of all cc files in //foo/ except bar.cc.
+Tags:
+action_command_lines, affects_outputs
+
--per_file_ltobackendopt=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths followed by an @ and a comma separated list of options> multiple uses are accumulatedAdditional options to selectively pass to LTO backend (under --features=thin_lto) when compiling certain backend objects. This option can be passed multiple times. Syntax: regex_filter@option_1,option_2,...,option_n. Where regex_filter stands for a list of include and exclude regular expression patterns. option_1 to option_n stand for arbitrary command line options. If an option contains a comma it has to be quoted with a backslash. Options can contain @. Only the first @ is used to split the string. Example: --per_file_ltobackendopt=//foo/.*.o,-//foo/bar.o@-O0 adds the -O0 command line option to the LTO backend command line of all o files in //foo/ except bar.o.
+Tags:
+action_command_lines, affects_outputs
+
--platform_suffix=<a string> default: see descriptionSpecifies a suffix to be added to the configuration directory.
+Tags:
+loses_incremental_state, affects_outputs, loading_and_analysis
+
--propeller_optimize=<a build target label> default: see descriptionUse Propeller profile information to optimize the build target.A propeller profile must consist of at least one of two files, a cc profile and a ld profile. This flag accepts a build label which must refer to the propeller profile input files. For example, the BUILD file that defines the label, in a/b/BUILD:propeller_optimize( name = "propeller_profile", cc_profile = "propeller_cc_profile.txt", ld_profile = "propeller_ld_profile.txt",)An exports_files directive may have to be added to the corresponding package to make these files visible to Bazel. The option must be used as: --propeller_optimize=//a/b:propeller_profile
+Tags:
+action_command_lines, affects_outputs
+
--propeller_optimize_absolute_cc_profile=<a string> default: see descriptionAbsolute path name of cc_profile file for Propeller Optimized builds.
+Tags:
+affects_outputs
+
--propeller_optimize_absolute_ld_profile=<a string> default: see descriptionAbsolute path name of ld_profile file for Propeller Optimized builds.
+Tags:
+affects_outputs
+
--run_under=<a prefix in front of command> default: see descriptionPrefix to insert before the executables for the 'test' and 'run' commands. If the value is 'foo -bar', and the execution command line is 'test_binary -baz', then the final command line is 'foo -bar test_binary -baz'.This can also be a label to an executable target. Some examples are: 'valgrind', 'strace', 'strace -c', 'valgrind --quiet --num-callers=20', '//package:target', '//package:target --options'.
+Tags:
+action_command_lines
+
If true, native libraries that contain identical functionality will be shared among different targets
+Tags:
+loading_and_analysis, affects_outputs
+
--[no]stamp default: "false"Stamp binaries with the date, username, hostname, workspace information, etc.
+Tags:
+affects_outputs
+
--strip=<always, sometimes or never> default: "sometimes"Specifies whether to strip binaries and shared libraries (using "-Wl,--strip-debug"). The default value of 'sometimes' means strip iff --compilation_mode=fastbuild.
+Tags:
+affects_outputs
+
--stripopt=<a string> multiple uses are accumulatedAdditional options to pass to strip when generating a '<name>.stripped' binary.
+Tags:
+action_command_lines, affects_outputs
+
--tvos_cpus=<comma-separated list of options> multiple uses are accumulatedComma-separated list of architectures for which to build Apple tvOS binaries.
+Tags:
+loses_incremental_state, loading_and_analysis
+
--tvos_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionMinimum compatible tvOS version for target simulators and devices. If unspecified, uses 'tvos_sdk_version'.
+Tags:
+loses_incremental_state
+
--visionos_cpus=<comma-separated list of options> multiple uses are accumulatedComma-separated list of architectures for which to build Apple visionOS binaries.
+Tags:
+loses_incremental_state, loading_and_analysis
+
--watchos_cpus=<comma-separated list of options> multiple uses are accumulatedComma-separated list of architectures for which to build Apple watchOS binaries.
+Tags:
+loses_incremental_state, loading_and_analysis
+
--watchos_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionMinimum compatible watchOS version for target simulators and devices. If unspecified, uses 'watchos_sdk_version'.
+Tags:
+loses_incremental_state
+
--xbinary_fdo=<a build target label> default: see descriptionUse XbinaryFDO profile information to optimize compilation. Specify the name of default cross binary profile. When the option is used together with --fdo_instrument/--fdo_optimize/--fdo_profile, those options will always prevail as if xbinary_fdo is never specified.
+Tags:
+affects_outputs
+
--[no]check_visibility default: "true"If disabled, visibility errors in target dependencies are demoted to warnings.
+Tags:
+build_file_semantics, non_configurable
+
--[no]desugar_for_android default: "true"Whether to desugar Java 8 bytecode before dexing.
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state
+
--[no]desugar_java8_libs default: "false"Whether to include supported Java 8 libraries in apps for legacy devices.
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state, experimental
+
--[no]enforce_constraints default: "true"Checks the environments each target is compatible with and reports errors if any target has dependencies that don't support the same environments
+Tags:
+build_file_semantics
+
--[no]experimental_check_desugar_deps default: "true"Whether to double-check correct desugaring at Android binary level.
+Tags:
+eagerness_to_exit, loading_and_analysis, experimental
+
--[no]experimental_enforce_transitive_visibility default: "false"If true, enable package()s to set the transitive_visibility attribute to restrict which packages may depend on them.
+Tags:
+build_file_semantics, experimental
+
--experimental_one_version_enforcement=<off, warning or error> default: "OFF"When enabled, enforce that a java_binary rule can't contain more than one version of the same class file on the classpath. This enforcement can break the build, or can just result in warnings.
+Tags:
+loading_and_analysis
+
--experimental_strict_java_deps=<off, warn, error, strict or default> default: "default"If true, checks that a Java target explicitly declares all directly used targets as dependencies.
+Tags:
+build_file_semantics, eagerness_to_exit
+
--[no]incompatible_check_testonly_for_output_files default: "false"If enabled, check testonly for prerequisite targets that are output files by looking up the testonly of the generating rule. This matches visibility checking.
+Tags:
+build_file_semantics, incompatible_change
+
--[no]incompatible_disable_native_android_rules default: "false"If enabled, direct usage of the native Android rules is disabled. Please use the Starlark Android rules from https://github.com/bazelbuild/rules_android
+Tags:
+eagerness_to_exit, incompatible_change
+
--[no]incompatible_disable_native_apple_binary_rule default: "false"No-op. Kept here for backwards compatibility.
+Tags:
+eagerness_to_exit, incompatible_change
+
--[no]one_version_enforcement_on_java_tests default: "true"When enabled, and with experimental_one_version_enforcement set to a non-NONE value, enforce one version on java_test targets. This flag can be disabled to improve incremental test performance at the expense of missing potential one version violations.
+Tags:
+loading_and_analysis
+
--python_native_rules_allowlist=<a build target label> default: see descriptionAn allowlist (package_group target) to use when enforcing --incompatible_python_disallow_native_rules.
+Tags:
+loading_and_analysis
+
--[no]strict_filesets default: "false"If this option is enabled, filesets crossing package boundaries are reported as errors.
+Tags:
+build_file_semantics, eagerness_to_exit
+
--strict_proto_deps=<off, warn, error, strict or default> default: "error"Unless OFF, checks that a proto_library target explicitly declares all directly used targets as dependencies.
+Tags:
+build_file_semantics, eagerness_to_exit, incompatible_change
+
--strict_public_imports=<off, warn, error, strict or default> default: "off"Unless OFF, checks that a proto_library target explicitly declares all targets used in 'import public' as exported.
+Tags:
+build_file_semantics, eagerness_to_exit, incompatible_change
+
--[no]strict_system_includes default: "false"If true, headers found through system include paths (-isystem) are also required to be declared.
+Tags:
+loading_and_analysis, eagerness_to_exit
+
--target_environment=<a build target label> multiple uses are accumulatedDeclares this build's target environment. Must be a label reference to an "environment" rule. If specified, all top-level targets must be compatible with this environment.
+Tags:
+changes_inputs
+
--apk_signing_method=<v1, v2, v1_v2 or v4> default: "v1_v2"Implementation to use to sign APKs
+Tags:
+action_command_lines, affects_outputs, loading_and_analysis
+
--[no]device_debug_entitlements default: "true"If set, and compilation mode is not 'opt', objc apps will include debug entitlements when signing.
+Tags:
+changes_inputs
+
--ios_signing_cert_name=<a string> default: see descriptionCertificate name to use for iOS signing. If not set will fall back to provisioning profile. May be the certificate's keychain identity preference or (substring) of the certificate's common name, as per codesign's man page (SIGNING IDENTITIES).
+Tags:
+action_command_lines
+
--[no]incompatible_disallow_sdk_frameworks_attributes default: "false"If true, disallow sdk_frameworks and weak_sdk_frameworks attributes in objc_library andobjc_import.
+Tags:
+build_file_semantics, incompatible_change
+
--[no]incompatible_objc_alwayslink_by_default default: "false"If true, make the default value true for alwayslink attributes in objc_library and objc_import.
+Tags:
+build_file_semantics, incompatible_change
+
--[no]incompatible_python_disallow_native_rules default: "false"When true, an error occurs when using the builtin py_* rules; instead the rule_python rules should be used. See https://github.com/bazelbuild/bazel/issues/17773 for more information and migration instructions.
+Tags:
+loading_and_analysis, incompatible_change
+
--[no]allow_analysis_failures default: "false"If true, an analysis failure of a rule target results in the target's propagation of an instance of AnalysisFailureInfo containing the error description, instead of resulting in a build failure.
+Tags:
+loading_and_analysis, experimental
+
--analysis_testing_deps_limit=<an integer> default: "2000"Sets the maximum number of transitive dependencies through a rule attribute with a for_analysis_testing configuration transition. Exceeding this limit will result in a rule error.
+Tags:
+loading_and_analysis
+
--[no]break_build_on_parallel_dex2oat_failure default: "false"If true dex2oat action failures will cause the build to break instead of executing dex2oat during test runtime.
+Tags:
+loading_and_analysis, experimental
+
--default_test_resources=<a resource name followed by equal and 1 float or 4 float, e.g memory=10,30,60,100> multiple uses are accumulatedOverride the default resources amount for tests. The expected format is <resource>=<value>. If a single positive number is specified as <value> it will override the default resources for all test sizes. If 4 comma-separated numbers are specified, they will override the resource amount for respectively the small, medium, large, enormous test sizes. Values can also be HOST_RAM/HOST_CPU, optionally followed by [-|]<float> (eg. memory=HOST_RAM.1,HOST_RAM*.2,HOST_RAM*.3,HOST_RAM*.4). The default test resources specified by this flag are overridden by explicit resources specified in tags.
+--[no]experimental_android_use_parallel_dex2oat default: "false"Use dex2oat in parallel to possibly speed up android_test.
+Tags:
+loading_and_analysis, host_machine_resource_optimizations, experimental
+
--[no]ios_memleaks default: "false"Enable checking for memory leaks in ios_test targets.
+Tags:
+action_command_lines
+
--ios_simulator_device=<a string> default: see descriptionThe device to simulate when running an iOS application in the simulator, e.g. 'iPhone 6'. You can get a list of devices by running 'xcrun simctl list devicetypes' on the machine the simulator will be run on.
+Tags:
+test_runner
+
--ios_simulator_version=<a dotted version (for example '2.3' or '3.3alpha2.4')> default: see descriptionThe version of iOS to run on the simulator when running or testing. This is ignored for ios_test rules if a target device is specified in the rule.
+Tags:
+test_runner
+
--runs_per_test=<a positive integer or test_regex@runs. This flag may be passed more than once> multiple uses are accumulatedSpecifies number of times to run each test. If any of those attempts fail for any reason, the whole test is considered failed. Normally the value specified is just an integer. Example: --runs_per_test=3 will run all tests 3 times. Alternate syntax: regex_filter@runs_per_test. Where runs_per_test stands for an integer value and regex_filter stands for a list of include and exclude regular expression patterns (Also see --instrumentation_filter). Example: --runs_per_test=//foo/.,-//foo/bar/.@3 runs all tests in //foo/ except those under foo/bar three times. This option can be passed multiple times. The most recently passed argument that matches takes precedence. If nothing matches, the test is only run once.
+--test_env=<a 'name[=value]' assignment with an optional value part or the special syntax '=name' to unset a variable> multiple uses are accumulatedSpecifies additional environment variables to be injected into the test runner environment. Variables can be either specified by <code>name</code>, in which case its value will be read from the Bazel client environment, or by the <code>name=value</code> pair. Previously set variables can be unset via <code>=name</code>. This option can be used multiple times to specify several variables. Used only by the 'bazel test' command.
+Tags:
+test_runner
+
--test_timeout=<a single integer or comma-separated list of 4 integers> default: "-1"Override the default test timeout values for test timeouts (in secs). If a single positive integer value is specified it will override all categories. If 4 comma-separated integers are specified, they will override the timeouts for short, moderate, long and eternal (in that order). In either form, a value of -1 tells blaze to use its default timeouts for that category.
+--[no]zip_undeclared_test_outputs default: "false"If true, undeclared test outputs will be archived in a zip file.
+Tags:
+test_runner
+
--[no]experimental_filter_library_jar_with_program_jar default: "false"Filter the ProGuard ProgramJar to remove any classes also present in the LibraryJar.
+Tags:
+action_command_lines, experimental
+
--[no]experimental_inmemory_dotd_files default: "true"If enabled, C++ .d files will be passed through in memory directly from the remote build nodes instead of being written to disk.
+Tags:
+loading_and_analysis, execution, affects_outputs, experimental
+
--[no]experimental_inmemory_jdeps_files default: "true"If enabled, the dependency (.jdeps) files generated from Java compilations will be passed through in memory directly from the remote build nodes instead of being written to disk.
+Tags:
+loading_and_analysis, execution, affects_outputs, experimental
+
--[no]experimental_retain_test_configuration_across_testonly default: "false"When enabled, --trim_test_configuration will not trim the test configuration for rules marked testonly=1. This is meant to reduce action conflict issues when non-test rules depend on cc_test rules. No effect if --trim_test_configuration is false.
+Tags:
+loading_and_analysis, loses_incremental_state, experimental
+
--[no]experimental_unsupported_and_brittle_include_scanning default: "false"Whether to narrow inputs to C/C++ compilation by parsing #include lines from input files. This can improve performance and incrementality by decreasing the size of compilation input trees. However, it can also break builds because the include scanner does not fully implement C preprocessor semantics. In particular, it does not understand dynamic #include directives and ignores preprocessor conditional logic. Use at your own risk. Any issues relating to this flag that are filed will be closed.
+Tags:
+loading_and_analysis, execution, changes_inputs, experimental
+
--[no]incremental_dexing default: "true"Does most of the work for dexing separately for each Jar file.
+Tags:
+affects_outputs, loading_and_analysis, loses_incremental_state
+
--[no]objc_use_dotd_pruning default: "true"If set, .d files emitted by clang will be used to prune the set of inputs passed into objc compiles.
+Tags:
+changes_inputs, loading_and_analysis
+
--[no]process_headers_in_dependencies default: "false"When building a target //a:a, process headers in all targets that //a:a depends on (if header processing is enabled for the toolchain).
+Tags:
+execution
+
--[no]trim_test_configuration default: "true"When enabled, test-related options will be cleared below the top level of the build. When this flag is active, tests cannot be built as dependencies of non-test rules, but changes to test-related options will not cause non-test rules to be re-analyzed.
+Tags:
+loading_and_analysis, loses_incremental_state
+
--toolchain_resolution_debug=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths> default: "-.*"Print debug information during toolchain resolution. The flag takes a regex, which is checked against toolchain types and specific targets to see which to debug. Multiple regexes may be separated by commas, and then each regex is checked separately. Note: The output of this flag is very complex and will likely only be useful to experts in toolchain resolution.
+Tags:
+terminal_output
+
--[no]verbose_visibility_errors default: "false"If enabled, visibility errors include additional diagnostic information.
+Tags:
+build_file_semantics, non_configurable
+
--flag_alias=<a 'name=value' flag alias> multiple uses are accumulatedSets a shorthand name for a Starlark flag. It takes a single key-value pair in the form "<key>=<value>" as an argument.
+Tags:
+changes_inputs, non_configurable
+
--[no]incompatible_default_to_explicit_init_py default: "false"This flag changes the default behavior so that init.py files are no longer automatically created in the runfiles of Python targets. Precisely, when a py_binary or py_test target has legacy_create_init set to "auto" (the default), it is treated as false if and only if this flag is set. See https://github.com/bazelbuild/bazel/issues/10076.
+Tags:
+affects_outputs, incompatible_change
+
--[no]cache_test_results [-t] default: "auto"If set to 'auto', Bazel reruns a test if and only if: (1) Bazel detects changes in the test or its dependencies, (2) the test is marked as external, (3) multiple test runs were requested with --runs_per_test, or(4) the test previously failed. If set to 'yes', Bazel caches all test results except for tests marked as external. If set to 'no', Bazel does not cache any test results.
+--[no]experimental_cancel_concurrent_tests default: "never"If 'on_failed' or 'on_passed, then Blaze will cancel concurrently running tests on the first run with that result. This is only useful in combination with --runs_per_test_detects_flakes.
+Tags:
+affects_outputs, loading_and_analysis, experimental
+
--[no]experimental_fetch_all_coverage_outputs default: "false"If true, then Bazel fetches the entire coverage data directory for each test during a coverage run.
+Tags:
+affects_outputs, loading_and_analysis, experimental
+
--[no]experimental_generate_llvm_lcov default: "false"If true, coverage for clang will generate an LCOV report.
+Tags:
+affects_outputs, loading_and_analysis, experimental
+
--experimental_java_classpath=<off, javabuilder, bazel or bazel_no_fallback> default: "bazel"Enables reduced classpaths for Java compilations.
+--[no]experimental_run_android_lint_on_java_rules default: "false"Whether to validate java_* sources.
+Tags:
+affects_outputs, experimental
+
--[no]explicit_java_test_deps default: "false"Explicitly specify a dependency to JUnit or Hamcrest in a java_test instead of accidentally obtaining from the TestRunner's deps. Only works for bazel right now.
+--host_java_launcher=<a build target label> default: see descriptionThe Java launcher used by tools that are executed during a build.
+--host_javacopt=<a string> multiple uses are accumulatedAdditional options to pass to javac when building tools that are executed during a build.
+--host_jvmopt=<a string> multiple uses are accumulatedAdditional options to pass to the Java VM when building tools that are executed during the build. These options will get added to the VM startup options of each java_binary target.
+--[no]incompatible_check_sharding_support default: "true"If true, Bazel will fail a sharded test if the test runner does not indicate that it supports sharding by touching the file at the path in TEST_SHARD_STATUS_FILE. If false, a test runner that does not support sharding will lead to all tests running in each shard.
+Tags:
+incompatible_change
+
--[no]incompatible_exclusive_test_sandboxed default: "true"If true, exclusive tests will run with sandboxed strategy. Add 'local' tag to force an exclusive test run locally
+Tags:
+incompatible_change
+
--[no]incompatible_strict_action_env default: "false"If true, Bazel uses an environment with a static value for PATH and does not inherit LD_LIBRARY_PATH. Use --action_env=ENV_VARIABLE if you want to inherit specific environment variables from the client, but note that doing so can prevent cross-user caching if a shared cache is used.
+Tags:
+loading_and_analysis, incompatible_change
+
--j2objc_translation_flags=<comma-separated list of options> multiple uses are accumulatedAdditional options to pass to the J2ObjC tool.
+--java_debugCauses the Java virtual machine of a java test to wait for a connection from a JDWP-compliant debugger (such as jdb) before starting the test. Implies -test_output=streamed.
+Expands to:
+
--test_arg=--wrapper_script_flag=--debug
+
--test_output=streamed
+
--test_strategy=exclusive
+
--test_timeout=9999
+
--nocache_test_results
+
--[no]java_deps default: "true"Generate dependency information (for now, compile-time classpath) per Java target.
+--[no]java_header_compilation default: "true"Compile ijars directly from source.
+--java_language_version=<a string> default: ""The Java language version
+--java_launcher=<a build target label> default: see descriptionThe Java launcher to use when building Java binaries. If this flag is set to the empty string, the JDK launcher is used. The "launcher" attribute overrides this flag.
+--java_runtime_version=<a string> default: "local_jdk"The Java runtime version
+--javacopt=<a string> multiple uses are accumulatedAdditional options to pass to javac.
+--jvmopt=<a string> multiple uses are accumulatedAdditional options to pass to the Java VM. These options will get added to the VM startup options of each java_binary target.
+--legacy_main_dex_list_generator=<a build target label> default: see descriptionSpecifies a binary to use to generate the list of classes that must be in the main dex when compiling legacy multidex.
+--optimizing_dexer=<a build target label> default: see descriptionSpecifies a binary to use to do dexing without sharding.
+--plugin=<a build target label> multiple uses are accumulatedPlugins to use in the build. Currently works with java_plugin.
+--proguard_top=<a build target label> default: see descriptionSpecifies which version of ProGuard to use for code removal when building a Java binary.
+--proto_compiler=<a build target label> default: "@bazel_tools//tools/proto:protoc"The label of the proto-compiler.
+Tags:
+affects_outputs, loading_and_analysis
+
--[no]proto_profile default: "true"Whether to pass profile_path to the proto compiler.
+Tags:
+affects_outputs, loading_and_analysis
+
--proto_profile_path=<a build target label> default: see descriptionThe profile to pass to the proto compiler as profile_path. If unset, but --proto_profile is true (the default), infers the path from --fdo_optimize.
+Tags:
+affects_outputs, loading_and_analysis
+
--proto_toolchain_for_cc=<a build target label> default: "@bazel_tools//tools/proto:cc_toolchain"Label of proto_lang_toolchain() which describes how to compile C++ protos
+Tags:
+affects_outputs, loading_and_analysis
+
--proto_toolchain_for_j2objc=<a build target label> default: "@bazel_tools//tools/j2objc:j2objc_proto_toolchain"Label of proto_lang_toolchain() which describes how to compile j2objc protos
+Tags:
+affects_outputs, loading_and_analysis
+
--proto_toolchain_for_java=<a build target label> default: "@bazel_tools//tools/proto:java_toolchain"Label of proto_lang_toolchain() which describes how to compile Java protos
+Tags:
+affects_outputs, loading_and_analysis
+
--proto_toolchain_for_javalite=<a build target label> default: "@bazel_tools//tools/proto:javalite_toolchain"Label of proto_lang_toolchain() which describes how to compile JavaLite protos
+Tags:
+affects_outputs, loading_and_analysis
+
--protocopt=<a string> multiple uses are accumulatedAdditional options to pass to the protobuf compiler.
+Tags:
+affects_outputs
+
--[no]runs_per_test_detects_flakes default: "false"If true, any shard in which at least one run/attempt passes and at least one run/attempt fails gets a FLAKY status.
+--shell_executable=<a path> default: see descriptionAbsolute path to the shell executable for Bazel to use. If this is unset, but the BAZEL_SH environment variable is set on the first Bazel invocation (that starts up a Bazel server), Bazel uses that. If neither is set, Bazel uses a hard-coded default path depending on the operating system it runs on (Windows: c:/msys64/usr/bin/bash.exe, FreeBSD: /usr/local/bin/bash, all others: /bin/bash). Note that using a shell that is not compatible with bash may lead to build failures or runtime failures of the generated binaries.
+Tags:
+loading_and_analysis
+
--test_arg=<a string> multiple uses are accumulatedSpecifies additional options and arguments that should be passed to the test executable. Can be used multiple times to specify several arguments. If multiple tests are executed, each of them will receive identical arguments. Used only by the 'bazel test' command.
+--test_filter=<a string> default: see descriptionSpecifies a filter to forward to the test framework. Used to limit the tests run. Note that this does not affect which targets are built.
+--test_result_expiration=<an integer> default: "-1"This option is deprecated and has no effect.
+--[no]test_runner_fail_fast default: "false"Forwards fail fast option to the test runner. The test runner should stop execution upon first failure.
+--test_sharding_strategy=<explicit, disabled or forced=k where k is the number of shards to enforce> default: "explicit"Specify strategy for test sharding: 'explicit' to only use sharding if the 'shard_count' BUILD attribute is present. 'disabled' to never use test sharding. 'forced=k' to enforce 'k' shards for testing regardless of the 'shard_count' BUILD attribute.
+--tool_java_language_version=<a string> default: ""The Java language version used to execute the tools that are needed during a build
+--tool_java_runtime_version=<a string> default: "remotejdk_11"The Java runtime version used to execute tools during the build
+--[no]use_ijars default: "true"If enabled, this option causes Java compilation to use interface jars. This will result in faster incremental compilation, but error messages can be different.
+--[no]gnu_format default: "false"If set, write the version to stdout using the conventions described in the GNU standards.
+Tags:
+affects_outputs, execution
+
unknown |
+This option has unknown, or undocumented, effect. | +
no_op |
+This option has literally no effect. | +
loses_incremental_state |
+Changing the value of this option can cause significant loss of incremental state, which slows builds. State could be lost due to a server restart or to invalidation of a large part of the dependency graph. | +
changes_inputs |
+This option actively changes the inputs that bazel considers for the build, such as filesystem restrictions, repository versions, or other options. | +
affects_outputs |
+This option affects bazel's outputs. This tag is intentionally broad, can include transitive affects, and does not specify the type of output it affects. | +
build_file_semantics |
+This option affects the semantics of BUILD or .bzl files. | +
bazel_internal_configuration |
+This option affects settings of bazel-internal machinery. This tag does not, on its own, mean that build artifacts are affected. | +
loading_and_analysis |
+This option affects the loading and analysis of dependencies, and the building of the dependency graph. | +
execution |
+This option affects the execution phase, such as sandboxing or remote execution related options. | +
host_machine_resource_optimizations |
+This option triggers an optimization that may be machine specific and is not guaranteed to work on all machines. The optimization could include a tradeoff with other aspects of performance, such as memory or cpu cost. | +
eagerness_to_exit |
+This option changes how eagerly bazel will exit from a failure, where a choice between continuing despite the failure and ending the invocation exists. | +
bazel_monitoring |
+This option is used to monitor bazel's behavior and performance. | +
terminal_output |
+This option affects bazel's terminal output. | +
action_command_lines |
+This option changes the command line arguments of one or more build actions. | +
test_runner |
+This option changes the testrunner environment of the build. | +
experimental |
+This option triggers an experimental feature with no guarantees of functionality. | +
incompatible_change |
+This option triggers a breaking change. Use this option to test your migration readiness or get early access to the new feature | +
deprecated |
+This option is deprecated. It might be that the feature it affects is deprecated, or that another method of supplying the information is preferred. | +
non_configurable |
+This option cannot be changed in a transition or be used in a select() statement. | +
This object is visible for the purpose of testing, and may be obtained from an Actions provider. It is normally not necessary to access Action objects or their fields within a rule's implementation function. You may instead want to see the Rules page for a general discussion of how to use actions when defining custom rules, or the API reference for creating actions.
Some fields of this object are only applicable for certain kinds of actions. Fields that are inapplicable are set to None.
+
+
sequence Action.args+ + A list of frozen Args objects containing information about the action arguments. These objects contain accurate argument information, including arguments involving expanded action output directories. However, Args objects are not readable in the analysis phase. For a less accurate account of arguments which is available in the analysis phase, see argv.
Note that some types of actions do not yet support exposure of this field. For such action types, this is None.
+ May return None.
+
+
sequence Action.argv+ + For actions created by ctx.actions.run() or ctx.actions.run_shell() an immutable list of the arguments for the command line to be executed. Note that for shell actions the first two arguments will be the shell path and
"-c".
+ May return None.
+
+ string Action.content+ + For actions created by ctx.actions.write() or ctx.actions.expand_template(), the contents of the file to be written, if those contents can be computed during the analysis phase. The value is
None if the contents cannot be determined until the execution phase, such as when a directory in an Args object needs to be expanded.
+ May return None.
+
+ dict Action.env+ + The 'fixed' environment variables for this action. This includes only environment settings which are explicitly set by the action definition, and thus omits settings which are only pre-set in the execution environment. + +
depset Action.inputs+ + A set of the input files of this action. + +
string Action.mnemonic+ + The mnemonic for this action. + +
depset Action.outputs+ + A set of the output files of this action. + +
dict Action.substitutions+ + For actions created by ctx.actions.expand_template(), an immutable dict holding the substitution mapping. + May return
None.
+
+
+
+
+
+
diff --git a/rules/lib/builtins/Args.mdx b/rules/lib/builtins/Args.mdx
new file mode 100644
index 0000000..452f141
--- /dev/null
+++ b/rules/lib/builtins/Args.mdx
@@ -0,0 +1,423 @@
+---
+title: 'Args'
+---
+
+
+
+
+
+
+
+
+It often happens that an action requires a large command line containing values accumulated from transitive dependencies. For example, a linker command line might list every object file needed by all of the libraries being linked. It is best practice to store such transitive data in depsets, so that they can be shared by multiple targets. However, if the rule author had to convert these depsets into lists of strings in order to construct an action command line, it would defeat this memory-sharing optimization.
For this reason, the action-constructing functions accept Args objects in addition to strings. Each Args object represents a concatenation of strings and depsets, with optional transformations for manipulating the data. Args objects do not process the depsets they encapsulate until the execution phase, when it comes time to calculate the command line. This helps defer any expensive copying until after the analysis phase is complete. See the Optimizing Performance page for more information.
Args are constructed by calling ctx.actions.args(). They can be passed as the arguments parameter of ctx.actions.run() or ctx.actions.run_shell(). Each mutation of an Args object appends values to the eventual command line.
The map_each feature allows you to customize how items are transformed into strings. If you do not provide a map_each function, the standard conversion is as follows:
File objects are turned into their File.path values.Label objects are turned into a string representation that resolves back to the same object when resolved in the context of the main repository. If possible, the string representation uses the apparent name of a repository in favor of the repository's canonical name, which makes this representation suited for use in BUILD files. While the exact form of the representation is not guaranteed, typical examples are //foo:bar, @repo//foo:bar and @@canonical_name+//foo:bar.bzl.File type to add(), and if you pass them to add_all() or add_joined() then you should provide a map_each function.When using string formatting (format, format_each, and format_joined params of the add*() methods), the format template is interpreted in the same way as %-substitution on strings, except that the template must have exactly one substitution placeholder and it must be %s. Literal percents may be escaped as %%. Formatting is applied after the value is converted to a string as per the above.
Each of the add*() methods have an alternate form that accepts an extra positional parameter, an "arg name" string to insert before the rest of the arguments. For add_all and add_joined the extra string will not be added if the sequence turns out to be empty. For instance, the same usage can add either --foo val1 val2 val3 --bar or just --bar to the command line, depending on whether the given sequence contains val1..val3 or is empty.
If the size of the command line can grow longer than the maximum size allowed by the system, the arguments can be spilled over into parameter files. See use_param_file() and set_param_file_format().
Example: Suppose we wanted to generate the command line:
+--foo foo1.txt foo2.txt ... fooN.txt --bar bar1.txt,bar2.txt,...,barM.txt --baz +We could use the following
Args object:
+# foo_deps and bar_deps are depsets containing
+# File objects for the foo and bar .txt files.
+args = ctx.actions.args()
+args.add_all("--foo", foo_deps)
+args.add_joined("--bar", bar_deps, join_with=",")
+args.add("--baz")
+ctx.actions.run(
+ ...
+ arguments = [args],
+ ...
+)
+
+
+Args Args.add(arg_name_or_value, value=unbound, *, format=None)+ + Appends an argument to this command line. + +
| Parameter | +Description | +
|---|---|
+ arg_name_or_value
+ |
+
+ required + If two positional parameters are passed this is interpreted as the arg name. The arg name is added before the value without any processing. If only one positional parameter is passed, it is interpreted as value (see below).
+ |
+
+ value
+ |
+
+ default is unbound+ The object to append. It will be converted to a string using the standard conversion mentioned above. Since there is no map_each parameter for this function, value should be either a string or a File. A list, tuple, depset, or directory File must be passed to add_all() or add_joined() instead of this method.
+ |
+
+ format
+ |
+
+ string; or None;
+ default is None+ A format string pattern, to be applied to the stringified version of value.
+ |
+
Args Args.add_all(arg_name_or_values, values=unbound, *, map_each=None, format_each=None, before_each=None, omit_if_empty=True, uniquify=False, expand_directories=True, terminate_with=None, allow_closure=False)+ + Appends multiple arguments to this command line. The items are processed lazily during the execution phase.
Most of the processing occurs over a list of arguments to be appended, as per the following steps:
File item is replaced by all Files recursively contained in that directory.map_each is given, it is applied to each item, and the resulting lists of strings are concatenated to form the initial argument list. Otherwise, the initial argument list is the result of applying the standard conversion to each item.format_each, if present.uniquify is true, duplicate arguments are removed. The first occurrence is the one that remains.before_each string is given, it is inserted as a new argument before each existing argument in the list. This effectively doubles the number of arguments to be appended by this point.omit_if_empty is true (the default), the arg name and terminate_with are inserted as the first and last arguments, respectively, if they are given.| Parameter | +Description | +
|---|---|
+ arg_name_or_values
+ |
+
+ required + If two positional parameters are passed this is interpreted as the arg name. The arg name is added before the values as a separate argument without any processing. This arg name will not be added if omit_if_empty is true (the default) and no other items are appended (as happens if values is empty or all of its items are filtered). If only one positional parameter is passed, it is interpreted as values (see below).
+ |
+
+ values
+ |
+
+ sequence; or depset;
+ default is unbound+ The list, tuple, or depset whose items will be appended. + |
+
+ map_each
+ |
+
+ callable; or None;
+ default is None+ A function that converts each item to zero or more strings, which may be further processed before appending. If this param is not provided, the standard conversion is used. The function is passed either one or two positional arguments: the item to convert, followed by an optional The return value's type depends on how many arguments are to be produced for the item:
None has the same effect as returning a list of length 1 or length 0 respectively. However, it is more efficient and readable to avoid creating a list where it is not needed.Ordinarily, items that are directories are automatically expanded to their contents when To avoid unintended retention of large analysis-phase data structures into the execution phase, the Warning: |
+
+ format_each
+ |
+
+ string; or None;
+ default is None+ An optional format string pattern, applied to each string returned by the map_each function. The format string must have exactly one '%s' placeholder.
+ |
+
+ before_each
+ |
+
+ string; or None;
+ default is None+ An optional argument to append before each argument derived from values is appended.
+ |
+
+ omit_if_empty
+ |
+
+ bool;
+ default is True+ If true, if there are no arguments derived from values to be appended, then all further processing is suppressed and the command line will be unchanged. If false, the arg name and terminate_with, if provided, will still be appended regardless of whether or not there are other arguments.
+ |
+
+ uniquify
+ |
+
+ bool;
+ default is False+ If true, duplicate arguments that are derived from values will be omitted. Only the first occurrence of each argument will remain. Usually this feature is not needed because depsets already omit duplicates, but it can be useful if map_each emits the same string for multiple items.
+ |
+
+ expand_directories
+ |
+
+ bool;
+ default is True+ If true, any directories in values will be expanded to a flat list of files. This happens before map_each is applied.
+ |
+
+ terminate_with
+ |
+
+ string; or None;
+ default is None+ An optional argument to append after all other arguments. This argument will not be added if omit_if_empty is true (the default) and no other items are appended (as happens if values is empty or all of its items are filtered).
+ |
+
+ allow_closure
+ |
+
+ bool;
+ default is False+ If true, allows the use of closures in function parameters like map_each. Usually this isn't necessary and it risks retaining large analysis-phase data structures into the execution phase.
+ |
+
Args Args.add_joined(arg_name_or_values, values=unbound, *, join_with, map_each=None, format_each=None, format_joined=None, omit_if_empty=True, uniquify=False, expand_directories=True, allow_closure=False)+ + Appends an argument to this command line by concatenating together multiple values using a separator. The items are processed lazily during the execution phase.
Processing is similar to add_all(), but the list of arguments derived from values is combined into a single argument as if by join_with.join(...), and then formatted using the given format_joined string template. Unlike add_all(), there is no before_each or terminate_with parameter since these are not generally useful when the items are combined into a single argument.
If after filtering there are no strings to join into an argument, and if omit_if_empty is true (the default), no processing is done. Otherwise if there are no strings to join but omit_if_empty is false, the joined string will be an empty string.
+
+
| Parameter | +Description | +
|---|---|
+ arg_name_or_values
+ |
+
+ required + If two positional parameters are passed this is interpreted as the arg name. The arg name is added before values without any processing. This arg will not be added if omit_if_empty is true (the default) and there are no strings derived from values to join together (which can happen if values is empty or all of its items are filtered). If only one positional parameter is passed, it is interpreted as values (see below).
+ |
+
+ values
+ |
+
+ sequence; or depset;
+ default is unbound+ The list, tuple, or depset whose items will be joined. + |
+
+ join_with
+ |
+
+ string;
+ required + A delimiter string used to join together the strings obtained from applying map_each and format_each, in the same manner as string.join().
+ |
+
+ map_each
+ |
+
+ callable; or None;
+ default is None+ Same as for add_all.
+ |
+
+ format_each
+ |
+
+ string; or None;
+ default is None+ Same as for add_all.
+ |
+
+ format_joined
+ |
+
+ string; or None;
+ default is None+ An optional format string pattern applied to the joined string. The format string must have exactly one '%s' placeholder. + |
+
+ omit_if_empty
+ |
+
+ bool;
+ default is True+ If true, if there are no strings to join together (either because values is empty or all its items are filtered), then all further processing is suppressed and the command line will be unchanged. If false, then even if there are no strings to join together, two arguments will be appended: the arg name followed by an empty string (which is the logical join of zero strings).
+ |
+
+ uniquify
+ |
+
+ bool;
+ default is False+ Same as for add_all.
+ |
+
+ expand_directories
+ |
+
+ bool;
+ default is True+ Same as for add_all.
+ |
+
+ allow_closure
+ |
+
+ bool;
+ default is False+ Same as for add_all.
+ |
+
Args Args.set_param_file_format(format)+ + Sets the format of the param file, if one is used + +
| Parameter | +Description | +
|---|---|
+ format
+ |
+
+ string;
+ required + Must be one of:
The format defaults to "shell" if not called. + |
+
Args Args.use_param_file(param_file_arg, *, use_always=False)+ + Spills the args to a params file, replacing them with a pointer to the param file. Use when your args may be too large for the system's command length limits.
Bazel may choose to elide writing the params file to the output tree during execution for efficiency. If you are debugging actions and want to inspect the param file, pass --materialize_param_files to your build.
+
+
| Parameter | +Description | +
|---|---|
+ param_file_arg
+ |
+
+ string;
+ required + A format string with a single "%s". If the args are spilled to a params file then they are replaced with an argument consisting of this string formatted with the path of the params file. For example, if the args are spilled to a params file "params.txt", then specifying "--file=%s" would cause the action command line to contain "--file=params.txt". + |
+
+ use_always
+ |
+
+ bool;
+ default is False+ Whether to always spill the args to a params file. If false, bazel will decide whether the arguments need to be spilled based on your system and arg length. + |
+
sequence CcCompilationOutputs.objects+ + Non-PIC object files. + +
sequence CcCompilationOutputs.pic_objects+ + PIC object files. + + + + + + diff --git a/rules/lib/builtins/CcLinkingOutputs.mdx b/rules/lib/builtins/CcLinkingOutputs.mdx new file mode 100644 index 0000000..55d6e98 --- /dev/null +++ b/rules/lib/builtins/CcLinkingOutputs.mdx @@ -0,0 +1,46 @@ +--- +title: 'CcLinkingOutputs' +--- + + + + + + + + +
File CcLinkingOutputs.executable+ + Represents the linked executable. + May return
None.
+
+ LibraryToLink CcLinkingOutputs.library_to_link+ +
LibraryToLink for including these outputs in further linking.
+ May return None.
+
+
+
+
+
+
diff --git a/rules/lib/builtins/CompilationContext.mdx b/rules/lib/builtins/CompilationContext.mdx
new file mode 100644
index 0000000..1b3bbfe
--- /dev/null
+++ b/rules/lib/builtins/CompilationContext.mdx
@@ -0,0 +1,132 @@
+---
+title: 'CompilationContext'
+---
+
+
+
+
+
+
+
+
+depset CompilationContext.defines+ + Returns the set of defines needed to compile this target. Each define is a string. These values are propagated to the target's transitive dependents, that is, any rules that depend on this target. + +
list CompilationContext.direct_headers+ + Returns the list of modular headers that are declared by this target. This includes both public headers (such as those listed in "hdrs") and private headers (such as those listed in "srcs"). + +
list CompilationContext.direct_private_headers+ + Returns the list of modular private headers (those listed in "srcs") that are declared by this target. + +
list CompilationContext.direct_public_headers+ + Returns the list of modular public headers (those listed in "hdrs") that are declared by this target. + +
list CompilationContext.direct_textual_headers+ + Returns the list of textual headers that are declared by this target. + +
depset CompilationContext.external_includes+ + Returns the set of search paths (as strings) for external header files referenced by angle bracket. Usually passed with -isystem. + +
depset CompilationContext.framework_includes+ + Returns the set of search paths (as strings) for framework header files. Usually passed with -F. + +
depset CompilationContext.headers+ + Returns the set of headers needed to compile this target. + +
depset CompilationContext.includes+ + Returns the set of search paths (as strings) for header files referenced both by angle bracket and quotes. Usually passed with -I. + +
depset CompilationContext.local_defines+ + Returns the set of defines needed to compile this target. Each define is a string. These values are not propagated to the target's transitive dependents. + +
depset CompilationContext.quote_includes+ + Returns the set of search paths (as strings) for header files referenced by quotes, e.g. #include "foo/bar/header.h". They can be either relative to the exec root or absolute. Usually passed with -iquote. + +
depset CompilationContext.system_includes+ + Returns the set of search paths (as strings) for header files referenced by angle brackets, e.g. #include <foo/bar/header.h>. They can be either relative to the exec root or absolute. Usually passed with -isystem. + +
depset CompilationContext.validation_artifacts+ + Returns the set of validation artifacts. + + + + + + diff --git a/rules/lib/builtins/DirectoryExpander.mdx b/rules/lib/builtins/DirectoryExpander.mdx new file mode 100644 index 0000000..921b35a --- /dev/null +++ b/rules/lib/builtins/DirectoryExpander.mdx @@ -0,0 +1,63 @@ +--- +title: 'DirectoryExpander' +--- + + + + + + + + +
ctx.actions.declare_directory during the execution phase. This is useful to expand directories in map_each.
+
+list DirectoryExpander.expand(file)+ + If the given
File is a directory, this returns a list of Files recursively underneath the directory. Otherwise, this returns a list containing just the given File itself.
+
+ | Parameter | +Description | +
|---|---|
+ file
+ |
+
+ File;
+ required + The directory or file to expand. + |
+
int DottedVersion.compare_to(other)+ + Compares based on most significant (first) not-matching version component. So, for example, 1.2.3 < 1.2.4 + +
| Parameter | +Description | +
|---|---|
+ other
+ |
+
+ DottedVersion;
+ required + The other dotted version. + |
+
ToolchainContext ExecGroupContext.toolchains+ + Toolchains required for this exec group + + + + + + diff --git a/rules/lib/builtins/ExecTransitionFactory.mdx b/rules/lib/builtins/ExecTransitionFactory.mdx new file mode 100644 index 0000000..efad8bc --- /dev/null +++ b/rules/lib/builtins/ExecTransitionFactory.mdx @@ -0,0 +1,25 @@ +--- +title: 'ExecTransitionFactory' +--- + + + + + + + + +
list ExpandedDirectory.children+ + Contains the files within the directory. + +
File ExpandedDirectory.directory+ + The input directory that was expanded. + + + + + + diff --git a/rules/lib/builtins/FeatureConfiguration.mdx b/rules/lib/builtins/FeatureConfiguration.mdx new file mode 100644 index 0000000..da61d12 --- /dev/null +++ b/rules/lib/builtins/FeatureConfiguration.mdx @@ -0,0 +1,25 @@ +--- +title: 'FeatureConfiguration' +--- + + + + + + + + +
When a File is passed to an Args object without using a map_each function, it is converted to a string by taking the value of its path field.
+
+
string File.basename+ + The base name of this file. This is the name of the file inside the directory. + +
string File.dirname+ + The name of the directory containing this file. It's taken from path and is always relative to the execution directory. + +
string File.extension+ + The file extension of this file, following (not including) the rightmost period. Empty string if the file's basename includes no periods. + +
bool File.is_directory+ + Returns true if this is a directory. This reflects the type the file was declared as (i.e. ctx.actions.declare_directory), not its type on the filesystem, which might differ. + +
bool File.is_source+ + Returns true if this is a source file, i.e. it is not generated. + +
bool File.is_symlink+ + Returns true if this was declared as a symlink. This reflects the type the file was declared as (i.e. ctx.actions.declare_symlink), not its type on the filesystem, which might differ. + +
Label File.owner+ + A label of a target that produces this File. + May return
None.
+
+ string File.path+ + The execution path of this file, relative to the workspace's execution directory. It consists of two parts, an optional first part called the root (see also the root module), and the second part which is the
short_path. The root may be empty, which it usually is for non-generated files. For generated files it usually contains a configuration-specific path fragment that encodes things like the target CPU architecture that was used while building said file. Use the short_path for the path under which the file is mapped if it's in the runfiles of a binary.
+
+ root File.root+ + The root beneath which this file resides. + +
string File.short_path+ + The path of this file relative to its root. This excludes the aforementioned root, i.e. configuration-specific fragments of the path. This is also the path under which the file is mapped if it's in the runfiles of a binary. + +
string File.tree_relative_path+ + The path of this file relative to the root of the ancestor's tree, if the ancestor's is_directory field is true.
tree_relative_path is only available for expanded files of a directory in an action command, i.e. Args.add_all(). For other types of files, it is an error to access this field.
+
+
+
+
+
+
diff --git a/rules/lib/builtins/Label.mdx b/rules/lib/builtins/Label.mdx
new file mode 100644
index 0000000..be83e2f
--- /dev/null
+++ b/rules/lib/builtins/Label.mdx
@@ -0,0 +1,181 @@
+---
+title: 'Label'
+---
+
+
+
+
+
+
+
+
+For every Label instance l, the string representation str(l) has the property that Label(str(l)) == l, regardless of where the Label() call occurs.
When passed as positional arguments to print() or fail(), Label use a string representation optimized for human readability instead. This representation uses an apparent repository name from the perspective of the main repository if possible.
+
+
Label Label(input)+ + Converts a label string into a
Label object, in the context of the package where the calling .bzl source file lives. If the given value is already a Label, it is returned unchanged.For macros, a related function, native.package_relative_label(), converts the input into a Label in the context of the package currently being constructed. Use that function to mimic the string-to-label conversion that is automatically done by label-valued rule attributes.
+
+
| Parameter | +Description | +
|---|---|
+ input
+ |
+
+ string; or Label;
+ required + The input label string or Label object. If a Label object is passed, it's returned as is. + |
+
string Label.name+ + The name of the target referred to by this label. For instance:
Label("@@foo//pkg/foo:abc").name == "abc"
+
+ string Label.package+ + The name of the package containing the target referred to by this label, without the repository name. For instance:
Label("@@repo//pkg/foo:abc").package == "pkg/foo"
+
+ Label Label.relative(relName)+ + Experimental. This API is experimental and may change at any time. Please do not depend on it. It may be enabled on an experimental basis by setting
--+incompatible_enable_deprecated_label_apis Label.same_package_label(), native.package_relative_label(), or Label() instead.Resolves a label that is either absolute (starts with //) or relative to the current package. If this label is in a remote repository, the argument will be resolved relative to that repository. If the argument contains a repository name, the current label is ignored and the argument is returned as-is, except that the repository name is rewritten if it is in the current repository mapping. Reserved labels will also be returned as-is.
For example:
+Label("//foo/bar:baz").relative(":quux") == Label("//foo/bar:quux")
+Label("//foo/bar:baz").relative("//wiz:quux") == Label("//wiz:quux")
+Label("@repo//foo/bar:baz").relative("//wiz:quux") == Label("@repo//wiz:quux")
+Label("@repo//foo/bar:baz").relative("//visibility:public") == Label("//visibility:public")
+Label("@repo//foo/bar:baz").relative("@other//wiz:quux") == Label("@other//wiz:quux")
+If the repository mapping passed in is {'@other' : '@remapped'}, then the following remapping will take place:
+Label("@repo//foo/bar:baz").relative("@other//wiz:quux") == Label("@remapped//wiz:quux")
+
+
+ | Parameter | +Description | +
|---|---|
+ relName
+ |
+
+ string;
+ required + The label that will be resolved relative to this one. + |
+
string Label.repo_name+ + The canonical name of the repository containing the target referred to by this label, without any leading at-signs (
@). For instance, Label("@@foo//bar:baz").repo_name == "foo"
+
+ Label Label.same_package_label(target_name)+ + Creates a label in the same package as this label with the given target name. + +
| Parameter | +Description | +
|---|---|
+ target_name
+ |
+
+ string;
+ required + The target name of the new label. + |
+
string Label.workspace_name+ + Experimental. This API is experimental and may change at any time. Please do not depend on it. It may be enabled on an experimental basis by setting
--+incompatible_enable_deprecated_label_apis Label.repo_name instead.The canonical name of the repository containing the target referred to by this label, without any leading at-signs (@). For instance,
Label("@@foo//bar:baz").workspace_name == "foo"
+
+ string Label.workspace_root+ + Returns the execution root for the repository containing the target referred to by this label, relative to the execroot. For instance:
Label("@repo//pkg/foo:abc").workspace_root == "external/repo"
+
+
+
+
+
+
diff --git a/rules/lib/builtins/LateBoundDefault.mdx b/rules/lib/builtins/LateBoundDefault.mdx
new file mode 100644
index 0000000..443f34e
--- /dev/null
+++ b/rules/lib/builtins/LateBoundDefault.mdx
@@ -0,0 +1,25 @@
+---
+title: 'LateBoundDefault'
+---
+
+
+
+
+
+
+
+
+See configuration_field for example usage. + + + + + + + diff --git a/rules/lib/builtins/LibraryToLink.mdx b/rules/lib/builtins/LibraryToLink.mdx new file mode 100644 index 0000000..88374ef --- /dev/null +++ b/rules/lib/builtins/LibraryToLink.mdx @@ -0,0 +1,126 @@ +--- +title: 'LibraryToLink' +--- + + +
+ + + + + +bool LibraryToLink.alwayslink+ + Whether to link the static library/objects in the --whole_archive block. + +
File LibraryToLink.dynamic_library+ +
Artifact of dynamic library to be linked. Always used for runtime and used for linking if interface_library is not passed.
+ May return None.
+
+ File LibraryToLink.interface_library+ +
Artifact of interface library to be linked.
+ May return None.
+
+ sequence LibraryToLink.lto_bitcode_files+ +
List of LTO bitcode files in the library.
+ May return None.
+
+ sequence LibraryToLink.objects+ +
List of object files in the library.
+ May return None.
+
+ sequence LibraryToLink.pic_lto_bitcode_files+ +
List of pic LTO bitcode files in the library.
+ May return None.
+
+ sequence LibraryToLink.pic_objects+ +
List of pic object files in the library.
+ May return None.
+
+ File LibraryToLink.pic_static_library+ +
Artifact of pic static library to be linked.
+ May return None.
+
+ File LibraryToLink.resolved_symlink_dynamic_library+ + The resolved
Artifact of the dynamic library to be linked if dynamic_library is a symlink, otherwise this is None.
+ May return None.
+
+ File LibraryToLink.resolved_symlink_interface_library+ + The resolved
Artifact of the interface library to be linked if interface_library is a symlink, otherwise this is None.
+ May return None.
+
+ File LibraryToLink.static_library+ +
Artifact of static library to be linked.
+ May return None.
+
+
+
+
+
+
diff --git a/rules/lib/builtins/License.mdx b/rules/lib/builtins/License.mdx
new file mode 100644
index 0000000..42229c5
--- /dev/null
+++ b/rules/lib/builtins/License.mdx
@@ -0,0 +1,25 @@
+---
+title: 'License'
+---
+
+
+
+
+
+
+
+
+sequence LinkerInput.additional_inputs+ + Returns the depset of additional inputs, e.g.: linker scripts. + +
sequence LinkerInput.libraries+ + Returns the depset of
LibraryToLink. May return a list but this is deprecated. See #8118.
+
+ Label LinkerInput.owner+ + Returns the owner of this LinkerInput. + +
sequence LinkerInput.user_link_flags+ + Returns the list of user link flags passed as strings. + + + + + + diff --git a/rules/lib/builtins/LinkingContext.mdx b/rules/lib/builtins/LinkingContext.mdx new file mode 100644 index 0000000..67e1369 --- /dev/null +++ b/rules/lib/builtins/LinkingContext.mdx @@ -0,0 +1,36 @@ +--- +title: 'LinkingContext' +--- + + + + + + + + +
depset LinkingContext.linker_inputs+ + Returns the depset of linker inputs. + + + + + + diff --git a/rules/lib/builtins/Provider.mdx b/rules/lib/builtins/Provider.mdx new file mode 100644 index 0000000..7206e4d --- /dev/null +++ b/rules/lib/builtins/Provider.mdx @@ -0,0 +1,29 @@ +--- +title: 'Provider' +--- + + + + + + + + +
DataInfo = provider() +d = DataInfo(x = 2, y = 3) +print(d.x + d.y) # prints 5Note: Some providers, defined internally, do not allow instance creation
DataInfo = provider() +def _rule_impl(ctx) + ... ctx.attr.dep[DataInfo]
Provider using the provider function.
+
+
+
+
+
+
+
diff --git a/rules/lib/builtins/Subrule.mdx b/rules/lib/builtins/Subrule.mdx
new file mode 100644
index 0000000..9fd6128
--- /dev/null
+++ b/rules/lib/builtins/Subrule.mdx
@@ -0,0 +1,25 @@
+---
+title: 'Subrule'
+---
+
+
+
+
+
+
+
+
+string SymlinkEntry.path+ + The path of the symlink in the runfiles tree + +
File SymlinkEntry.target_file+ + Target file of the symlink + + + + + + diff --git a/rules/lib/builtins/Target.mdx b/rules/lib/builtins/Target.mdx new file mode 100644 index 0000000..0fa26fc --- /dev/null +++ b/rules/lib/builtins/Target.mdx @@ -0,0 +1,33 @@ +--- +title: 'Target' +--- + + + + + + + + +
ctx.attr corresponding to dependency attributes (label or label_list). Has the following fields:
+Label Target.labeltarget[DefaultInfo]). The presence of providers can be checked using the in operator (SomeInfo in target).TemplateDict TemplateDict.add(key, value)+ + Add a String value + +
| Parameter | +Description | +
|---|---|
+ key
+ |
+
+ string;
+ required + A String key + |
+
+ value
+ |
+
+ string;
+ required + A String value + |
+
TemplateDict TemplateDict.add_joined(key, values, *, join_with, map_each, uniquify=False, format_joined=None, allow_closure=False)+ + Add depset of values + +
| Parameter | +Description | +
|---|---|
+ key
+ |
+
+ string;
+ required + A String key + |
+
+ values
+ |
+
+ depset;
+ required + The depset whose items will be joined. + |
+
+ join_with
+ |
+
+ string;
+ required + A delimiter string used to join together the strings obtained from applying map_each, in the same manner as string.join().
+ |
+
+ map_each
+ |
+
+ callable;
+ required + A Starlark function accepting a single argument and returning either a string, None, or a list of strings. This function is applied to each item of the depset specified in the values parameter
+ |
+
+ uniquify
+ |
+
+ bool;
+ default is False+ If true, duplicate strings derived from values will be omitted. Only the first occurrence of each string will remain. Usually this feature is not needed because depsets already omit duplicates, but it can be useful if map_each emits the same string for multiple items.
+ |
+
+ format_joined
+ |
+
+ string; or None;
+ default is None+ An optional format string pattern applied to the joined string. The format string must have exactly one '%s' placeholder. + |
+
+ allow_closure
+ |
+
+ bool;
+ default is False+ If true, allows the use of closures in function parameters like map_each. Usually this isn't necessary and it risks retaining large analysis-phase data structures into the execution phase.
+ |
+
ctx.toolchains["//pkg:my_toolchain_type"]. If the toolchain was optional and no toolchain was resolved, this will return None. Accessing toolchains of an aspect or rule via ctx.toolchains returns the indexed toolchain as a ToolchainInfo provider. While when using aspects, ToolchainContext is also used to hold the toolchains of the base target. It can be accessed by ctx.rule.toolchains["//pkg:my_toolchain_type"] and it returns the list of providers resulted from applying the aspects on these toolchain targets.
+
+
+
+
+
+
+
diff --git a/rules/lib/builtins/actions.mdx b/rules/lib/builtins/actions.mdx
new file mode 100644
index 0000000..fff1554
--- /dev/null
+++ b/rules/lib/builtins/actions.mdx
@@ -0,0 +1,988 @@
+---
+title: 'actions'
+---
+
+
+
+
+
+
+
+
+ctx.actions.
+
+Args actions.args()+ + Returns an Args object that can be used to build memory-efficient command lines. + +
File actions.declare_directory(filename, *, sibling=None)+ + Declares that the rule or aspect creates a directory with the given name, in the current package. You must create an action that generates the directory. The contents of the directory are not directly accessible from Starlark, but can be expanded in an action command with
Args.add_all(). Only regular files and directories can be in the expanded contents of a declare_directory.
+
+ | Parameter | +Description | +
|---|---|
+ filename
+ |
+
+ string;
+ required + If no 'sibling' provided, path of the new directory, relative to the current package. Otherwise a base name for a file ('sibling' defines a directory). + |
+
+ sibling
+ |
+
+ File; or None;
+ default is None+ A file that lives in the same directory as the newly declared directory. The file must be in the current package. + |
+
File actions.declare_file(filename, *, sibling=None)+ + Declares that the rule or aspect creates a file with the given filename. If
sibling is not specified, the file name is relative to the package directory, otherwise the file is in the same directory as sibling. Files cannot be created outside of the current package.Remember that in addition to declaring a file, you must separately create an action that emits the file. Creating that action will require passing the returned File object to the action's construction function.
Note that predeclared output files do not need to be (and cannot be) declared using this function. You can obtain their File objects from ctx.outputs instead. See example of use.
+
+
| Parameter | +Description | +
|---|---|
+ filename
+ |
+
+ string;
+ required + If no 'sibling' provided, path of the new file, relative to the current package. Otherwise a base name for a file ('sibling' determines a directory). + |
+
+ sibling
+ |
+
+ File; or None;
+ default is None+ A file that lives in the same directory as the newly created file. The file must be in the current package. + |
+
File actions.declare_symlink(filename, *, sibling=None)+ + Declares that the rule or aspect creates a symlink with the given name in the current package. You must create an action that generates this symlink. Bazel will never dereference this symlink and will transfer it verbatim to sandboxes or remote executors. Symlinks inside tree artifacts are not currently supported. + +
| Parameter | +Description | +
|---|---|
+ filename
+ |
+
+ string;
+ required + If no 'sibling' provided, path of the new symlink, relative to the current package. Otherwise a base name for a file ('sibling' defines a directory). + |
+
+ sibling
+ |
+
+ File; or None;
+ default is None+ A file that lives in the same directory as the newly declared symlink. + |
+
None actions.do_nothing(*, mnemonic, inputs=[])
+
+ Creates an empty action that neither executes a command nor produces any output, but that is useful for inserting 'extra actions'.
+
+ | Parameter | +Description | +
|---|---|
+ mnemonic
+ |
+
+ string;
+ required + A one-word description of the action, for example, CppCompile or GoLink. + |
+
+ inputs
+ |
+
+ sequence of Files; or depset;
+ default is []+ List of the input files of the action. + |
+
None actions.expand_template(*, template, output, substitutions={}, is_executable=False, computed_substitutions=unbound)
+
+ Creates a template expansion action. When the action is executed, it will generate a file based on a template. Parts of the template will be replaced using the substitutions dictionary, in the order the substitutions are specified. Whenever a key of the dictionary appears in the template (or a result of a previous substitution), it is replaced with the associated value. There is no special syntax for the keys. You may, for example, use curly braces to avoid conflicts (for example, {KEY}). See example of use.
+
+ | Parameter | +Description | +
|---|---|
+ template
+ |
+
+ File;
+ required + The template file, which is a UTF-8 encoded text file. + |
+
+ output
+ |
+
+ File;
+ required + The output file, which is a UTF-8 encoded text file. + |
+
+ substitutions
+ |
+
+ dict;
+ default is {}+ Substitutions to make when expanding the template. + |
+
+ is_executable
+ |
+
+ bool;
+ default is False+ Whether the output file should be executable. + |
+
+ computed_substitutions
+ |
+
+ TemplateDict;
+ default is unbound+ Substitutions to make when expanding the template. + |
+
None actions.map_directory(*, input_directories, additional_inputs={}, output_directories, tools, additional_params={}, execution_requirements=None, exec_group=None, toolchain=None, use_default_shell_env=False, env=None, mnemonic=None, implementation)
+
+ Creates multiple actions based on the files within one or more input directories, to output one or more output directories.
+
+ | Parameter | +Description | +
|---|---|
+ input_directories
+ |
+
+ dict of Files;
+ required + A dictionary mapping of strings to input directories, as declared by ctx.actions.declare_directory() (only directories are allowed as values here). The values specify the directories that we want expanded to access their files in the implementation function. The keys (strings) act as identifiers to easily reference a specific directory in the implementation function.
+ |
+
+ additional_inputs
+ |
+
+ dict;
+ default is {}+ A dictionary of mapping of strings to additional inputs (only files, FilesToRunProvider(s) and Depset(s) are allowed here). The values specify any additional inputs that we want to make accessible to actions created by the implementation function. The keys (strings) act as identifiers to easily reference a specific input from within the implementation function. + |
+
+ output_directories
+ |
+
+ dict of Files;
+ required + A dictionary mapping of strings to output directories, as declared by ctx.actions.declare_directory(). The values specify the output directories that we want to generate by the actions created by the implementation function. The keys (strings) act as identifiers to easily reference a specific output directory from within the implementation function.
+ |
+
+ tools
+ |
+
+ dict;
+ required + A dictionary mapping of strings to tools (only files, FilesToRunProvider(s) and Depset(s) are allowed here). The values specify the tools that we want to make accessible to actions created by the implementation function. The keys (strings) act as identifiers to easily reference a specific tool from within the implementation function. + |
+
+ additional_params
+ |
+
+ dict;
+ default is {}+ A dictionary mapping of strings to additional parameters (only string, boolean and integer values are allowed here). The values specify any additional parameters that we want to make accessible to the implementation function that could be used to influence its behavior. The keys (strings) act as identifiers to easily reference a specific parameter from within the implementation function. + |
+
+ execution_requirements
+ |
+
+ dict; or None;
+ default is None+ Information for scheduling the created actions. See tags for useful keys. + |
+
+ exec_group
+ |
+
+ string; or None;
+ default is None+ Run the created actions on the given exec group's execution platform. If none, uses the target's default execution platform. + |
+
+ toolchain
+ |
+
+ Label; or string; or None;
+ default is None+ Toolchain type of the executable or tools used by the created actions. If executable and tools are not coming from a toolchain, set this parameter to If executable and tools are coming from a toolchain, toolchain type must be set so that the created actions execute on the correct execution platform. Note that the rule which creates these actions needs to define this toolchain inside its 'rule()' function. When |
+
+ use_default_shell_env
+ |
+
+ bool;
+ default is False+ Whether the created actions should use the default shell environment, which consists of a few OS-dependent variables as well as variables set via --action_env.If both |
+
+ env
+ |
+
+ dict; or None;
+ default is None+ Sets the dictionary of environment variables. If both |
+
+ mnemonic
+ |
+
+ string; or None;
+ default is None+ A one-word description of the created actions, for example, CppCompile or GoLink. + |
+
+ implementation
+ |
+
+ function;
+ required + A Starlark function that gets called after input directories have been built to generate actions +that output files to the specified output directories. This function is passed the following +arguments: + +
|
+
None actions.run(*, outputs, inputs=[], unused_inputs_list=None, executable, tools=unbound, arguments=[], mnemonic=None, progress_message=None, use_default_shell_env=False, env=None, execution_requirements=None, input_manifests=None, exec_group=None, shadowed_action=None, resource_set=None, toolchain=unbound)
+
+ Creates an action that runs an executable. See example of use.
+
+ | Parameter | +Description | +
|---|---|
+ outputs
+ |
+
+ sequence of Files;
+ required + List of the output files of the action. + |
+
+ inputs
+ |
+
+ sequence of Files; or depset;
+ default is []+ List or depset of the input files of the action. + |
+
+ unused_inputs_list
+ |
+
+ File; or None;
+ default is None+ File containing list of inputs unused by the action. The content of this file (generally one of the outputs of the action) corresponds to the list of input files that were not used during the whole action execution. Any change in those files must not affect in any way the outputs of the action. + |
+
+ executable
+ |
+
+ File; or string; or FilesToRunProvider;
+ required + The executable file to be called by the action. + |
+
+ tools
+ |
+
+ sequence; or depset;
+ default is unbound+ List or depset of any tools needed by the action. Tools are executable inputs that may have their own runfiles which are automatically made available to the action. +When a list is provided, it can be a heterogenous collection of: +
Files from ctx.executable and FilesToRunProviders which are directly in the list will have their runfiles automatically added. All tools are implicitly added as inputs.
+
+
+ |
+
+ arguments
+ |
+
+ sequence;
+ default is []+ Command line arguments of the action. Must be a list of strings or actions.args() objects.
+ |
+
+ mnemonic
+ |
+
+ string; or None;
+ default is None+ A one-word description of the action, for example, CppCompile or GoLink. + |
+
+ progress_message
+ |
+
+ string; or None;
+ default is None+ Progress message to show to the user during the build, for example, "Compiling foo.cc to create foo.o". The message may contain %{label}, %{input}, or %{output} patterns, which are substituted with label string, first input, or output's path, respectively. Prefer to use patterns instead of static strings, because the former are more efficient.
+ |
+
+ use_default_shell_env
+ |
+
+ bool;
+ default is False+ Whether the action should use the default shell environment, which consists of a few OS-dependent variables as well as variables set via --action_env.If both |
+
+ env
+ |
+
+ dict; or None;
+ default is None+ Sets the dictionary of environment variables. If both |
+
+ execution_requirements
+ |
+
+ dict; or None;
+ default is None+ Information for scheduling the action. See tags for useful keys. + |
+
+ input_manifests
+ |
+
+ sequence; or None;
+ default is None+ Legacy argument. Ignored. + |
+
+ exec_group
+ |
+
+ string; or None;
+ default is None+ Runs the action on the given exec group's execution platform. If none, uses the target's default execution platform. + |
+
+ shadowed_action
+ |
+
+ Action;
+ default is None+ Runs the action using the given shadowed action's inputs and environment added to the action's inputs list and environment. The action environment can overwrite any of the shadowed action's environment variables. If none, uses only the action's inputs and given environment. + |
+
+ resource_set
+ |
+
+ callable; or None;
+ default is None+ A callback function that returns a resource set dictionary, used to estimate resource usage at execution time if this action is run locally. The function accepts two positional arguments: a string representing an OS name (e.g. "osx"), and an integer representing the number of inputs to the action. The returned dictionary may contain the following entries, each of which may be a float or an int:
If this parameter is set to The callback must be top-level (lambda and nested functions aren't allowed). + |
+
+ toolchain
+ |
+
+ Label; or string; or None;
+ default is unbound+ Toolchain type of the executable or tools used in this action. If executable and tools are not coming from a toolchain, set this parameter to `None`. If executable and tools are coming from a toolchain, toolchain type must be set so that the action executes on the correct execution platform. Note that the rule which creates this action needs to define this toolchain inside its 'rule()' function. When `toolchain` and `exec_group` parameters are both set, `exec_group` will be used. An error is raised in case the `exec_group` doesn't specify the same toolchain. + |
+
None actions.run_shell(*, outputs, inputs=[], tools=unbound, arguments=[], mnemonic=None, command, progress_message=None, use_default_shell_env=False, env=None, execution_requirements=None, input_manifests=None, exec_group=None, shadowed_action=None, resource_set=None, toolchain=unbound)
+
+ Creates an action that runs a shell command. See example of use.
+
+ | Parameter | +Description | +
|---|---|
+ outputs
+ |
+
+ sequence of Files;
+ required + List of the output files of the action. + |
+
+ inputs
+ |
+
+ sequence of Files; or depset;
+ default is []+ List or depset of the input files of the action. + |
+
+ tools
+ |
+
+ sequence of Files; or depset;
+ default is unbound+ List or depset of any tools needed by the action. Tools are executable inputs that may have their own runfiles which are automatically made available to the action. +When a list is provided, it can be a heterogenous collection of: +
Files from ctx.executable and FilesToRunProviders which are directly in the list will have their runfiles automatically added. All tools are implicitly added as inputs.
+
+
+ |
+
+ arguments
+ |
+
+ sequence;
+ default is []+ Command line arguments of the action. Must be a list of strings or actions.args() objects.Bazel passes the elements in this attribute as arguments to the command.The command can access these arguments using shell variable substitutions such as In the case where |
+
+ mnemonic
+ |
+
+ string; or None;
+ default is None+ A one-word description of the action, for example, CppCompile or GoLink. + |
+
+ command
+ |
+
+ string; or sequence of strings;
+ required + Shell command to execute. This may either be a string (preferred) or a sequence of strings (deprecated). If (Deprecated) If Bazel uses the same shell to execute the command as it does for genrules. + |
+
+ progress_message
+ |
+
+ string; or None;
+ default is None+ Progress message to show to the user during the build, for example, "Compiling foo.cc to create foo.o". The message may contain %{label}, %{input}, or %{output} patterns, which are substituted with label string, first input, or output's path, respectively. Prefer to use patterns instead of static strings, because the former are more efficient.
+ |
+
+ use_default_shell_env
+ |
+
+ bool;
+ default is False+ Whether the action should use the default shell environment, which consists of a few OS-dependent variables as well as variables set via --action_env.If both |
+
+ env
+ |
+
+ dict; or None;
+ default is None+ Sets the dictionary of environment variables. If both |
+
+ execution_requirements
+ |
+
+ dict; or None;
+ default is None+ Information for scheduling the action. See tags for useful keys. + |
+
+ input_manifests
+ |
+
+ sequence; or None;
+ default is None+ Legacy argument. Ignored. + |
+
+ exec_group
+ |
+
+ string; or None;
+ default is None+ Runs the action on the given exec group's execution platform. If none, uses the target's default execution platform. + |
+
+ shadowed_action
+ |
+
+ Action;
+ default is None+ Runs the action using the given shadowed action's discovered inputs added to the action's inputs list. If none, uses only the action's inputs. + |
+
+ resource_set
+ |
+
+ callable; or None;
+ default is None+ A callback function for estimating resource usage if run locally. See ctx.actions.run().
+ |
+
+ toolchain
+ |
+
+ Label; or string; or None;
+ default is unbound+ Toolchain type of the executable or tools used in this action. If executable and tools are not coming from a toolchain, set this parameter to `None`. If executable and tools are coming from a toolchain, toolchain type must be set so that the action executes on the correct execution platform. Note that the rule which creates this action needs to define this toolchain inside its 'rule()' function. When `toolchain` and `exec_group` parameters are both set, `exec_group` will be used. An error is raised in case the `exec_group` doesn't specify the same toolchain. + |
+
None actions.symlink(*, output, target_file=None, target_path=None, is_executable=False, progress_message=None)
+
+ Creates an action that writes a symlink in the file system.This function must be called with exactly one of target_file or target_path specified.
When you use target_file, declare output with declare_file() or declare_directory() and match the type of target_file. This makes the symlink point to target_file. Bazel invalidates the output of this action whenever the target of the symlink or its contents change.
Otherwise, when you use target_path, declare output with declare_symlink()). In this case, the symlink points to target_path. Bazel never resolves the symlink and the output of this action is invalidated only when the text contents of the symlink (that is, the value of readlink()) changes. In particular, this can be used to create a dangling symlink.
| Parameter | +Description | +
|---|---|
+ output
+ |
+
+ File;
+ required + The output of this action. + |
+
+ target_file
+ |
+
+ File; or None;
+ default is None+ The File that the output symlink will point to. + |
+
+ target_path
+ |
+
+ string; or None;
+ default is None+ The exact path that the output symlink will point to. No normalization or other processing is applied. + |
+
+ is_executable
+ |
+
+ bool;
+ default is False+ May only be used with target_file, not target_path. If true, when the action is executed, the target_file's path is checked to confirm that it is executable, and an error is reported if it is not. Setting is_executable to False does not mean the target is not executable, just that no verification is done.This feature does not make sense for |
+
+ progress_message
+ |
+
+ string; or None;
+ default is None+ Progress message to show to the user during the build. + |
+
TemplateDict actions.template_dict()+ + Returns a TemplateDict object for memory-efficient template expansion. + +
None actions.write(output, content, is_executable=False, *, mnemonic=None)
+
+ Creates a file write action. When the action is executed, it will write the given content to a file. This is used to generate files using information available in the analysis phase. If the file is large and with a lot of static content, consider using expand_template.
+
+ | Parameter | +Description | +
|---|---|
+ output
+ |
+
+ File;
+ required + The output file. + |
+
+ content
+ |
+
+ string; or Args;
+ required + the contents of the file. May be a either a string or an actions.args() object.
+ |
+
+ is_executable
+ |
+
+ bool;
+ default is False+ Whether the output file should be executable. + |
+
+ mnemonic
+ |
+
+ string; or None;
+ default is None+ A one-word description of the action, for example, CppCompile or GoLink. + |
+
Xcode.app/Contents/Developer/Platforms. Each platform represents an Apple platform type (such as iOS or tvOS) combined with one or more related CPU architectures. For example, the iOS simulator platform supports x86_64 and i386 architectures.Specific instances of this type can be retrieved from the fields of the apple_common.platform struct:
apple_common.platform.ios_deviceapple_common.platform.ios_simulatorapple_common.platform.macosapple_common.platform.tvos_deviceapple_common.platform.tvos_simulatorapple_common.platform.watchos_deviceapple_common.platform.watchos_simulatorMore commonly, however, the apple configuration fragment has fields/methods that allow rules to determine the platform for which a target is being built.
Example:
+p = apple_common.platform.ios_device +print(p.name_in_plist) # 'iPhoneOS' ++ +
bool apple_platform.is_device+ + Returns
True if this platform is a device platform or False if it is a simulator platform.
+
+ string apple_platform.name+ + Returns the name aka starlarkKey of this platform. + +
string apple_platform.name_in_plist+ + The name of the platform as it appears in the
CFBundleSupportedPlatforms entry of an Info.plist file and in Xcode's platforms directory, without the extension (for example, iPhoneOS or iPhoneSimulator).iphoneos, iphonesimulator), can be passed to Xcode's command-line tools like ibtool and actool when they expect a platform name.
+
+ string apple_platform.platform_type+ + Returns the platform type of this platform. + + + + + + diff --git a/rules/lib/builtins/bazel_module.mdx b/rules/lib/builtins/bazel_module.mdx new file mode 100644 index 0000000..66167cb --- /dev/null +++ b/rules/lib/builtins/bazel_module.mdx @@ -0,0 +1,60 @@ +--- +title: 'bazel_module' +--- + + + + + + + + +
bool bazel_module.is_root+ + Whether this module is the root module. + +
string bazel_module.name+ + The name of the module. + +
bazel_module_tags bazel_module.tags+ + The tags in the module related to the module extension currently being processed. + +
string bazel_module.version+ + The version of the module. + + + + + + diff --git a/rules/lib/builtins/bazel_module_tags.mdx b/rules/lib/builtins/bazel_module_tags.mdx new file mode 100644 index 0000000..40f42b6 --- /dev/null +++ b/rules/lib/builtins/bazel_module_tags.mdx @@ -0,0 +1,27 @@ +--- +title: 'bazel_module_tags' +--- + + + + + + + + +
print() or fail(), tag instance objects turn into a meaningful string representation of the form "'install' tag at /home/user/workspace/MODULE.bazel:3:4". This can be used to construct error messages that point to the location of the tag in the module file, e.g. fail("Conflict between", tag1, "and", tag2).
+
+
+
+
+
+
+
diff --git a/rules/lib/builtins/configuration.mdx b/rules/lib/builtins/configuration.mdx
new file mode 100644
index 0000000..4410f93
--- /dev/null
+++ b/rules/lib/builtins/configuration.mdx
@@ -0,0 +1,70 @@
+---
+title: 'configuration'
+---
+
+
+
+
+
+
+
+
+bool configuration.coverage_enabled+ + A boolean that tells whether code coverage is enabled for this run. Note that this does not compute whether a specific rule should be instrumented for code coverage data collection. For that, see the
ctx.coverage_instrumented function.
+
+ dict configuration.default_shell_env+ + A dictionary representing the static local shell environment. It maps variables to their values (strings). + +
string configuration.host_path_separator+ + Returns the separator for PATH environment variable, which is ':' on Unix. + +
string configuration.short_id+ + A short identifier for this configuration understood by the
config and query subcommands.
+Use this to distinguish different configurations for the same target in a way that is friendly to humans and tool usage, for example in an aspect used by an IDE. Keep in mind the following caveats:
dict configuration.test_env+ + A dictionary containing user-specified test environment variables and their values, as set by the --test_env options. DO NOT USE! This is not the complete environment! + + + + + + diff --git a/rules/lib/builtins/ctx.mdx b/rules/lib/builtins/ctx.mdx new file mode 100644 index 0000000..1e9ebc2 --- /dev/null +++ b/rules/lib/builtins/ctx.mdx @@ -0,0 +1,625 @@ +--- +title: 'ctx' +--- + + + + + + + + +
In particular, it lets the implementation function access the current target's label, attributes, configuration, and the providers of its dependencies. It has methods for declaring output files and the actions that produce them.
Context objects essentially live for the duration of the call to the implementation function. It is not useful to access these objects outside of their associated function. See the Rules page for more information. + +
actions ctx.actions+ + Contains methods for declaring output files and the actions that produce them. + +
list ctx.aspect_ids+ + A list of ids for all aspects applied to the target. Only available in aspect implementation functions. + +
struct ctx.attr+ + A struct to access the values of the attributes. The values are provided by the user (if not, a default value is used). The attributes of the struct and the types of their values correspond to the keys and values of the
attrs dict provided to the rule function. See example of use.
+
+ root ctx.bin_dir+ + The root corresponding to bin directory. + +
string ctx.build_file_path+ + Deprecated: Use
ctx.label.package + '/BUILD'. The path to the BUILD file for this rule, relative to the source root.
+
+ unknown ctx.build_setting_value+ + Value of the build setting represented by the current target. If this isn't the context for an instance of a rule that sets the
build_setting attribute, reading this is an error.
+
+ configuration ctx.configuration+ + The default configuration. See the configuration type for more details. + +
bool ctx.coverage_instrumented(target=None)+ + Returns whether code coverage instrumentation should be generated when performing compilation actions for this rule or, if
target is provided, the rule specified by that Target. (If a non-rule or a Starlark rule Target is provided, this returns False.) Checks if the sources of the current rule (if no Target is provided) or the sources of Target should be instrumented based on the --instrumentation_filter and --instrument_test_targets config settings. This differs from coverage_enabled in the configuration, which notes whether coverage data collection is enabled for the entire run, but not whether a specific target should be instrumented.
+
+ | Parameter | +Description | +
|---|---|
+ target
+ |
+
+ Target; or None;
+ default is None+ A Target specifying a rule. If not provided, defaults to the current rule. + |
+
StarlarkValue ctx.created_actions()+ + For rules with _skylark_testable set to
True, this returns an Actions provider representing all actions created so far for the current rule. For all other rules, returns None. Note that the provider is not updated when subsequent actions are created, so you will have to call this function again if you wish to inspect them. ctx object and create actions on it.
+
+ list ctx.disabled_features+ + The set of features that are explicitly disabled by the user for this rule. + +
ExecGroupCollection ctx.exec_groups+ + A collection of the execution groups available for this rule, indexed by their name. Access with
ctx.exec_groups[name_of_group].
+
+ struct ctx.executable+ + A
struct containing executable files defined in label type attributes marked as executable=True. The struct fields correspond to the attribute names. Each value in the struct is either a File or None. If an optional attribute is not specified in the rule then the corresponding struct value is None. If a label type is not marked as executable=True, no corresponding struct field is generated. See example of use.
+
+ string ctx.expand_location(input, targets=[])+ + Expands all
$(location ...) templates in the given string by replacing $(location //x) with the path of the output file of target //x. Expansion only works for labels that point to direct dependencies of this rule or that are explicitly listed in the optional argument targets. $(location ...) will cause an error if the referenced target has multiple outputs. In this case, please use $(locations ...) since it produces a space-separated list of output paths. It can be safely used for a single output file, too.genrule). In other cases, it is often better to manipulate labels directly.
+
+ | Parameter | +Description | +
|---|---|
+ input
+ |
+
+ string;
+ required + String to be expanded. + |
+
+ targets
+ |
+
+ sequence of Targets;
+ default is []+ List of targets for additional lookup information. These are expanded as follows: A target with a single file in DefaultInfo.files expands to that file. Other targets expand to their DefaultInfo.executable file if set and if --incompatible_locations_prefers_executable is enabled, otherwise they expand to DefaultInfo.files.
+ |
+
None.
+
+ string ctx.expand_make_variables(attribute_name, command, additional_substitutions)+ + Deprecated. Use ctx.var to access the variables instead.
$(VAR_NAME). Also, $$VAR_NAME expands to $VAR_NAME. Examples:
+ctx.expand_make_variables("cmd", "$(MY_VAR)", {"MY_VAR": "Hi"}) # == "Hi"
+ctx.expand_make_variables("cmd", "$$PWD", {}) # == "$PWD"
+Additional variables may come from other places, such as configurations. Note that this function is experimental.
+
+ | Parameter | +Description | +
|---|---|
+ attribute_name
+ |
+
+ string;
+ required + The attribute name. Used for error reporting. + |
+
+ command
+ |
+
+ string;
+ required + The expression to expand. It can contain references to "Make variables". + |
+
+ additional_substitutions
+ |
+
+ dict;
+ required + Additional substitutions to make beyond the default make variables. + |
+
list ctx.features+ + The set of features that are explicitly enabled by the user for this rule. See example of use. + +
struct ctx.file+ + A
struct containing files defined in label type attributes marked as allow_single_file. The struct fields correspond to the attribute names. The struct value is always a File or None. If an optional attribute is not specified in the rule then the corresponding struct value is None. If a label type is not marked as allow_single_file, no corresponding struct field is generated. It is a shortcut for:list(ctx.attr.<ATTR>.files)[0]In other words, use
file to access the (singular) default output of a dependency. See example of use.
+
+ struct ctx.files+ + A
struct containing files defined in label or label list type attributes. The struct fields correspond to the attribute names. The struct values are list of Files. It is a shortcut for:[f for t in ctx.attr.<ATTR> for f in t.files]In other words, use
files to access the default outputs of a dependency. See example of use.
+
+ fragments ctx.fragments+ + Allows access to configuration fragments in target configuration. + +
root ctx.genfiles_dir+ + The root corresponding to genfiles directory. + +
File ctx.info_file+ + The file that is used to hold the non-volatile workspace status for the current build request. See documentation for --workspace_status_command for more information. + +
Label ctx.label+ + The label of the target currently being analyzed. + +
structure ctx.outputs+ + A pseudo-struct containing all the predeclared output files, represented by
File objects. See the Rules page for more information and examples.This field does not exist on aspect contexts, since aspects do not have predeclared outputs.
The fields of this object are defined as follows. It is an error if two outputs produce the same field name or have the same label.
outputs dict, then for every entry in the dict, there is a field whose name is the key and whose value is the corresponding File.attr.output that the rule declares, there is a field whose name is the attribute's name. If the target specified a label for that attribute, then the field value is the corresponding File; otherwise the field value is None.attr.output_list that the rule declares, there is a field whose name is the attribute's name. The field value is a list of File objects corresponding to the labels given for that attribute in the target, or an empty list if the attribute was not specified in the target.executable or test, there is a field named "executable", which is the default executable. It is recommended that instead of using this, you pass another file (either predeclared or not) to the executable arg of DefaultInfo.tuple ctx.resolve_command(*, command='', attribute=None, expand_locations=False, make_variables=None, tools=[], label_dict={}, execution_requirements={})+ + (Experimental) Returns a tuple
(inputs, command, empty list) of the list of resolved inputs and the argv list for the resolved command both of them suitable for passing as the same-named arguments of the ctx.action method.resolve_tools() instead (if that fits your needs). The empty list is returned as the third member of the tuple for backwards compatibility.
+
+ | Parameter | +Description | +
|---|---|
+ command
+ |
+
+ string;
+ default is ''+ Command to resolve. + |
+
+ attribute
+ |
+
+ string; or None;
+ default is None+ Name of the associated attribute for which to issue an error, or None. + |
+
+ expand_locations
+ |
+
+ bool;
+ default is False+ Shall we expand $(location) variables? See ctx.expand_location() for more details. + |
+
+ make_variables
+ |
+
+ dict; or None;
+ default is None+ Make variables to expand, or None. + |
+
+ tools
+ |
+
+ sequence of Targets;
+ default is []+ List of tools (list of targets). + |
+
+ label_dict
+ |
+
+ dict;
+ default is {}+ Dictionary of resolved labels and the corresponding list of Files (a dict of Label : list of Files). + |
+
+ execution_requirements
+ |
+
+ dict;
+ default is {}+ Information for scheduling the action to resolve this command. See tags for useful keys. + |
+
tuple ctx.resolve_tools(*, tools=[])+ + Returns a tuple
(inputs, empty list) of the depset of resolved inputs required to run the tools, suitable for passing as the same-named argument of the ctx.actions.run and ctx.actions.run_shell methods. ctx.resolve_command, this method does not require that Bash be installed on the machine, so it's suitable for rules built on Windows. The empty list is returned as part of the tuple for backward compatibility.
+
+ | Parameter | +Description | +
|---|---|
+ tools
+ |
+
+ sequence of Targets;
+ default is []+ List of tools (list of targets). + |
+
rule_attributes ctx.rule+ + Rule attributes descriptor for the rule that the aspect is applied to. Only available in aspect implementation functions. + +
runfiles ctx.runfiles(files=[], transitive_files=None, collect_data=False, collect_default=False, symlinks={}, root_symlinks={})+ + Creates a runfiles object. + +
| Parameter | +Description | +
|---|---|
+ files
+ |
+
+ sequence of Files;
+ default is []+ The list of files to be added to the runfiles. + |
+
+ transitive_files
+ |
+
+ depset of Files; or None;
+ default is None+ The (transitive) set of files to be added to the runfiles. The depset should use the default order (which, as the name implies, is the default).
+ |
+
+ collect_data
+ |
+
+ bool;
+ default is False+ Use of this parameter is not recommended. See runfiles guide. Whether to collect the data runfiles from the dependencies in srcs, data and deps attributes. + |
+
+ collect_default
+ |
+
+ bool;
+ default is False+ Use of this parameter is not recommended. See runfiles guide. Whether to collect the default runfiles from the dependencies in srcs, data and deps attributes. + |
+
+ symlinks
+ |
+
+ dict; or depset of SymlinkEntrys;
+ default is {}+ Either a SymlinkEntry depset or the map of symlinks to be added to the runfiles. Symlinks are always added under the main workspace's runfiles directory (e.g. <runfiles_root>/_main/<symlink_path>, not the directory corresponding to the current target's repository. See Runfiles symlinks in the rules guide.
+ |
+
+ root_symlinks
+ |
+
+ dict; or depset of SymlinkEntrys;
+ default is {}+ Either a SymlinkEntry depset or a map of symlinks to be added to the runfiles. See Runfiles symlinks in the rules guide. + |
+
struct ctx.split_attr+ + A struct to access the values of attributes with split configurations. If the attribute is a label list, the value of split_attr is a dict of the keys of the split (as strings) to lists of the ConfiguredTargets in that branch of the split. If the attribute is a label, then the value of split_attr is a dict of the keys of the split (as strings) to single ConfiguredTargets. Attributes with split configurations still appear in the attr struct, but their values will be single lists with all the branches of the split merged together. + +
unknown ctx.super()+ + Experimental: Calls parent's implementation function and returns its providers + +
bool ctx.target_platform_has_constraint(constraintValue)+ + Returns true if the given constraint value is part of the current target platform. + +
| Parameter | +Description | +
|---|---|
+ constraintValue
+ |
+
+ ConstraintValueInfo;
+ required + The constraint value to check the target platform against. + |
+
ToolchainContext ctx.toolchains+ + Toolchains for the default exec group of this rule. + +
dict ctx.var+ + Dictionary (String to String) of configuration variables. + +
File ctx.version_file+ + The file that is used to hold the volatile workspace status for the current build request. See documentation for --workspace_status_command for more information. + +
string ctx.workspace_name+ + The name of the workspace, which is effectively the execution root name and runfiles prefix for the main repo. If
--enable_bzlmod is on, this is the fixed string _main. Otherwise, this is the workspace name as defined in the WORKSPACE file.
+
+
+
+
+
+
diff --git a/rules/lib/builtins/depset.mdx b/rules/lib/builtins/depset.mdx
new file mode 100644
index 0000000..2740279
--- /dev/null
+++ b/rules/lib/builtins/depset.mdx
@@ -0,0 +1,86 @@
+---
+title: 'depset'
+---
+
+
+
+
+
+
+
+
+A specialized data structure that supports efficient merge operations and has a defined traversal +order. Commonly used for accumulating data from transitive dependencies in rules and aspects. For +more information see here. + +
The elements of a depset must be hashable and all of the same type (as defined by the built-in
+type(x) function), but depsets are not simply hash
+sets and do not support fast membership tests. If you need a general set datatype, use the core
+Starlark set type (available since Bazel 8.1); if your .bzl file needs to
+be compatible with older Bazel releases, you can simulate a set by using a dictionary where all keys
+map to True.
+
+
When tested for truth (that is, when used in a Boolean context such as if d: where
+d is a depset), a depset is True if and only if it is non-empty; this check is an O(1)
+operation.
+
+
Depsets are immutable. They should be created using their
+constructor function and merged or augmented with other
+depsets via the transitive argument.
+
+
The order parameter determines the kind of traversal that is done to convert the
+depset to an iterable. There are four possible values:
+
+
"default" (formerly "stable"): Order is unspecified (but
+ deterministic).
+ "postorder" (formerly "compile"): A left-to-right post-ordering.
+ Precisely, this recursively traverses all children leftmost-first, then the direct elements
+ leftmost-first.
+ "preorder" (formerly "naive_link"): A left-to-right pre-ordering.
+ Precisely, this traverses the direct elements leftmost-first, then recursively traverses the
+ children leftmost-first.
+ "topological" (formerly "link"): A topological ordering from the root
+ down to the leaves. There is no left-to-right guarantee.
+ Two depsets may only be merged if either both depsets have the same order, or one of them has
+"default" order. In the latter case the resulting depset's order will be the same as
+the other's order.
+
+
Depsets may contain duplicate values but these will be suppressed when iterating (using
+to_list()). Duplicates may interfere with the ordering
+semantics.
+
+
+
list depset.to_list()+ + Returns a list of the elements, without duplicates, in the depset's traversal order. Note that order is unspecified (but deterministic) for elements that were added more than once to the depset. Order is also unspecified for
"default"-ordered depsets, and for elements of child depsets whose order differs from that of the parent depset. The list is a copy; modifying it has no effect on the depset and vice versa.
+
+
+
+
+
+
diff --git a/rules/lib/builtins/exec_result.mdx b/rules/lib/builtins/exec_result.mdx
new file mode 100644
index 0000000..605d041
--- /dev/null
+++ b/rules/lib/builtins/exec_result.mdx
@@ -0,0 +1,54 @@
+---
+title: 'exec_result'
+---
+
+
+
+
+
+
+
+
+int exec_result.return_code+ + The return code returned after the execution of the program. 256 if the process was terminated by a time out; values larger than 128 indicate termination by a signal. + + +
string exec_result.stderr+ + The content of the standard error output returned by the execution. + +
string exec_result.stdout+ + The content of the standard output returned by the execution. + + + + + + diff --git a/rules/lib/builtins/extension_metadata.mdx b/rules/lib/builtins/extension_metadata.mdx new file mode 100644 index 0000000..a518c56 --- /dev/null +++ b/rules/lib/builtins/extension_metadata.mdx @@ -0,0 +1,25 @@ +--- +title: 'extension_metadata' +--- + + + + + + + + +
ctx.fragments.java Only configuration fragments which are declared in the rule definition may be accessed in this collection.
See the configuration fragment reference for a list of available fragments and the rules documentation for how to use them. + + + + + + + diff --git a/rules/lib/builtins/java_annotation_processing.mdx b/rules/lib/builtins/java_annotation_processing.mdx new file mode 100644 index 0000000..696cf91 --- /dev/null +++ b/rules/lib/builtins/java_annotation_processing.mdx @@ -0,0 +1,86 @@ +--- +title: 'java_annotation_processing' +--- + + +
+ + + + + +File java_annotation_processing.class_jar+ + Deprecated: Please use
JavaInfo.java_outputs.generated_class_jar instead.
+ May return None.
+
+ bool java_annotation_processing.enabled+ + Deprecated. Returns true if annotation processing was applied on this target. + +
list java_annotation_processing.processor_classnames+ + Deprecated: Please use
JavaInfo.plugins instead. Returns class names of annotation processors applied to this rule.
+
+ depset java_annotation_processing.processor_classpath+ + Deprecated: Please use
JavaInfo.plugins instead. Returns a classpath of annotation processors applied to this rule.
+
+ File java_annotation_processing.source_jar+ + Deprecated: Please use
JavaInfo.java_outputs.generated_source_jar instead.
+ May return None.
+
+ depset java_annotation_processing.transitive_class_jars+ + Deprecated. Returns a transitive set of class file jars resulting from annotation processing of this rule and its dependencies. + +
depset java_annotation_processing.transitive_source_jars+ + Deprecated. Returns a transitive set of source archives resulting from annotation processing of this rule and its dependencies. + + + + + + diff --git a/rules/lib/builtins/macro.mdx b/rules/lib/builtins/macro.mdx new file mode 100644 index 0000000..ef43a43 --- /dev/null +++ b/rules/lib/builtins/macro.mdx @@ -0,0 +1,31 @@ +--- +title: 'macro' +--- + + + + + + + + +
macro(). Invoking this value during package
+construction time will instantiate the macro, and cause the macro's implementation function to be
+evaluated (in a separate context, different from the context in which the macro value was invoked),
+in most cases causing targets to be added to the package's target set. For more information, see
+Macros.
+
+
+
+
+
+
+
+
diff --git a/rules/lib/builtins/mapped_root.mdx b/rules/lib/builtins/mapped_root.mdx
new file mode 100644
index 0000000..4e16d8e
--- /dev/null
+++ b/rules/lib/builtins/mapped_root.mdx
@@ -0,0 +1,36 @@
+---
+title: 'mapped_root'
+---
+
+
+
+
+
+
+
+
+string mapped_root.path+ + Returns the relative path from the exec root to the actual root. + + + + + + diff --git a/rules/lib/builtins/module_ctx.mdx b/rules/lib/builtins/module_ctx.mdx new file mode 100644 index 0000000..1089f19 --- /dev/null +++ b/rules/lib/builtins/module_ctx.mdx @@ -0,0 +1,889 @@ +--- +title: 'module_ctx' +--- + + + + + + + + +
implementation function when you create a module extension.
+
+unknown module_ctx.download(url, output='', sha256='', executable=False, allow_fail=False, canonical_id='', auth={}, headers={}, *, integrity='', block=True)
+
+ Downloads a file to the output path for the provided url and returns a struct containing success, a flag which is true if the download completed successfully, and if successful, a hash of the file with the fields sha256 and integrity. When sha256 or integrity is user specified, setting an explicit canonical_id is highly recommended. e.g. get_default_canonical_id
+
+
+ | Parameter | +Description | +
|---|---|
+ url
+ |
+
+ string; or Iterable of strings;
+ required + List of mirror URLs referencing the same file. + |
+
+ output
+ |
+
+ string; or Label; or path;
+ default is ''+ path to the output file, relative to the repository directory. + |
+
+ sha256
+ |
+
+ string;
+ default is ''+ The expected SHA-256 hash of the file downloaded. This must match the SHA-256 hash of the file downloaded. It is a security risk to omit the SHA-256 as remote files can change. At best omitting this field will make your build non-hermetic. It is optional to make development easier but should be set before shipping. If provided, the repository cache will first be checked for a file with the given hash; a download will only be attempted if the file was not found in the cache. After a successful download, the file will be added to the cache. + + |
+
+ executable
+ |
+
+ bool;
+ default is False+ Set the executable flag on the created file, false by default. + |
+
+ allow_fail
+ |
+
+ bool;
+ default is False+ If set, indicate the error in the return value instead of raising an error for failed downloads. + + |
+
+ canonical_id
+ |
+
+ string;
+ default is ''+ If set, restrict cache hits to those cases where the file was added to the cache with the same canonical id. By default caching uses the checksum ( sha256 or integrity).
+
+ |
+
+ auth
+ |
+
+ dict;
+ default is {}+ An optional dict specifying authentication information for some of the URLs. + |
+
+ headers
+ |
+
+ dict;
+ default is {}+ An optional dict specifying http headers for all URLs. + |
+
+ integrity
+ |
+
+ string;
+ default is ''+ Expected checksum of the file downloaded, in Subresource Integrity format. This must match the checksum of the file downloaded. It is a security risk to omit the checksum as remote files can change. At best omitting this field will make your build non-hermetic. It is optional to make development easier but should be set before shipping. If provided, the repository cache will first be checked for a file with the given checksum; a download will only be attempted if the file was not found in the cache. After a successful download, the file will be added to the cache. + + |
+
+ block
+ |
+
+ bool;
+ default is True+ If set to false, the call returns immediately and instead of the regular return value, it returns a token with one single method, wait(), which blocks until the download is finished and returns the usual return value or throws as usual. + + |
+
struct module_ctx.download_and_extract(url, output='', sha256='', type='', strip_prefix='', allow_fail=False, canonical_id='', auth={}, headers={}, *, integrity='', rename_files={})+ + Downloads a file to the output path for the provided url, extracts it, and returns a struct containing
success, a flag which is true if the download completed successfully, and if successful, a hash of the file with the fields sha256 and integrity. When sha256 or integrity is user specified, setting an explicit canonical_id is highly recommended. e.g. get_default_canonical_id
+
+
+ | Parameter | +Description | +
|---|---|
+ url
+ |
+
+ string; or Iterable of strings;
+ required + List of mirror URLs referencing the same file. + |
+
+ output
+ |
+
+ string; or Label; or path;
+ default is ''+ Path to the directory where the archive will be unpacked, relative to the repository directory. + + |
+
+ sha256
+ |
+
+ string;
+ default is ''+ The expected SHA-256 hash of the file downloaded. This must match the SHA-256 hash of the file downloaded. It is a security risk to omit the SHA-256 as remote files can change. At best omitting this field will make your build non-hermetic. It is optional to make development easier but should be set before shipping. If provided, the repository cache will first be checked for a file with the given hash; a download will only be attempted if the file was not found in the cache. After a successful download, the file will be added to the cache. + + |
+
+ type
+ |
+
+ string;
+ default is ''+ The archive type of the downloaded file. By default, the archive type is determined from the file extension of the URL. If the file has no extension, you can explicitly specify either "zip", "jar", "war", "aar", "nupkg", "whl", "tar", "tar.gz", "tgz", "tar.xz", "txz", ".tar.zst", ".tzst", "tar.bz2", ".tbz", ".ar", or ".deb" here. + + |
+
+ strip_prefix
+ |
+
+ string;
+ default is ''+ A directory prefix to strip from the extracted files. Many archives contain a +top-level directory that contains all files in the archive. Instead of needing to +specify this prefix over and over in the build_file, this field can
+be used to strip it from extracted files.
+
+For compatibility, this parameter may also be used under the deprecated name
+ |
+
+ allow_fail
+ |
+
+ bool;
+ default is False+ If set, indicate the error in the return value instead of raising an error for failed downloads. + + |
+
+ canonical_id
+ |
+
+ string;
+ default is ''+ If set, restrict cache hits to those cases where the file was added to the cache with the same canonical id. By default caching uses the checksum +( sha256 or integrity).
+
+ |
+
+ auth
+ |
+
+ dict;
+ default is {}+ An optional dict specifying authentication information for some of the URLs. + |
+
+ headers
+ |
+
+ dict;
+ default is {}+ An optional dict specifying http headers for all URLs. + |
+
+ integrity
+ |
+
+ string;
+ default is ''+ Expected checksum of the file downloaded, in Subresource Integrity format. This must match the checksum of the file downloaded. It is a security risk to omit the checksum as remote files can change. At best omitting this field will make your build non-hermetic. It is optional to make development easier but should be set before shipping. If provided, the repository cache will first be checked for a file with the given checksum; a download will only be attempted if the file was not found in the cache. After a successful download, the file will be added to the cache. + |
+
+ rename_files
+ |
+
+ dict;
+ default is {}+ An optional dict specifying files to rename during the extraction. Archive entries with names exactly matching a key will be renamed to the value, prior to any directory prefix adjustment. This can be used to extract archives that contain non-Unicode filenames, or which have files that would extract to the same path on case-insensitive filesystems. + + |
+
exec_result module_ctx.execute(arguments, timeout=600, environment={}, quiet=True, working_directory="")+ + Executes the command given by the list of arguments. The execution time of the command is limited by
timeout (in seconds, default 600 seconds). This method returns an exec_result structure containing the output of the command. The environment map can be used to override some environment variables to be passed to the process.
+
+
+ | Parameter | +Description | +
|---|---|
+ arguments
+ |
+
+ sequence;
+ required + List of arguments, the first element should be the path to the program to execute. + + |
+
+ timeout
+ |
+
+ int;
+ default is 600+ Maximum duration of the command in seconds (default is 600 seconds). + |
+
+ environment
+ |
+
+ dict;
+ default is {}+ Force some environment variables to be set to be passed to the process. The value can be None to remove the environment variable.
+
+ |
+
+ quiet
+ |
+
+ bool;
+ default is True+ If stdout and stderr should be printed to the terminal. + |
+
+ working_directory
+ |
+
+ string;
+ default is ""+ Working directory for command execution. +Can be relative to the repository root or absolute. +The default is the repository root. + + |
+
extension_metadata module_ctx.extension_metadata(*, root_module_direct_deps=None, root_module_direct_dev_deps=None, reproducible=False)+ + Constructs an opaque object that can be returned from the module extension's implementation function to provide metadata about the repositories generated by the extension to Bazel. + +
| Parameter | +Description | +
|---|---|
+ root_module_direct_deps
+ |
+
+ sequence of strings; or string; or None;
+ default is None+ The names of the repositories that the extension considers to be direct dependencies of the root module. If the root module imports additional repositories or does not import all of these repositories via use_repo, Bazel will print a warning when the extension is evaluated, instructing the user to run bazel mod tidy to fix the use_repo calls automatically. If one of If one of Exactly one of |
+
+ root_module_direct_dev_deps
+ |
+
+ sequence of strings; or string; or None;
+ default is None+ The names of the repositories that the extension considers to be direct dev dependencies of the root module. If the root module imports additional repositories or does not import all of these repositories via use_repo on an extension proxy created with use_extension(..., dev_dependency = True), Bazel will print a warning when the extension is evaluated, instructing the user to run bazel mod tidy to fix the use_repo calls automatically. If one of Exactly one of |
+
+ reproducible
+ |
+
+ bool;
+ default is False+ States that this module extension ensures complete reproducibility, thereby it should not be stored in the lockfile. + |
+
None module_ctx.extract(archive, output='', strip_prefix='', *, rename_files={}, watch_archive='auto')
+
+ Extract an archive to the repository directory.
+
+ | Parameter | +Description | +
|---|---|
+ archive
+ |
+
+ string; or Label; or path;
+ required + path to the archive that will be unpacked, relative to the repository directory. + |
+
+ output
+ |
+
+ string; or Label; or path;
+ default is ''+ path to the directory where the archive will be unpacked, relative to the repository directory. + |
+
+ strip_prefix
+ |
+
+ string;
+ default is ''+ a directory prefix to strip from the extracted files. Many archives contain a +top-level directory that contains all files in the archive. Instead of needing to +specify this prefix over and over in the build_file, this field can be
+used to strip it from extracted files.
+
+For compatibility, this parameter may also be used under the deprecated name
+ |
+
+ rename_files
+ |
+
+ dict;
+ default is {}+ An optional dict specifying files to rename during the extraction. Archive entries with names exactly matching a key will be renamed to the value, prior to any directory prefix adjustment. This can be used to extract archives that contain non-Unicode filenames, or which have files that would extract to the same path on case-insensitive filesystems. + |
+
+ watch_archive
+ |
+
+ string;
+ default is 'auto'+ whether to watch the archive file. Can be the string 'yes', 'no', or 'auto'. Passing 'yes' is equivalent to immediately invoking the watch() method; passing 'no' does not attempt to watch the file; passing 'auto' will only attempt to watch the file when it is legal to do so (see watch() docs for more information.
+ |
+
None module_ctx.file(path, content='', executable=True, legacy_utf8=False)
+
+ Generates a file in the repository directory with the provided content.
+
+ | Parameter | +Description | +
|---|---|
+ path
+ |
+
+ string; or Label; or path;
+ required + Path of the file to create, relative to the repository directory. + |
+
+ content
+ |
+
+ string;
+ default is ''+ The content of the file to create, empty by default. + |
+
+ executable
+ |
+
+ bool;
+ default is True+ Set the executable flag on the created file, true by default. + |
+
+ legacy_utf8
+ |
+
+ bool;
+ default is False+ No-op. This parameter is deprecated and will be removed in a future version of Bazel. + + |
+
string module_ctx.getenv(name, default=None)+ + Returns the value of an environment variable
name as a string if exists, or default if it doesn't. When building incrementally, any change to the value of the variable named by name will cause this repository to be re-fetched.
+
+
+
| Parameter | +Description | +
|---|---|
+ name
+ |
+
+ string;
+ required + Name of desired environment variable. + |
+
+ default
+ |
+
+ string; or None;
+ default is None+ Default value to return if name is not found.
+ |
+
None.
+
+ bool module_ctx.is_dev_dependency(tag)+ + Returns whether the given tag was specified on the result of a use_extension call with
devDependency = True.
+
+ | Parameter | +Description | +
|---|---|
+ tag
+ |
+
+ bazel_module_tag;
+ required + A tag obtained from bazel_module.tags. + |
+
list module_ctx.modules+ + A list of all the Bazel modules in the external dependency graph that use this module extension, each of which is a bazel_module object that exposes all the tags it specified for this extension. The iteration order of this dictionary is guaranteed to be the same as breadth-first search starting from the root module. + +
repository_os module_ctx.os+ + A struct to access information from the system. + +
path module_ctx.path(path)+ + Returns a path from a string, label, or path. If this context is a
repository_ctx, a relative path will resolve relative to the repository directory. If it is a module_ctx, a relative path will resolve relative to a temporary working directory for this module extension. If the path is a label, it will resolve to the path of the corresponding file. Note that remote repositories and module extensions are executed during the analysis phase and thus cannot depends on a target result (the label should point to a non-generated file). If path is a path, it will return that path as is.
+
+
+ | Parameter | +Description | +
|---|---|
+ path
+ |
+
+ string; or Label; or path;
+ required + string, Label or path from which to create a path from.
+ |
+
string module_ctx.read(path, *, watch='auto')+ + Reads the content of a file on the filesystem. + +
| Parameter | +Description | +
|---|---|
+ path
+ |
+
+ string; or Label; or path;
+ required + Path of the file to read from. + |
+
+ watch
+ |
+
+ string;
+ default is 'auto'+ Whether to watch the file. Can be the string 'yes', 'no', or 'auto'. Passing 'yes' is equivalent to immediately invoking the watch() method; passing 'no' does not attempt to watch the file; passing 'auto' will only attempt to watch the file when it is legal to do so (see watch() docs for more information.
+
+ |
+
None module_ctx.report_progress(status='')
+
+ Updates the progress status for the fetching of this repository or module extension.
+
+ | Parameter | +Description | +
|---|---|
+ status
+ |
+
+ string;
+ default is ''+ string describing the current status of the fetch progress.
+ |
+
bool module_ctx.root_module_has_non_dev_dependency+ + Whether the root module uses this extension as a non-dev dependency. + +
None module_ctx.watch(path)
+
+ Tells Bazel to watch for changes to the given path, whether or not it exists, or whether it's a file or a directory. Any changes to the file or directory will invalidate this repository or module extension, and cause it to be refetched or re-evaluated next time."Changes" include changes to the contents of the file (if the path is a file); if the path was a file but is now a directory, or vice versa; and if the path starts or stops existing. Notably, this does not include changes to any files under the directory if the path is a directory. For that, use path.readdir() instead.
Note that attempting to watch paths inside the repo currently being fetched, or inside the working directory of the current module extension, will result in an error. A module extension attempting to watch a path outside the current Bazel workspace will also result in an error. + + +
| Parameter | +Description | +
|---|---|
+ path
+ |
+
+ string; or Label; or path;
+ required + Path of the file to watch. + |
+
path module_ctx.which(program)+ + Returns the
path of the corresponding program or None if there is no such program in the path.
+
+
+ | Parameter | +Description | +
|---|---|
+ program
+ |
+
+ string;
+ required + Program to find in the path. + |
+
None.
+
+
+
+
+
+
diff --git a/rules/lib/builtins/path.mdx b/rules/lib/builtins/path.mdx
new file mode 100644
index 0000000..5e47bed
--- /dev/null
+++ b/rules/lib/builtins/path.mdx
@@ -0,0 +1,144 @@
+---
+title: 'path'
+---
+
+
+
+
+
+
+
+
+string path.basename+ + A string giving the basename of the file. + +
path path.dirname+ + The parent directory of this file, or None if this file does not have a parent. + May return
None.
+
+ bool path.exists+ + Returns true if the file or directory denoted by this path exists.
Note that accessing this field does not cause the path to be watched. If you'd like the repo rule or module extension to be sensitive to the path's existence, use the watch() method on the context object.
+
+
+
path path.get_child(*relative_paths)+ + Returns the path obtained by joining this path with the given relative paths. + +
| Parameter | +Description | +
|---|---|
+ relative_paths
+ |
+
+ required + Zero or more relative path strings to append to this path with path separators added as needed. + + |
+
bool path.is_dir+ + Returns true if this path points to a directory.
Note that accessing this field does not cause the path to be watched. If you'd like the repo rule or module extension to be sensitive to whether the path is a directory or a file, use the watch() method on the context object.
+
+
+
list path.readdir(*, watch='auto')+ + Returns the list of entries in the directory denoted by this path. Each entry is a
path object itself.
+
+
+ | Parameter | +Description | +
|---|---|
+ watch
+ |
+
+ string;
+ default is 'auto'+ whether Bazel should watch the list of entries in this directory and refetch the repository or re-evaluate the module extension next time when any changes are detected. Changes to detect include entry creation, deletion, and renaming. Note that this doesn't watch the contents of any entries in the directory. Can be the string 'yes', 'no', or 'auto'. If set to 'auto', Bazel will only watch this directory when it is legal to do so (see |
+
path path.realpath+ + Returns the canonical path for this path by repeatedly replacing all symbolic links with their referents. + + + + + + + diff --git a/rules/lib/builtins/propagation_ctx.mdx b/rules/lib/builtins/propagation_ctx.mdx new file mode 100644 index 0000000..7caad00 --- /dev/null +++ b/rules/lib/builtins/propagation_ctx.mdx @@ -0,0 +1,44 @@ +--- +title: 'propagation_ctx' +--- + + + + + + + + +
propagation_predicate, attr_aspects and toolchains_aspects functions of aspects. It provides access to the information needed to determine whether the aspect should be propagated to the target and what attributes or toolchain types it should be propagated to next.
+
+struct propagation_ctx.attr+ + A struct to access only the public parameters of the aspect. The keys and values of the struct are the parameters names and values. + +
StarlarkAspectPropagationRuleApi propagation_ctx.rule+ + Allows access to the details of the rule. + + + + + + diff --git a/rules/lib/builtins/repo_metadata.mdx b/rules/lib/builtins/repo_metadata.mdx new file mode 100644 index 0000000..7220273 --- /dev/null +++ b/rules/lib/builtins/repo_metadata.mdx @@ -0,0 +1,26 @@ +--- +title: 'repo_metadata' +--- + + + + + + + + +
repository_ctx.repo_metadata.
+
+
+
+
+
+
+
+
diff --git a/rules/lib/builtins/repository_ctx.mdx b/rules/lib/builtins/repository_ctx.mdx
new file mode 100644
index 0000000..1e538a8
--- /dev/null
+++ b/rules/lib/builtins/repository_ctx.mdx
@@ -0,0 +1,1169 @@
+---
+title: 'repository_ctx'
+---
+
+
+
+
+
+
+
+
+implementation function when you create a repository rule.
+
+
+structure repository_ctx.attr+ + A struct to access the values of the attributes. The values are provided by the user (if not, a default value is used). + + +
bool repository_ctx.delete(path)+ + Deletes a file or a directory. Returns a bool, indicating whether the file or directory was actually deleted by this call. + + +
| Parameter | +Description | +
|---|---|
+ path
+ |
+
+ string; or path;
+ required + Path of the file to delete, relative to the repository directory, or absolute. Can be a path or a string. + + |
+
unknown repository_ctx.download(url, output='', sha256='', executable=False, allow_fail=False, canonical_id='', auth={}, headers={}, *, integrity='', block=True)
+
+ Downloads a file to the output path for the provided url and returns a struct containing success, a flag which is true if the download completed successfully, and if successful, a hash of the file with the fields sha256 and integrity. When sha256 or integrity is user specified, setting an explicit canonical_id is highly recommended. e.g. get_default_canonical_id
+
+
+ | Parameter | +Description | +
|---|---|
+ url
+ |
+
+ string; or Iterable of strings;
+ required + List of mirror URLs referencing the same file. + |
+
+ output
+ |
+
+ string; or Label; or path;
+ default is ''+ path to the output file, relative to the repository directory. + |
+
+ sha256
+ |
+
+ string;
+ default is ''+ The expected SHA-256 hash of the file downloaded. This must match the SHA-256 hash of the file downloaded. It is a security risk to omit the SHA-256 as remote files can change. At best omitting this field will make your build non-hermetic. It is optional to make development easier but should be set before shipping. If provided, the repository cache will first be checked for a file with the given hash; a download will only be attempted if the file was not found in the cache. After a successful download, the file will be added to the cache. + + |
+
+ executable
+ |
+
+ bool;
+ default is False+ Set the executable flag on the created file, false by default. + |
+
+ allow_fail
+ |
+
+ bool;
+ default is False+ If set, indicate the error in the return value instead of raising an error for failed downloads. + + |
+
+ canonical_id
+ |
+
+ string;
+ default is ''+ If set, restrict cache hits to those cases where the file was added to the cache with the same canonical id. By default caching uses the checksum ( sha256 or integrity).
+
+ |
+
+ auth
+ |
+
+ dict;
+ default is {}+ An optional dict specifying authentication information for some of the URLs. + |
+
+ headers
+ |
+
+ dict;
+ default is {}+ An optional dict specifying http headers for all URLs. + |
+
+ integrity
+ |
+
+ string;
+ default is ''+ Expected checksum of the file downloaded, in Subresource Integrity format. This must match the checksum of the file downloaded. It is a security risk to omit the checksum as remote files can change. At best omitting this field will make your build non-hermetic. It is optional to make development easier but should be set before shipping. If provided, the repository cache will first be checked for a file with the given checksum; a download will only be attempted if the file was not found in the cache. After a successful download, the file will be added to the cache. + + |
+
+ block
+ |
+
+ bool;
+ default is True+ If set to false, the call returns immediately and instead of the regular return value, it returns a token with one single method, wait(), which blocks until the download is finished and returns the usual return value or throws as usual. + + |
+
struct repository_ctx.download_and_extract(url, output='', sha256='', type='', strip_prefix='', allow_fail=False, canonical_id='', auth={}, headers={}, *, integrity='', rename_files={})+ + Downloads a file to the output path for the provided url, extracts it, and returns a struct containing
success, a flag which is true if the download completed successfully, and if successful, a hash of the file with the fields sha256 and integrity. When sha256 or integrity is user specified, setting an explicit canonical_id is highly recommended. e.g. get_default_canonical_id
+
+
+ | Parameter | +Description | +
|---|---|
+ url
+ |
+
+ string; or Iterable of strings;
+ required + List of mirror URLs referencing the same file. + |
+
+ output
+ |
+
+ string; or Label; or path;
+ default is ''+ Path to the directory where the archive will be unpacked, relative to the repository directory. + + |
+
+ sha256
+ |
+
+ string;
+ default is ''+ The expected SHA-256 hash of the file downloaded. This must match the SHA-256 hash of the file downloaded. It is a security risk to omit the SHA-256 as remote files can change. At best omitting this field will make your build non-hermetic. It is optional to make development easier but should be set before shipping. If provided, the repository cache will first be checked for a file with the given hash; a download will only be attempted if the file was not found in the cache. After a successful download, the file will be added to the cache. + + |
+
+ type
+ |
+
+ string;
+ default is ''+ The archive type of the downloaded file. By default, the archive type is determined from the file extension of the URL. If the file has no extension, you can explicitly specify either "zip", "jar", "war", "aar", "nupkg", "whl", "tar", "tar.gz", "tgz", "tar.xz", "txz", ".tar.zst", ".tzst", "tar.bz2", ".tbz", ".ar", or ".deb" here. + + |
+
+ strip_prefix
+ |
+
+ string;
+ default is ''+ A directory prefix to strip from the extracted files. Many archives contain a +top-level directory that contains all files in the archive. Instead of needing to +specify this prefix over and over in the build_file, this field can
+be used to strip it from extracted files.
+
+For compatibility, this parameter may also be used under the deprecated name
+ |
+
+ allow_fail
+ |
+
+ bool;
+ default is False+ If set, indicate the error in the return value instead of raising an error for failed downloads. + + |
+
+ canonical_id
+ |
+
+ string;
+ default is ''+ If set, restrict cache hits to those cases where the file was added to the cache with the same canonical id. By default caching uses the checksum +( sha256 or integrity).
+
+ |
+
+ auth
+ |
+
+ dict;
+ default is {}+ An optional dict specifying authentication information for some of the URLs. + |
+
+ headers
+ |
+
+ dict;
+ default is {}+ An optional dict specifying http headers for all URLs. + |
+
+ integrity
+ |
+
+ string;
+ default is ''+ Expected checksum of the file downloaded, in Subresource Integrity format. This must match the checksum of the file downloaded. It is a security risk to omit the checksum as remote files can change. At best omitting this field will make your build non-hermetic. It is optional to make development easier but should be set before shipping. If provided, the repository cache will first be checked for a file with the given checksum; a download will only be attempted if the file was not found in the cache. After a successful download, the file will be added to the cache. + |
+
+ rename_files
+ |
+
+ dict;
+ default is {}+ An optional dict specifying files to rename during the extraction. Archive entries with names exactly matching a key will be renamed to the value, prior to any directory prefix adjustment. This can be used to extract archives that contain non-Unicode filenames, or which have files that would extract to the same path on case-insensitive filesystems. + + |
+
exec_result repository_ctx.execute(arguments, timeout=600, environment={}, quiet=True, working_directory="")+ + Executes the command given by the list of arguments. The execution time of the command is limited by
timeout (in seconds, default 600 seconds). This method returns an exec_result structure containing the output of the command. The environment map can be used to override some environment variables to be passed to the process.
+
+
+ | Parameter | +Description | +
|---|---|
+ arguments
+ |
+
+ sequence;
+ required + List of arguments, the first element should be the path to the program to execute. + + |
+
+ timeout
+ |
+
+ int;
+ default is 600+ Maximum duration of the command in seconds (default is 600 seconds). + |
+
+ environment
+ |
+
+ dict;
+ default is {}+ Force some environment variables to be set to be passed to the process. The value can be None to remove the environment variable.
+
+ |
+
+ quiet
+ |
+
+ bool;
+ default is True+ If stdout and stderr should be printed to the terminal. + |
+
+ working_directory
+ |
+
+ string;
+ default is ""+ Working directory for command execution. +Can be relative to the repository root or absolute. +The default is the repository root. + + |
+
None repository_ctx.extract(archive, output='', strip_prefix='', *, rename_files={}, watch_archive='auto')
+
+ Extract an archive to the repository directory.
+
+ | Parameter | +Description | +
|---|---|
+ archive
+ |
+
+ string; or Label; or path;
+ required + path to the archive that will be unpacked, relative to the repository directory. + |
+
+ output
+ |
+
+ string; or Label; or path;
+ default is ''+ path to the directory where the archive will be unpacked, relative to the repository directory. + |
+
+ strip_prefix
+ |
+
+ string;
+ default is ''+ a directory prefix to strip from the extracted files. Many archives contain a +top-level directory that contains all files in the archive. Instead of needing to +specify this prefix over and over in the build_file, this field can be
+used to strip it from extracted files.
+
+For compatibility, this parameter may also be used under the deprecated name
+ |
+
+ rename_files
+ |
+
+ dict;
+ default is {}+ An optional dict specifying files to rename during the extraction. Archive entries with names exactly matching a key will be renamed to the value, prior to any directory prefix adjustment. This can be used to extract archives that contain non-Unicode filenames, or which have files that would extract to the same path on case-insensitive filesystems. + |
+
+ watch_archive
+ |
+
+ string;
+ default is 'auto'+ whether to watch the archive file. Can be the string 'yes', 'no', or 'auto'. Passing 'yes' is equivalent to immediately invoking the watch() method; passing 'no' does not attempt to watch the file; passing 'auto' will only attempt to watch the file when it is legal to do so (see watch() docs for more information.
+ |
+
None repository_ctx.file(path, content='', executable=True, legacy_utf8=False)
+
+ Generates a file in the repository directory with the provided content.
+
+ | Parameter | +Description | +
|---|---|
+ path
+ |
+
+ string; or Label; or path;
+ required + Path of the file to create, relative to the repository directory. + |
+
+ content
+ |
+
+ string;
+ default is ''+ The content of the file to create, empty by default. + |
+
+ executable
+ |
+
+ bool;
+ default is True+ Set the executable flag on the created file, true by default. + |
+
+ legacy_utf8
+ |
+
+ bool;
+ default is False+ No-op. This parameter is deprecated and will be removed in a future version of Bazel. + + |
+
string repository_ctx.getenv(name, default=None)+ + Returns the value of an environment variable
name as a string if exists, or default if it doesn't. When building incrementally, any change to the value of the variable named by name will cause this repository to be re-fetched.
+
+
+
| Parameter | +Description | +
|---|---|
+ name
+ |
+
+ string;
+ required + Name of desired environment variable. + |
+
+ default
+ |
+
+ string; or None;
+ default is None+ Default value to return if name is not found.
+ |
+
None.
+
+ string repository_ctx.name+ + The canonical name of the external repository created by this rule. This name is guaranteed to be unique among all external repositories, but its exact format is not specified. Use
original_name instead to get the name that was originally specified as the name when this repository rule was instantiated.
+
+ string repository_ctx.original_name+ + The name that was originally specified as the
name attribute when this repository rule was instantiated. This name is not necessarily unique among external repositories. Use name instead to get the canonical name of the external repository.
+
+ repository_os repository_ctx.os+ + A struct to access information from the system. + +
None repository_ctx.patch(patch_file, strip=0, *, watch_patch='auto')
+
+ Apply a patch file to the root directory of external repository. The patch file should be a standard unified diff format file. The Bazel-native patch implementation doesn't support fuzz match and binary patch like the patch command line tool.
+
+
+ | Parameter | +Description | +
|---|---|
+ patch_file
+ |
+
+ string; or Label; or path;
+ required + The patch file to apply, it can be label, relative path or absolute path. If it's a relative path, it will resolve to the repository directory. + + |
+
+ strip
+ |
+
+ int;
+ default is 0+ Strip the specified number of leading components from file names. + |
+
+ watch_patch
+ |
+
+ string;
+ default is 'auto'+ Whether to watch the patch file. Can be the string 'yes', 'no', or 'auto'. Passing 'yes' is equivalent to immediately invoking the watch() method; passing 'no' does not attempt to watch the file; passing 'auto' will only attempt to watch the file when it is legal to do so (see watch() docs for more information.
+
+ |
+
path repository_ctx.path(path)+ + Returns a path from a string, label, or path. If this context is a
repository_ctx, a relative path will resolve relative to the repository directory. If it is a module_ctx, a relative path will resolve relative to a temporary working directory for this module extension. If the path is a label, it will resolve to the path of the corresponding file. Note that remote repositories and module extensions are executed during the analysis phase and thus cannot depends on a target result (the label should point to a non-generated file). If path is a path, it will return that path as is.
+
+
+ | Parameter | +Description | +
|---|---|
+ path
+ |
+
+ string; or Label; or path;
+ required + string, Label or path from which to create a path from.
+ |
+
string repository_ctx.read(path, *, watch='auto')+ + Reads the content of a file on the filesystem. + +
| Parameter | +Description | +
|---|---|
+ path
+ |
+
+ string; or Label; or path;
+ required + Path of the file to read from. + |
+
+ watch
+ |
+
+ string;
+ default is 'auto'+ Whether to watch the file. Can be the string 'yes', 'no', or 'auto'. Passing 'yes' is equivalent to immediately invoking the watch() method; passing 'no' does not attempt to watch the file; passing 'auto' will only attempt to watch the file when it is legal to do so (see watch() docs for more information.
+
+ |
+
None repository_ctx.rename(src, dst)
+
+ Renames the file or directory from src to dst. Parent directories are created as needed. Fails if the destination path
+already exists. Both paths must be located within the repository.
+
+
+ | Parameter | +Description | +
|---|---|
+ src
+ |
+
+ string; or Label; or path;
+ required + The path of the existing file or directory to rename, relative +to the repository directory. + + |
+
+ dst
+ |
+
+ string; or Label; or path;
+ required + The new name to which the file or directory will be renamed to, +relative to the repository directory. + + |
+
repo_metadata repository_ctx.repo_metadata(*, reproducible=False, attrs_for_reproducibility={})+ + Constructs an opaque object that can be returned from the repo rule's implementation function to provide metadata about its reproducibility. + + +
| Parameter | +Description | +
|---|---|
+ reproducible
+ |
+
+ bool;
+ default is False+ States that this repo can be reproducibly refetched; that is, if it were fetched another time with exactly the same input attributes, repo rule definition, watched files and environment variables, etc., then exactly the same output would be produced. This property needs to hold even if other untracked conditions change, such as information from the internet, the path of the workspace root, output from running arbitrary executables, etc. If set to True, this allows the fetched repo contents to be cached across workspaces. Note that setting this to True does not guarantee caching in the repo contents cache; for example, local repo rules are never cached. + + |
+
+ attrs_for_reproducibility
+ |
+
+ dict;
+ default is {}+ If reproducible is False, this can be specified to tell Bazel which attributes of the original repo rule to change to make it reproducible.
+
+ |
+
None repository_ctx.report_progress(status='')
+
+ Updates the progress status for the fetching of this repository or module extension.
+
+ | Parameter | +Description | +
|---|---|
+ status
+ |
+
+ string;
+ default is ''+ string describing the current status of the fetch progress.
+ |
+
None repository_ctx.symlink(target, link_name)
+
+ Creates a symlink on the filesystem.
+
+ | Parameter | +Description | +
|---|---|
+ target
+ |
+
+ string; or Label; or path;
+ required + The path that the symlink should point to. + |
+
+ link_name
+ |
+
+ string; or Label; or path;
+ required + The path of the symlink to create. + |
+
None repository_ctx.template(path, template, substitutions={}, executable=True, *, watch_template='auto')
+
+ Generates a new file using a template. Every occurrence in template of a key of substitutions will be replaced by the corresponding value. The result is written in path. An optional executable argument (default to true) can be set to turn on or off the executable bit.
+
+
+ | Parameter | +Description | +
|---|---|
+ path
+ |
+
+ string; or Label; or path;
+ required + Path of the file to create, relative to the repository directory. + |
+
+ template
+ |
+
+ string; or Label; or path;
+ required + Path to the template file. + |
+
+ substitutions
+ |
+
+ dict;
+ default is {}+ Substitutions to make when expanding the template. + |
+
+ executable
+ |
+
+ bool;
+ default is True+ Set the executable flag on the created file, true by default. + |
+
+ watch_template
+ |
+
+ string;
+ default is 'auto'+ Whether to watch the template file. Can be the string 'yes', 'no', or 'auto'. Passing 'yes' is equivalent to immediately invoking the watch() method; passing 'no' does not attempt to watch the file; passing 'auto' will only attempt to watch the file when it is legal to do so (see watch() docs for more information.
+
+ |
+
None repository_ctx.watch(path)
+
+ Tells Bazel to watch for changes to the given path, whether or not it exists, or whether it's a file or a directory. Any changes to the file or directory will invalidate this repository or module extension, and cause it to be refetched or re-evaluated next time."Changes" include changes to the contents of the file (if the path is a file); if the path was a file but is now a directory, or vice versa; and if the path starts or stops existing. Notably, this does not include changes to any files under the directory if the path is a directory. For that, use path.readdir() instead.
Note that attempting to watch paths inside the repo currently being fetched, or inside the working directory of the current module extension, will result in an error. A module extension attempting to watch a path outside the current Bazel workspace will also result in an error. + + +
| Parameter | +Description | +
|---|---|
+ path
+ |
+
+ string; or Label; or path;
+ required + Path of the file to watch. + |
+
None repository_ctx.watch_tree(path)
+
+ Tells Bazel to watch for changes to any files or directories transitively under the given path. Any changes to the contents of files, the existence of files or directories, file names or directory names, will cause this repo to be refetched.Note that attempting to watch paths inside the repo currently being fetched will result in an error. + + +
| Parameter | +Description | +
|---|---|
+ path
+ |
+
+ string; or Label; or path;
+ required + Path of the directory tree to watch. + |
+
path repository_ctx.which(program)+ + Returns the
path of the corresponding program or None if there is no such program in the path.
+
+
+ | Parameter | +Description | +
|---|---|
+ program
+ |
+
+ string;
+ required + Program to find in the path. + |
+
None.
+
+ path repository_ctx.workspace_root+ + The path to the root workspace of the bazel invocation. + + + + + + diff --git a/rules/lib/builtins/repository_os.mdx b/rules/lib/builtins/repository_os.mdx new file mode 100644 index 0000000..debe4c8 --- /dev/null +++ b/rules/lib/builtins/repository_os.mdx @@ -0,0 +1,55 @@ +--- +title: 'repository_os' +--- + + + + + + + + +
string repository_os.arch+ + A string identifying the architecture Bazel is running on (the value of the
"os.arch" Java property converted to lower case).
+
+
+ dict repository_os.environ+ + The dictionary of environment variables.
NOTE: Retrieving an environment variable from this dictionary does not establish a dependency from a repository rule or module extension to the environment variable. To establish a dependency when looking up an environment variable, use either repository_ctx.getenv or module_ctx.getenv instead.
+
+
+
string repository_os.name+ + A string identifying the operating system Bazel is running on (the value of the
"os.name" Java property converted to lower case).
+
+
+
+
+
+
+
diff --git a/rules/lib/builtins/repository_rule.mdx b/rules/lib/builtins/repository_rule.mdx
new file mode 100644
index 0000000..79db2a3
--- /dev/null
+++ b/rules/lib/builtins/repository_rule.mdx
@@ -0,0 +1,26 @@
+---
+title: 'repository_rule'
+---
+
+
+
+
+
+
+
+
+repository_rule().
+
+
+
+
+
+
+
+
diff --git a/rules/lib/builtins/root.mdx b/rules/lib/builtins/root.mdx
new file mode 100644
index 0000000..08e3e50
--- /dev/null
+++ b/rules/lib/builtins/root.mdx
@@ -0,0 +1,36 @@
+---
+title: 'root'
+---
+
+
+
+
+
+
+
+
+string root.path+ + Returns the relative path from the exec root to the actual root. + + + + + + diff --git a/rules/lib/builtins/rule.mdx b/rules/lib/builtins/rule.mdx new file mode 100644 index 0000000..7c6069e --- /dev/null +++ b/rules/lib/builtins/rule.mdx @@ -0,0 +1,30 @@ +--- +title: 'rule' +--- + + + + + + + + +
rule()). Calling the value during
+evaluation of a package's BUILD file creates an instance of the rule and adds it to the
+package's target set. For more information, visit this page about
+Rules.
+
+
+
+
+
+
+
+
diff --git a/rules/lib/builtins/rule_attributes.mdx b/rules/lib/builtins/rule_attributes.mdx
new file mode 100644
index 0000000..8b444c4
--- /dev/null
+++ b/rules/lib/builtins/rule_attributes.mdx
@@ -0,0 +1,92 @@
+---
+title: 'rule_attributes'
+---
+
+
+
+
+
+
+
+
+struct rule_attributes.attr+ + A struct to access the values of the attributes. The values are provided by the user (if not, a default value is used). The attributes of the struct and the types of their values correspond to the keys and values of the
attrs dict provided to the rule function. See example of use.
+
+ ExecGroupCollection rule_attributes.exec_groups+ + A collection of the execution groups available for the rule the aspect is applied to, indexed by their names. + +
struct rule_attributes.executable+ + A
struct containing executable files defined in label type attributes marked as executable=True. The struct fields correspond to the attribute names. Each value in the struct is either a File or None. If an optional attribute is not specified in the rule then the corresponding struct value is None. If a label type is not marked as executable=True, no corresponding struct field is generated. See example of use.
+
+ struct rule_attributes.file+ + A
struct containing files defined in label type attributes marked as allow_single_file. The struct fields correspond to the attribute names. The struct value is always a File or None. If an optional attribute is not specified in the rule then the corresponding struct value is None. If a label type is not marked as allow_single_file, no corresponding struct field is generated. It is a shortcut for:list(ctx.attr.<ATTR>.files)[0]In other words, use
file to access the (singular) default output of a dependency. See example of use.
+
+ struct rule_attributes.files+ + A
struct containing files defined in label or label list type attributes. The struct fields correspond to the attribute names. The struct values are list of Files. It is a shortcut for:[f for t in ctx.attr.<ATTR> for f in t.files]In other words, use
files to access the default outputs of a dependency. See example of use.
+
+ string rule_attributes.kind+ + The kind of a rule, such as 'cc_library' + +
ToolchainContext rule_attributes.toolchains+ + Toolchains for the default exec group of the rule the aspect is applied to. + +
dict rule_attributes.var+ + Dictionary (String to String) of configuration variables. + + + + + + diff --git a/rules/lib/builtins/runfiles.mdx b/rules/lib/builtins/runfiles.mdx new file mode 100644 index 0000000..0333826 --- /dev/null +++ b/rules/lib/builtins/runfiles.mdx @@ -0,0 +1,136 @@ +--- +title: 'runfiles' +--- + + + + + + + + +
DefaultInfo in order to tell the build system about the runfiles needed by the outputs produced by the rule.
++ See runfiles guide for details.
+ + +depset runfiles.empty_filenames+ + Returns names of empty files to create. + +
depset runfiles.files+ + Returns the set of runfiles as files. + +
runfiles runfiles.merge(other)+ + Returns a new runfiles object that includes all the contents of this one and the argument.
+Note: When you have many runfiles objects to merge, use merge_all() rather than calling merge in a loop. This avoids constructing deep depset structures which can cause build failures.
| Parameter | +Description | +
|---|---|
+ other
+ |
+
+ runfiles;
+ required + The runfiles object to merge into this. + |
+
runfiles runfiles.merge_all(other)+ + Returns a new runfiles object that includes all the contents of this one and of the runfiles objects in the argument. + + +
| Parameter | +Description | +
|---|---|
+ other
+ |
+
+ sequence of runfiless;
+ required + The sequence of runfiles objects to merge into this. + |
+
depset runfiles.root_symlinks+ + Returns the set of root symlinks. + +
depset runfiles.symlinks+ + Returns the set of symlinks. + + + + + + diff --git a/rules/lib/builtins/struct.mdx b/rules/lib/builtins/struct.mdx new file mode 100644 index 0000000..66a4b38 --- /dev/null +++ b/rules/lib/builtins/struct.mdx @@ -0,0 +1,63 @@ +--- +title: 'struct' +--- + + + + + + + + +
Structs fields cannot be reassigned once the struct is created. Two structs are equal if they have the same fields and if corresponding field values are equal. + +
struct struct(**kwargs)+ + Creates an immutable struct using the keyword arguments as attributes. It is used to group multiple values together. Example:
s = struct(x = 2, y = 3) +return s.x + getattr(s, "y") # returns 5+ +
| Parameter | +Description | +
|---|---|
+ kwargs
+ |
+
+ default is {}+ Dictionary of arguments. + |
+
actions subrule_ctx.actions+ + Contains methods for declaring output files and the actions that produce them + +
fragments subrule_ctx.fragments+ + Allows access to configuration fragments in target configuration. + +
Label subrule_ctx.label+ + The label of the target currently being analyzed + +
ToolchainContext subrule_ctx.toolchains+ + Contains methods for declaring output files and the actions that produce them + + + + + + diff --git a/rules/lib/builtins/tag_class.mdx b/rules/lib/builtins/tag_class.mdx new file mode 100644 index 0000000..07f5547 --- /dev/null +++ b/rules/lib/builtins/tag_class.mdx @@ -0,0 +1,26 @@ +--- +title: 'tag_class' +--- + + + + + + + + +
tag_class().
+
+
+
+
+
+
+
+
diff --git a/rules/lib/builtins/template_ctx.mdx b/rules/lib/builtins/template_ctx.mdx
new file mode 100644
index 0000000..bd42877
--- /dev/null
+++ b/rules/lib/builtins/template_ctx.mdx
@@ -0,0 +1,175 @@
+---
+title: 'template_ctx'
+---
+
+
+
+
+
+
+
+
+Args template_ctx.args()+ + Returns an Args object that can be used to build memory-efficient command lines. + +
File template_ctx.declare_file(filename, *, directory)+ + Declares that implementation creates a file with the given filename within the specified directory.
Remember that in addition to declaring a file, you must separately create an action that emits the file. Creating that action will require passing the returned File object to the action's construction function.
+
+
| Parameter | +Description | +
|---|---|
+ filename
+ |
+
+ string;
+ required + The relative path of the file within the directory. + |
+
+ directory
+ |
+
+ File;
+ required + The directory in which the file should be created. + |
+
None template_ctx.run(*, outputs, inputs=[], executable, tools=None, arguments=[], progress_message=None)
+
+ Creates an action that runs an executable.
+
+ | Parameter | +Description | +
|---|---|
+ outputs
+ |
+
+ sequence of Files;
+ required + List of the output files of the action. + |
+
+ inputs
+ |
+
+ sequence of Files; or depset;
+ default is []+ List or depset of the input files of the action. + |
+
+ executable
+ |
+
+ File; or string; or FilesToRunProvider;
+ required + The executable file to be called by the action. + |
+
+ tools
+ |
+
+ sequence; or depset; or None;
+ default is None+ List or depset of any tools needed by the action. Tools are executable inputs that may have their own runfiles which are automatically made available to the action. +When a list is provided, it can be a heterogenous collection of: +
Files from ctx.executable and FilesToRunProviders which are directly in the list will have their runfiles automatically added. All tools are implicitly added as inputs.
+
+
+ |
+
+ arguments
+ |
+
+ sequence;
+ default is []+ Command line arguments of the action. Must be a list of strings or actions.args() objects.
+ |
+
+ progress_message
+ |
+
+ string; or None;
+ default is None+ Progress message to show to the user during the build. + |
+
bool toolchain_type.mandatory+ + Whether the toolchain type is mandatory or optional. + +
Label toolchain_type.toolchain_type+ + The toolchain type that is required. + + + + + + diff --git a/rules/lib/builtins/transition.mdx b/rules/lib/builtins/transition.mdx new file mode 100644 index 0000000..cd002fc --- /dev/null +++ b/rules/lib/builtins/transition.mdx @@ -0,0 +1,94 @@ +--- +title: 'transition' +--- + + + + + + + + +
Represents a configuration transition across a dependency edge. For example, if //package:foo depends on //package:bar with a configuration transition, then the configuration of //package:bar (and its dependencies) will be //package:foo's configuration plus the changes specified by the transition function.
+
+
transition transition(*, implementation, inputs, outputs)+ + A transition that reads a set of input build settings and writes a set of output build settings.
Example:
+def _transition_impl(settings, attr):
+ # This transition just reads the current CPU value as a demonstration.
+ # A real transition could incorporate this into its followup logic.
+ current_cpu = settings["//command_line_option:cpu"]
+ return {"//command_line_option:compilation_mode": "dbg"}
+
+build_in_debug_mode = transition(
+ implementation = _transition_impl,
+ inputs = ["//command_line_option:cpu"],
+ outputs = ["//command_line_option:compilation_mode"],
+)For more details see here.
+ +| Parameter | +Description | +
|---|---|
+ implementation
+ |
+
+ callable;
+ required + The function implementing this transition. This function always has two parameters: settings and attr. The settings param is a dictionary whose set of keys is defined by the inputs parameter. So, for each build setting --//foo=bar, if inputs contains //foo, settings will have an entry settings['//foo']='bar'.The This function must return a |
+
+ inputs
+ |
+
+ sequence of strings;
+ required + List of build settings that can be read by this transition. This becomes the key set of the settings parameter of the implementation function parameter. + |
+
+ outputs
+ |
+
+ sequence of strings;
+ required + List of build settings that can be written by this transition. This must be a superset of the key set of the dictionary returned by this transition. + |
+
repository_ctx.execute_wasm(). It contains the function's
+return value and output buffer.
+
+If execution failed before the function returned then the return code will be negative
+and the error_message field will be set.
+
+
+
string wasm_exec_result.error_message+ + Contains an error message if execution failed before the function returned. + +
string wasm_exec_result.output+ + The content of the output buffer returned by the WebAssembly function. + +
long wasm_exec_result.return_code+ + The return value of the WebAssembly function, or a negative value if execution +was terminated before the function returned. + + + + + + + diff --git a/rules/lib/builtins/wasm_module.mdx b/rules/lib/builtins/wasm_module.mdx new file mode 100644 index 0000000..24c8de3 --- /dev/null +++ b/rules/lib/builtins/wasm_module.mdx @@ -0,0 +1,36 @@ +--- +title: 'wasm_module' +--- + + + + + + + + +
repository_ctx.load_wasm().
+
+unknown wasm_module.path+ + The path this WebAssembly module was loaded from. + + + + + + diff --git a/rules/lib/core.mdx b/rules/lib/core.mdx new file mode 100644 index 0000000..ecaeaba --- /dev/null +++ b/rules/lib/core.mdx @@ -0,0 +1,44 @@ +--- +title: 'core' +--- + + + + + + + +
d[k] and key membership testing using k in d; both operations take constant time. Unfrozen dictionaries are mutable, and may be updated by assigning to d[k] or by calling certain methods. Dictionaries are iterable; iteration yields the sequence of keys in insertion order. Iteration order is unaffected by updating the value associated with an existing key, but is affected by removing then reinserting a key.
+d = {0: "x", 2: "z", 1: "y"}
+[k for k in d] # [0, 2, 1]
+d.pop(2)
+d[0], d[2] = "a", "b"
+0 in d, "a" in d # (True, False)
+[(k, v) for k, v in d.items()] # [(0, "a"), (1, "y"), (2, "b")]
+
+There are four ways to construct a dictionary: +
{k: v, ...} yields a new dictionary with the specified key/value entries, inserted in the order they appear in the expression. Evaluation fails if any two key expressions yield the same value.
+{k: v for vars in seq} yields a new dictionary into which each key/value pair is inserted in loop iteration order. Duplicates are permitted: the first insertion of a given key determines its position in the sequence, and the last determines its associated value.
+
+{k: v for k, v in (("a", 0), ("b", 1), ("a", 2))} # {"a": 2, "b": 1}
+{i: 2*i for i in range(3)} # {0: 0, 1: 2, 2: 4}
+
+x | y yields a new dictionary by combining two existing dictionaries. If the two dictionaries have a key k in common, the right hand side dictionary's value of the key (in other words, y[k]) wins. The |= variant of the union operator modifies a dictionary in-place. Example:d = {"foo": "FOO", "bar": "BAR"} | {"foo": "FOO2", "baz": "BAZ"}
+# d == {"foo": "FOO2", "bar": "BAR", "baz": "BAZ"}
+d = {"a": 1, "b": 2}
+d |= {"b": 3, "c": 4}
+# d == {"a": 1, "b": 3, "c": 4}None dict.clear()
+
+ Remove all items from the dictionary.
+
+ unknown dict.get(key, default=None)+ + Returns the value for
key if key is in the dictionary, else default. If default is not given, it defaults to None, so that this method never throws an error.
+
+ | Parameter | +Description | +
|---|---|
+ key
+ |
+
+ required + The key to look for. + |
+
+ default
+ |
+
+ default is None+ The default value to use (instead of None) if the key is not found. + |
+
list dict.items()+ + Returns the list of key-value tuples:
{2: "a", 4: "b", 1: "c"}.items() == [(2, "a"), (4, "b"), (1, "c")]
+
+
+ list dict.keys()+ + Returns the list of keys:
{2: "a", 4: "b", 1: "c"}.keys() == [2, 4, 1]
+
+
+ unknown dict.pop(key, default=unbound)+ + Removes a
key from the dict, and returns the associated value. If no entry with that key was found, remove nothing and return the specified default value; if no default value was specified, fail instead.
+
+ | Parameter | +Description | +
|---|---|
+ key
+ |
+
+ required + The key. + |
+
+ default
+ |
+
+ default is unbound+ a default value if the key is absent. + |
+
tuple dict.popitem()+ + Remove and return the first
(key, value) pair from the dictionary. popitem is useful to destructively iterate over a dictionary, as often used in set algorithms. If the dictionary is empty, the popitem call fails.
+
+ unknown dict.setdefault(key, default=None)+ + If
key is in the dictionary, return its value. If not, insert key with a value of default and return default. default defaults to None.
+
+ | Parameter | +Description | +
|---|---|
+ key
+ |
+
+ required + The key. + |
+
+ default
+ |
+
+ default is None+ a default value if the key is absent. + |
+
None dict.update(pairs=[], **kwargs)
+
+ Updates the dictionary first with the optional positional argument, pairs, then with the optional keyword arguments
+If the positional argument is present, it must be a dict, iterable, or None.
+If it is a dict, then its key/value pairs are inserted into this dict. If it is an iterable, it must provide a sequence of pairs (or other iterables of length 2), each of which is treated as a key/value pair to be inserted.
+Each keyword argument name=value causes the name/value pair to be inserted into this dict.
+
+ | Parameter | +Description | +
|---|---|
+ pairs
+ |
+
+ default is []+ Either a dictionary or a list of entries. Entries must be tuples or lists with exactly two elements: key, value. + |
+
+ kwargs
+ |
+
+ required + Dictionary of additional entries. + |
+
list dict.values()+ + Returns the list of values:
{2: "a", 4: "b", 1: "c"}.values() == ["a", "b", "c"]
+
+
+
+
+
+
+
diff --git a/rules/lib/core/float.mdx b/rules/lib/core/float.mdx
new file mode 100644
index 0000000..156305f
--- /dev/null
+++ b/rules/lib/core/float.mdx
@@ -0,0 +1,25 @@
+---
+title: 'float'
+---
+
+
+
+
+
+
+
+
+153
+0x2A # hexadecimal literal
+0o54 # octal literal
+23 * 2 + 5
+100 / -7
+100 % -7 # -5 (unlike in some other languages)
+int("18")
+
+
+
+
+
+
+
+
diff --git a/rules/lib/core/json.mdx b/rules/lib/core/json.mdx
new file mode 100644
index 0000000..720a305
--- /dev/null
+++ b/rules/lib/core/json.mdx
@@ -0,0 +1,241 @@
+---
+title: 'json'
+---
+
+
+
+
+
+
+
+
+unknown json.decode(x, default=unbound)+ + The decode function has one required positional parameter: a JSON string. +It returns the Starlark value that the string denotes. +
"null", "true" and "false" are parsed as None, True, and False.
+x is not a valid JSON encoding and the optional default parameter is specified (including specified as None), this function returns the default value.
+If x is not a valid JSON encoding and the optional default parameter is not specified, this function fails.
+
+ | Parameter | +Description | +
|---|---|
+ x
+ |
+
+ string;
+ required + JSON string to decode. + |
+
+ default
+ |
+
+ default is unbound+ If specified, the value to return when x cannot be decoded.
+ |
+
string json.encode(x)+ +
The encode function accepts one required positional argument, which it converts to JSON by cases: +
| Parameter | +Description | +
|---|---|
+ x
+ |
+
+ required + + |
+
string json.encode_indent(x, *, prefix='', indent='\t')+ + The encode_indent function is equivalent to
json.indent(json.encode(x), ...). See indent for description of formatting parameters.
+
+ | Parameter | +Description | +
|---|---|
+ x
+ |
+
+ required + + |
+
+ prefix
+ |
+
+ string;
+ default is ''+ + |
+
+ indent
+ |
+
+ string;
+ default is '\t'+ + |
+
string json.indent(s, *, prefix='', indent='\t')+ + The indent function returns the indented form of a valid JSON-encoded string. +Each array element or object field appears on a new line, beginning with the prefix string followed by one or more copies of the indent string, according to its nesting depth. +The function accepts one required positional parameter, the JSON string, +and two optional keyword-only string parameters, prefix and indent, +that specify a prefix of each new line, and the unit of indentation. +If the input is not valid, the function may fail or return invalid output. + + +
| Parameter | +Description | +
|---|---|
+ s
+ |
+
+ string;
+ required + + |
+
+ prefix
+ |
+
+ string;
+ default is ''+ + |
+
+ indent
+ |
+
+ string;
+ default is '\t'+ + |
+
x = [1, 2, 3]Accessing elements is possible using indexing (starts from
0):e = x[1] # e == 2Lists support the
+ operator to concatenate two lists. Example:x = [1, 2] + [3, 4] # x == [1, 2, 3, 4] +x = ["a", "b"] +x += ["c"] # x == ["a", "b", "c"]Similar to strings, lists support slice operations:
['a', 'b', 'c', 'd'][1:3] # ['b', 'c'] +['a', 'b', 'c', 'd'][::2] # ['a', 'c'] +['a', 'b', 'c', 'd'][3:0:-1] # ['d', 'c', 'b']Lists are mutable, as in Python. + +
None list.append(item)
+
+ Adds an item to the end of the list.
+
+ | Parameter | +Description | +
|---|---|
+ item
+ |
+
+ required + Item to add at the end. + |
+
None list.clear()
+
+ Removes all the elements of the list.
+
+ None list.extend(items)
+
+ Adds all items to the end of the list.
+
+ | Parameter | +Description | +
|---|---|
+ items
+ |
+
+ iterable;
+ required + Items to add at the end. + |
+
int list.index(x, start=unbound, end=unbound)+ + Returns the index in the list of the first item whose value is x. It is an error if there is no such item. + +
| Parameter | +Description | +
|---|---|
+ x
+ |
+
+ required + The object to search. + |
+
+ start
+ |
+
+ int;
+ default is unbound+ The start index of the list portion to inspect. + |
+
+ end
+ |
+
+ int;
+ default is unbound+ The end index of the list portion to inspect. + |
+
None list.insert(index, item)
+
+ Inserts an item at a given position.
+
+ | Parameter | +Description | +
|---|---|
+ index
+ |
+
+ int;
+ required + The index of the given position. + |
+
+ item
+ |
+
+ required + The item. + |
+
unknown list.pop(i=-1)+ + Removes the item at the given position in the list, and returns it. If no
index is specified, it removes and returns the last item in the list.
+
+ | Parameter | +Description | +
|---|---|
+ i
+ |
+
+ int;
+ default is -1+ The index of the item. + |
+
None list.remove(x)
+
+ Removes the first item from the list whose value is x. It is an error if there is no such item.
+
+ | Parameter | +Description | +
|---|---|
+ x
+ |
+
+ required + The object to remove. + |
+
x = range(1, 10, 3)Accessing elements is possible using indexing (starts from
0):e = x[1] # e == 2Ranges do not support the
+ operator for concatenation.Similar to strings, ranges support slice operations:range(10)[1:3] # range(1, 3) +range(10)[::2] # range(0, 10, 2) +range(10)[3:0:-1] # range(3, 0, -1)Ranges are immutable, as in Python 3. + + + + + + + diff --git a/rules/lib/core/set.mdx b/rules/lib/core/set.mdx new file mode 100644 index 0000000..910b749 --- /dev/null +++ b/rules/lib/core/set.mdx @@ -0,0 +1,809 @@ +--- +title: 'set' +--- + + + + + + + + +
"set".
+
+Sets provide constant-time operations to insert, remove, or check for the presence of a value. +Sets are implemented using a hash table, and therefore, just like keys of a +dictionary, elements of a set must be hashable. A value may be used as an +element of a set if and only if it may be used as a key of a dictionary. + +
Sets may be constructed using the set() built-in
+function, which returns a new set containing the unique elements of its optional argument, which
+must be an iterable. Calling set() without an argument constructs an empty set. Sets
+have no literal syntax.
+
+
The in and not in operations check whether a value is (or is not) in a
+set:
+
+
+s = set(["a", "b", "c"]) +"a" in s # True +"z" in s # False ++ +
A set is iterable, and thus may be used as the operand of a for loop, a list
+comprehension, and the various built-in functions that operate on iterables. Its length can be
+retrieved using the len() built-in function, and the
+order of iteration is the order in which elements were first added to the set:
+
+
+s = set(["z", "y", "z", "y"])
+len(s) # prints 2
+s.add("x")
+len(s) # prints 3
+for e in s:
+ print e # prints "z", "y", "x"
+
+
+A set used in Boolean context is true if and only if it is non-empty. + +
+s = set() +"non-empty" if s else "empty" # "empty" +t = set(["x", "y"]) +"non-empty" if t else "empty" # "non-empty" ++ +
Sets may be compared for equality or inequality using == and !=. A set
+s is equal to t if and only if t is a set containing the same
+elements; iteration order is not significant. In particular, a set is not equal to the list
+of its elements. Sets are not ordered with respect to other sets, and an attempt to compare two sets
+using <, <=, >, >=, or to sort a
+sequence of sets, will fail.
+
+
+set() == set() # True +set() != [] # True +set([1, 2]) == set([2, 1]) # True +set([1, 2]) != [1, 2] # True ++ +
The | operation on two sets returns the union of the two sets: a set containing the
+elements found in either one or both of the original sets.
+
+
+set([1, 2]) | set([3, 2]) # set([1, 2, 3]) ++ +
The & operation on two sets returns the intersection of the two sets: a set
+containing only the elements found in both of the original sets.
+
+
+set([1, 2]) & set([2, 3]) # set([2]) +set([1, 2]) & set([3, 4]) # set() ++ +
The - operation on two sets returns the difference of the two sets: a set containing
+the elements found in the left-hand side set but not the right-hand side set.
+
+
+set([1, 2]) - set([2, 3]) # set([1]) +set([1, 2]) - set([3, 4]) # set([1, 2]) ++ +
The ^ operation on two sets returns the symmetric difference of the two sets: a set
+containing the elements found in exactly one of the two original sets, but not in both.
+
+
+set([1, 2]) ^ set([2, 3]) # set([1, 3]) +set([1, 2]) ^ set([3, 4]) # set([1, 2, 3, 4]) ++ +
In each of the above operations, the elements of the resulting set retain their order from the +two operand sets, with all elements that were drawn from the left-hand side ordered before any +element that was only present in the right-hand side. + +
The corresponding augmented assignments, |=, &=, -=,
+and ^=, modify the left-hand set in place.
+
+
+s = set([1, 2]) +s |= set([2, 3, 4]) # s now equals set([1, 2, 3, 4]) +s &= set([0, 1, 2, 3]) # s now equals set([1, 2, 3]) +s -= set([0, 1]) # s now equals set([2, 3]) +s ^= set([3, 4]) # s now equals set([2, 4]) ++ +
Like all mutable values in Starlark, a set can be frozen, and once frozen, all subsequent +operations that attempt to update it will fail. + + +
None set.add(element)
+
+ Adds an element to the set.
+
+It is permissible to add a value already present in the set; this leaves the set
+unchanged.
+
+
If you need to add multiple elements to a set, see update or
+the |= augmented assignment operation.
+
+
+
| Parameter | +Description | +
|---|---|
+ element
+ |
+
+ required + Element to add. + |
+
None set.clear()
+
+ Removes all the elements of the set.
+
+ set set.difference(*others)+ + Returns a new mutable set containing the difference of this set with others. + +
If s and t are sets, s.difference(t) is equivalent to
+s - t; however, note that the - operation requires both sides to be sets,
+while the difference method also accepts sequences and dicts.
+
+
It is permissible to call difference without any arguments; this returns a copy of
+the set.
+
+
For example, +
+set([1, 2, 3]).difference([2]) # set([1, 3]) +set([1, 2, 3]).difference([0, 1], [3, 4]) # set([2]) ++ + +
| Parameter | +Description | +
|---|---|
+ others
+ |
+
+ required + Collections of hashable elements. + |
+
None set.difference_update(*others)
+
+ Removes any elements found in any others from this set.
+
+If s and t are sets, s.difference_update(t) is equivalent
+to s -= t; however, note that the -= augmented assignment requires both
+sides to be sets, while the difference_update method also accepts sequences and dicts.
+
+
It is permissible to call difference_update without any arguments; this leaves the
+set unchanged.
+
+
For example, +
+s = set([1, 2, 3, 4]) +s.difference_update([2]) # None; s is set([1, 3, 4]) +s.difference_update([0, 1], [4, 5]) # None; s is set([3]) ++ + +
| Parameter | +Description | +
|---|---|
+ others
+ |
+
+ required + Collections of hashable elements. + |
+
None set.discard(element)
+
+ Removes an element from the set if it is present.
+
+It is permissible to discard a value not present in the set; this leaves the set
+unchanged. If you want to fail on an attempt to remove a non-present element, use
+remove instead. If you need to remove multiple elements from a
+set, see difference_update or the -=
+augmented assignment operation.
+
+
For example, +
+s = set(["x", "y"])
+s.discard("y") # None; s == set(["x"])
+s.discard("y") # None; s == set(["x"])
+
+
+
+ | Parameter | +Description | +
|---|---|
+ element
+ |
+
+ required + Element to discard. Must be hashable. + |
+
set set.intersection(*others)+ + Returns a new mutable set containing the intersection of this set with others. + +
If s and t are sets, s.intersection(t) is equivalent to
+s & t; however, note that the & operation requires both sides to
+be sets, while the intersection method also accepts sequences and dicts.
+
+
It is permissible to call intersection without any arguments; this returns a copy of
+the set.
+
+
For example, +
+set([1, 2]).intersection([2, 3]) # set([2]) +set([1, 2, 3]).intersection([0, 1], [1, 2]) # set([1]) ++ + +
| Parameter | +Description | +
|---|---|
+ others
+ |
+
+ required + Collections of hashable elements. + |
+
None set.intersection_update(*others)
+
+ Removes any elements not found in all others from this set.
+
+If s and t are sets, s.intersection_update(t) is
+equivalent to s &= t; however, note that the &= augmented
+assignment requires both sides to be sets, while the intersection_update method also
+accepts sequences and dicts.
+
+
It is permissible to call intersection_update without any arguments; this leaves the
+set unchanged.
+
+
For example, +
+s = set([1, 2, 3, 4]) +s.intersection_update([0, 1, 2]) # None; s is set([1, 2]) +s.intersection_update([0, 1], [1, 2]) # None; s is set([1]) ++ + +
| Parameter | +Description | +
|---|---|
+ others
+ |
+
+ required + Collections of hashable elements. + |
+
bool set.isdisjoint(other)+ + Returns true if this set has no elements in common with another. + +
For example, +
+set([1, 2]).isdisjoint([3, 4]) # True +set().isdisjoint(set()) # True +set([1, 2]).isdisjoint([2, 3]) # False ++ + +
| Parameter | +Description | +
|---|---|
+ other
+ |
+
+ required + A collection of hashable elements. + |
+
bool set.issubset(other)+ + Returns true of this set is a subset of another. + +
Note that a set is always considered to be a subset of itself. + +
For example, +
+set([1, 2]).issubset([1, 2, 3]) # True +set([1, 2]).issubset([1, 2]) # True +set([1, 2]).issubset([2, 3]) # False ++ + +
| Parameter | +Description | +
|---|---|
+ other
+ |
+
+ required + A collection of hashable elements. + |
+
bool set.issuperset(other)+ + Returns true of this set is a superset of another. + +
Note that a set is always considered to be a superset of itself. + +
For example, +
+set([1, 2, 3]).issuperset([1, 2]) # True +set([1, 2, 3]).issuperset([1, 2, 3]) # True +set([1, 2, 3]).issuperset([2, 3, 4]) # False ++ + +
| Parameter | +Description | +
|---|---|
+ other
+ |
+
+ required + A collection of hashable elements. + |
+
unknown set.pop()+ + Removes and returns the first element of the set (in iteration order, which is the order in which +elements were first added to the set). + +
Fails if the set is empty. + +
For example, +
+s = set([3, 1, 2]) +s.pop() # 3; s == set([1, 2]) +s.pop() # 1; s == set([2]) +s.pop() # 2; s == set() +s.pop() # error: empty set ++ + +
None set.remove(element)
+
+ Removes an element, which must be present in the set, from the set.
+
+remove fails if the element was not present in the set. If you don't want to fail on
+an attempt to remove a non-present element, use discard instead.
+If you need to remove multiple elements from a set, see
+difference_update or the -= augmented
+assignment operation.
+
+
+
| Parameter | +Description | +
|---|---|
+ element
+ |
+
+ required + Element to remove. Must be an element of the set (and hashable). + |
+
set set.symmetric_difference(other)+ + Returns a new mutable set containing the symmetric difference of this set with another collection of +hashable elements. + +
If s and t are sets, s.symmetric_difference(t) is
+equivalent to s ^ t; however, note that the ^ operation requires both
+sides to be sets, while the symmetric_difference method also accepts a sequence or a
+dict.
+
+
For example, +
+set([1, 2]).symmetric_difference([2, 3]) # set([1, 3]) ++ + +
| Parameter | +Description | +
|---|---|
+ other
+ |
+
+ required + A collection of hashable elements. + |
+
None set.symmetric_difference_update(other)
+
+ Returns a new mutable set containing the symmetric difference of this set with another collection of
+hashable elements.
+
+If s and t are sets, s.symmetric_difference_update(t) is
+equivalent to `s ^= t; however, note that the ^=` augmented assignment requires both
+sides to be sets, while the symmetric_difference_update method also accepts a sequence
+or a dict.
+
+
For example, +
+s = set([1, 2]) +s.symmetric_difference_update([2, 3]) # None; s == set([1, 3]) ++ + +
| Parameter | +Description | +
|---|---|
+ other
+ |
+
+ required + A collection of hashable elements. + |
+
set set.union(*others)+ + Returns a new mutable set containing the union of this set with others. + +
If s and t are sets, s.union(t) is equivalent to
+s | t; however, note that the | operation requires both sides to be sets,
+while the union method also accepts sequences and dicts.
+
+
It is permissible to call union without any arguments; this returns a copy of the
+set.
+
+
For example, +
+set([1, 2]).union([2, 3]) # set([1, 2, 3])
+set([1, 2]).union([2, 3], {3: "a", 4: "b"}) # set([1, 2, 3, 4])
+
+
+
+ | Parameter | +Description | +
|---|---|
+ others
+ |
+
+ required + Collections of hashable elements. + |
+
None set.update(*others)
+
+ Adds the elements found in others to this set.
+
+For example, +
+s = set() +s.update([1, 2]) # None; s is set([1, 2]) +s.update([2, 3], [3, 4]) # None; s is set([1, 2, 3, 4]) ++ +
If s and t are sets, s.update(t) is equivalent to
+s |= t; however, note that the |= augmented assignment requires both sides
+to be sets, while the update method also accepts sequences and dicts.
+
+
It is permissible to call update without any arguments; this leaves the set
+unchanged.
+
+
+
| Parameter | +Description | +
|---|---|
+ others
+ |
+
+ required + Collections of hashable elements. + |
+
a = 'abc\ndef' +b = "ab'cd" +c = """multiline string""" + +# Strings support slicing (negative index starts from the end): +x = "hello"[2:4] # "ll" +y = "hello"[1:-1] # "ell" +z = "hello"[:4] # "hell" +# Slice steps can be used, too: +s = "hello"[::2] # "hlo" +t = "hello"[3:0:-1] # "lle" +Strings are not directly iterable, use the
.elems() method to iterate over their characters. Examples:"bc" in "abcd" # evaluates to True +x = [c for c in "abc".elems()] # x == ["a", "b", "c"]+Implicit concatenation of strings is not allowed; use the
+ operator instead. Comparison operators perform a lexicographical comparison; use == to test for equality.
+
+string string.capitalize()+ + Returns a copy of the string with its first character (if any) capitalized and the rest lowercased. This method does not support non-ascii characters. + +
int string.count(sub, start=0, end=None)+ + Returns the number of (non-overlapping) occurrences of substring
sub in string, optionally restricting to [start:end], start being inclusive and end being exclusive.
+
+ | Parameter | +Description | +
|---|---|
+ sub
+ |
+
+ string;
+ required + The substring to count. + |
+
+ start
+ |
+
+ int; or None;
+ default is 0+ Restrict to search from this position. + |
+
+ end
+ |
+
+ int; or None;
+ default is None+ optional position before which to restrict to search. + |
+
sequence string.elems()+ + Returns an iterable value containing successive 1-element substrings of the string. Equivalent to
[s[i] for i in range(len(s))], except that the returned value might not be a list.
+
+ bool string.endswith(sub, start=0, end=None)+ + Returns True if the string ends with
sub, otherwise False, optionally restricting to [start:end], start being inclusive and end being exclusive.
+
+ | Parameter | +Description | +
|---|---|
+ sub
+ |
+
+ string; or tuple of strings;
+ required + The suffix (or tuple of alternative suffixes) to match. + |
+
+ start
+ |
+
+ int; or None;
+ default is 0+ Test beginning at this position. + |
+
+ end
+ |
+
+ int; or None;
+ default is None+ optional position at which to stop comparing. + |
+
int string.find(sub, start=0, end=None)+ + Returns the first index where
sub is found, or -1 if no such index exists, optionally restricting to [start:end], start being inclusive and end being exclusive.
+
+ | Parameter | +Description | +
|---|---|
+ sub
+ |
+
+ string;
+ required + The substring to find. + |
+
+ start
+ |
+
+ int; or None;
+ default is 0+ Restrict to search from this position. + |
+
+ end
+ |
+
+ int; or None;
+ default is None+ optional position before which to restrict to search. + |
+
string string.format(*args, **kwargs)+ + Perform string interpolation. Format strings contain replacement fields surrounded by curly braces
{}. Anything that is not contained in braces is considered literal text, which is copied unchanged to the output.If you need to include a brace character in the literal text, it can be escaped by doubling: {{ and }}A replacement field can be either a name, a number, or empty. Values are converted to strings using the str function.# Access in order:
+"{} < {}".format(4, 5) == "4 < 5"
+# Access by position:
+"{1}, {0}".format(2, 1) == "1, 2"
+# Access by name:
+"x{key}x".format(key = 2) == "x2x"
+
+
+ | Parameter | +Description | +
|---|---|
+ args
+ |
+
+ default is ()+ List of arguments. + |
+
+ kwargs
+ |
+
+ default is {}+ Dictionary of arguments. + |
+
int string.index(sub, start=0, end=None)+ + Returns the first index where
sub is found, or raises an error if no such index exists, optionally restricting to [start:end]start being inclusive and end being exclusive.
+
+ | Parameter | +Description | +
|---|---|
+ sub
+ |
+
+ string;
+ required + The substring to find. + |
+
+ start
+ |
+
+ int; or None;
+ default is 0+ Restrict to search from this position. + |
+
+ end
+ |
+
+ int; or None;
+ default is None+ optional position before which to restrict to search. + |
+
bool string.isalnum()+ + Returns True if all characters in the string are alphanumeric ([a-zA-Z0-9]) and there is at least one character. + +
bool string.isalpha()+ + Returns True if all characters in the string are alphabetic ([a-zA-Z]) and there is at least one character. + +
bool string.isdigit()+ + Returns True if all characters in the string are digits ([0-9]) and there is at least one character. + +
bool string.islower()+ + Returns True if all cased characters in the string are lowercase and there is at least one character. + +
bool string.isspace()+ + Returns True if all characters are white space characters and the string contains at least one character. + +
bool string.istitle()+ + Returns True if the string is in title case and it contains at least one character. This means that every uppercase character must follow an uncased one (e.g. whitespace) and every lowercase character must follow a cased one (e.g. uppercase or lowercase). + +
bool string.isupper()+ + Returns True if all cased characters in the string are uppercase and there is at least one character. + +
string string.join(elements)+ + Returns a string in which the string elements of the argument have been joined by this string as a separator. Example:
"|".join(["a", "b", "c"]) == "a|b|c"+ +
| Parameter | +Description | +
|---|---|
+ elements
+ |
+
+ iterable of strings;
+ required + The objects to join. + |
+
string string.lower()+ + Returns the lower case version of this string. + +
string string.lstrip(chars=None)+ + Returns a copy of the string where leading characters that appear in
chars are removed. Note that chars is not a prefix: all combinations of its value are removed:"abcba".lstrip("ba") == "cba"
+
+ | Parameter | +Description | +
|---|---|
+ chars
+ |
+
+ string; or None;
+ default is None+ The characters to remove, or all whitespace if None. + |
+
tuple string.partition(sep)+ + Splits the input string at the first occurrence of the separator
sep and returns the resulting partition as a three-element tuple of the form (before, separator, after). If the input string does not contain the separator, partition returns (self, '', '').
+
+ | Parameter | +Description | +
|---|---|
+ sep
+ |
+
+ string;
+ required + The string to split on. + |
+
string string.removeprefix(prefix)+ + If the string starts with
prefix, returns a new string with the prefix removed. Otherwise, returns the string.
+
+ | Parameter | +Description | +
|---|---|
+ prefix
+ |
+
+ string;
+ required + The prefix to remove if present. + |
+
string string.removesuffix(suffix)+ + If the string ends with
suffix, returns a new string with the suffix removed. Otherwise, returns the string.
+
+ | Parameter | +Description | +
|---|---|
+ suffix
+ |
+
+ string;
+ required + The suffix to remove if present. + |
+
string string.replace(old, new, count=-1)+ + Returns a copy of the string in which the occurrences of
old have been replaced with new, optionally restricting the number of replacements to count.
+
+ | Parameter | +Description | +
|---|---|
+ old
+ |
+
+ string;
+ required + The string to be replaced. + |
+
+ new
+ |
+
+ string;
+ required + The string to replace with. + |
+
+ count
+ |
+
+ int;
+ default is -1+ The maximum number of replacements. If omitted, or if the value is negative, there is no limit. + |
+
int string.rfind(sub, start=0, end=None)+ + Returns the last index where
sub is found, or -1 if no such index exists, optionally restricting to [start:end], start being inclusive and end being exclusive.
+
+ | Parameter | +Description | +
|---|---|
+ sub
+ |
+
+ string;
+ required + The substring to find. + |
+
+ start
+ |
+
+ int; or None;
+ default is 0+ Restrict to search from this position. + |
+
+ end
+ |
+
+ int; or None;
+ default is None+ optional position before which to restrict to search. + |
+
int string.rindex(sub, start=0, end=None)+ + Returns the last index where
sub is found, or raises an error if no such index exists, optionally restricting to [start:end], start being inclusive and end being exclusive.
+
+ | Parameter | +Description | +
|---|---|
+ sub
+ |
+
+ string;
+ required + The substring to find. + |
+
+ start
+ |
+
+ int; or None;
+ default is 0+ Restrict to search from this position. + |
+
+ end
+ |
+
+ int; or None;
+ default is None+ optional position before which to restrict to search. + |
+
tuple string.rpartition(sep)+ + Splits the input string at the last occurrence of the separator
sep and returns the resulting partition as a three-element tuple of the form (before, separator, after). If the input string does not contain the separator, rpartition returns ('', '', self).
+
+ | Parameter | +Description | +
|---|---|
+ sep
+ |
+
+ string;
+ required + The string to split on. + |
+
list string.rsplit(sep, maxsplit=unbound)+ + Returns a list of all the words in the string, using
sep as the separator, optionally limiting the number of splits to maxsplit. Except for splitting from the right, this method behaves like split().
+
+ | Parameter | +Description | +
|---|---|
+ sep
+ |
+
+ string;
+ required + The string to split on. + |
+
+ maxsplit
+ |
+
+ int;
+ default is unbound+ The maximum number of splits. + |
+
string string.rstrip(chars=None)+ + Returns a copy of the string where trailing characters that appear in
chars are removed. Note that chars is not a suffix: all combinations of its value are removed:"abcbaa".rstrip("ab") == "abc"
+
+ | Parameter | +Description | +
|---|---|
+ chars
+ |
+
+ string; or None;
+ default is None+ The characters to remove, or all whitespace if None. + |
+
list string.split(sep, maxsplit=unbound)+ + Returns a list of all the words in the string, using
sep as the separator, optionally limiting the number of splits to maxsplit.
+
+ | Parameter | +Description | +
|---|---|
+ sep
+ |
+
+ string;
+ required + The string to split on. + |
+
+ maxsplit
+ |
+
+ int;
+ default is unbound+ The maximum number of splits. + |
+
sequence string.splitlines(keepends=False)+ + Splits the string at line boundaries ('\n', '\r\n', '\r') and returns the result as a new mutable list. + +
| Parameter | +Description | +
|---|---|
+ keepends
+ |
+
+ bool;
+ default is False+ Whether the line breaks should be included in the resulting list. + |
+
bool string.startswith(sub, start=0, end=None)+ + Returns True if the string starts with
sub, otherwise False, optionally restricting to [start:end], start being inclusive and end being exclusive.
+
+ | Parameter | +Description | +
|---|---|
+ sub
+ |
+
+ string; or tuple of strings;
+ required + The prefix (or tuple of alternative prefixes) to match. + |
+
+ start
+ |
+
+ int; or None;
+ default is 0+ Test beginning at this position. + |
+
+ end
+ |
+
+ int; or None;
+ default is None+ Stop comparing at this position. + |
+
string string.strip(chars=None)+ + Returns a copy of the string where leading or trailing characters that appear in
chars are removed. Note that chars is neither a prefix nor a suffix: all combinations of its value are removed:"aabcbcbaa".strip("ab") == "cbc"
+
+ | Parameter | +Description | +
|---|---|
+ chars
+ |
+
+ string; or None;
+ default is None+ The characters to remove, or all whitespace if None. + |
+
string string.title()+ + Converts the input string into title case, i.e. every word starts with an uppercase letter while the remaining letters are lowercase. In this context, a word means strictly a sequence of letters. This method does not support supplementary Unicode characters. + +
string string.upper()+ + Returns the upper case version of this string. + + + + + + diff --git a/rules/lib/core/tuple.mdx b/rules/lib/core/tuple.mdx new file mode 100644 index 0000000..c517520 --- /dev/null +++ b/rules/lib/core/tuple.mdx @@ -0,0 +1,29 @@ +--- +title: 'tuple' +--- + + + + + + + + +
x = (1, 2, 3)Accessing elements is possible using indexing (starts from
0):e = x[1] # e == 2Lists support the
+ operator to concatenate two tuples. Example:x = (1, 2) + (3, 4) # x == (1, 2, 3, 4)
+x = ("a", "b")
+x += ("c",) # x == ("a", "b", "c")Similar to lists, tuples support slice operations:('a', 'b', 'c', 'd')[1:3] # ('b', 'c')
+('a', 'b', 'c', 'd')[::2] # ('a', 'c')
+('a', 'b', 'c', 'd')[3:0:-1] # ('d', 'c', 'b')Tuples are immutable, therefore x[1] = "a" is not supported.
+
+
+
+
+
+
+
diff --git a/rules/lib/fragments.mdx b/rules/lib/fragments.mdx
new file mode 100644
index 0000000..2578698
--- /dev/null
+++ b/rules/lib/fragments.mdx
@@ -0,0 +1,42 @@
+---
+title: 'fragments'
+---
+
+
+
+
+
+
+
+Rule implementations can get them using ctx.fragments.[fragment name]
+
+
apple_platform apple.multi_arch_platform(platform_type)+ + The platform of the current configuration for the given platform type. This should only be invoked in a context where multiple architectures may be supported; consider single_arch_platform for other cases. + +
| Parameter | +Description | +
|---|---|
+ platform_type
+ |
+
+ string;
+ required + The apple platform type. + |
+
string apple.single_arch_cpu+ + The single "effective" architecture for this configuration (e.g.,
i386 or arm64) in the context of rule logic that is only concerned with a single architecture (such as objc_library, which registers single-architecture compile actions).
+
+ apple_platform apple.single_arch_platform+ + The platform of the current configuration. This should only be invoked in a context where only a single architecture may be supported; consider multi_arch_platform for other cases. + + + + + + diff --git a/rules/lib/fragments/bazel_android.mdx b/rules/lib/fragments/bazel_android.mdx new file mode 100644 index 0000000..5077e73 --- /dev/null +++ b/rules/lib/fragments/bazel_android.mdx @@ -0,0 +1,36 @@ +--- +title: 'bazel_android' +--- + + + + + + + + +
bool bazel_android.merge_android_manifest_permissions+ + The value of --merge_android_manifest_permissions flag. + + + + + + diff --git a/rules/lib/fragments/bazel_py.mdx b/rules/lib/fragments/bazel_py.mdx new file mode 100644 index 0000000..44e3174 --- /dev/null +++ b/rules/lib/fragments/bazel_py.mdx @@ -0,0 +1,44 @@ +--- +title: 'bazel_py' +--- + + + + + + + + +
bool bazel_py.python_import_all_repositories+ + The value of the --experimental_python_import_all_repositories flag. + +
string bazel_py.python_path+ + The value of the --python_path flag. + + + + + + diff --git a/rules/lib/fragments/coverage.mdx b/rules/lib/fragments/coverage.mdx new file mode 100644 index 0000000..40a4ec7 --- /dev/null +++ b/rules/lib/fragments/coverage.mdx @@ -0,0 +1,37 @@ +--- +title: 'coverage' +--- + + + + + + + + +
Label coverage.output_generator+ + Returns the label pointed to by the
--coverage_output_generator option if coverage collection is enabled, otherwise returns None. Can be accessed with configuration_field:attr.label(+ May return
default = configuration_field(
fragment = "coverage",
name = "output_generator"
)
)
None.
+
+
+
+
+
+
diff --git a/rules/lib/fragments/cpp.mdx b/rules/lib/fragments/cpp.mdx
new file mode 100644
index 0000000..385b7a5
--- /dev/null
+++ b/rules/lib/fragments/cpp.mdx
@@ -0,0 +1,101 @@
+---
+title: 'cpp'
+---
+
+
+
+
+
+
+
+
+bool cpp.apple_generate_dsym+ + Whether to generate Apple debug symbol(.dSYM) artifacts. + +
list cpp.conlyopts+ + The flags passed to Bazel by
--conlyopt option.
+
+ list cpp.copts+ + The flags passed to Bazel by
--copt option.
+
+ Label cpp.custom_malloc+ + Returns label pointed to by
--custom_malloc option. Can be accessed with configuration_field:attr.label(+ May return
default = configuration_field(
fragment = "cpp",
name = "custom_malloc"
)
)
None.
+
+ list cpp.cxxopts+ + The flags passed to Bazel by
--cxxopt option.
+
+ list cpp.linkopts+ + The flags passed to Bazel by
--linkopt option.
+
+ bool cpp.objc_generate_linkmap+ + (Apple-only) Whether to generate linkmap artifacts. + +
bool cpp.objc_should_strip_binary+ + (Apple-only) whether to perform symbol and dead-code strippings on linked binaries. + +
list cpp.objccopts+ + The flags passed to Bazel by
--objccopt option.
+
+
+
+
+
+
diff --git a/rules/lib/fragments/j2objc.mdx b/rules/lib/fragments/j2objc.mdx
new file mode 100644
index 0000000..05e9d79
--- /dev/null
+++ b/rules/lib/fragments/j2objc.mdx
@@ -0,0 +1,36 @@
+---
+title: 'j2objc'
+---
+
+
+
+
+
+
+
+
+list j2objc.translation_flags+ + The list of flags to be used when the j2objc compiler is invoked. + + + + + + diff --git a/rules/lib/fragments/java.mdx b/rules/lib/fragments/java.mdx new file mode 100644 index 0000000..729eab5 --- /dev/null +++ b/rules/lib/fragments/java.mdx @@ -0,0 +1,140 @@ +--- +title: 'java' +--- + + + + + + + + +
int java.bytecode_optimization_pass_actions+ + This specifies the number of actions to divide the OPTIMIZATION stage of the bytecode optimizer into. Note that if split_bytecode_optimization_pass is set, this will only change behavior if it is > 2. + +
string java.bytecode_optimizer_mnemonic+ + The mnemonic for the bytecode optimizer. + +
list java.default_javac_flags+ + The default flags for the Java compiler. + +
depset java.default_javac_flags_depset+ + The default flags for the Java compiler. + +
list java.default_jvm_opts+ + Additional options to pass to the Java VM for each java_binary target + +
bool java.disallow_java_import_exports()+ + Returns true if java_import exports are not allowed. + +
bool java.multi_release_deploy_jars+ + The value of the --incompatible_multi_release_deploy_jars flag. + +
string java.one_version_enforcement_level+ + The value of the --experimental_one_version_enforcement flag. + +
list java.plugins+ + A list containing the labels provided with --plugins, if any. + +
bool java.run_android_lint+ + The value of the --experimental_run_android_lint_on_java_rules flag. + +
bool java.split_bytecode_optimization_pass+ + Returns whether the OPTIMIZATION stage of the bytecode optimizer will be split across two actions. + +
string java.strict_java_deps+ + The value of the strict_java_deps flag. + +
bool java.use_header_compilation_direct_deps()+ + Returns true if Java header compilation should use separate outputs for direct deps. + +
bool java.use_ijars()+ + Returns true iff Java compilation should use ijars. + + + + + + diff --git a/rules/lib/fragments/objc.mdx b/rules/lib/fragments/objc.mdx new file mode 100644 index 0000000..d560201 --- /dev/null +++ b/rules/lib/fragments/objc.mdx @@ -0,0 +1,111 @@ +--- +title: 'objc' +--- + + + + + + + + +
bool objc.alwayslink_by_default+ + Returns whether objc_library and objc_import should default to alwayslink=True. + +
bool objc.builtin_objc_strip_action+ + Returns whether to emit a strip action as part of objc linking. + +
list objc.copts_for_current_compilation_mode+ + Returns a list of default options to use for compiling Objective-C in the current mode. + +
bool objc.disallow_sdk_frameworks_attributes+ + Returns whether sdk_frameworks and weak_sdk_frameworks are disallowed attributes. + +
string objc.ios_simulator_device+ + The type of device (e.g. 'iPhone 6') to use when running on the simulator. + May return
None.
+
+ DottedVersion objc.ios_simulator_version+ + The SDK version of the iOS simulator to use when running on the simulator. + May return
None.
+
+ bool objc.run_memleaks+ + Returns a boolean indicating whether memleaks should be run during tests or not. + +
string objc.signing_certificate_name+ + Returns the flag-supplied certificate name to be used in signing, or None if no such certificate was specified. + May return
None.
+
+ bool objc.strip_executable_safely+ + Returns whether executable strip action should use flag -x, which does not break dynamic symbol resolution. + +
bool objc.uses_device_debug_entitlements+ + Returns whether device debug entitlements should be included when signing an application. + + + + + + diff --git a/rules/lib/fragments/platform.mdx b/rules/lib/fragments/platform.mdx new file mode 100644 index 0000000..877d00c --- /dev/null +++ b/rules/lib/fragments/platform.mdx @@ -0,0 +1,44 @@ +--- +title: 'platform' +--- + + + + + + + + +
Label platform.host_platform+ + The current host platform + +
Label platform.platform+ + The current target platform + + + + + + diff --git a/rules/lib/fragments/proto.mdx b/rules/lib/fragments/proto.mdx new file mode 100644 index 0000000..a9686e6 --- /dev/null +++ b/rules/lib/fragments/proto.mdx @@ -0,0 +1,25 @@ +--- +title: 'proto' +--- + + + + + + + + +
bool py.build_python_zip+ + The effective value of --build_python_zip + +
string py.default_python_version+ + No-op: PY3 is the default Python version. + +
bool py.default_to_explicit_init_py+ + The value from the --incompatible_default_to_explicit_init_py flag + +
bool py.disable_py2+ + No-op: PY2 is no longer supported. + +
bool py.disallow_native_rules+ + The value of the --incompatible_python_disallow_native_rules flag. + +
bool py.include_label_in_linkstamp+ + Whether the build label is included in unstamped builds. + +
bool py.use_toolchains+ + No-op: Python toolchains are always used. + + + + + + diff --git a/rules/lib/globals.mdx b/rules/lib/globals.mdx new file mode 100644 index 0000000..5d948e3 --- /dev/null +++ b/rules/lib/globals.mdx @@ -0,0 +1,32 @@ +--- +title: 'globals' +--- + + + + + + + +
unknown abs(x)+ + Returns the absolute value of a number (a non-negative number with the same magnitude).
abs(-2.3) == 2.3+ +
| Parameter | +Description | +
|---|---|
+ x
+ |
+
+ int; or float;
+ required + A number (int or float) + |
+
bool all(elements)+ + Returns true if all elements evaluate to True or if the collection is empty. Elements are converted to boolean using the bool function.
all(["hello", 3, True]) == True +all([-1, 0, 1]) == False+ +
| Parameter | +Description | +
|---|---|
+ elements
+ |
+
+ iterable;
+ required + A collection of elements. + |
+
bool any(elements)+ + Returns true if at least one element evaluates to True. Elements are converted to boolean using the bool function.
any([-1, 0, 1]) == True +any([False, 0, ""]) == False+ +
| Parameter | +Description | +
|---|---|
+ elements
+ |
+
+ iterable;
+ required + A collection of elements. + |
+
bool bool(x=False)+ + Constructor for the bool type. It returns
False if the object is None, False, an empty string (""), the number 0, or an empty collection (e.g. (), []). Otherwise, it returns True.
+
+ | Parameter | +Description | +
|---|---|
+ x
+ |
+
+ default is False+ The variable to convert. + |
+
dict dict(pairs=[], **kwargs)+ + Creates a dictionary from an optional positional argument and an optional set of keyword arguments. In the case where the same key is given multiple times, the last value will be used. Entries supplied via keyword arguments are considered to come after entries supplied via the positional argument. + +
| Parameter | +Description | +
|---|---|
+ pairs
+ |
+
+ default is []+ A dict, or an iterable whose elements are each of length 2 (key, value). + |
+
+ kwargs
+ |
+
+ required + Dictionary of additional entries. + |
+
list dir(x)+ + Returns a list of strings: the names of the attributes and methods of the parameter object. + +
| Parameter | +Description | +
|---|---|
+ x
+ |
+
+ required + The object to check. + |
+
list enumerate(list, start=0)+ + Returns a list of pairs (two-element tuples), with the index (int) and the item from the input sequence. +
enumerate([24, 21, 84]) == [(0, 24), (1, 21), (2, 84)]+ + +
| Parameter | +Description | +
|---|---|
+ list
+ |
+
+ required + input sequence. + |
+
+ start
+ |
+
+ int;
+ default is 0+ start index. + |
+
None fail(*args, msg=None, attr=None, sep=" ")
+
+ Causes execution to fail with an error.
+
+ | Parameter | +Description | +
|---|---|
+ msg
+ |
+
+ default is None+ Deprecated: use positional arguments instead. This argument acts like an implicit leading positional argument. + |
+
+ attr
+ |
+
+ string; or None;
+ default is None+ Deprecated. Causes an optional prefix containing this string to be added to the error message. + |
+
+ sep
+ |
+
+ string;
+ default is " "+ The separator string between the objects, default is space (" "). + |
+
+ args
+ |
+
+ required + A list of values, formatted with debugPrint (which is equivalent to str by default) and joined with sep (defaults to " "), that appear in the error message. + |
+
float float(x=unbound)+ + Returns x as a float value.
x is already a float, float returns it unchanged. x is a bool, float returns 1.0 for True and 0.0 for False. x is an int, float returns the nearest finite floating-point value to x, or an error if the magnitude is too large. x is a string, it must be a valid floating-point literal, or be equal (ignoring case) to NaN, Inf, or Infinity, optionally preceded by a + or - sign. float() returns 0.0.
+
+ | Parameter | +Description | +
|---|---|
+ x
+ |
+
+ string; or bool; or int; or float;
+ default is unbound+ The value to convert. + |
+
unknown getattr(x, name, default=unbound)+ + Returns the struct's field of the given name if it exists. If not, it either returns
default (if specified) or raises an error. getattr(x, "foobar") is equivalent to x.foobar.getattr(ctx.attr, "myattr") +getattr(ctx.attr, "myattr", "mydefault")+ +
| Parameter | +Description | +
|---|---|
+ x
+ |
+
+ required + The struct whose attribute is accessed. + |
+
+ name
+ |
+
+ string;
+ required + The name of the struct attribute. + |
+
+ default
+ |
+
+ default is unbound+ The default value to return in case the struct doesn't have an attribute of the given name. + |
+
bool hasattr(x, name)+ + Returns True if the object
x has an attribute or method of the given name, otherwise False. Example:hasattr(ctx.attr, "myattr")+ +
| Parameter | +Description | +
|---|---|
+ x
+ |
+
+ required + The object to check. + |
+
+ name
+ |
+
+ string;
+ required + The name of the attribute. + |
+
int hash(value)+ + Return a hash value for a string. This is computed deterministically using the same algorithm as Java's
String.hashCode(), namely: s[0] * (31^(n-1)) + s[1] * (31^(n-2)) + ... + s[n-1]Hashing of values besides strings is not currently supported. + +
| Parameter | +Description | +
|---|---|
+ value
+ |
+
+ string;
+ required + String value to hash. + |
+
int int(x, base=unbound)+ + Returns x as an int value.
x is already an int, int returns it unchanged.x is a bool, int returns 1 for True and 0 for False.x is a string, it must have the format <sign><prefix><digits>. <sign> is either "+", "-", or empty (interpreted as positive). <digits> are a sequence of digits from 0 up to base - 1, where the letters a-z (or equivalently, A-Z) are used as digits for 10-35. In the case where base is 2/8/16, <prefix> is optional and may be 0b/0o/0x (or equivalently, 0B/0O/0X) respectively; if the base is any other value besides these bases or the special value 0, the prefix must be empty. In the case where base is 0, the string is interpreted as an integer literal, in the sense that one of the bases 2/8/10/16 is chosen depending on which prefix if any is used. If base is 0, no prefix is used, and there is more than one digit, the leading digit cannot be 0; this is to avoid confusion between octal and decimal. The magnitude of the number represented by the string must be within the allowed range for the int type.x is a float, int returns the integer value of the float, rounding towards zero. It is an error if x is non-finite (NaN or infinity).x is any other type, or if the value is a string not satisfying the above format. Unlike Python's int function, this function does not allow zero arguments, and does not allow extraneous whitespace for string arguments.Examples:
int("123") == 123
+int("-123") == -123
+int("+123") == 123
+int("FF", 16) == 255
+int("0xFF", 16) == 255
+int("10", 0) == 10
+int("-0x10", 0) == -16
+int("-0x10", 0) == -16
+int("123.456") == 123
+
+
+ | Parameter | +Description | +
|---|---|
+ x
+ |
+
+ string; or bool; or int; or float;
+ required + The string to convert. + |
+
+ base
+ |
+
+ int;
+ default is unbound+ The base used to interpret a string value; defaults to 10. Must be between 2 and 36 (inclusive), or 0 to detect the base as if x were an integer literal. This parameter must not be supplied if the value is not a string.
+ |
+
int len(x)+ + Returns the length of a string, sequence (such as a list or tuple), dict, set, or other iterable. + +
| Parameter | +Description | +
|---|---|
+ x
+ |
+
+ iterable; or string;
+ required + The value whose length to report. + |
+
list list(x=[])+ + Returns a new list with the same elements as the given iterable value.
list([1, 2]) == [1, 2]
+list((2, 3, 2)) == [2, 3, 2]
+list({5: "a", 2: "b", 4: "c"}) == [5, 2, 4]
+
+ | Parameter | +Description | +
|---|---|
+ x
+ |
+
+ iterable;
+ default is []+ The object to convert. + |
+
unknown max(*args, key=None)+ + Returns the largest one of all given arguments. If only one positional argument is provided, it must be a non-empty iterable.It is an error if elements are not comparable (for example int with string), or if no arguments are given.
+max(2, 5, 4) == 5
+max([5, 6, 3]) == 6
+max("two", "three", "four", key = len) =="three" # the longest
+max([1, -1, -2, 2], key = abs) == -2 # the first encountered with maximal key value
+
+
+ | Parameter | +Description | +
|---|---|
+ key
+ |
+
+ callable; or None;
+ default is None+ An optional function applied to each element before comparison. + |
+
+ args
+ |
+
+ required + The elements to be checked. + |
+
unknown min(*args, key=None)+ + Returns the smallest one of all given arguments. If only one positional argument is provided, it must be a non-empty iterable. It is an error if elements are not comparable (for example int with string), or if no arguments are given.
+min(2, 5, 4) == 2
+min([5, 6, 3]) == 3
+min("six", "three", "four", key = len) == "six" # the shortest
+min([2, -2, -1, 1], key = abs) == -1 # the first encountered with minimal key value
+
+
+ | Parameter | +Description | +
|---|---|
+ key
+ |
+
+ callable; or None;
+ default is None+ An optional function applied to each element before comparison. + |
+
+ args
+ |
+
+ required + The elements to be checked. + |
+
None print(*args, sep=" ")
+
+ Prints args as debug output. It will be prefixed with the string "DEBUG" and the location (file and line number) of this call. The exact way in which the arguments are converted to strings is unspecified and may change at any time. In particular, it may be different from (and more detailed than) the formatting done by str() and repr().Using print in production code is discouraged due to the spam it creates for users. For deprecations, prefer a hard error using fail() whenever possible.
+
+
| Parameter | +Description | +
|---|---|
+ sep
+ |
+
+ string;
+ default is " "+ The separator string between the objects, default is space (" "). + |
+
+ args
+ |
+
+ required + The objects to print. + |
+
sequence range(start_or_stop, stop=unbound, step=1)+ + Creates a list where items go from
start to stop, using a step increment. If a single argument is provided, items will range from 0 to that element.range(4) == [0, 1, 2, 3] +range(3, 9, 2) == [3, 5, 7] +range(3, 0, -1) == [3, 2, 1]+ +
| Parameter | +Description | +
|---|---|
+ start_or_stop
+ |
+
+ int;
+ required + Value of the start element if stop is provided, otherwise value of stop and the actual start is 0 + |
+
+ stop
+ |
+
+ int;
+ default is unbound+ optional index of the first item not to be included in the resulting list; generation of the list stops before stop is reached.
+ |
+
+ step
+ |
+
+ int;
+ default is 1+ The increment (default is 1). It may be negative. + |
+
string repr(x)+ + Converts any object to a string representation. This is useful for debugging.
repr("ab") == '"ab"'
+
+ | Parameter | +Description | +
|---|---|
+ x
+ |
+
+ required + The object to convert. + |
+
list reversed(sequence)+ + Returns a new, unfrozen list that contains the elements of the original iterable sequence in reversed order.
reversed([3, 5, 4]) == [4, 5, 3]+ +
| Parameter | +Description | +
|---|---|
+ sequence
+ |
+
+ iterable;
+ required + The iterable sequence (e.g. list) to be reversed. + |
+
set set(elements=[])+ + Creates a new set containing the unique elements of a given +iterable, preserving iteration order. + +
If called with no argument, set() returns a new empty set.
+
+
For example, +
+set() # an empty set
+set([3, 1, 1, 2]) # set([3, 1, 2]), a set of three elements
+set({"k1": "v1", "k2": "v2"}) # set(["k1", "k2"]), a set of two elements
+
+
+
+ | Parameter | +Description | +
|---|---|
+ elements
+ |
+
+ iterable;
+ default is []+ An iterable of hashable values. + |
+
list sorted(iterable, key=None, *, reverse=False)+ + Returns a new sorted list containing all the elements of the supplied iterable sequence. An error may occur if any pair of elements x, y may not be compared using x < y. The elements are sorted into ascending order, unless the reverse argument is True, in which case the order is descending. + Sorting is stable: elements that compare equal retain their original relative order. +
+sorted([3, 5, 4]) == [3, 4, 5] +sorted([3, 5, 4], reverse = True) == [5, 4, 3] +sorted(["two", "three", "four"], key = len) == ["two", "four", "three"] # sort by length ++ +
| Parameter | +Description | +
|---|---|
+ iterable
+ |
+
+ iterable;
+ required + The iterable sequence to sort. + |
+
+ key
+ |
+
+ callable; or None;
+ default is None+ An optional function applied to each element before comparison. + |
+
+ reverse
+ |
+
+ bool;
+ default is False+ Return results in descending order. + |
+
string str(x)+ + Converts any object to string. This is useful for debugging.
str("ab") == "ab"
+str(8) == "8"
+
+ | Parameter | +Description | +
|---|---|
+ x
+ |
+
+ required + The object to convert. + |
+
tuple tuple(x=())+ + Returns a tuple with the same elements as the given iterable value.
tuple([1, 2]) == (1, 2)
+tuple((2, 3, 2)) == (2, 3, 2)
+tuple({5: "a", 2: "b", 4: "c"}) == (5, 2, 4)
+
+ | Parameter | +Description | +
|---|---|
+ x
+ |
+
+ iterable;
+ default is ()+ The object to convert. + |
+
string type(x)+ + Returns the type name of its argument. This is useful for debugging and type-checking. Examples:
type(2) == "int" +type([1]) == "list" +type(struct(a = 2)) == "struct"This function might change in the future. To write Python-compatible code and be future-proof, use it only to compare return values:
if type(x) == type([]): # if x is a list+ +
| Parameter | +Description | +
|---|---|
+ x
+ |
+
+ required + The object to check type of. + |
+
list zip(*args)+ + Returns a
list of tuples, where the i-th tuple contains the i-th element from each of the argument sequences or iterables. The list has the size of the shortest input. With a single iterable argument, it returns a list of 1-tuples. With no arguments, it returns an empty list. Examples:zip() # == [] +zip([1, 2]) # == [(1,), (2,)] +zip([1, 2], [3, 4]) # == [(1, 3), (2, 4)] +zip([1, 2], [3, 4, 5]) # == [(1, 3), (2, 4)]+ +
| Parameter | +Description | +
|---|---|
+ args
+ |
+
+ required + lists to zip. + |
+
depset depset(direct=None, order="default", *, transitive=None)+ + Creates a depset. The
direct parameter is a list of direct elements of the depset, and transitive parameter is a list of depsets whose elements become indirect elements of the created depset. The order in which elements are returned when the depset is converted to a list is specified by the order parameter. See the Depsets overview for more information.
+All elements (direct and indirect) of a depset must be of the same type, as obtained by the expression type(x).
+
Because a hash-based set is used to eliminate duplicates during iteration, all elements of a depset should be hashable. However, this invariant is not currently checked consistently in all constructors. Use the --incompatible_always_check_depset_elements flag to enable consistent checking; this will be the default behavior in future releases; see Issue 10313. +
In addition, elements must currently be immutable, though this restriction will be relaxed in future. +
The order of the created depset should be compatible with the order of its transitive depsets. "default" order is compatible with any other order, all other orders are only compatible with themselves.
+
+
| Parameter | +Description | +
|---|---|
+ direct
+ |
+
+ sequence; or None;
+ default is None+ A list of direct elements of a depset. + |
+
+ order
+ |
+
+ string;
+ default is "default"+ The traversal strategy for the new depset. See here for the possible values. + |
+
+ transitive
+ |
+
+ sequence of depsets; or None;
+ default is None+ A list of depsets whose elements will become indirect elements of the depset. + |
+
unknown existing_rule(name)+ + Returns an immutable dict-like object that describes the attributes of a rule instantiated in this thread's package, or
None if no rule instance of that name exists.Here, an immutable dict-like object means a deeply immutable object x supporting dict-like iteration, len(x), name in x, x[name], x.get(name), x.items(), x.keys(), and x.values().
The result contains an entry for each attribute, with the exception of private ones (whose names do not start with a letter) and a few unrepresentable legacy attribute types. In addition, the dict contains entries for the rule instance's name and kind (for example, 'cc_binary').
The values of the result represent attribute values as follows:
':foo' for targets in the same package or '//pkg:name' for targets in a different package.select values are returned with their contents transformed as described above.If possible, use this function only in implementation functions of rule finalizer symbolic macros. Use of this function in other contexts is not recommened, and will be disabled in a future Bazel release; it makes BUILD files brittle and order-dependent. Also, beware that it differs subtly from the two other conversions of rule attribute values from internal form to Starlark: one used by computed defaults, the other used by ctx.attr.foo.
+
+
| Parameter | +Description | +
|---|---|
+ name
+ |
+
+ string;
+ required + The name of the target. + |
+
unknown existing_rules()+ + Returns an immutable dict-like object describing the rules so far instantiated in this thread's package. Each entry of the dict-like object maps the name of the rule instance to the result that would be returned by
existing_rule(name).Here, an immutable dict-like object means a deeply immutable object x supporting dict-like iteration, len(x), name in x, x[name], x.get(name), x.items(), x.keys(), and x.values().
If possible, use this function only in implementation functions of rule finalizer symbolic macros. Use of this function in other contexts is not recommened, and will be disabled in a future Bazel release; it makes BUILD files brittle and order-dependent.
+
+
None exports_files(srcs, visibility=None, licenses=None)
+
+ Specifies a list of files belonging to this package that are exported to other packages.
+
+ | Parameter | +Description | +
|---|---|
+ srcs
+ |
+
+ sequence of strings;
+ required + The list of files to export. + |
+
+ visibility
+ |
+
+ sequence; or None;
+ default is None+ A visibility declaration can to be specified. The files will be visible to the targets specified. If no visibility is specified, the files will be visible to every package. + |
+
+ licenses
+ |
+
+ sequence of strings; or None;
+ default is None+ Licenses to be specified. + |
+
sequence glob(include=[], exclude=[], exclude_directories=1, allow_empty=unbound)+ + Glob returns a new, mutable, sorted list of every file in the current package that:
include.exclude (default []).exclude_directories argument is enabled (set to 1), files of type directory will be omitted from the results (default 1).
+
+ | Parameter | +Description | +
|---|---|
+ include
+ |
+
+ sequence of strings;
+ default is []+ The list of glob patterns to include. + |
+
+ exclude
+ |
+
+ sequence of strings;
+ default is []+ The list of glob patterns to exclude. + |
+
+ exclude_directories
+ |
+
+ int;
+ default is 1+ A flag whether to exclude directories or not. + |
+
+ allow_empty
+ |
+
+ default is unbound+ Whether we allow glob patterns to match nothing. If `allow_empty` is False, each individual include pattern must match something and also the final result must be non-empty (after the matches of the `exclude` patterns are excluded). + |
+
string module_name()+ + The name of the Bazel module associated with the repo this package is in. If this package is from a repo defined in WORKSPACE instead of MODULE.bazel, this is empty. For repos generated by module extensions, this is the name of the module hosting the extension. It's the same as the
module.name field seen in module_ctx.modules.
+ May return None.
+
+ string module_version()+ + The version of the Bazel module associated with the repo this package is in. If this package is from a repo defined in WORKSPACE instead of MODULE.bazel, this is empty. For repos generated by module extensions, this is the version of the module hosting the extension. It's the same as the
module.version field seen in module_ctx.modules.
+ May return None.
+
+ unknown package(**kwargs)+ + Declares metadata that applies to every rule in the package. It must be called at most once within a package (BUILD file). If called, it should be the first call in the BUILD file, right after the
load() statements.
+
+ | Parameter | +Description | +
|---|---|
+ kwargs
+ |
+
+ required + See the package() function in the Build Encyclopedia for applicable arguments.
+ |
+
List package_default_visibility()+ + Returns the default visibility of the package being evaluated. This is the value of the
default_visibility parameter of package(), extended to include the package itself.
+
+ None package_group(*, name, packages=[], includes=[])
+
+ This function defines a set of packages and assigns a label to the group. The label can be referenced in visibility attributes.
+
+ | Parameter | +Description | +
|---|---|
+ name
+ |
+
+ string;
+ required + The unique name for this rule. + |
+
+ packages
+ |
+
+ sequence of strings;
+ default is []+ A complete enumeration of packages in this group. + |
+
+ includes
+ |
+
+ sequence of strings;
+ default is []+ Other package groups that are included in this one. + |
+
string package_name()+ + The name of the package being evaluated, without the repository name. For example, in the BUILD file
some/package/BUILD, its value will be some/package. If the BUILD file calls a function defined in a .bzl file, package_name() will match the caller BUILD file package. The value will always be an empty string for the root package.
+
+ Label package_relative_label(input)+ + Converts the input string into a Label object, in the context of the package currently being initialized (that is, the
BUILD file for which the current macro is executing). If the input is already a Label, it is returned unchanged.This function may only be called while evaluating a BUILD file and the macros it directly or indirectly calls; it may not be called in (for instance) a rule implementation function.
The result of this function is the same Label value as would be produced by passing the given string to a label-valued attribute of a target declared in the BUILD file.
Usage note: The difference between this function and Label() is that Label() uses the context of the package of the .bzl file that called it, not the package of the BUILD file. Use Label() when you need to refer to a fixed target that is hardcoded into the macro, such as a compiler. Use package_relative_label() when you need to normalize a label string supplied by the BUILD file to a Label object. (There is no way to convert a string to a Label in the context of a package other than the BUILD file or the calling .bzl file. For that reason, outer macros should always prefer to pass Label objects to inner macros rather than label strings.)
+
+
| Parameter | +Description | +
|---|---|
+ input
+ |
+
+ string; or Label;
+ required + The input label string or Label object. If a Label object is passed, it's returned as is. + |
+
string repo_name()+ + The canonical name of the repository containing the package currently being evaluated, with no leading at-signs. + +
string repository_name()+ + Experimental. This API is experimental and may change at any time. Please do not depend on it. It may be enabled on an experimental basis by setting
--+incompatible_enable_deprecated_label_apis repo_name instead, which doesn't contain the spurious leading at-sign, but behaves identically otherwise.The canonical name of the repository containing the package currently being evaluated, with a single at-sign (@) prefixed. For example, in packages that are called into existence by the WORKSPACE stanza local_repository(name='local', path=...) it will be set to @local. In packages in the main repository, it will be set to @.
+
+
unknown select(x, no_match_error='')+ +
select() is the helper function that makes a rule attribute configurable. See build encyclopedia for details.
+
+ | Parameter | +Description | +
|---|---|
+ x
+ |
+
+ dict;
+ required + A dict that maps configuration conditions to values. Each key is a Label or a label string that identifies a config_setting or constraint_value instance. See the documentation on macros for when to use a Label instead of a string. If --incompatible_resolve_select_keys_eagerly is enabled, the keys are resolved to Label objects relative to the package of the file that contains this call to select.
+ |
+
+ no_match_error
+ |
+
+ string;
+ default is ''+ Optional custom error to report if no condition matches. + |
+
sequence subpackages(*, include, exclude=[], allow_empty=False)+ + Returns a new mutable list of every direct subpackage of the current package, regardless of file-system directory depth. List returned is sorted and contains the names of subpackages relative to the current package. It is advised to prefer using the methods in bazel_skylib.subpackages module rather than calling this function directly. + +
| Parameter | +Description | +
|---|---|
+ include
+ |
+
+ sequence of strings;
+ required + The list of glob patterns to include in subpackages scan. + |
+
+ exclude
+ |
+
+ sequence of strings;
+ default is []+ The list of glob patterns to exclude from subpackages scan. + |
+
+ allow_empty
+ |
+
+ bool;
+ default is False+ Whether we fail if the call returns an empty list. By default empty list indicates potential error in BUILD file where the call to subpackages() is superflous. Setting to true allows this function to succeed in that case. + |
+
transition analysis_test_transition(*, settings)+ +
Creates a configuration transition to be applied on an analysis-test rule's dependencies. This transition may only be applied on attributes of rules with analysis_test = True. Such rules are restricted in capabilities (for example, the size of their dependency tree is limited), so transitions created using this function are limited in potential scope as compared to transitions created using transition().
This function is primarily designed to facilitate the Analysis Test Framework core library. See its documentation (or its implementation) for best practices. + +
| Parameter | +Description | +
|---|---|
+ settings
+ |
+
+ dict;
+ required + A dictionary containing information about configuration settings which should be set by this configuration transition. Keys are build setting labels and values are their new post-transition values. All other settings are unchanged. Use this to declare specific configuration settings that an analysis test requires to be set in order to pass. + |
+
Aspect aspect(implementation, attr_aspects=[], toolchains_aspects=[], attrs={}, required_providers=[], required_aspect_providers=[], provides=[], requires=[], propagation_predicate=None, fragments=[], host_fragments=[], toolchains=[], doc=None, *, apply_to_generating_rules=False, exec_compatible_with=[], exec_groups=None, subrules=[])+ + Creates a new aspect. The result of this function must be stored in a global value. Please see the introduction to Aspects for more details. + +
| Parameter | +Description | +
|---|---|
+ implementation
+ |
+
+ function;
+ required + A Starlark function that implements this aspect, with exactly two parameters: Target (the target to which the aspect is applied) and ctx (the rule context which the target is created from). Attributes of the target are available via the ctx.rule field. This function is evaluated during the analysis phase for each application of an aspect to a target.
+ |
+
+ attr_aspects
+ |
+
+ sequence of strings; or function;
+ default is []+ Accepts a list of attribute names or [Experimental] a function that returns the list of attribute names. The aspect propagates along dependencies specified in the attributes of a target with these names. Common values here include deps and exports. The list can also contain a single string "*" to propagate along all dependencies of a target.
+ |
+
+ toolchains_aspects
+ |
+
+ sequence; or function;
+ default is []+ Accepts a list of toolchain types or [Experimental] a function that returns the list of toolchain types. The aspect propagates to target toolchains which match these toolchain types. + |
+
+ attrs
+ |
+
+ dict;
+ default is {}+ A dictionary declaring all the attributes of the aspect. It maps from an attribute name to an attribute object, like attr.label or attr.string (see attr module). Aspect attributes are available to implementation function as fields of ctx parameter. Implicit attributes starting with Explicit attributes must have type Declared attributes will convert |
+
+ required_providers
+ |
+
+ sequence;
+ default is []+ This attribute allows the aspect to limit its propagation to only the targets whose rules advertise its required providers. The value must be a list containing either individual providers or lists of providers but not both. For example, [[FooInfo], [BarInfo], [BazInfo, QuxInfo]] is a valid value while [FooInfo, BarInfo, [BazInfo, QuxInfo]] is not valid.An unnested list of providers will automatically be converted to a list containing one list of providers. That is, To make some rule (e.g. |
+
+ required_aspect_providers
+ |
+
+ sequence;
+ default is []+ This attribute allows this aspect to inspect other aspects. The value must be a list containing either individual providers or lists of providers but not both. For example, [[FooInfo], [BarInfo], [BazInfo, QuxInfo]] is a valid value while [FooInfo, BarInfo, [BazInfo, QuxInfo]] is not valid.An unnested list of providers will automatically be converted to a list containing one list of providers. That is, To make another aspect (e.g. |
+
+ provides
+ |
+
+ sequence;
+ default is []+ A list of providers that the implementation function must return. It is an error if the implementation function omits any of the types of providers listed here from its return value. However, the implementation function may return additional providers not listed here. Each element of the list is an |
+
+ requires
+ |
+
+ sequence of Aspects;
+ default is []+ List of aspects required to be propagated before this aspect. + |
+
+ propagation_predicate
+ |
+
+ function; or None;
+ default is None+ Experimental: a function that returns a boolean value indicating whether the aspect should be propagated to a target. + |
+
+ fragments
+ |
+
+ sequence of strings;
+ default is []+ List of names of configuration fragments that the aspect requires in target configuration. + |
+
+ host_fragments
+ |
+
+ sequence of strings;
+ default is []+ List of names of configuration fragments that the aspect requires in host configuration. + |
+
+ toolchains
+ |
+
+ sequence;
+ default is []+ If set, the set of toolchains this aspect requires. The list can contain String, Label, or StarlarkToolchainTypeApi objects, in any combination. Toolchains will be found by checking the current platform, and provided to the aspect implementation via ctx.toolchain.
+ |
+
+ doc
+ |
+
+ string; or None;
+ default is None+ A description of the aspect that can be extracted by documentation generating tools. + |
+
+ apply_to_generating_rules
+ |
+
+ bool;
+ default is False+ If true, the aspect will, when applied to an output file, instead apply to the output file's generating rule. For example, suppose an aspect propagates transitively through attribute `deps` and it is applied to target `alpha`. Suppose `alpha` has `deps = [':beta_output']`, where `beta_output` is a declared output of a target `beta`. Suppose `beta` has a target `charlie` as one of its `deps`. If `apply_to_generating_rules=True` for the aspect, then the aspect will propagate through `alpha`, `beta`, and `charlie`. If False, then the aspect will propagate only to `alpha`. False by default. + |
+
+ exec_compatible_with
+ |
+
+ sequence of strings;
+ default is []+ A list of constraints on the execution platform that apply to all instances of this aspect. + |
+
+ exec_groups
+ |
+
+ dict; or None;
+ default is None+ Dict of execution group name (string) to exec_groups. If set, allows aspects to run actions on multiple execution platforms within a single instance. See execution groups documentation for more info.
+ |
+
+ subrules
+ |
+
+ sequence of Subrules;
+ default is []+ Experimental: list of subrules used by this aspect. + |
+
LateBoundDefault configuration_field(fragment, name)+ + References a late-bound default value for an attribute of type label. A value is 'late-bound' if it requires the configuration to be built before determining the value. Any attribute using this as a value must be private.
Example usage:
Defining a rule attribute:
'_foo': attr.label(default=configuration_field(fragment='java', name='toolchain'))
Accessing in rule implementation:
def _rule_impl(ctx): + foo_info = ctx.attr._foo + ...+ +
| Parameter | +Description | +
|---|---|
+ fragment
+ |
+
+ string;
+ required + The name of a configuration fragment which contains the late-bound value. + |
+
+ name
+ |
+
+ string;
+ required + The name of the value to obtain from the configuration fragment. + |
+
depset depset(direct=None, order="default", *, transitive=None)+ + Creates a depset. The
direct parameter is a list of direct elements of the depset, and transitive parameter is a list of depsets whose elements become indirect elements of the created depset. The order in which elements are returned when the depset is converted to a list is specified by the order parameter. See the Depsets overview for more information.
+All elements (direct and indirect) of a depset must be of the same type, as obtained by the expression type(x).
+
Because a hash-based set is used to eliminate duplicates during iteration, all elements of a depset should be hashable. However, this invariant is not currently checked consistently in all constructors. Use the --incompatible_always_check_depset_elements flag to enable consistent checking; this will be the default behavior in future releases; see Issue 10313. +
In addition, elements must currently be immutable, though this restriction will be relaxed in future. +
The order of the created depset should be compatible with the order of its transitive depsets. "default" order is compatible with any other order, all other orders are only compatible with themselves.
+
+
| Parameter | +Description | +
|---|---|
+ direct
+ |
+
+ sequence; or None;
+ default is None+ A list of direct elements of a depset. + |
+
+ order
+ |
+
+ string;
+ default is "default"+ The traversal strategy for the new depset. See here for the possible values. + |
+
+ transitive
+ |
+
+ sequence of depsets; or None;
+ default is None+ A list of depsets whose elements will become indirect elements of the depset. + |
+
exec_group exec_group(*, toolchains=[], exec_compatible_with=[])+ + Creates an execution group which can be used to create actions for a specific execution platform during rule implementation. + +
| Parameter | +Description | +
|---|---|
+ toolchains
+ |
+
+ sequence;
+ default is []+ The set of toolchains this execution group requires. The list can contain String, Label, or StarlarkToolchainTypeApi objects, in any combination. + |
+
+ exec_compatible_with
+ |
+
+ sequence of strings;
+ default is []+ A list of constraints on the execution platform. + |
+
transition exec_transition(*, implementation, inputs, outputs)+ + A specialized version of
transition() used to define the exec transition. See its documentation (or its implementation) for best practices. Only usable from the Bazel builtins.
+
+ | Parameter | +Description | +
|---|---|
+ implementation
+ |
+
+ callable;
+ required + + |
+
+ inputs
+ |
+
+ sequence of strings;
+ required + + |
+
+ outputs
+ |
+
+ sequence of strings;
+ required + + |
+
macro macro(*, implementation, attrs={}, inherit_attrs=None, finalizer=False, doc=None)+ + Defines a symbolic macro, which may be called in
BUILD files or macros (legacy or
+symbolic) to define targets – possibly multiple ones.
+
+The value returned by macro(...) must be assigned to a global variable in a .bzl
+file; the name of the global variable will be the macro symbol's name.
+
+
See Macros for a comprehensive guide on how to use symbolic +macros. + + +
| Parameter | +Description | +
|---|---|
+ implementation
+ |
+
+ function;
+ required + The Starlark function implementing this macro. The values of the macro's attributes are passed to +the implementation function as keyword arguments. The implementation function must have at least two +named parameters, name and visibility, and if the macro inherits
+attributes (see inherit_attrs below), it must have a **kwargs residual
+keyword parameter.
+
+By convention, the implementation function should have a named parameter for any attribute that
+the macro needs to examine, modify, or pass to non-"main" targets, while the "bulk" inherited
+attributes which will be passed to the "main" target unchanged are passed as The implementation function must not return a value. Instead, the implementation function +declares targets by calling rule or macro symbols. + + The name of any target or inner symbolic macro declared by a symbolic macro (including by any
+Starlark function that the macro's implementation function transitively calls) must either equal
+ By default, targets declared by a symbolic macro (including by any Starlark function that the
+macro's implementation function transitively calls) are visible only in the package containing the
+.bzl file defining the macro. To declare targets visible externally, including to the caller of
+the symbolic macro, the implementation function must set The following APIs are unavailable within a macro implementation function and any Starlark +function it transitively calls: +
|
+
+ attrs
+ |
+
+ dict;
+ default is {}+ A dictionary of the attributes this macro supports, analogous to +rule.attrs. Keys are attribute names, and values are either attribute +objects like attr.label_list(...) (see the attr
+module), or None. A None entry means that the macro does not have an
+attribute by that name, even if it would have otherwise inherited one via inherit_attrs
+(see below).
+
+The special Attributes whose names start with To limit memory usage, there is a cap on the number of attributes that may be declared. + + |
+
+ inherit_attrs
+ |
+
+ rule; or macro; or string; or None;
+ default is None+ A rule symbol, macro symbol, or the name of a built-in common attribute list (see below) from which +the macro should inherit attributes. + + If Note that if the return value of The inheritance mechanism works as follows: +
When a non-mandatory attribute is inherited, the default value of the attribute is overridden
+to be For example, the following macro inherits all attributes from
+def _my_cc_library_impl(name, visibility, tags, **kwargs):
+ # Append a tag; tags attr was inherited from native.cc_library, and
+ # therefore is None unless explicitly set by the caller of my_cc_library()
+ my_tags = (tags or []) + ["my_custom_tag"]
+ native.cc_library(
+ name = name,
+ visibility = visibility,
+ tags = my_tags,
+ **kwargs
+ )
+
+my_cc_library = macro(
+ implementation = _my_cc_library_impl,
+ inherit_attrs = native.cc_library,
+ attrs = {
+ "cxxopts": None,
+ "copts": attr.string_list(default = ["-D_FOO"]),
+ },
+)
+
+
+If By convention, a macro should pass inherited, non-overridden attributes unchanged to the "main"
+rule or macro symbol which the macro is wrapping. Typically, most inherited attributes will not have
+a parameter in the implementation function's parameter list, and will simply be passed via
+ |
+
+ finalizer
+ |
+
+ bool;
+ default is False+ Whether this macro is a rule finalizer, which is a macro that, regardless of its position in a + BUILD file, is evaluated at the end of package loading, after all non-finalizer targets
+have been defined.
+
+Unlike ordinary symbolic macros, rule finalizers may call
+ |
+
+ doc
+ |
+
+ string; or None;
+ default is None+ A description of the macro that can be extracted by documentation generating tools. + |
+
callable materializer_rule(*, implementation, attrs={}, doc=None)
+
+ Creates a new materializer rule, which can be called from a BUILD file or a macro to create materializer targets.Materializer targets are used to dynamically select dependencies at analysis time. Targets which depend on a materializer target will see the materialized dependencies, rather than the materializer target itself. + +
| Parameter | +Description | +
|---|---|
+ implementation
+ |
+
+ function;
+ required + The Starlark function implementing this materializer rule. It must have exactly one parameter: ctx. This function is called during the analysis phase for each instance of the rule. Materializer rules return exactly one and only one MaterializedDepsInfo provider which specifies the dependencies to materialize in place of any instance of this rule in the attributes of another target. + |
+
+ attrs
+ |
+
+ dict;
+ default is {}+ A dictionary to declare all the attributes of the rule. It maps from an attribute name to an attribute object (see + attr module). Attributes starting with _ are private, and can be used to add an implicit dependency on a label. The attribute name is implicitly added and must not be specified. Attributes visibility, deprecation, tags, testonly, and features are implicitly added and cannot be overridden. Most rules need only a handful of attributes. To limit memory usage, there is a cap on the number of attributes that may be declared.
+Declared attributes will convert |
+
+ doc
+ |
+
+ string; or None;
+ default is None+ A description of the rule that can be extracted by documentation generating tools. + |
+
unknown module_extension(implementation, *, tag_classes={}, doc=None, environ=[], os_dependent=False, arch_dependent=False)
+
+ Creates a new module extension. Store it in a global value, so that it can be exported and used in a MODULE.bazel file with use_extension.
+
+ | Parameter | +Description | +
|---|---|
+ implementation
+ |
+
+ callable;
+ required + The function that implements this module extension. Must take a single parameter, module_ctx. The function is called once at the beginning of a build to determine the set of available repos.
+ |
+
+ tag_classes
+ |
+
+ dict;
+ default is {}+ A dictionary to declare all the tag classes used by the extension. It maps from the name of the tag class to a tag_class object.
+ |
+
+ doc
+ |
+
+ string; or None;
+ default is None+ A description of the module extension that can be extracted by documentation generating tools. + |
+
+ environ
+ |
+
+ sequence of strings;
+ default is []+ Provides a list of environment variable that this module extension depends on. If an environment variable in that list changes, the extension will be re-evaluated. + |
+
+ os_dependent
+ |
+
+ bool;
+ default is False+ Indicates whether this extension is OS-dependent or not + |
+
+ arch_dependent
+ |
+
+ bool;
+ default is False+ Indicates whether this extension is architecture-dependent or not + |
+
unknown provider(doc=None, *, fields=None, init=None)+ + Defines a provider symbol. The resulting value of this function must be stored in a global value to be usable in a rule or aspect implementation. Providers can be instantiated by calling the resulting value as a function, or used directly as an index key for retrieving an instance of that provider from a target. Example:
MyInfo = provider() +... +def _my_library_impl(ctx): + ... + my_info = MyInfo(x = 2, y = 3) + # my_info.x == 2 + # my_info.y == 3 + ...
See Rules (Providers) for a comprehensive guide on how to use providers.
Returns a Provider callable value if init is not specified.
If init is specified, returns a tuple of 2 elements: a Provider callable value and a raw constructor callable value. See Rules (Custom initialization of custom providers) and the discussion of the init parameter below for details.
+
+
| Parameter | +Description | +
|---|---|
+ doc
+ |
+
+ string; or None;
+ default is None+ A description of the provider that can be extracted by documentation generating tools. + |
+
+ fields
+ |
+
+ sequence of strings; or dict; or None;
+ default is None+ If specified, restricts the set of allowed fields. Possible values are:
|
+
+ init
+ |
+
+ callable; or None;
+ default is None+ An optional callback for preprocessing and validating the provider's field values during instantiation. If init is specified, provider() returns a tuple of 2 elements: the normal provider symbol and a raw constructor.A precise description follows; see Rules (Custom initialization of providers) for an intuitive discussion and use cases. Let
init callback is not given, a call to the symbol P itself acts as a call to the default constructor function c; in other words, P(*args, **kwargs) returns c(*args, **kwargs). For example,MyInfo = provider() +m = MyInfo(foo = 1)will straightforwardly make it so that m is a MyInfo instance with m.foo == 1.But in the case where
NB: the above steps imply that an error occurs if In this way, the When MyInfo, _new_myinfo = provider(init = ...)+ |
+
callable repository_rule(implementation, *, attrs=None, local=False, environ=[], configure=False, remotable=False, doc=None)+ + Creates a new repository rule. Store it in a global value, so that it can be loaded and called from a
module_extension() implementation function, or used by use_repo_rule().
+
+
+ | Parameter | +Description | +
|---|---|
+ implementation
+ |
+
+ callable;
+ required + the function that implements this rule. Must have a single parameter, repository_ctx. The function is called during the loading phase for each instance of the rule.
+ |
+
+ attrs
+ |
+
+ dict; or None;
+ default is None+ A dictionary to declare all the attributes of the repository rule. It maps from an attribute name to an attribute object (see + attr module). Attributes starting with _ are private, and can be used to add an implicit dependency on a label to a file (a repository rule cannot depend on a generated artifact). The attribute name is implicitly added and must not be specified.
+Declared attributes will convert |
+
+ local
+ |
+
+ bool;
+ default is False+ Indicate that this rule fetches everything from the local system and should be reevaluated at every fetch. + |
+
+ environ
+ |
+
+ sequence of strings;
+ default is []+ Deprecated. This parameter has been deprecated. Migrate to repository_ctx.getenv instead.Provides a list of environment variable that this repository rule depends on. If an environment variable in that list change, the repository will be refetched. + |
+
+ configure
+ |
+
+ bool;
+ default is False+ Indicate that the repository inspects the system for configuration purpose + |
+
+ remotable
+ |
+
+ bool;
+ default is False+ Experimental. This parameter is experimental and may change at any time. Please do not depend on it. It may be enabled on an experimental basis by setting --experimental_repo_remote_exec Compatible with remote execution + |
+
+ doc
+ |
+
+ string; or None;
+ default is None+ A description of the repository rule that can be extracted by documentation generating tools. + |
+
callable rule(implementation, *, test=unbound, attrs={}, outputs=None, executable=unbound, output_to_genfiles=False, fragments=[], host_fragments=[], _skylark_testable=False, toolchains=[], doc=None, provides=[], dependency_resolution_rule=False, exec_compatible_with=[], analysis_test=False, build_setting=None, cfg=None, exec_groups=None, initializer=None, parent=None, extendable=None, subrules=[])
+
+ Creates a new rule, which can be called from a BUILD file or a macro to create targets.Rules must be assigned to global variables in a .bzl file; the name of the global variable is the rule's name.
Test rules are required to have a name ending in _test, while all other rules must not have this suffix. (This restriction applies only to rules, not to their targets.)
+
+
| Parameter | +Description | +
|---|---|
+ implementation
+ |
+
+ function;
+ required + the Starlark function implementing this rule, must have exactly one parameter: ctx. The function is called during the analysis phase for each instance of the rule. It can access the attributes provided by the user. It must create actions to generate all the declared outputs. + |
+
+ test
+ |
+
+ bool;
+ default is unbound+ Whether this rule is a test rule, that is, whether it may be the subject of a bazel test command. All test rules are automatically considered executable; it is unnecessary (and discouraged) to explicitly set executable = True for a test rule. The value defaults to False. See the Rules page for more information.
+ |
+
+ attrs
+ |
+
+ dict;
+ default is {}+ A dictionary to declare all the attributes of the rule. It maps from an attribute name to an attribute object (see + attr module). Attributes starting with _ are private, and can be used to add an implicit dependency on a label. The attribute name is implicitly added and must not be specified. Attributes visibility, deprecation, tags, testonly, and features are implicitly added and cannot be overridden. Most rules need only a handful of attributes. To limit memory usage, there is a cap on the number of attributes that may be declared.
+Declared attributes will convert |
+
+ outputs
+ |
+
+ dict; or None; or function;
+ default is None+ Deprecated. This parameter is deprecated and will be removed soon. Please do not depend on it. It is disabled with --incompatible_no_rule_outputs_param. Use this flag to verify your code is compatible with its imminent removal. This parameter has been deprecated. Migrate rules to use OutputGroupInfo or attr.output instead. A schema for defining predeclared outputs. Unlike The value of this argument is either a dictionary or a callback function that produces a dictionary. The callback works similar to computed dependency attributes: The function's parameter names are matched against the rule's attributes, so for example if you pass Each entry in the dictionary creates a predeclared output where the key is an identifier and the value is a string template that determines the output's label. In the rule's implementation function, the identifier becomes the field name used to access the output's
In practice, the most common substitution placeholder is |
+
+ executable
+ |
+
+ bool;
+ default is unbound+ Whether this rule is considered executable, that is, whether it may be the subject of a bazel run command. It defaults to False. See the Rules page for more information.
+ |
+
+ output_to_genfiles
+ |
+
+ bool;
+ default is False+ If true, the files will be generated in the genfiles directory instead of the bin directory. Unless you need it for compatibility with existing rules (e.g. when generating header files for C++), do not set this flag. + |
+
+ fragments
+ |
+
+ sequence of strings;
+ default is []+ List of names of configuration fragments that the rule requires in target configuration. + |
+
+ host_fragments
+ |
+
+ sequence of strings;
+ default is []+ List of names of configuration fragments that the rule requires in host configuration. + |
+
+ _skylark_testable
+ |
+
+ bool;
+ default is False+ (Experimental) If true, this rule will expose its actions for inspection by rules that depend on it via an Actions provider. The provider is also available to the rule itself by calling ctx.created_actions().This should only be used for testing the analysis-time behavior of Starlark rules. This flag may be removed in the future. + |
+
+ toolchains
+ |
+
+ sequence;
+ default is []+ If set, the set of toolchains this rule requires. The list can contain String, Label, or StarlarkToolchainTypeApi objects, in any combination. Toolchains will be found by checking the current platform, and provided to the rule implementation via ctx.toolchain.
+ |
+
+ doc
+ |
+
+ string; or None;
+ default is None+ A description of the rule that can be extracted by documentation generating tools. + |
+
+ provides
+ |
+
+ sequence;
+ default is []+ A list of providers that the implementation function must return. It is an error if the implementation function omits any of the types of providers listed here from its return value. However, the implementation function may return additional providers not listed here. Each element of the list is an |
+
+ dependency_resolution_rule
+ |
+
+ bool;
+ default is False+ If set, the rule can be a dependency through attributes also marked as available in materializers. Every attribute of rules with this flag set must be marked as available in materializers also. This is so that rules so marked cannot depend on rules that are not so marked. + |
+
+ exec_compatible_with
+ |
+
+ sequence of strings;
+ default is []+ A list of constraints on the execution platform that apply to all targets of this rule type. + |
+
+ analysis_test
+ |
+
+ bool;
+ default is False+ If true, then this rule is treated as an analysis test. Note: Analysis test rules are primarily defined using infrastructure provided in core Starlark libraries. See Testing for guidance. If a rule is defined as an analysis test rule, it becomes allowed to use configuration transitions defined using analysis_test_transition on its attributes, but opts into some restrictions:
|
+
+ build_setting
+ |
+
+ BuildSetting; or None;
+ default is None+ If set, describes what kind of build setting this rule is. See the config module. If this is set, a mandatory attribute named "build_setting_default" is automatically added to this rule, with a type corresponding to the value passed in here.
+ |
+
+ cfg
+ |
+
+ default is None+ If set, points to the configuration transition the rule will apply to its own configuration before analysis. + |
+
+ exec_groups
+ |
+
+ dict; or None;
+ default is None+ Dict of execution group name (string) to exec_groups. If set, allows rules to run actions on multiple execution platforms within a single target. See execution groups documentation for more info.
+ |
+
+ initializer
+ |
+
+ default is None+ Experimental: the Stalark function initializing the attributes of the rule. The function is called at load time for each instance of the rule. It's called with It has to return a dictionary from the attribute names to the desired values. The attributes that are not returned are unaffected. Returning Initializers are evaluated before the default values specified in an attribute definition. Consequently, if a parameter in the initializer's signature contains a default values, it overwrites the default from the attribute definition (except if returning Similarly, if a parameter in the initializer's signature doesn't have a default, the parameter will become mandatory. It's a good practice to omit default/mandatory settings on an attribute definition in such cases. It's a good practice to use In case of extended rules, all initializers are called proceeding from child to ancestors. Each initializer is passed only the public attributes it knows about. + |
+
+ parent
+ |
+
+ default is None+ Experimental: the Stalark rule that is extended. When set the public attributes are merged as well as advertised providers. The rule matches executable and test from the parent. Values of fragments, toolchains, exec_compatible_with, and exec_groups are merged. Legacy or deprecated parameters may not be set. Incoming configuration transition cfg of parent is applied after thisrule's incoming configuration.
+ |
+
+ extendable
+ |
+
+ bool; or Label; or string; or None;
+ default is None+ Experimental: A label of an allowlist defining which rules can extending this rule. It can be set also to True/False to always allow/disallow extending. Bazel defaults to always allowing extensions. + |
+
+ subrules
+ |
+
+ sequence of Subrules;
+ default is []+ Experimental: List of subrules used by this rule. + |
+
unknown select(x, no_match_error='')+ +
select() is the helper function that makes a rule attribute configurable. See build encyclopedia for details.
+
+ | Parameter | +Description | +
|---|---|
+ x
+ |
+
+ dict;
+ required + A dict that maps configuration conditions to values. Each key is a Label or a label string that identifies a config_setting or constraint_value instance. See the documentation on macros for when to use a Label instead of a string. If --incompatible_resolve_select_keys_eagerly is enabled, the keys are resolved to Label objects relative to the package of the file that contains this call to select.
+ |
+
+ no_match_error
+ |
+
+ string;
+ default is ''+ Optional custom error to report if no condition matches. + |
+
Subrule subrule(*, implementation, attrs={}, toolchains=[], fragments=[], subrules=[])+ + Constructs a new instance of a subrule. The result of this function must be stored in a global variable before it can be used. + +
| Parameter | +Description | +
|---|---|
+ implementation
+ |
+
+ function;
+ required + The Starlark function implementing this subrule + |
+
+ attrs
+ |
+
+ dict;
+ default is {}+ A dictionary to declare all the (private) attributes of the subrule. Subrules may only have private attributes that are label-typed (i.e. label or label-list). The resolved values corresponding to these labels are automatically passed by Bazel to the subrule's implementation function as named arguments (thus the implementation function is required to accept named parameters matching the attribute names). The types of these values will be:
|
+
+ toolchains
+ |
+
+ sequence;
+ default is []+ If set, the set of toolchains this subrule requires. The list can contain String, Label, or StarlarkToolchainTypeApi objects, in any combination. Toolchains will be found by checking the current platform, and provided to the subrule implementation via ctx.toolchains. Note that AEGs need to be enabled on the consuming rule(s) if this parameter is set. In case you haven't migrated to AEGs yet, see https://bazel.build/extending/auto-exec-groups#migration-aegs.
+ |
+
+ fragments
+ |
+
+ sequence of strings;
+ default is []+ List of names of configuration fragments that the subrule requires in target configuration. + |
+
+ subrules
+ |
+
+ sequence of Subrules;
+ default is []+ List of other subrules needed by this subrule. + |
+
tag_class tag_class(attrs={}, *, doc=None)+ + Creates a new tag_class object, which defines an attribute schema for a class of tags, which are data objects usable by a module extension. + +
| Parameter | +Description | +
|---|---|
+ attrs
+ |
+
+ dict;
+ default is {}+ A dictionary to declare all the attributes of this tag class. It maps from an attribute name to an attribute object (see +attr module). + Note that unlike |
+
+ doc
+ |
+
+ string; or None;
+ default is None+ A description of the tag class that can be extracted by documentation generating tools. + |
+
None visibility(value)
+
+ Sets the load visibility of the .bzl module currently being initialized.
The load visibility of a module governs whether or not other BUILD and .bzl files may load it. (This is distinct from the target visibility of the underlying .bzl source file, which governs whether the file may appear as a dependency of other targets.) Load visibility works at the level of packages: To load a module the file doing the loading must live in a package that has been granted visibility to the module. A module can always be loaded within its own package, regardless of its visibility.
visibility() may only be called once per .bzl file, and only at the top level, not inside a function. The preferred style is to put this call immediately below the load() statements and any brief logic needed to determine the argument.
If the flag --check_bzl_visibility is set to false, load visibility violations will emit warnings but not fail the build.
+
+
| Parameter | +Description | +
|---|---|
+ value
+ |
+
+ required + A list of package specification strings, or a single package specification string. Package specifications follow the same format as for
The "@" syntax is not allowed; all specifications are interpreted relative to the current module's repository. If Note that the flags |
+
None archive_override(*, module_name, **kwargs)
+
+ Specifies that this dependency should come from an archive file (zip, gzip, etc) at a
+certain location, instead of from a registry. Effectively, this dependency will be
+backed by an http_archive rule.
+
+This directive only takes effect in the root module; in other words, if a module is +used as a dependency by others, its own overrides are ignored. + +
| Parameter | +Description | +
|---|---|
+ module_name
+ |
+
+ string;
+ required + The name of the Bazel module dependency to apply this override to. + |
+
+ kwargs
+ |
+
+ required + All other arguments are forwarded to the underlying http_archive repo
+rule. Note that the name attribute shouldn't be specified; use
+module_name instead.
+ |
+
None bazel_dep(*, name, version='', max_compatibility_level=-1, repo_name='', dev_dependency=False)
+
+ Declares a direct dependency on another Bazel module.
+
+ | Parameter | +Description | +
|---|---|
+ name
+ |
+
+ string;
+ required + The name of the module to be added as a direct dependency. + |
+
+ version
+ |
+
+ string;
+ default is ''+ The version of the module to be added as a direct dependency. + |
+
+ max_compatibility_level
+ |
+
+ int;
+ default is -1+ The maximum compatibility_level supported for the module to be added as a direct dependency. The version of the module implies the minimum compatibility_level supported, as well as the maximum if this attribute is not specified.
+ |
+
+ repo_name
+ |
+
+ string; or None;
+ default is ''+ The name of the external repo representing this dependency. This is by default the +name of the module. Can be set to None to make this dependency a
+"nodep" dependency: in this case, this bazel_dep specification
+is only honored if the target module already exists in the dependency graph by some
+other means.
+
+ |
+
+ dev_dependency
+ |
+
+ bool;
+ default is False+ If true, this dependency will be ignored if the current module is not the root module or --ignore_dev_dependency is enabled.
+ |
+
None flag_alias(name, starlark_flag)
+
+ Maps a command-line flag --foo to a Starlark flag --@repo//defs:foo. Bazel translates all
+ instances of $ bazel build //target --foo to $ bazel build //target --@repo//defs:foo.
+
+
+ | Parameter | +Description | +
|---|---|
+ name
+ |
+
+ string;
+ required + The name of the flag. + |
+
+ starlark_flag
+ |
+
+ string;
+ required + The label of the Starlark flag to alias to. + |
+
None git_override(*, module_name, **kwargs)
+
+ Specifies that this dependency should come from a certain commit in a Git repository,
+instead of from a registry. Effectively, this dependency will be backed by a
+git_repository rule.
+
+This directive only takes effect in the root module; in other words, if a module is +used as a dependency by others, its own overrides are ignored. + +
| Parameter | +Description | +
|---|---|
+ module_name
+ |
+
+ string;
+ required + The name of the Bazel module dependency to apply this override to. + |
+
+ kwargs
+ |
+
+ required + All other arguments are forwarded to the underlying git_repository
+repo rule. Note that the name attribute shouldn't be specified; use
+module_name instead.
+ |
+
None include(label)
+
+ Includes the contents of another MODULE.bazel-like file. Effectively, include() behaves as if the included file is textually placed at the location of the include() call, except that variable bindings (such as those used for use_extension) are only ever visible in the file they occur in, not in any included or including files.Only the root module may use include(); it is an error if a bazel_dep's MODULE file uses include().
Only files in the main repo may be included.
include() allows you to segment the root module file into multiple parts, to avoid having an enormous MODULE.bazel file or to better manage access control for individual semantic segments.
+
+
| Parameter | +Description | +
|---|---|
+ label
+ |
+
+ string;
+ required + The label pointing to the file to include. The label must point to a file in the main repo; in other words, it must start with double slashes ( //). The name of the file must end with .MODULE.bazel and must not start with ..
+ |
+
None inject_repo(extension_proxy, *args, **kwargs)
+
+ Injects one or more new repos into the given module extension.
+This is ignored if the current module is not the root module or
+--ignore_dev_dependency is enabled.
+
+Use override_repo instead to override an
+existing repo.
+
+
| Parameter | +Description | +
|---|---|
+ extension_proxy
+ |
+
+ module_extension_proxy;
+ required + A module extension proxy object returned by a use_extension call.
+ |
+
+ args
+ |
+
+ required + The repos visible to the current module that should be injected into the +extension under the same name. + |
+
+ kwargs
+ |
+
+ required + The new repos to inject into the extension, where the values are the names of +repos in the scope of the current module and the keys are the name they will be +visible under in the extension. + Keys that are not valid identifiers can be specified via a literal dict
+passed as extra keyword arguments, e.g.,
+ |
+
None local_path_override(*, module_name, path)
+
+ Specifies that this dependency should come from a certain directory on local disk,
+instead of from a registry. Effectively, this dependency will be backed by a
+local_repository rule.
+
+This directive only takes effect in the root module; in other words, if a module is +used as a dependency by others, its own overrides are ignored. + +
| Parameter | +Description | +
|---|---|
+ module_name
+ |
+
+ string;
+ required + The name of the Bazel module dependency to apply this override to. + |
+
+ path
+ |
+
+ string;
+ required + The path to the directory where this module is. + |
+
None module(*, name='', version='', compatibility_level=0, repo_name='', bazel_compatibility=[])
+
+ Declares certain properties of the Bazel module represented by the current Bazel repo. These properties are either essential metadata of the module (such as the name and version), or affect behavior of the current module and its dependents. It should be called at most once, and if called, it must be the very first directive in the MODULE.bazel file. It can be omitted only if this module is the root module (as in, if it's not going to be depended on by another module). + +
| Parameter | +Description | +
|---|---|
+ name
+ |
+
+ string;
+ default is ''+ The name of the module. Can be omitted only if this module is the root module (as in, if it's not going to be depended on by another module). A valid module name must: 1) only contain lowercase letters (a-z), digits (0-9), dots (.), hyphens (-), and underscores (_); 2) begin with a lowercase letter; 3) end with a lowercase letter or digit. + |
+
+ version
+ |
+
+ string;
+ default is ''+ The version of the module. Can be omitted only if this module is the root module (as in, if it's not going to be depended on by another module). The version must be in a relaxed SemVer format; see the documentation for more details. + |
+
+ compatibility_level
+ |
+
+ int;
+ default is 0+ The compatibility level of the module; this should be changed every time a major incompatible change is introduced. This is essentially the "major version" of the module in terms of SemVer, except that it's not embedded in the version string itself, but exists as a separate field. Modules with different compatibility levels participate in version resolution as if they're modules with different names, but the final dependency graph cannot contain multiple modules with the same name but different compatibility levels (unless multiple_version_override is in effect). See the documentation for more details.
+ |
+
+ repo_name
+ |
+
+ string;
+ default is ''+ The name of the repository representing this module, as seen by the module itself. By default, the name of the repo is the name of the module. This can be specified to ease migration for projects that have been using a repo name for itself that differs from its module name. + |
+
+ bazel_compatibility
+ |
+
+ Iterable of strings;
+ default is []+ A list of bazel versions that allows users to declare which Bazel versions are compatible with this module. It does NOT affect dependency resolution, but bzlmod will use this information to check if your current Bazel version is compatible. The format of this value is a string of some constraint values separated by comma. Three constraints are supported: <=X.X.X: The Bazel version must be equal or older than X.X.X. Used when there is a known incompatible change in a newer version. >=X.X.X: The Bazel version must be equal or newer than X.X.X.Used when you depend on some features that are only available since X.X.X. -X.X.X: The Bazel version X.X.X is not compatible. Used when there is a bug in X.X.X that breaks you, but fixed in later versions. + |
+
None multiple_version_override(*, module_name, versions, registry='')
+
+ Specifies that a dependency should still come from a registry, but multiple versions of it should be allowed to coexist. See the documentation for more details. This directive only takes effect in the root module; in other words, if a module is used as a dependency by others, its own overrides are ignored.
+
+ | Parameter | +Description | +
|---|---|
+ module_name
+ |
+
+ string;
+ required + The name of the Bazel module dependency to apply this override to. + |
+
+ versions
+ |
+
+ Iterable of strings;
+ required + Explicitly specifies the versions allowed to coexist. These versions must already be present in the dependency graph pre-selection. Dependencies on this module will be "upgraded" to the nearest higher allowed version at the same compatibility level, whereas dependencies that have a higher version than any allowed versions at the same compatibility level will cause an error. + |
+
+ registry
+ |
+
+ string;
+ default is ''+ Overrides the registry for this module; instead of finding this module from the default list of registries, the given registry should be used. + |
+
None override_repo(extension_proxy, *args, **kwargs)
+
+ Overrides one or more repos defined by the given module extension with the given repos
+visible to the current module. This is ignored if the current module is not the root
+module or `--ignore_dev_dependency` is enabled.
+
+Use inject_repo instead to add a new repo.
+
+
+
| Parameter | +Description | +
|---|---|
+ extension_proxy
+ |
+
+ module_extension_proxy;
+ required + A module extension proxy object returned by a use_extension call.
+ |
+
+ args
+ |
+
+ required + The repos in the extension that should be overridden with the repos of the same +name in the current module. + |
+
+ kwargs
+ |
+
+ required + The overrides to apply to the repos generated by the extension, where the values +are the names of repos in the scope of the current module and the keys are the +names of the repos they will override in the extension. + Keys that are not valid identifiers can be specified via a literal dict
+passed as extra keyword arguments, e.g.,
+ |
+
None register_execution_platforms(*platform_labels, dev_dependency=False)
+
+ Specifies already-defined execution platforms to be registered when this module is selected. Should be absolute target patterns (ie. beginning with either @ or //). See toolchain resolution for more information. Patterns that expand to multiple targets, such as :all, will be registered in lexicographical order by name.
+
+ | Parameter | +Description | +
|---|---|
+ dev_dependency
+ |
+
+ bool;
+ default is False+ If true, the execution platforms will not be registered if the current module is not the root module or `--ignore_dev_dependency` is enabled. + |
+
+ platform_labels
+ |
+
+ sequence of strings;
+ required + The target patterns to register. + |
+
None register_toolchains(*toolchain_labels, dev_dependency=False)
+
+ Specifies already-defined toolchains to be registered when this module is selected. Should be absolute target patterns (ie. beginning with either @ or //). See toolchain resolution for more information. Patterns that expand to multiple targets, such as :all, will be registered in lexicographical order by target name (not the name of the toolchain implementation).
+
+ | Parameter | +Description | +
|---|---|
+ dev_dependency
+ |
+
+ bool;
+ default is False+ If true, the toolchains will not be registered if the current module is not the root module or `--ignore_dev_dependency` is enabled. + |
+
+ toolchain_labels
+ |
+
+ sequence of strings;
+ required + The target patterns to register. + |
+
None single_version_override(*, module_name, version='', registry='', patches=[], patch_cmds=[], patch_strip=0)
+
+ Specifies that a dependency should still come from a registry, but its version should be pinned, or its registry overridden, or a list of patches applied. This directive only takes effect in the root module; in other words, if a module is used as a dependency by others, its own overrides are ignored.
+
+ | Parameter | +Description | +
|---|---|
+ module_name
+ |
+
+ string;
+ required + The name of the Bazel module dependency to apply this override to. + |
+
+ version
+ |
+
+ string;
+ default is ''+ Overrides the declared version of this module in the dependency graph. In other words, this module will be "pinned" to this override version. This attribute can be omitted if all one wants to override is the registry or the patches. + |
+
+ registry
+ |
+
+ string;
+ default is ''+ Overrides the registry for this module; instead of finding this module from the default list of registries, the given registry should be used. + |
+
+ patches
+ |
+
+ Iterable of strings;
+ default is []+ A list of labels pointing to patch files to apply for this module. The patch files must exist in the source tree of the top level project. They are applied in the list order. If a patch makes changes to the MODULE.bazel file, these changes will only be effective if the patch file is provided by the root module. + |
+
+ patch_cmds
+ |
+
+ Iterable of strings;
+ default is []+ Sequence of Bash commands to be applied on Linux/Macos after patches are applied. Changes to the MODULE.bazel file will not be effective. + |
+
+ patch_strip
+ |
+
+ int;
+ default is 0+ Same as the --strip argument of Unix patch. + |
+
module_extension_proxy use_extension(extension_bzl_file, extension_name, *, dev_dependency=False, isolate=False)+ + Returns a proxy object representing a module extension; its methods can be invoked to create module extension tags. + +
| Parameter | +Description | +
|---|---|
+ extension_bzl_file
+ |
+
+ string;
+ required + A label to the Starlark file defining the module extension. + |
+
+ extension_name
+ |
+
+ string;
+ required + The name of the module extension to use. A symbol with this name must be exported by the Starlark file. + |
+
+ dev_dependency
+ |
+
+ bool;
+ default is False+ If true, this usage of the module extension will be ignored if the current module is not the root module or `--ignore_dev_dependency` is enabled. + |
+
+ isolate
+ |
+
+ bool;
+ default is False+ Experimental. This parameter is experimental and may change at any time. Please do not depend on it. It may be enabled on an experimental basis by setting --experimental_isolated_extension_usages If true, this usage of the module extension will be isolated from all other usages, both in this and other modules. Tags created for this usage do not affect other usages and the repositories generated by the extension for this usage will be distinct from all other repositories generated by the extension. This parameter is currently experimental and only available with the flag |
+
None use_repo(extension_proxy, *args, **kwargs)
+
+ Imports one or more repos generated by the given module extension into the scope of the current module.
+
+ | Parameter | +Description | +
|---|---|
+ extension_proxy
+ |
+
+ module_extension_proxy;
+ required + A module extension proxy object returned by a use_extension call.
+ |
+
+ args
+ |
+
+ required + The names of the repos to import. + |
+
+ kwargs
+ |
+
+ required + Specifies certain repos to import into the scope of the current module with +different names. The keys should be the name to use in the current scope, +whereas the values should be the original names exported by the module +extension. + Keys that are not valid identifiers can be specified via a literal dict
+passed as extra keyword arguments, e.g.,
+ |
+
repo_rule_proxy use_repo_rule(repo_rule_bzl_file, repo_rule_name)+ + Returns a proxy value that can be directly invoked in the MODULE.bazel file as a repository rule, one or more times. Repos created in such a way are only visible to the current module, under the name declared using the
name attribute on the proxy. The implicit Boolean dev_dependency attribute can also be used on the proxy to denote that a certain repo is only to be created when the current module is the root module.
+
+ | Parameter | +Description | +
|---|---|
+ repo_rule_bzl_file
+ |
+
+ string;
+ required + A label to the Starlark file defining the repo rule. + |
+
+ repo_rule_name
+ |
+
+ string;
+ required + The name of the repo rule to use. A symbol with this name must be exported by the Starlark file. + |
+
None ignore_directories(dirs)
+
+ The list of directories to ignore in this repository. This function takes a list of strings and a directory is ignored if any of the given strings matches its repository-relative path according to the semantics of the glob() function. This function can be used to ignore directories that are implementation details of source control systems, output files of other build systems, etc.
+
+
| Parameter | +Description | +
|---|---|
+ dirs
+ |
+
+ sequence of strings;
+ required + + |
+
None repo(**kwargs)
+
+ Declares metadata that applies to every rule in the repository. It must be called at most once per REPO.bazel file. If called, it must be the first call in the REPO.bazel file.
+
+ | Parameter | +Description | +
|---|---|
+ kwargs
+ |
+
+ required + The repo() function accepts exactly the same arguments as the package() function in BUILD files.
+ |
+
None ignore(*args)
+
+ Ignore this repo from vendoring. Bazel will never vendor it or use the corresponding directory (if exists) while building in vendor mode.
+
+ | Parameter | +Description | +
|---|---|
+ args
+ |
+
+ required + The canonical repo names of the repos to ignore. + |
+
None pin(*args)
+
+ Pin the contents of this repo under the vendor directory. Bazel will not update this repo while vendoring, and will use the vendored source as if there is a --override_repository flag when building in vendor mode
+
+ | Parameter | +Description | +
|---|---|
+ args
+ |
+
+ required + The canonical repo names of the repos to pin. + |
+
analysis_test=True must return an instance of this provider, and non-analysis-phase test rules cannot return this provider.
+
+AnalysisTestResultInfo AnalysisTestResultInfo(success, message)+ + The
AnalysisTestResultInfo constructor.
+
+ | Parameter | +Description | +
|---|---|
+ success
+ |
+
+ bool;
+ required + If true, then the analysis-phase test represented by this target should pass. If false, the test should fail. + |
+
+ message
+ |
+
+ string;
+ required + A descriptive message containing information about the test and its success/failure. + |
+
string AnalysisTestResultInfo.message+ + A descriptive message containing information about the test and its success/failure. + +
bool AnalysisTestResultInfo.success+ + If true, then the analysis-phase test represented by this target passed. If false, the test failed. + + + + + + diff --git a/rules/lib/providers/CcInfo.mdx b/rules/lib/providers/CcInfo.mdx new file mode 100644 index 0000000..fb7fc77 --- /dev/null +++ b/rules/lib/providers/CcInfo.mdx @@ -0,0 +1,99 @@ +--- +title: 'CcInfo' +--- + + + + + + + + +
CcInfo CcInfo(*, compilation_context=None, linking_context=None, debug_context=None)+ + The
CcInfo constructor.
+
+ | Parameter | +Description | +
|---|---|
+ compilation_context
+ |
+
+ CompilationContext; or None;
+ default is None+ The CompilationContext.
+ |
+
+ linking_context
+ |
+
+ struct; or None;
+ default is None+ The LinkingContext.
+ |
+
+ debug_context
+ |
+
+ struct; or None;
+ default is None+ The DebugContext.
+ |
+
CompilationContext CcInfo.compilation_context+ + Returns the
CompilationContext
+
+ struct CcInfo.linking_context+ + Returns the
LinkingContext
+
+
+
+
+
+
diff --git a/rules/lib/providers/CcToolchainConfigInfo.mdx b/rules/lib/providers/CcToolchainConfigInfo.mdx
new file mode 100644
index 0000000..2b5d5c5
--- /dev/null
+++ b/rules/lib/providers/CcToolchainConfigInfo.mdx
@@ -0,0 +1,25 @@
+---
+title: 'CcToolchainConfigInfo'
+---
+
+
+
+
+
+
+
+
+None CcToolchainInfo.all_files
+
+ Returns all toolchain files (so they can be passed to actions using this toolchain as inputs).
+
+ None CcToolchainInfo.ar_executable
+
+ The path to the ar binary.
+
+ None CcToolchainInfo.built_in_include_directories
+
+ Returns the list of built-in directories of the compiler.
+
+ None CcToolchainInfo.compiler
+
+ C++ compiler.
+
+ None CcToolchainInfo.compiler_executable
+
+ The path to the compiler binary.
+
+ None CcToolchainInfo.cpu
+
+ Target CPU of the C++ toolchain.
+
+ None CcToolchainInfo.dynamic_runtime_lib(*, feature_configuration)
+
+ Returns the files from `dynamic_runtime_lib` attribute (so they can be passed to actions using this toolchain as inputs). The caller can check whether the feature_configuration enables `static_link_cpp_runtimes` feature (if not, neither `static_runtime_lib` nor `dynamic_runtime_lib` have to be used), and use `static_runtime_lib` if static linking mode is active.
+
+ | Parameter | +Description | +
|---|---|
+ feature_configuration
+ |
+
+ required + Feature configuration to be queried. + |
+
None CcToolchainInfo.gcov_executable
+
+ The path to the gcov binary.
+
+ None CcToolchainInfo.ld_executable
+
+ The path to the ld binary.
+
+ None CcToolchainInfo.libc
+
+ libc version string.
+
+ None CcToolchainInfo.needs_pic_for_dynamic_libraries(*, feature_configuration)
+
+ Returns true if this rule's compilations should apply -fPIC, false otherwise. Determines if we should apply -fPIC for this rule's C++ compilations depending on the C++ toolchain and presence of `--force_pic` Bazel option.
+
+ | Parameter | +Description | +
|---|---|
+ feature_configuration
+ |
+
+ required + Feature configuration to be queried. + |
+
None CcToolchainInfo.nm_executable
+
+ The path to the nm binary.
+
+ None CcToolchainInfo.objcopy_executable
+
+ The path to the objcopy binary.
+
+ None CcToolchainInfo.objdump_executable
+
+ The path to the objdump binary.
+
+ None CcToolchainInfo.preprocessor_executable
+
+ The path to the preprocessor binary.
+
+ None CcToolchainInfo.static_runtime_lib(*, feature_configuration)
+
+ Returns the files from `static_runtime_lib` attribute (so they can be passed to actions using this toolchain as inputs). The caller should check whether the feature_configuration enables `static_link_cpp_runtimes` feature (if not, neither `static_runtime_lib` nor `dynamic_runtime_lib` should be used), and use `dynamic_runtime_lib` if dynamic linking mode is active.
+
+ | Parameter | +Description | +
|---|---|
+ feature_configuration
+ |
+
+ required + Feature configuration to be queried. + |
+
None CcToolchainInfo.strip_executable
+
+ The path to the strip binary.
+
+ None CcToolchainInfo.sysroot
+
+ Returns the sysroot to be used. If the toolchain compiler does not support different sysroots, or the sysroot is the same as the default sysroot, then this method returns None.
+
+ None CcToolchainInfo.target_gnu_system_name
+
+ The GNU System Name.
+
+
+
+
+
+
diff --git a/rules/lib/providers/ConstraintCollection.mdx b/rules/lib/providers/ConstraintCollection.mdx
new file mode 100644
index 0000000..899e483
--- /dev/null
+++ b/rules/lib/providers/ConstraintCollection.mdx
@@ -0,0 +1,25 @@
+---
+title: 'ConstraintCollection'
+---
+
+
+
+
+
+
+
+
+--experimental_platforms_api
+
+
+
+
+
+
+
diff --git a/rules/lib/providers/ConstraintSettingInfo.mdx b/rules/lib/providers/ConstraintSettingInfo.mdx
new file mode 100644
index 0000000..51825f5
--- /dev/null
+++ b/rules/lib/providers/ConstraintSettingInfo.mdx
@@ -0,0 +1,36 @@
+---
+title: 'ConstraintSettingInfo'
+---
+
+
+
+
+
+
+
+
+--experimental_platforms_api
+
+bool ConstraintSettingInfo.has_default_constraint_value+ + Whether there is a default constraint_value for this setting. + + + + + + diff --git a/rules/lib/providers/ConstraintValueInfo.mdx b/rules/lib/providers/ConstraintValueInfo.mdx new file mode 100644 index 0000000..e37a096 --- /dev/null +++ b/rules/lib/providers/ConstraintValueInfo.mdx @@ -0,0 +1,25 @@ +--- +title: 'ConstraintValueInfo' +--- + + + + + + + + +
--experimental_platforms_api
+
+
+
+
+
+
+
diff --git a/rules/lib/providers/DebugPackageInfo.mdx b/rules/lib/providers/DebugPackageInfo.mdx
new file mode 100644
index 0000000..ba5c589
--- /dev/null
+++ b/rules/lib/providers/DebugPackageInfo.mdx
@@ -0,0 +1,127 @@
+---
+title: 'DebugPackageInfo'
+---
+
+
+
+
+
+
+
+
+DebugPackageInfo DebugPackageInfo(*, target_label, stripped_file=None, unstripped_file, dwp_file=None)+ + The
DebugPackageInfo constructor.
+
+ | Parameter | +Description | +
|---|---|
+ target_label
+ |
+
+ Label;
+ required + The label for the *_binary target + |
+
+ stripped_file
+ |
+
+ File; or None;
+ default is None+ The stripped file (the explicit ".stripped" target) + |
+
+ unstripped_file
+ |
+
+ File;
+ required + The unstripped file (the default executable target). + |
+
+ dwp_file
+ |
+
+ File; or None;
+ default is None+ The .dwp file (for fission builds) or null if --fission=no. + |
+
File DebugPackageInfo.dwp_file+ + Returns the .dwp file (for fission builds) or null if --fission=no. + May return
None.
+
+ File DebugPackageInfo.stripped_file+ + Returns the stripped file (the explicit ".stripped" target). + May return
None.
+
+ Label DebugPackageInfo.target_label+ + Returns the label for the *_binary target + +
File DebugPackageInfo.unstripped_file+ + Returns the unstripped file (the default executable target) + + + + + + diff --git a/rules/lib/providers/DefaultInfo.mdx b/rules/lib/providers/DefaultInfo.mdx new file mode 100644 index 0000000..5544755 --- /dev/null +++ b/rules/lib/providers/DefaultInfo.mdx @@ -0,0 +1,144 @@ +--- +title: 'DefaultInfo' +--- + + + + + + + + +
+See the rules page for extensive guides on how to use this provider. +
+ + +DefaultInfo DefaultInfo(*, files=None, runfiles=None, data_runfiles=None, default_runfiles=None, executable=None)+ + The
DefaultInfo constructor.
+
+ | Parameter | +Description | +
|---|---|
+ files
+ |
+
+ depset; or None;
+ default is None+ A depset of File objects representing the default outputs to build when this target is specified on the bazel command line. By default it is all predeclared outputs.
+ |
+
+ runfiles
+ |
+
+ runfiles; or None;
+ default is None+ runfiles descriptor describing the files that this target needs when run (e.g. via the run command or as a tool dependency for an action).
+
+ |
+
+ data_runfiles
+ |
+
+ runfiles; or None;
+ default is None+ It is recommended that you avoid using this parameter (see "runfiles features to avoid") runfiles descriptor describing the runfiles this target needs to run when it is a dependency via thedata attribute.
+ |
+
+ default_runfiles
+ |
+
+ runfiles; or None;
+ default is None+ It is recommended that you avoid using this parameter (see "runfiles features to avoid") runfiles descriptor describing the runfiles this target needs to run when it is a dependency via any attribute other than thedata attribute.
+ |
+
+ executable
+ |
+
+ File; or None;
+ default is None+ If this rule is marked executable or test, this is a File object representing the file that should be executed to run the target. By default it is the predeclared output ctx.outputs.executable but it is recommended to pass another file (either predeclared or not) explicitly.
+ |
+
runfiles DefaultInfo.data_runfiles+ + runfiles descriptor describing the files that this target needs when run in the condition that it is a
data dependency attribute. Under most circumstances, use the default_runfiles parameter instead. See "runfiles features to avoid" for details.
+ May return None.
+
+ runfiles DefaultInfo.default_runfiles+ + runfiles descriptor describing the files that this target needs when run (via the
run command or as a tool dependency).
+ May return None.
+
+ depset DefaultInfo.files+ + A
depset of File objects representing the default outputs to build when this target is specified on the bazel command line. By default it is all predeclared outputs.
+ May return None.
+
+ FilesToRunProvider DefaultInfo.files_to_run+ + A
FilesToRunProvider object containing information about the executable and runfiles of the target.
+ May return None.
+
+
+
+
+
+
diff --git a/rules/lib/providers/ExecutionInfo.mdx b/rules/lib/providers/ExecutionInfo.mdx
new file mode 100644
index 0000000..2c57ccd
--- /dev/null
+++ b/rules/lib/providers/ExecutionInfo.mdx
@@ -0,0 +1,89 @@
+---
+title: 'ExecutionInfo'
+---
+
+
+
+
+
+
+
+
+ExecutionInfo ExecutionInfo(requirements={}, exec_group='test')+ + Creates an instance. + +
| Parameter | +Description | +
|---|---|
+ requirements
+ |
+
+ dict;
+ default is {}+ A dict indicating special execution requirements, such as hardware platforms. + |
+
+ exec_group
+ |
+
+ string;
+ default is 'test'+ The name of the exec group that is used to execute the test. + |
+
string ExecutionInfo.exec_group+ + The name of the exec group that is used to execute the test. + +
dict ExecutionInfo.requirements+ + A dict indicating special execution requirements, such as hardware platforms. + + + + + + diff --git a/rules/lib/providers/FeatureFlagInfo.mdx b/rules/lib/providers/FeatureFlagInfo.mdx new file mode 100644 index 0000000..fb2e9da --- /dev/null +++ b/rules/lib/providers/FeatureFlagInfo.mdx @@ -0,0 +1,81 @@ +--- +title: 'FeatureFlagInfo' +--- + + + + + + + + +
string FeatureFlagInfo.error+ + If non-None, this error was generated when trying to compute current value of flag. + May return
None.
+
+ bool FeatureFlagInfo.is_valid_value(value)+ + The value of the flag in the configuration used by the flag rule. + +
| Parameter | +Description | +
|---|---|
+ value
+ |
+
+ string;
+ required + String, the value to check for validity for this flag. + |
+
string FeatureFlagInfo.value+ + The current value of the flag in the flag's current configuration. None if there is an error. + May return
None.
+
+
+
+
+
+
diff --git a/rules/lib/providers/FilesToRunProvider.mdx b/rules/lib/providers/FilesToRunProvider.mdx
new file mode 100644
index 0000000..efed2c0
--- /dev/null
+++ b/rules/lib/providers/FilesToRunProvider.mdx
@@ -0,0 +1,56 @@
+---
+title: 'FilesToRunProvider'
+---
+
+
+
+
+
+
+
+
+DefaultInfo.files_to_run.
+
+
+File FilesToRunProvider.executable+ + The main executable or None if it does not exist. + May return
None.
+
+ File FilesToRunProvider.repo_mapping_manifest+ + The repo mapping manifest or None if it does not exist. + May return
None.
+
+ File FilesToRunProvider.runfiles_manifest+ + The runfiles manifest or None if it does not exist. + May return
None.
+
+
+
+
+
+
diff --git a/rules/lib/providers/IncompatiblePlatformProvider.mdx b/rules/lib/providers/IncompatiblePlatformProvider.mdx
new file mode 100644
index 0000000..979502e
--- /dev/null
+++ b/rules/lib/providers/IncompatiblePlatformProvider.mdx
@@ -0,0 +1,25 @@
+---
+title: 'IncompatiblePlatformProvider'
+---
+
+
+
+
+
+
+
+
+bazel cquery for more information.
+
+
+
+
+
+
+
diff --git a/rules/lib/providers/InstrumentedFilesInfo.mdx b/rules/lib/providers/InstrumentedFilesInfo.mdx
new file mode 100644
index 0000000..4b82296
--- /dev/null
+++ b/rules/lib/providers/InstrumentedFilesInfo.mdx
@@ -0,0 +1,44 @@
+---
+title: 'InstrumentedFilesInfo'
+---
+
+
+
+
+
+
+
+
+--instrumentation_filter for purposes of code coverage data collection. When coverage data collection is enabled, a manifest containing the combined paths in instrumented_files and metadata_files are passed to the test action as inputs, with the manifest's path noted in the environment variable COVERAGE_MANIFEST. The metadata files, but not the source files, are also passed to the test action as inputs. When InstrumentedFilesInfo is returned by an aspect's implementation function, any InstrumentedFilesInfo from the base rule target is ignored.
+
+depset InstrumentedFilesInfo.instrumented_files+ +
depset of File objects representing instrumented source files for this target and its dependencies.
+
+ depset InstrumentedFilesInfo.metadata_files+ +
depset of File objects representing coverage metadata files for this target and its dependencies. These files contain additional information required to generate LCOV-format coverage output after the code is executed, e.g. the .gcno files generated when gcc is run with -ftest-coverage.
+
+
+
+
+
+
diff --git a/rules/lib/providers/JavaRuntimeInfo.mdx b/rules/lib/providers/JavaRuntimeInfo.mdx
new file mode 100644
index 0000000..1d63277
--- /dev/null
+++ b/rules/lib/providers/JavaRuntimeInfo.mdx
@@ -0,0 +1,119 @@
+---
+title: 'JavaRuntimeInfo'
+---
+
+
+
+
+
+
+
+
+File JavaRuntimeInfo.default_cds+ + Returns the JDK default CDS archive. + May return
None.
+
+ depset JavaRuntimeInfo.files+ + Returns the files in the Java runtime. + +
depset JavaRuntimeInfo.hermetic_files+ + Returns the files in the Java runtime needed for hermetic deployments. + +
sequence JavaRuntimeInfo.hermetic_static_libs+ + Returns the JDK static libraries. + +
string JavaRuntimeInfo.java_executable_exec_path+ + Returns the execpath of the Java executable. + +
string JavaRuntimeInfo.java_executable_runfiles_path+ + Returns the path of the Java executable in runfiles trees. This should only be used when one needs to access the JVM during the execution of a binary or a test built by Bazel. In particular, when one needs to invoke the JVM during an action, java_executable_exec_path should be used instead. + +
string JavaRuntimeInfo.java_home+ + Returns the execpath of the root of the Java installation. + +
string JavaRuntimeInfo.java_home_runfiles_path+ + Returns the path of the Java installation in runfiles trees. This should only be used when one needs to access the JDK during the execution of a binary or a test built by Bazel. In particular, when one needs the JDK during an action, java_home should be used instead. + +
File JavaRuntimeInfo.lib_ct_sym+ + Returns the lib/ct.sym file. + May return
None.
+
+ File JavaRuntimeInfo.lib_modules+ + Returns the lib/modules file. + May return
None.
+
+ int JavaRuntimeInfo.version+ + The Java feature version of the runtime. This is 0 if the version is unknown. + + + + + + diff --git a/rules/lib/providers/JavaToolchainInfo.mdx b/rules/lib/providers/JavaToolchainInfo.mdx new file mode 100644 index 0000000..969e061 --- /dev/null +++ b/rules/lib/providers/JavaToolchainInfo.mdx @@ -0,0 +1,118 @@ +--- +title: 'JavaToolchainInfo' +--- + + + + + + + + +
depset JavaToolchainInfo.bootclasspath+ + The Java target bootclasspath entries. Corresponds to javac's -bootclasspath flag. + +
FilesToRunProvider JavaToolchainInfo.ijar+ + A FilesToRunProvider representing the ijar executable. + +
FilesToRunProvider JavaToolchainInfo.jacocorunner+ + The jacocorunner used by the toolchain. + May return
None.
+
+ JavaRuntimeInfo JavaToolchainInfo.java_runtime+ + The java runtime information. + +
depset JavaToolchainInfo.jvm_opt+ + The default options for the JVM running the java compiler and associated tools. + +
Label JavaToolchainInfo.label+ + The toolchain label. + +
FilesToRunProvider JavaToolchainInfo.proguard_allowlister+ + Return the binary to validate proguard configuration + May return
None.
+
+ FilesToRunProvider JavaToolchainInfo.single_jar+ + The SingleJar deploy jar. + +
string JavaToolchainInfo.source_version+ + The java source version. + +
string JavaToolchainInfo.target_version+ + The java target version. + +
depset JavaToolchainInfo.tools+ + The compilation tools. + + + + + + diff --git a/rules/lib/providers/MaterializedDepsInfo.mdx b/rules/lib/providers/MaterializedDepsInfo.mdx new file mode 100644 index 0000000..71dab22 --- /dev/null +++ b/rules/lib/providers/MaterializedDepsInfo.mdx @@ -0,0 +1,36 @@ +--- +title: 'MaterializedDepsInfo' +--- + + + + + + + + +
list MaterializedDepsInfo.deps+ + The list of dependencies. These may be ConfiguredTarget or DormantDependency objects. + + + + + + diff --git a/rules/lib/providers/ObjcProvider.mdx b/rules/lib/providers/ObjcProvider.mdx new file mode 100644 index 0000000..9f19344 --- /dev/null +++ b/rules/lib/providers/ObjcProvider.mdx @@ -0,0 +1,84 @@ +--- +title: 'ObjcProvider' +--- + + + + + + + + +
sequence ObjcProvider.direct_module_maps+ + Module map files from this target directly (no transitive module maps). Used to enforce proper use of private header files and for Swift compilation. + +
sequence ObjcProvider.direct_sources+ + All direct source files from this target (no transitive files), including any headers in the 'srcs' attribute. + +
depset ObjcProvider.j2objc_library+ + Static libraries that are built from J2ObjC-translated Java code. + +
depset ObjcProvider.module_map+ + Clang module maps, used to enforce proper use of private header files. + +
depset ObjcProvider.source+ + All transitive source files. + +
depset ObjcProvider.strict_include+ + Non-propagated include search paths specified with '-I' on the command line. Also known as header search paths (and distinct from user header search paths). + +
depset ObjcProvider.umbrella_header+ + Clang umbrella header. Public headers are #included in umbrella headers to be compatible with J2ObjC segmented headers. + + + + + + diff --git a/rules/lib/providers/OutputGroupInfo.mdx b/rules/lib/providers/OutputGroupInfo.mdx new file mode 100644 index 0000000..5d7c1de --- /dev/null +++ b/rules/lib/providers/OutputGroupInfo.mdx @@ -0,0 +1,62 @@ +--- +title: 'OutputGroupInfo' +--- + + + + + + + + +
OutputGroupInfo OutputGroupInfo(**kwargs)+ + Instantiate this provider with
OutputGroupInfo(group1 = <files>, group2 = <files>...)See Requesting output files for more information. + +
| Parameter | +Description | +
|---|---|
+ kwargs
+ |
+
+ default is {}+ Dictionary of arguments. + |
+
bool PackageSpecificationInfo.contains(target)+ + Checks if a target exists in a package group. + +
| Parameter | +Description | +
|---|---|
+ target
+ |
+
+ Label; or string;
+ required + A target which is checked if it exists inside the package group. + |
+
--experimental_platforms_api
+
+
+
+
+
+
+
diff --git a/rules/lib/providers/RunEnvironmentInfo.mdx b/rules/lib/providers/RunEnvironmentInfo.mdx
new file mode 100644
index 0000000..6df0bd6
--- /dev/null
+++ b/rules/lib/providers/RunEnvironmentInfo.mdx
@@ -0,0 +1,44 @@
+---
+title: 'RunEnvironmentInfo'
+---
+
+
+
+
+
+
+
+
+dict RunEnvironmentInfo.environment+ + A map of string keys and values that represent environment variables and their values. These will be made available when the target that returns this provider is executed, either as a test or via the run command. + +
List RunEnvironmentInfo.inherited_environment+ + A sequence of names of environment variables. These variables are made available with their current value taken from the shell environment when the target that returns this provider is executed, either as a test or via the run command. If a variable is contained in both
environment and inherited_environment, the value inherited from the shell environment will take precedence if set. This is most useful for test rules, which run with a hermetic environment under bazel test and can use this mechanism to non-hermetically include a variable from the outer environment. By contrast, bazel run already forwards the outer environment. Note, though, that it may be surprising for an otherwise hermetic test to hardcode a non-hermetic dependency on the environment, and that this may even accidentally expose sensitive information. Prefer setting the test environment explicitly with the --test_env flag, and even then prefer to avoid using this flag and instead populate the environment explicitly.
+
+
+
+
+
+
diff --git a/rules/lib/providers/TemplateVariableInfo.mdx b/rules/lib/providers/TemplateVariableInfo.mdx
new file mode 100644
index 0000000..d603e39
--- /dev/null
+++ b/rules/lib/providers/TemplateVariableInfo.mdx
@@ -0,0 +1,36 @@
+---
+title: 'TemplateVariableInfo'
+---
+
+
+
+
+
+
+
+
+$(VARIABLE) in BUILD files and expanded by ctx.expand_make_variables and implicitly in certain attributes of built-in rules.TemplateVariableInfo can be created by calling its eponymous constructor with a string-to-string dict as an argument that specifies the variables provided.
Example: platform_common.TemplateVariableInfo({'FOO': 'bar'})
dict TemplateVariableInfo.variables+ + Returns the make variables defined by this target as a dictionary with string keys and string values + + + + + + diff --git a/rules/lib/providers/ToolchainInfo.mdx b/rules/lib/providers/ToolchainInfo.mdx new file mode 100644 index 0000000..67dc9c5 --- /dev/null +++ b/rules/lib/providers/ToolchainInfo.mdx @@ -0,0 +1,25 @@ +--- +title: 'ToolchainInfo' +--- + + + + + + + + +
--experimental_platforms_api
+
+Label ToolchainTypeInfo.type_label+ + The label uniquely identifying this toolchain type. + + + + + + diff --git a/rules/lib/providers/file_provider.mdx b/rules/lib/providers/file_provider.mdx new file mode 100644 index 0000000..61c05f6 --- /dev/null +++ b/rules/lib/providers/file_provider.mdx @@ -0,0 +1,25 @@ +--- +title: 'file_provider' +--- + + + + + + + + +
list java_compilation_info.boot_classpath+ + Boot classpath for this Java target. + +
depset java_compilation_info.compilation_classpath+ + Compilation classpath for this Java target. + +
depset java_compilation_info.javac_options+ + A depset of options to java compiler. To get the exact list of options passed to javac in the correct order, use the tokenize_javacopts utility in rules_java + +
depset java_compilation_info.runtime_classpath+ + Run-time classpath for this Java target. + + + + + + diff --git a/rules/lib/providers/java_output_jars.mdx b/rules/lib/providers/java_output_jars.mdx new file mode 100644 index 0000000..3074340 --- /dev/null +++ b/rules/lib/providers/java_output_jars.mdx @@ -0,0 +1,54 @@ +--- +title: 'java_output_jars' +--- + + + + + + + + +
list java_output_jars.jars+ + Returns information about outputs of this Java/Java-like target. Deprecated: Use java_info.java_outputs. + +
File java_output_jars.jdeps+ + A manifest proto file. The protobuf file containing the manifest generated from JavaBuilder. This function returns a value when exactly one manifest proto file is present in the outputs. Deprecated: Use java_info.java_outputs[i].jdeps. + May return
None.
+
+ File java_output_jars.native_headers+ + A jar containing CC header files supporting native method implementation. This function returns a value when exactly one native headers jar file is present in the outputs. Deprecated: Use java_info.java_outputs[i].native_headers_jar. + May return
None.
+
+
+
+
+
+
diff --git a/rules/lib/toplevel.mdx b/rules/lib/toplevel.mdx
new file mode 100644
index 0000000..b0cc8ce
--- /dev/null
+++ b/rules/lib/toplevel.mdx
@@ -0,0 +1,42 @@
+---
+title: 'toplevel'
+---
+
+
+
+
+
+
+
+dict apple_common.apple_host_system_env(xcode_config)+ + Returns a dict of environment variables that should be set for actions that need to run build tools on an Apple host system, such as the version of Xcode that should be used. The keys are variable names and the values are their corresponding values. + +
| Parameter | +Description | +
|---|---|
+ xcode_config
+ |
+
+ required + A provider containing information about the Xcode configuration. + |
+
unknown apple_common.apple_toolchain()+ + Utilities for resolving items from the apple toolchain. + +
DottedVersion apple_common.dotted_version(version)+ + Creates a new DottedVersion instance. + +
| Parameter | +Description | +
|---|---|
+ version
+ |
+
+ string;
+ required + The string representation of the DottedVersion. + |
+
struct apple_common.platform+ + An enum-like struct that contains the following fields corresponding to Apple platforms:
ios_deviceios_simulatormacostvos_devicetvos_simulatorvisionos_devicevisionos_simulatorwatchos_devicewatchos_simulatorThese values can be passed to methods that expect a platform, like XcodeVersionConfig.sdk_version_for_platform. + +
struct apple_common.platform_type+ + An enum-like struct that contains the following fields corresponding to Apple platform types:
iosmacostvosvisionoswatchosThese values can be passed to methods that expect a platform type, like the 'apple' configuration fragment's multi_arch_platform method.
Example:
+ctx.fragments.apple.multi_arch_platform(apple_common.platform_type.ios) ++ +
dict apple_common.target_apple_env(xcode_config, platform)+ + Returns a
dict of environment variables that should be set for actions that build targets of the given Apple platform type. For example, this dictionary contains variables that denote the platform name and SDK version with which to build. The keys are variable names and the values are their corresponding values.
+
+ | Parameter | +Description | +
|---|---|
+ xcode_config
+ |
+
+ required + A provider containing information about the Xcode configuration. + |
+
+ platform
+ |
+
+ required + The apple platform. + |
+
Provider apple_common.XcodeProperties+ + The constructor/key for the
XcodeVersionProperties provider.If a target propagates the XcodeVersionProperties provider, use this as the key with which to retrieve it. Example:
+dep = ctx.attr.deps[0] +p = dep[apple_common.XcodeVersionProperties] ++ +
Provider apple_common.XcodeVersionConfig+ + The constructor/key for the
XcodeVersionConfig provider.
+
+
+
+
+
+
diff --git a/rules/lib/toplevel/attr.mdx b/rules/lib/toplevel/attr.mdx
new file mode 100644
index 0000000..87bef4a
--- /dev/null
+++ b/rules/lib/toplevel/attr.mdx
@@ -0,0 +1,1276 @@
+---
+title: 'attr'
+---
+
+
+
+
+
+
+
+
+attrs dictionary argument of rule(), aspect(), repository_rule() and tag_class(). See the Rules page for more on defining +and using attributes.
+ + +Attribute attr.bool(*, configurable=unbound, default=False, doc=None, mandatory=False)+ + Creates a schema for a boolean attribute. The corresponding
ctx.attr attribute will be of type bool.
+
+ | Parameter | +Description | +
|---|---|
+ configurable
+ |
+
+ bool; or unbound;
+ default is unbound+ This argument can only be specified for an attribute of a symbolic macro. If For an attribute of a rule or aspect, |
+
+ default
+ |
+
+ bool;
+ default is False+ A default value to use if no value for this attribute is given when instantiating the rule. + |
+
+ doc
+ |
+
+ string; or None;
+ default is None+ A description of the attribute that can be extracted by documentation generating tools. + |
+
+ mandatory
+ |
+
+ bool;
+ default is False+ If true, the value must be specified explicitly (even if it has a default).
+ |
+
Attribute attr.int(*, configurable=unbound, default=0, doc=None, mandatory=False, values=[])+ + Creates a schema for an integer attribute. The value must be in the signed 32-bit range. The corresponding
ctx.attr attribute will be of type int.
+
+ | Parameter | +Description | +
|---|---|
+ configurable
+ |
+
+ bool; or unbound;
+ default is unbound+ This argument can only be specified for an attribute of a symbolic macro. If For an attribute of a rule or aspect, |
+
+ default
+ |
+
+ int;
+ default is 0+ A default value to use if no value for this attribute is given when instantiating the rule. + |
+
+ doc
+ |
+
+ string; or None;
+ default is None+ A description of the attribute that can be extracted by documentation generating tools. + |
+
+ mandatory
+ |
+
+ bool;
+ default is False+ If true, the value must be specified explicitly (even if it has a default).
+ |
+
+ values
+ |
+
+ sequence of ints;
+ default is []+ The list of allowed values for the attribute. An error is raised if any other value is given. + |
+
Attribute attr.int_list(mandatory=False, allow_empty=True, *, configurable=unbound, default=[], doc=None)+ + Creates a schema for a list-of-integers attribute. Each element must be in the signed 32-bit range. + +
| Parameter | +Description | +
|---|---|
+ mandatory
+ |
+
+ bool;
+ default is False+ If true, the value must be specified explicitly (even if it has a default).
+ |
+
+ allow_empty
+ |
+
+ bool;
+ default is True+ True if the attribute can be empty. + |
+
+ configurable
+ |
+
+ bool; or unbound;
+ default is unbound+ This argument can only be specified for an attribute of a symbolic macro. If For an attribute of a rule or aspect, |
+
+ default
+ |
+
+ sequence of ints;
+ default is []+ A default value to use if no value for this attribute is given when instantiating the rule. + |
+
+ doc
+ |
+
+ string; or None;
+ default is None+ A description of the attribute that can be extracted by documentation generating tools. + |
+
Attribute attr.label(*, configurable=unbound, default=None, materializer=None, doc=None, executable=False, allow_files=None, allow_single_file=None, mandatory=False, skip_validations=False, providers=[], for_dependency_resolution=unbound, allow_rules=None, cfg=None, aspects=[], flags=[])+ +
Creates a schema for a label attribute. This is a dependency attribute.
This attribute contains unique Label values. If a string is supplied in place of a Label, it will be converted using the label constructor. The relative parts of the label path, including the (possibly renamed) repository, are resolved with respect to the instantiated target's package.
At analysis time (within the rule's implementation function), when retrieving the attribute value from ctx.attr, labels are replaced by the corresponding Targets. This allows you to access the providers of the current target's dependencies.
In addition to ordinary source files, this kind of attribute is often used to refer to a tool -- for example, a compiler. Such tools are considered to be dependencies, just like source files. To avoid requiring users to specify the tool's label every time they use the rule in their BUILD files, you can hard-code the label of a canonical tool as the default value of this attribute. If you also want to prevent users from overriding this default, you can make the attribute private by giving it a name that starts with an underscore. See the Rules page for more information.
+
+
| Parameter | +Description | +
|---|---|
+ configurable
+ |
+
+ bool; or unbound;
+ default is unbound+ This argument can only be specified for an attribute of a symbolic macro. If For an attribute of a rule or aspect, |
+
+ default
+ |
+
+ Label; or string; or LateBoundDefault; or NativeComputedDefault; or function; or None;
+ default is None+ A default value to use if no value for this attribute is given when instantiating the rule.Use a string or the Label function to specify a default value, for example, attr.label(default = "//a:b").
+ |
+
+ materializer
+ |
+
+ function;
+ default is None+ Experimental. This parameter is experimental and may change at any time. Please do not depend on it. It may be enabled on an experimental basis by setting --experimental_dormant_deps If set, the attribute materializes dormant dependencies from the transitive closure. The value of this parameter must be a functon that gets access to the values of the attributes of the rule that either are not dependencies or are marked as available for dependency resolution. It must return either a dormant dependency or a list of them depending on the type of the attribute + |
+
+ doc
+ |
+
+ string; or None;
+ default is None+ A description of the attribute that can be extracted by documentation generating tools. + |
+
+ executable
+ |
+
+ bool;
+ default is False+ True if the dependency has to be executable. This means the label must refer to an executable file, or to a rule that outputs an executable file. Access the label with ctx.executable.<attribute_name>.
+ |
+
+ allow_files
+ |
+
+ bool; or sequence of strings; or None;
+ default is None+ Whether File targets are allowed. Can be True, False (default), or a list of file extensions that are allowed (for example, [".cc", ".cpp"]).
+ |
+
+ allow_single_file
+ |
+
+ default is None+ This is similar to allow_files, with the restriction that the label must correspond to a single File. Access it through ctx.file.<attribute_name>.
+ |
+
+ mandatory
+ |
+
+ bool;
+ default is False+ If true, the value must be specified explicitly (even if it has a default).
+ |
+
+ skip_validations
+ |
+
+ bool;
+ default is False+ If true, validation actions of transitive dependencies from this attribute will not run. This is a temporary mitigation and WILL be removed in the future. + |
+
+ providers
+ |
+
+ sequence;
+ default is []+ The providers that must be given by any dependency appearing in this attribute. The format of this argument is a list of lists of providers -- |
+
+ for_dependency_resolution
+ |
+
+ default is unbound+ If this is set, the attribute is available for materializers. Only rules marked with the flag of the same name are allowed to be referenced through such attributes. + |
+
+ allow_rules
+ |
+
+ sequence of strings; or None;
+ default is None+ Which rule targets (name of the classes) are allowed. This is deprecated (kept only for compatibility), use providers instead. + |
+
+ cfg
+ |
+
+ default is None+ Configuration of the attribute. It can be either "exec", which indicates that the dependency is built for the execution platform, or "target", which indicates that the dependency is build for the target platform. A typical example of the difference is when building mobile apps, where the target platform is Android or iOS while the execution platform is Linux, macOS, or Windows. This parameter is required if executable is True to guard against accidentally building host tools in the target configuration. "target" has no semantic effect, so don't set it when executable is False unless it really helps clarify your intentions.
+ |
+
+ aspects
+ |
+
+ sequence of Aspects;
+ default is []+ Aspects that should be applied to the dependency or dependencies specified by this attribute. + |
+
+ flags
+ |
+
+ sequence of strings;
+ default is []+ Deprecated, will be removed. + |
+
Attribute attr.label_keyed_string_dict(allow_empty=True, *, configurable=unbound, default={}, doc=None, allow_files=None, allow_rules=None, providers=[], for_dependency_resolution=unbound, flags=[], mandatory=False, skip_validations=False, cfg=None, aspects=[])+ +
Creates a schema for an attribute holding a dictionary, where the keys are labels and the values are strings. This is a dependency attribute.
This attribute contains unique Label values. If a string is supplied in place of a Label, it will be converted using the label constructor. The relative parts of the label path, including the (possibly renamed) repository, are resolved with respect to the instantiated target's package.
At analysis time (within the rule's implementation function), when retrieving the attribute value from ctx.attr, labels are replaced by the corresponding Targets. This allows you to access the providers of the current target's dependencies.
+
+
| Parameter | +Description | +
|---|---|
+ allow_empty
+ |
+
+ bool;
+ default is True+ True if the attribute can be empty. + |
+
+ configurable
+ |
+
+ bool; or unbound;
+ default is unbound+ This argument can only be specified for an attribute of a symbolic macro. If For an attribute of a rule or aspect, |
+
+ default
+ |
+
+ dict; or function;
+ default is {}+ A default value to use if no value for this attribute is given when instantiating the rule.Use strings or the Label function to specify default values, for example, attr.label_keyed_string_dict(default = {"//a:b": "value", "//a:c": "string"}).
+ |
+
+ doc
+ |
+
+ string; or None;
+ default is None+ A description of the attribute that can be extracted by documentation generating tools. + |
+
+ allow_files
+ |
+
+ bool; or sequence of strings; or None;
+ default is None+ Whether File targets are allowed. Can be True, False (default), or a list of file extensions that are allowed (for example, [".cc", ".cpp"]).
+ |
+
+ allow_rules
+ |
+
+ sequence of strings; or None;
+ default is None+ Which rule targets (name of the classes) are allowed. This is deprecated (kept only for compatibility), use providers instead. + |
+
+ providers
+ |
+
+ sequence;
+ default is []+ The providers that must be given by any dependency appearing in this attribute. The format of this argument is a list of lists of providers -- |
+
+ for_dependency_resolution
+ |
+
+ default is unbound+ If this is set, the attribute is available for materializers. Only rules marked with the flag of the same name are allowed to be referenced through such attributes. + |
+
+ flags
+ |
+
+ sequence of strings;
+ default is []+ Deprecated, will be removed. + |
+
+ mandatory
+ |
+
+ bool;
+ default is False+ If true, the value must be specified explicitly (even if it has a default).
+ |
+
+ skip_validations
+ |
+
+ bool;
+ default is False+ If true, validation actions of transitive dependencies from this attribute will not run. This is a temporary mitigation and WILL be removed in the future. + |
+
+ cfg
+ |
+
+ default is None+ Configuration of the attribute. It can be either "exec", which indicates that the dependency is built for the execution platform, or "target", which indicates that the dependency is build for the target platform. A typical example of the difference is when building mobile apps, where the target platform is Android or iOS while the execution platform is Linux, macOS, or Windows.
+ |
+
+ aspects
+ |
+
+ sequence of Aspects;
+ default is []+ Aspects that should be applied to the dependency or dependencies specified by this attribute. + |
+
Attribute attr.label_list(allow_empty=True, *, configurable=unbound, default=[], materializer=None, doc=None, allow_files=None, allow_rules=None, providers=[], for_dependency_resolution=unbound, flags=[], mandatory=False, skip_validations=False, cfg=None, aspects=[])+ +
Creates a schema for a list-of-labels attribute. This is a dependency attribute. The corresponding ctx.attr attribute will be of type list of Targets.
This attribute contains unique Label values. If a string is supplied in place of a Label, it will be converted using the label constructor. The relative parts of the label path, including the (possibly renamed) repository, are resolved with respect to the instantiated target's package.
At analysis time (within the rule's implementation function), when retrieving the attribute value from ctx.attr, labels are replaced by the corresponding Targets. This allows you to access the providers of the current target's dependencies.
+
+
| Parameter | +Description | +
|---|---|
+ allow_empty
+ |
+
+ bool;
+ default is True+ True if the attribute can be empty. + |
+
+ configurable
+ |
+
+ bool; or unbound;
+ default is unbound+ This argument can only be specified for an attribute of a symbolic macro. If For an attribute of a rule or aspect, |
+
+ default
+ |
+
+ sequence of Labels; or function;
+ default is []+ A default value to use if no value for this attribute is given when instantiating the rule.Use strings or the Label function to specify default values, for example, attr.label_list(default = ["//a:b", "//a:c"]).
+ |
+
+ materializer
+ |
+
+ function;
+ default is None+ Experimental. This parameter is experimental and may change at any time. Please do not depend on it. It may be enabled on an experimental basis by setting --experimental_dormant_deps If set, the attribute materializes dormant dependencies from the transitive closure. The value of this parameter must be a functon that gets access to the values of the attributes of the rule that either are not dependencies or are marked as available for dependency resolution. It must return either a dormant dependency or a list of them depending on the type of the attribute + |
+
+ doc
+ |
+
+ string; or None;
+ default is None+ A description of the attribute that can be extracted by documentation generating tools. + |
+
+ allow_files
+ |
+
+ bool; or sequence of strings; or None;
+ default is None+ Whether File targets are allowed. Can be True, False (default), or a list of file extensions that are allowed (for example, [".cc", ".cpp"]).
+ |
+
+ allow_rules
+ |
+
+ sequence of strings; or None;
+ default is None+ Which rule targets (name of the classes) are allowed. This is deprecated (kept only for compatibility), use providers instead. + |
+
+ providers
+ |
+
+ sequence;
+ default is []+ The providers that must be given by any dependency appearing in this attribute. The format of this argument is a list of lists of providers -- |
+
+ for_dependency_resolution
+ |
+
+ default is unbound+ If this is set, the attribute is available for materializers. Only rules marked with the flag of the same name are allowed to be referenced through such attributes. + |
+
+ flags
+ |
+
+ sequence of strings;
+ default is []+ Deprecated, will be removed. + |
+
+ mandatory
+ |
+
+ bool;
+ default is False+ If true, the value must be specified explicitly (even if it has a default).
+ |
+
+ skip_validations
+ |
+
+ bool;
+ default is False+ If true, validation actions of transitive dependencies from this attribute will not run. This is a temporary mitigation and WILL be removed in the future. + |
+
+ cfg
+ |
+
+ default is None+ Configuration of the attribute. It can be either "exec", which indicates that the dependency is built for the execution platform, or "target", which indicates that the dependency is build for the target platform. A typical example of the difference is when building mobile apps, where the target platform is Android or iOS while the execution platform is Linux, macOS, or Windows.
+ |
+
+ aspects
+ |
+
+ sequence of Aspects;
+ default is []+ Aspects that should be applied to the dependency or dependencies specified by this attribute. + |
+
Attribute attr.output(*, doc=None, mandatory=False)+ +
Creates a schema for an output (label) attribute.
This attribute contains unique Label values. If a string is supplied in place of a Label, it will be converted using the label constructor. The relative parts of the label path, including the (possibly renamed) repository, are resolved with respect to the instantiated target's package.
At analysis time, the corresponding File can be retrieved using ctx.outputs.
+
+
| Parameter | +Description | +
|---|---|
+ doc
+ |
+
+ string; or None;
+ default is None+ A description of the attribute that can be extracted by documentation generating tools. + |
+
+ mandatory
+ |
+
+ bool;
+ default is False+ If true, the value must be specified explicitly (even if it has a default).
+ |
+
Attribute attr.output_list(allow_empty=True, *, doc=None, mandatory=False)+ + Creates a schema for a list-of-outputs attribute.
This attribute contains unique Label values. If a string is supplied in place of a Label, it will be converted using the label constructor. The relative parts of the label path, including the (possibly renamed) repository, are resolved with respect to the instantiated target's package.
At analysis time, the corresponding File can be retrieved using ctx.outputs.
+
+
| Parameter | +Description | +
|---|---|
+ allow_empty
+ |
+
+ bool;
+ default is True+ True if the attribute can be empty. + |
+
+ doc
+ |
+
+ string; or None;
+ default is None+ A description of the attribute that can be extracted by documentation generating tools. + |
+
+ mandatory
+ |
+
+ bool;
+ default is False+ If true, the value must be specified explicitly (even if it has a default).
+ |
+
Attribute attr.string(*, configurable=unbound, default='', doc=None, mandatory=False, values=[])+ + Creates a schema for a string attribute. + +
| Parameter | +Description | +
|---|---|
+ configurable
+ |
+
+ bool; or unbound;
+ default is unbound+ This argument can only be specified for an attribute of a symbolic macro. If For an attribute of a rule or aspect, |
+
+ default
+ |
+
+ string; or NativeComputedDefault;
+ default is ''+ A default value to use if no value for this attribute is given when instantiating the rule. + |
+
+ doc
+ |
+
+ string; or None;
+ default is None+ A description of the attribute that can be extracted by documentation generating tools. + |
+
+ mandatory
+ |
+
+ bool;
+ default is False+ If true, the value must be specified explicitly (even if it has a default).
+ |
+
+ values
+ |
+
+ sequence of strings;
+ default is []+ The list of allowed values for the attribute. An error is raised if any other value is given. + |
+
Attribute attr.string_dict(allow_empty=True, *, configurable=unbound, default={}, doc=None, mandatory=False)+ + Creates a schema for an attribute holding a dictionary, where the keys and values are strings. + +
| Parameter | +Description | +
|---|---|
+ allow_empty
+ |
+
+ bool;
+ default is True+ True if the attribute can be empty. + |
+
+ configurable
+ |
+
+ bool; or unbound;
+ default is unbound+ This argument can only be specified for an attribute of a symbolic macro. If For an attribute of a rule or aspect, |
+
+ default
+ |
+
+ dict;
+ default is {}+ A default value to use if no value for this attribute is given when instantiating the rule. + |
+
+ doc
+ |
+
+ string; or None;
+ default is None+ A description of the attribute that can be extracted by documentation generating tools. + |
+
+ mandatory
+ |
+
+ bool;
+ default is False+ If true, the value must be specified explicitly (even if it has a default).
+ |
+
Attribute attr.string_keyed_label_dict(allow_empty=True, *, configurable=unbound, default={}, doc=None, allow_files=None, allow_rules=None, providers=[], for_dependency_resolution=unbound, flags=[], mandatory=False, cfg=None, aspects=[])+ +
Creates a schema for an attribute whose value is a dictionary where the keys are strings and the values are labels. This is a dependency attribute.
This attribute contains unique Label values. If a string is supplied in place of a Label, it will be converted using the label constructor. The relative parts of the label path, including the (possibly renamed) repository, are resolved with respect to the instantiated target's package.
At analysis time (within the rule's implementation function), when retrieving the attribute value from ctx.attr, labels are replaced by the corresponding Targets. This allows you to access the providers of the current target's dependencies.
+
+
| Parameter | +Description | +
|---|---|
+ allow_empty
+ |
+
+ bool;
+ default is True+ True if the attribute can be empty. + |
+
+ configurable
+ |
+
+ bool; or unbound;
+ default is unbound+ This argument can only be specified for an attribute of a symbolic macro. If For an attribute of a rule or aspect, |
+
+ default
+ |
+
+ dict; or function;
+ default is {}+ A default value to use if no value for this attribute is given when instantiating the rule.Use strings or the Label function to specify default values, for example, attr.string_keyed_label_dict(default = {"foo": "//a:b", "bar": "//a:c"}).
+ |
+
+ doc
+ |
+
+ string; or None;
+ default is None+ A description of the attribute that can be extracted by documentation generating tools. + |
+
+ allow_files
+ |
+
+ bool; or sequence of strings; or None;
+ default is None+ Whether File targets are allowed. Can be True, False (default), or a list of file extensions that are allowed (for example, [".cc", ".cpp"]).
+ |
+
+ allow_rules
+ |
+
+ sequence of strings; or None;
+ default is None+ Which rule targets (name of the classes) are allowed. This is deprecated (kept only for compatibility), use providers instead. + |
+
+ providers
+ |
+
+ sequence;
+ default is []+ The providers that must be given by any dependency appearing in this attribute. The format of this argument is a list of lists of providers -- |
+
+ for_dependency_resolution
+ |
+
+ default is unbound+ If this is set, the attribute is available for materializers. Only rules marked with the flag of the same name are allowed to be referenced through such attributes. + |
+
+ flags
+ |
+
+ sequence of strings;
+ default is []+ Deprecated, will be removed. + |
+
+ mandatory
+ |
+
+ bool;
+ default is False+ If true, the value must be specified explicitly (even if it has a default).
+ |
+
+ cfg
+ |
+
+ default is None+ Configuration of the attribute. It can be either "exec", which indicates that the dependency is built for the execution platform, or "target", which indicates that the dependency is build for the target platform. A typical example of the difference is when building mobile apps, where the target platform is Android or iOS while the execution platform is Linux, macOS, or Windows.
+ |
+
+ aspects
+ |
+
+ sequence of Aspects;
+ default is []+ Aspects that should be applied to the dependency or dependencies specified by this attribute. + |
+
Attribute attr.string_list(mandatory=False, allow_empty=True, *, configurable=unbound, default=[], doc=None)+ + Creates a schema for a list-of-strings attribute. + +
| Parameter | +Description | +
|---|---|
+ mandatory
+ |
+
+ bool;
+ default is False+ If true, the value must be specified explicitly (even if it has a default).
+ |
+
+ allow_empty
+ |
+
+ bool;
+ default is True+ True if the attribute can be empty. + |
+
+ configurable
+ |
+
+ bool; or unbound;
+ default is unbound+ This argument can only be specified for an attribute of a symbolic macro. If For an attribute of a rule or aspect, |
+
+ default
+ |
+
+ sequence of strings; or NativeComputedDefault;
+ default is []+ A default value to use if no value for this attribute is given when instantiating the rule. + |
+
+ doc
+ |
+
+ string; or None;
+ default is None+ A description of the attribute that can be extracted by documentation generating tools. + |
+
Attribute attr.string_list_dict(allow_empty=True, *, configurable=unbound, default={}, doc=None, mandatory=False)+ + Creates a schema for an attribute holding a dictionary, where the keys are strings and the values are lists of strings. + +
| Parameter | +Description | +
|---|---|
+ allow_empty
+ |
+
+ bool;
+ default is True+ True if the attribute can be empty. + |
+
+ configurable
+ |
+
+ bool; or unbound;
+ default is unbound+ This argument can only be specified for an attribute of a symbolic macro. If For an attribute of a rule or aspect, |
+
+ default
+ |
+
+ dict;
+ default is {}+ A default value to use if no value for this attribute is given when instantiating the rule. + |
+
+ doc
+ |
+
+ string; or None;
+ default is None+ A description of the attribute that can be extracted by documentation generating tools. + |
+
+ mandatory
+ |
+
+ bool;
+ default is False+ If true, the value must be specified explicitly (even if it has a default).
+ |
+
bool cc_common.action_is_enabled(*, feature_configuration, action_name)+ + Returns True if given action_config is enabled in the feature configuration. + +
| Parameter | +Description | +
|---|---|
+ feature_configuration
+ |
+
+ FeatureConfiguration;
+ required + Feature configuration to be queried. + |
+
+ action_name
+ |
+
+ string;
+ required + Name of the action_config. + |
+
Provider cc_common.CcToolchainInfo+ + The key used to retrieve the provider that contains information about the C++ toolchain being used + +
tuple cc_common.compile(*, actions, feature_configuration, cc_toolchain, srcs=[], public_hdrs=[], private_hdrs=[], includes=[], quote_includes=[], system_includes=[], framework_includes=[], defines=[], local_defines=[], include_prefix='', strip_include_prefix='', user_compile_flags=[], conly_flags=[], cxx_flags=[], compilation_contexts=[], name, disallow_pic_outputs=False, disallow_nopic_outputs=False, additional_inputs=[], module_interfaces=unbound)+ + Should be used for C++ compilation. Returns tuple of (
CompilationContext, CcCompilationOutputs).
+
+ | Parameter | +Description | +
|---|---|
+ actions
+ |
+
+ actions;
+ required + actions object.
+ |
+
+ feature_configuration
+ |
+
+ FeatureConfiguration;
+ required + feature_configuration to be queried.
+ |
+
+ cc_toolchain
+ |
+
+ Info;
+ required + CcToolchainInfo provider to be used.
+ |
+
+ srcs
+ |
+
+ sequence;
+ default is []+ The list of source files to be compiled. + |
+
+ public_hdrs
+ |
+
+ sequence;
+ default is []+ List of headers needed for compilation of srcs and may be included by dependent rules transitively. + |
+
+ private_hdrs
+ |
+
+ sequence;
+ default is []+ List of headers needed for compilation of srcs and NOT to be included by dependent rules. + |
+
+ includes
+ |
+
+ sequence; or depset;
+ default is []+ Search paths for header files referenced both by angle bracket and quotes. Usually passed with -I. Propagated to dependents transitively. + |
+
+ quote_includes
+ |
+
+ sequence;
+ default is []+ Search paths for header files referenced by quotes, e.g. #include "foo/bar/header.h". They can be either relative to the exec root or absolute. Usually passed with -iquote. Propagated to dependents transitively. + |
+
+ system_includes
+ |
+
+ sequence;
+ default is []+ Search paths for header files referenced by angle brackets, e.g. #include <foo/bar/header.h>. They can be either relative to the exec root or absolute. Usually passed with -isystem. Propagated to dependents transitively. + |
+
+ framework_includes
+ |
+
+ sequence;
+ default is []+ Search paths for header files from Apple frameworks. They can be either relative to the exec root or absolute. Usually passed with -F. Propagated to dependents transitively. + |
+
+ defines
+ |
+
+ sequence;
+ default is []+ Set of defines needed to compile this target. Each define is a string. Propagated to dependents transitively. + |
+
+ local_defines
+ |
+
+ sequence;
+ default is []+ Set of defines needed to compile this target. Each define is a string. Not propagated to dependents transitively. + |
+
+ include_prefix
+ |
+
+ string;
+ default is ''+ The prefix to add to the paths of the headers of this rule. When set, the headers in the hdrs attribute of this rule are accessible at is the value of this attribute prepended to their repository-relative path. The prefix in the strip_include_prefix attribute is removed before this prefix is added. + |
+
+ strip_include_prefix
+ |
+
+ string;
+ default is ''+ The prefix to strip from the paths of the headers of this rule. When set, the headers in the hdrs attribute of this rule are accessible at their path with this prefix cut off. If it's a relative path, it's taken as a package-relative one. If it's an absolute one, it's understood as a repository-relative path. The prefix in the include_prefix attribute is added after this prefix is stripped. + |
+
+ user_compile_flags
+ |
+
+ sequence;
+ default is []+ Additional list of compilation options. + |
+
+ conly_flags
+ |
+
+ sequence;
+ default is []+ Additional list of compilation options for C compiles. + |
+
+ cxx_flags
+ |
+
+ sequence;
+ default is []+ Additional list of compilation options for C++ compiles. + |
+
+ compilation_contexts
+ |
+
+ sequence;
+ default is []+ Headers from dependencies used for compilation. + |
+
+ name
+ |
+
+ string;
+ required + This is used for naming the output artifacts of actions created by this method. See also the `main_output` arg. + |
+
+ disallow_pic_outputs
+ |
+
+ bool;
+ default is False+ Whether PIC outputs should be created. + |
+
+ disallow_nopic_outputs
+ |
+
+ bool;
+ default is False+ Whether NOPIC outputs should be created. + |
+
+ additional_inputs
+ |
+
+ sequence;
+ default is []+ List of additional files needed for compilation of srcs + |
+
+ module_interfaces
+ |
+
+ sequence;
+ default is unbound+ The list of module interfaces source files to be compiled. Note: this is an experimental feature, only enabled with --experimental_cpp_modules + |
+
FeatureConfiguration cc_common.configure_features(*, ctx, cc_toolchain, language=None, requested_features=[], unsupported_features=[])+ + Creates a feature_configuration instance. Requires the cpp configuration fragment. + +
| Parameter | +Description | +
|---|---|
+ ctx
+ |
+
+ ctx;
+ required + The rule context. + |
+
+ cc_toolchain
+ |
+
+ Info;
+ required + cc_toolchain for which we configure features. + |
+
+ language
+ |
+
+ string; or None;
+ default is None+ The language to configure for: either c++ or objc (default c++) + |
+
+ requested_features
+ |
+
+ sequence;
+ default is []+ List of features to be enabled. + |
+
+ unsupported_features
+ |
+
+ sequence;
+ default is []+ List of features that are unsupported by the current rule. + |
+
None cc_common.create_cc_toolchain_config_info(*, ctx, features=[], action_configs=[], artifact_name_patterns=[], cxx_builtin_include_directories=[], toolchain_identifier, host_system_name=None, target_system_name=None, target_cpu=None, target_libc=None, compiler, abi_version=None, abi_libc_version=None, tool_paths=[], make_variables=[], builtin_sysroot=None)
+
+ Creates a CcToolchainConfigInfo provider
+
+ | Parameter | +Description | +
|---|---|
+ ctx
+ |
+
+ ctx;
+ required + The rule context. + |
+
+ features
+ |
+
+ sequence;
+ default is []+ Contains all flag specifications for one feature. Arguments:
provides contains the name of a different feature or action config that we want to enable.- provides contains the same value as a 'provides' in a different feature or action config that we want to enable. Use this in order to ensure that incompatible features cannot be accidentally activated at the same time, leading to hard to diagnose compiler errors.
+ |
+
+ action_configs
+ |
+
+ sequence;
+ default is []+ An action config corresponds to a Bazel action, and allows selection of a tool based on activated features. Action config activation occurs by the same semantics as features: a feature can 'require' or 'imply' an action config in the same way that it would another feature. Arguments:
|
+
+ artifact_name_patterns
+ |
+
+ sequence;
+ default is []+ The name for an artifact of a given category of input or output artifacts to an action. Arguments:
|
+
+ cxx_builtin_include_directories
+ |
+
+ sequence;
+ default is []+ Built-in include directories for C++ compilation. These should be the exact paths used by the compiler, and are generally relative to the exec root. The paths used by the compiler can be determined by 'gcc -E -xc++ - -v'. We currently use the C++ paths also for C compilation, which is safe as long as there are no name clashes between C++ and C header files. Relative paths are resolved relative to the configuration file directory. If the compiler has --sysroot support, then these paths should use %sysroot% rather than the include path, and specify the sysroot attribute in order to give blaze the information necessary to make the correct replacements. + |
+
+ toolchain_identifier
+ |
+
+ string;
+ required + The unique identifier of the toolchain within the crosstool release. It must be possible to use this as a directory name in a path. It has to match the following regex: [a-zA-Z_][\.\- \w]* + |
+
+ host_system_name
+ |
+
+ string; or None;
+ default is None+ Ignored. + |
+
+ target_system_name
+ |
+
+ string; or None;
+ default is None+ Deprecated. The GNU System Name. The string is exposed to CcToolchainInfo.target_gnu_system_name. + |
+
+ target_cpu
+ |
+
+ string; or None;
+ default is None+ Deprecated: Use cpu based constraints instead. If the string is "k8", `target_cpu` will be omitted from the filename of raw FDO profile data. + |
+
+ target_libc
+ |
+
+ string; or None;
+ default is None+ Deprecated: Use OS based constraints instead. The libc version string (e.g. "glibc-2.2.2"). If the string is "macosx", platform is assumed to be MacOS. Otherwise, Linux. The string is exposed to CcToolchainInfo.libc. + |
+
+ compiler
+ |
+
+ string;
+ required + The compiler string (e.g. "gcc"). The current toolchain's compiler is exposed to `@bazel_tools//tools/cpp:compiler (compiler_flag)` as a flag value. Targets that require compiler-specific flags can use the config_settings in https://github.com/bazelbuild/rules_cc/blob/main/cc/compiler/BUILD in select() statements or create custom config_setting if the existing settings don't suffice. + |
+
+ abi_version
+ |
+
+ string; or None;
+ default is None+ The abi in use, which is a gcc version. E.g.: "gcc-3.4". The string is set to C++ toolchain variable ABI. + |
+
+ abi_libc_version
+ |
+
+ string; or None;
+ default is None+ The glibc version used by the abi we're using. The string is set to C++ toolchain variable ABI_LIBC_VERSION. + |
+
+ tool_paths
+ |
+
+ sequence;
+ default is []+ Tool locations. Arguments:
|
+
+ make_variables
+ |
+
+ sequence;
+ default is []+ A make variable that is made accessible to rules. + |
+
+ builtin_sysroot
+ |
+
+ string; or None;
+ default is None+ The built-in sysroot. If this attribute is not present, Bazel does not allow using a different sysroot, i.e. through the --grte_top option. + |
+
CompilationContext cc_common.create_compilation_context(*, headers=unbound, system_includes=unbound, includes=unbound, quote_includes=unbound, framework_includes=unbound, defines=unbound, local_defines=unbound)+ + Creates a
CompilationContext.
+
+ | Parameter | +Description | +
|---|---|
+ headers
+ |
+
+ default is unbound+ Set of headers needed to compile this target + |
+
+ system_includes
+ |
+
+ default is unbound+ Set of search paths for header files referenced by angle brackets, i.e. #include <foo/bar/header.h>. They can be either relative to the exec root or absolute. Usually passed with -isystem + |
+
+ includes
+ |
+
+ default is unbound+ Set of search paths for header files referenced both by angle bracket and quotes.Usually passed with -I + |
+
+ quote_includes
+ |
+
+ default is unbound+ Set of search paths for header files referenced by quotes, i.e. #include "foo/bar/header.h". They can be either relative to the exec root or absolute. Usually passed with -iquote + |
+
+ framework_includes
+ |
+
+ default is unbound+ Set of framework search paths for header files (Apple platform only) + |
+
+ defines
+ |
+
+ default is unbound+ Set of defines needed to compile this target. Each define is a string. Propagated transitively to dependents. + |
+
+ local_defines
+ |
+
+ default is unbound+ Set of defines needed to compile this target. Each define is a string. Not propagated transitively to dependents. + |
+
CcCompilationOutputs cc_common.create_compilation_outputs(*, objects=None, pic_objects=None)+ + Create compilation outputs object. + +
| Parameter | +Description | +
|---|---|
+ objects
+ |
+
+ depset; or None;
+ default is None+ List of object files. + |
+
+ pic_objects
+ |
+
+ depset; or None;
+ default is None+ List of pic object files. + |
+
Variables cc_common.create_compile_variables(*, cc_toolchain, feature_configuration, source_file=None, output_file=None, user_compile_flags=None, include_directories=None, quote_include_directories=None, system_include_directories=None, framework_include_directories=None, preprocessor_defines=None, thinlto_index=None, thinlto_input_bitcode_file=None, thinlto_output_object_file=None, use_pic=False, add_legacy_cxx_options=False, variables_extension=unbound)+ + Returns variables used for compilation actions. + +
| Parameter | +Description | +
|---|---|
+ cc_toolchain
+ |
+
+ Info;
+ required + cc_toolchain for which we are creating build variables. + |
+
+ feature_configuration
+ |
+
+ FeatureConfiguration;
+ required + Feature configuration to be queried. + |
+
+ source_file
+ |
+
+ File; or string; or None;
+ default is None+ Optional source file path for the compilation. Please prefer passing source_file here over appending it to the end of the command line generated from cc_common.get_memory_inefficient_command_line, as then it's in the power of the toolchain author to properly specify and position compiler flags. + |
+
+ output_file
+ |
+
+ File; or string; or None;
+ default is None+ Optional output file path of the compilation. Please prefer passing output_file here over appending it to the end of the command line generated from cc_common.get_memory_inefficient_command_line, as then it's in the power of the toolchain author to properly specify and position compiler flags. + |
+
+ user_compile_flags
+ |
+
+ sequence of strings; or None;
+ default is None+ List of additional compilation flags (copts). + |
+
+ include_directories
+ |
+
+ depset; or None;
+ default is None+ Depset of include directories. + |
+
+ quote_include_directories
+ |
+
+ depset; or None;
+ default is None+ Depset of quote include directories. + |
+
+ system_include_directories
+ |
+
+ depset; or None;
+ default is None+ Depset of system include directories. + |
+
+ framework_include_directories
+ |
+
+ depset; or None;
+ default is None+ Depset of framework include directories. + |
+
+ preprocessor_defines
+ |
+
+ depset; or None;
+ default is None+ Depset of preprocessor defines. + |
+
+ thinlto_index
+ |
+
+ string; or None;
+ default is None+ LTO index file path. + |
+
+ thinlto_input_bitcode_file
+ |
+
+ string; or None;
+ default is None+ Bitcode file that is input to LTO backend. + |
+
+ thinlto_output_object_file
+ |
+
+ string; or None;
+ default is None+ Object file that is output by LTO backend. + |
+
+ use_pic
+ |
+
+ bool;
+ default is False+ When true the compilation will generate position independent code. + |
+
+ add_legacy_cxx_options
+ |
+
+ bool;
+ default is False+ Unused. + |
+
+ variables_extension
+ |
+
+ dict;
+ default is unbound+ A dictionary of additional variables used by compile actions. + |
+
LibraryToLink cc_common.create_library_to_link(*, actions, feature_configuration=None, cc_toolchain=None, static_library=None, pic_static_library=None, dynamic_library=None, interface_library=None, pic_objects=unbound, objects=unbound, alwayslink=False, dynamic_library_symlink_path='', interface_library_symlink_path='')+ + Creates
LibraryToLink
+
+ | Parameter | +Description | +
|---|---|
+ actions
+ |
+
+ required + actions object.
+ |
+
+ feature_configuration
+ |
+
+ default is None+ feature_configuration to be queried.
+ |
+
+ cc_toolchain
+ |
+
+ default is None+ CcToolchainInfo provider to be used.
+ |
+
+ static_library
+ |
+
+ File; or None;
+ default is None+ File of static library to be linked.
+ |
+
+ pic_static_library
+ |
+
+ File; or None;
+ default is None+ File of pic static library to be linked.
+ |
+
+ dynamic_library
+ |
+
+ File; or None;
+ default is None+ File of dynamic library to be linked. Always used for runtime and used for linking if interface_library is not passed.
+ |
+
+ interface_library
+ |
+
+ File; or None;
+ default is None+ File of interface library to be linked.
+ |
+
+ pic_objects
+ |
+
+ sequence of Files;
+ default is unbound+ Experimental, do not use + |
+
+ objects
+ |
+
+ sequence of Files;
+ default is unbound+ Experimental, do not use + |
+
+ alwayslink
+ |
+
+ bool;
+ default is False+ Whether to link the static library/objects in the --whole_archive block. + |
+
+ dynamic_library_symlink_path
+ |
+
+ string;
+ default is ''+ Override the default path of the dynamic library link in the solib directory. Empty string to use the default. + |
+
+ interface_library_symlink_path
+ |
+
+ string;
+ default is ''+ Override the default path of the interface library link in the solib directory. Empty string to use the default. + |
+
Variables cc_common.create_link_variables(*, cc_toolchain, feature_configuration, library_search_directories=[], runtime_library_search_directories=[], user_link_flags=[], output_file=None, param_file=None, is_using_linker=True, is_linking_dynamic_library=False, must_keep_debug=True, use_test_only_flags=False, is_static_linking_mode=True)+ + Returns link variables used for linking actions. + +
| Parameter | +Description | +
|---|---|
+ cc_toolchain
+ |
+
+ Info;
+ required + cc_toolchain for which we are creating build variables. + |
+
+ feature_configuration
+ |
+
+ FeatureConfiguration;
+ required + Feature configuration to be queried. + |
+
+ library_search_directories
+ |
+
+ depset;
+ default is []+ Depset of directories where linker will look for libraries at link time. + |
+
+ runtime_library_search_directories
+ |
+
+ depset;
+ default is []+ Depset of directories where loader will look for libraries at runtime. + |
+
+ user_link_flags
+ |
+
+ sequence;
+ default is []+ List of additional link flags (linkopts). + |
+
+ output_file
+ |
+
+ default is None+ Optional output file path. + |
+
+ param_file
+ |
+
+ default is None+ Optional param file path. + |
+
+ is_using_linker
+ |
+
+ bool;
+ default is True+ True when using linker, False when archiver. Caller is responsible for keeping this in sync with action name used (is_using_linker = True for linking executable or dynamic library, is_using_linker = False for archiving static library). + |
+
+ is_linking_dynamic_library
+ |
+
+ bool;
+ default is False+ True when creating dynamic library, False when executable or static library. Caller is responsible for keeping this in sync with action name used. This field will be removed once b/65151735 is fixed. + |
+
+ must_keep_debug
+ |
+
+ bool;
+ default is True+ When set to False, bazel will expose 'strip_debug_symbols' variable, which is usually used to use the linker to strip debug symbols from the output file. + |
+
+ use_test_only_flags
+ |
+
+ bool;
+ default is False+ When set to true, 'is_cc_test' variable will be set. + |
+
+ is_static_linking_mode
+ |
+
+ bool;
+ default is True+ Unused. + |
+
LinkerInput cc_common.create_linker_input(*, owner, libraries=None, user_link_flags=None, additional_inputs=None)+ + Creates a
LinkerInput.
+
+ | Parameter | +Description | +
|---|---|
+ owner
+ |
+
+ Label;
+ required + The label of the target that produced all files used in this input. + |
+
+ libraries
+ |
+
+ None; or depset;
+ default is None+ List of LibraryToLink.
+ |
+
+ user_link_flags
+ |
+
+ None; or depset of strings; or sequence of strings;
+ default is None+ User link flags passed as strings. Accepts either [String], [[String]] or depset(String). The latter is discouraged as it's only kept for compatibility purposes, the depset is flattened. If you want to propagate user_link_flags via unflattened depsets() wrap them in a LinkerInput so that they are not flattened till the end. + |
+
+ additional_inputs
+ |
+
+ None; or depset;
+ default is None+ For additional inputs to the linking action, e.g.: linking scripts. + |
+
LinkingContext cc_common.create_linking_context(*, linker_inputs)+ + Creates a
LinkingContext.
+
+ | Parameter | +Description | +
|---|---|
+ linker_inputs
+ |
+
+ depset;
+ required + Depset of LinkerInput.
+ |
+
tuple cc_common.create_linking_context_from_compilation_outputs(*, actions, name, feature_configuration, cc_toolchain, language='c++', disallow_static_libraries=False, disallow_dynamic_library=False, compilation_outputs, linking_contexts=[], user_link_flags=[], alwayslink=False, additional_inputs=[], variables_extension=unbound)+ + Should be used for creating library rules that can propagate information downstream in order to be linked later by a top level rule that does transitive linking to create an executable or a dynamic library. Returns tuple of (
CcLinkingContext, CcLinkingOutputs).
+
+ | Parameter | +Description | +
|---|---|
+ actions
+ |
+
+ actions;
+ required + actions object.
+ |
+
+ name
+ |
+
+ string;
+ required + This is used for naming the output artifacts of actions created by this method. + |
+
+ feature_configuration
+ |
+
+ FeatureConfiguration;
+ required + feature_configuration to be queried.
+ |
+
+ cc_toolchain
+ |
+
+ Info;
+ required + CcToolchainInfo provider to be used.
+ |
+
+ language
+ |
+
+ string;
+ default is 'c++'+ Only C++ supported for now. Do not use this parameter. + |
+
+ disallow_static_libraries
+ |
+
+ bool;
+ default is False+ Whether static libraries should be created. + |
+
+ disallow_dynamic_library
+ |
+
+ bool;
+ default is False+ Whether a dynamic library should be created. + |
+
+ compilation_outputs
+ |
+
+ CcCompilationOutputs;
+ required + Compilation outputs containing object files to link. + |
+
+ linking_contexts
+ |
+
+ sequence;
+ default is []+ Libraries from dependencies. These libraries will be linked into the output artifact of the link() call, be it a binary or a library. + |
+
+ user_link_flags
+ |
+
+ sequence;
+ default is []+ Additional list of linking options. + |
+
+ alwayslink
+ |
+
+ bool;
+ default is False+ Whether this library should always be linked. + |
+
+ additional_inputs
+ |
+
+ sequence;
+ default is []+ For additional inputs to the linking action, e.g.: linking scripts. + |
+
+ variables_extension
+ |
+
+ dict;
+ default is unbound+ Additional variables to pass to the toolchain configuration when creating link command line. + |
+
LtoCompilationContext cc_common.create_lto_compilation_context(*, objects={})
+
+ Create LTO compilation context
+
+ | Parameter | +Description | +
|---|---|
+ objects
+ |
+
+ dict;
+ default is {}+ map of full object to index object + |
+
None cc_common.do_not_use_tools_cpp_compiler_present
+
+ Do not use this field, its only purpose is to help with migration from config_setting.values{'compiler') to config_settings.flag_values{'@bazel_tools//tools/cpp:compiler'}
+
+ dict cc_common.get_environment_variables(*, feature_configuration, action_name, variables)+ + Returns environment variables to be set for given action. + +
| Parameter | +Description | +
|---|---|
+ feature_configuration
+ |
+
+ FeatureConfiguration;
+ required + Feature configuration to be queried. + |
+
+ action_name
+ |
+
+ string;
+ required + Name of the action. Has to be one of the names in @bazel_tools//tools/build_defs/cc:action_names.bzl (https://github.com/bazelbuild/bazel/blob/master/tools/build_defs/cc/action_names.bzl) + |
+
+ variables
+ |
+
+ Variables;
+ required + Build variables to be used for template expansion. + |
+
sequence cc_common.get_execution_requirements(*, feature_configuration, action_name)+ + Returns execution requirements for given action. + +
| Parameter | +Description | +
|---|---|
+ feature_configuration
+ |
+
+ FeatureConfiguration;
+ required + Feature configuration to be queried. + |
+
+ action_name
+ |
+
+ string;
+ required + Name of the action. Has to be one of the names in @bazel_tools//tools/build_defs/cc:action_names.bzl (https://github.com/bazelbuild/bazel/blob/master/tools/build_defs/cc/action_names.bzl) + |
+
sequence cc_common.get_memory_inefficient_command_line(*, feature_configuration, action_name, variables)+ + Returns flattened command line flags for given action, using given variables for expansion. Flattens nested sets and ideally should not be used, or at least should not outlive analysis. Work on memory efficient function returning Args is ongoing. + +
| Parameter | +Description | +
|---|---|
+ feature_configuration
+ |
+
+ FeatureConfiguration;
+ required + Feature configuration to be queried. + |
+
+ action_name
+ |
+
+ string;
+ required + Name of the action. Has to be one of the names in @bazel_tools//tools/build_defs/cc:action_names.bzl (https://github.com/bazelbuild/bazel/blob/master/tools/build_defs/cc/action_names.bzl) + |
+
+ variables
+ |
+
+ Variables;
+ required + Build variables to be used for template expansions. + |
+
string cc_common.get_tool_for_action(*, feature_configuration, action_name)+ + Returns tool path for given action. + +
| Parameter | +Description | +
|---|---|
+ feature_configuration
+ |
+
+ FeatureConfiguration;
+ required + Feature configuration to be queried. + |
+
+ action_name
+ |
+
+ string;
+ required + Name of the action. Has to be one of the names in @bazel_tools//tools/build_defs/cc:action_names.bzl (https://github.com/bazelbuild/bazel/blob/master/tools/build_defs/cc/action_names.bzl) + |
+
bool cc_common.is_enabled(*, feature_configuration, feature_name)+ + Returns True if given feature is enabled in the feature configuration. + +
| Parameter | +Description | +
|---|---|
+ feature_configuration
+ |
+
+ FeatureConfiguration;
+ required + Feature configuration to be queried. + |
+
+ feature_name
+ |
+
+ string;
+ required + Name of the feature. + |
+
CcLinkingOutputs cc_common.link(*, actions, name, feature_configuration, cc_toolchain, language='c++', output_type='executable', link_deps_statically=True, compilation_outputs=None, linking_contexts=[], user_link_flags=[], stamp=0, additional_inputs=[], additional_outputs=[], variables_extension={})+ + Should be used for C++ transitive linking. + +
| Parameter | +Description | +
|---|---|
+ actions
+ |
+
+ actions;
+ required + actions object.
+ |
+
+ name
+ |
+
+ string;
+ required + This is used for naming the output artifacts of actions created by this method. + |
+
+ feature_configuration
+ |
+
+ FeatureConfiguration;
+ required + feature_configuration to be queried.
+ |
+
+ cc_toolchain
+ |
+
+ Info;
+ required + CcToolchainInfo provider to be used.
+ |
+
+ language
+ |
+
+ string;
+ default is 'c++'+ Only C++ supported for now. Do not use this parameter. + |
+
+ output_type
+ |
+
+ string;
+ default is 'executable'+ Can be either 'executable' or 'dynamic_library'. + |
+
+ link_deps_statically
+ |
+
+ bool;
+ default is True+ True to link dependencies statically, False dynamically. + |
+
+ compilation_outputs
+ |
+
+ CcCompilationOutputs; or None;
+ default is None+ Compilation outputs containing object files to link. + |
+
+ linking_contexts
+ |
+
+ sequence;
+ default is []+ Linking contexts from dependencies to be linked into the linking context generated by this rule. + |
+
+ user_link_flags
+ |
+
+ sequence;
+ default is []+ Additional list of linker options. + |
+
+ stamp
+ |
+
+ int;
+ default is 0+ Whether to include build information in the linked executable, if output_type is 'executable'. If 1, build information is always included. If 0 (the default build information is always excluded. If -1, uses the default behavior, which may be overridden by the --[no]stamp flag. This should be unset (or set to 0) when generating the executable output for test rules. + |
+
+ additional_inputs
+ |
+
+ sequence; or depset;
+ default is []+ For additional inputs to the linking action, e.g.: linking scripts. + |
+
+ additional_outputs
+ |
+
+ sequence;
+ default is []+ For additional outputs to the linking action, e.g.: map files. + |
+
+ variables_extension
+ |
+
+ dict;
+ default is {}+ Additional variables to pass to the toolchain configuration when create link command line. + |
+
unknown cc_common.merge_cc_infos(*, direct_cc_infos=[], cc_infos=[])+ + Merges multiple
CcInfos into one.
+
+ | Parameter | +Description | +
|---|---|
+ direct_cc_infos
+ |
+
+ sequence;
+ default is []+ List of CcInfos to be merged, whose headers will be exported by the direct fields in the returned provider.
+ |
+
+ cc_infos
+ |
+
+ sequence;
+ default is []+ List of CcInfos to be merged, whose headers will not be exported by the direct fields in the returned provider.
+ |
+
CompilationContext cc_common.merge_compilation_contexts(*, compilation_contexts=[])+ + Merges multiple
CompilationContextss into one.
+
+ | Parameter | +Description | +
|---|---|
+ compilation_contexts
+ |
+
+ sequence;
+ default is []+ List of CompilationContextss to be merged. The headers of each context will be exported by the direct fields in the returned provider.
+ |
+
CcCompilationOutputs cc_common.merge_compilation_outputs(*, compilation_outputs=[])+ + Merge compilation outputs. + +
| Parameter | +Description | +
|---|---|
+ compilation_outputs
+ |
+
+ sequence;
+ default is []+ + |
+
ex: the following rule is marked as a build setting by setting the build_setting parameter of the rule() function. Specifically it is a build setting of type int and is a flag which means this build setting is callable on the command line.
my_rule = rule( + implementation = _impl, + build_setting = config.int(flag = True), + ... + )+ +
BuildSetting config.bool(*, flag=False)+ + A bool-typed build setting + +
| Parameter | +Description | +
|---|---|
+ flag
+ |
+
+ bool;
+ default is False+ Whether or not this build setting is callable on the command line. + |
+
ExecTransitionFactory config.exec(exec_group=None)+ + Creates an execution transition. + +
| Parameter | +Description | +
|---|---|
+ exec_group
+ |
+
+ string; or None;
+ default is None+ The name of the exec group whose execution platform this transition will use. If not provided, this exec transition will use the target's default execution platform. + |
+
BuildSetting config.int(*, flag=False)+ + An integer-typed build setting + +
| Parameter | +Description | +
|---|---|
+ flag
+ |
+
+ bool;
+ default is False+ Whether or not this build setting is callable on the command line. + |
+
transition config.none()+ + Creates a transition which removes all configuration, unsetting all flags. Intended for the case where a dependency is data-only and contains no code that needs to be built, but should only be analyzed once. + +
BuildSetting config.string(*, flag=False, allow_multiple=False)+ + A string-typed build setting + +
| Parameter | +Description | +
|---|---|
+ flag
+ |
+
+ bool;
+ default is False+ Whether or not this build setting is callable on the command line. + |
+
+ allow_multiple
+ |
+
+ bool;
+ default is False+ Deprecated, use a string_list setting with repeatable = True instead. If set, this flag is allowed to be set multiple times on the command line. The Value of the flag as accessed in transitions and build setting implementation function will be a list of strings. Insertion order and repeated values are both maintained. This list can be post-processed in the build setting implementation function if different behavior is desired.
+ |
+
BuildSetting config.string_list(*, flag=False, repeatable=False)+ + A string list-typed build setting. On the command line pass a list using comma-separated value like
--//my/setting=foo,bar.
+
+ | Parameter | +Description | +
|---|---|
+ flag
+ |
+
+ bool;
+ default is False+ Whether or not this build setting is callable on the command line. + |
+
+ repeatable
+ |
+
+ bool;
+ default is False+ If set, instead of expecting a comma-separated value, this flag is allowed to be set multiple times on the command line with each individual value treated as a single string to add to the list value. Insertion order and repeated values are both maintained. This list can be post-processed in the build setting implementation function if different behavior is desired. + |
+
BuildSetting config.string_set(*, flag=False, repeatable=False)+ + A string set-typed build setting. The value of this setting will be a set of strings in Starlark. On the command line, pass a set using a comma-separated value like
--//my/setting=foo,bar.Unlike with a string_list, the order of the elements doesn't matter and only a single instance of each element is maintained. This is recommended over string_list for flags where these properties are not needed as it can improve build performance by avoiding unnecessary configurations forking.
+
+
| Parameter | +Description | +
|---|---|
+ flag
+ |
+
+ bool;
+ default is False+ Whether or not this build setting is callable on the command line. + |
+
+ repeatable
+ |
+
+ bool;
+ default is False+ If set, instead of expecting a comma-separated value, this flag is allowed to be set multiple times on the command line with each individual value treated as a single string to add to the set value. Only a single instance of repeated values is maintained and the insertion order does not matter. + |
+
transition config.target()+ + Creates a target transition. This is a no-op transition intended for the case where a transition object is needed, but doesn't want to actually change anything. Equivalent to
cfg = "target" in attr.label().
+
+
+
+
+
+
diff --git a/rules/lib/toplevel/config_common.mdx b/rules/lib/toplevel/config_common.mdx
new file mode 100644
index 0000000..49cc61a
--- /dev/null
+++ b/rules/lib/toplevel/config_common.mdx
@@ -0,0 +1,81 @@
+---
+title: 'config_common'
+---
+
+
+
+
+
+
+
+
+Provider config_common.FeatureFlagInfo+ + The key used to retrieve the provider containing config_feature_flag's value. + +
toolchain_type config_common.toolchain_type(name, *, mandatory=True)+ + Declare a rule's dependency on a toolchain type. + +
| Parameter | +Description | +
|---|---|
+ name
+ |
+
+ string; or Label;
+ required + The toolchain type that is required. + |
+
+ mandatory
+ |
+
+ bool;
+ default is True+ Whether the toolchain type is mandatory or optional. + |
+
InstrumentedFilesInfo coverage_common.instrumented_files_info(ctx, *, source_attributes=[], dependency_attributes=[], extensions=None, metadata_files=[], baseline_coverage_files=None)+ + Creates a new InstrumentedFilesInfo instance. Use this provider to communicate coverage-related attributes of the current build rule. + +
| Parameter | +Description | +
|---|---|
+ ctx
+ |
+
+ ctx;
+ required + The rule context. + |
+
+ source_attributes
+ |
+
+ sequence;
+ default is []+ A list of attribute names which contain source files processed by this rule. + |
+
+ dependency_attributes
+ |
+
+ sequence;
+ default is []+ A list of attribute names which might provide runtime dependencies (either code dependencies or runfiles). + |
+
+ extensions
+ |
+
+ sequence of strings; or None;
+ default is None+ File extensions used to filter files from source_attributes. For example, 'js'. If not provided (or None), then all files from source_attributes will be added to instrumented files, if an empty list is provided, then no files from source attributes will be added. + |
+
+ metadata_files
+ |
+
+ sequence of Files;
+ default is []+ Additional files required to generate coverage LCOV files after code execution. e.g. .gcno files for C++. + |
+
+ baseline_coverage_files
+ |
+
+ sequence of Files; or None;
+ default is None+ + |
+
Provider java_common.BootClassPathInfo+ + The provider used to supply bootclasspath information + +
struct java_common.compile(ctx, *, source_jars=[], source_files=[], output, output_source_jar=None, javac_opts=[], deps=[], runtime_deps=[], exports=[], plugins=[], exported_plugins=[], native_libraries=[], annotation_processor_additional_inputs=[], annotation_processor_additional_outputs=[], strict_deps='ERROR', java_toolchain, bootclasspath=None, sourcepath=[], resources=[], resource_jars=[], classpath_resources=[], neverlink=False, enable_annotation_processing=True, enable_compile_jar_action=True, add_exports=[], add_opens=[])+ + Compiles Java source files/jars from the implementation of a Starlark rule and returns a provider that represents the results of the compilation and can be added to the set of providers emitted by this rule. + +
| Parameter | +Description | +
|---|---|
+ ctx
+ |
+
+ ctx;
+ required + The rule context. + |
+
+ source_jars
+ |
+
+ sequence of Files;
+ default is []+ A list of the jars to be compiled. At least one of source_jars or source_files should be specified. + |
+
+ source_files
+ |
+
+ sequence of Files;
+ default is []+ A list of the Java source files to be compiled. At least one of source_jars or source_files should be specified. + |
+
+ output
+ |
+
+ File;
+ required + + |
+
+ output_source_jar
+ |
+
+ File; or None;
+ default is None+ The output source jar. Defaults to `{output_jar}-src.jar` if unset. + |
+
+ javac_opts
+ |
+
+ sequence of strings;
+ default is []+ A list of the desired javac options. + |
+
+ deps
+ |
+
+ sequence of structs;
+ default is []+ A list of dependencies. + |
+
+ runtime_deps
+ |
+
+ sequence of structs;
+ default is []+ A list of runtime dependencies. + |
+
+ exports
+ |
+
+ sequence of structs;
+ default is []+ A list of exports. + |
+
+ plugins
+ |
+
+ sequence of structs; or sequence of structs;
+ default is []+ A list of plugins. + |
+
+ exported_plugins
+ |
+
+ sequence of structs; or sequence of structs;
+ default is []+ A list of exported plugins. + |
+
+ native_libraries
+ |
+
+ sequence of CcInfos;
+ default is []+ CC native library dependencies that are needed for this library. + |
+
+ annotation_processor_additional_inputs
+ |
+
+ sequence of Files;
+ default is []+ A list of inputs that the Java compilation action will take in addition to the Java sources for annotation processing. + |
+
+ annotation_processor_additional_outputs
+ |
+
+ sequence of Files;
+ default is []+ A list of outputs that the Java compilation action will output in addition to the class jar from annotation processing. + |
+
+ strict_deps
+ |
+
+ string;
+ default is 'ERROR'+ A string that specifies how to handle strict deps. Possible values: 'OFF', 'ERROR', 'WARN' and 'DEFAULT'. For more details see --strict_java_deps. By default 'ERROR'.
+ |
+
+ java_toolchain
+ |
+
+ Info;
+ required + A JavaToolchainInfo to be used for this compilation. Mandatory. + |
+
+ bootclasspath
+ |
+
+ default is None+ A BootClassPathInfo to be used for this compilation. If present, overrides the bootclasspath associated with the provided java_toolchain. + |
+
+ sourcepath
+ |
+
+ sequence of Files;
+ default is []+ + |
+
+ resources
+ |
+
+ sequence of Files;
+ default is []+ + |
+
+ resource_jars
+ |
+
+ sequence of Files;
+ default is []+ + |
+
+ classpath_resources
+ |
+
+ sequence of Files;
+ default is []+ + |
+
+ neverlink
+ |
+
+ bool;
+ default is False+ + |
+
+ enable_annotation_processing
+ |
+
+ bool;
+ default is True+ Disables annotation processing in this compilation, causing any annotation processors provided in plugins or in exported_plugins of deps to be ignored. + |
+
+ enable_compile_jar_action
+ |
+
+ bool;
+ default is True+ Enables header compilation or ijar creation. If set to False, it forces use of the full class jar in the compilation classpaths of any dependants. Doing so is intended for use by non-library targets such as binaries that do not have dependants. + |
+
+ add_exports
+ |
+
+ sequence of strings;
+ default is []+ Allow this library to access the given |
+
+ add_opens
+ |
+
+ sequence of strings;
+ default is []+ Allow this library to reflectively access the given |
+
Provider java_common.JavaRuntimeInfo+ + The key used to retrieve the provider that contains information about the Java runtime being used. + +
Provider java_common.JavaToolchainInfo+ + The key used to retrieve the provider that contains information about the Java toolchain being used. + +
struct java_common.merge(providers)+ + Merges the given providers into a single JavaInfo. + +
| Parameter | +Description | +
|---|---|
+ providers
+ |
+
+ sequence of structs;
+ required + The list of providers to merge. + |
+
File java_common.pack_sources(actions, *, output_source_jar=None, sources=[], source_jars=[], java_toolchain)+ + Packs sources and source jars into a single source jar file. The return value is typically passed to
JavaInfo#source_jar
| Parameter | +Description | +
|---|---|
+ actions
+ |
+
+ actions;
+ required + ctx.actions + |
+
+ output_source_jar
+ |
+
+ File; or None;
+ default is None+ The output source jar. + |
+
+ sources
+ |
+
+ sequence of Files;
+ default is []+ A list of Java source files to be packed into the source jar. + |
+
+ source_jars
+ |
+
+ sequence of Files;
+ default is []+ A list of source jars to be packed into the source jar. + |
+
+ java_toolchain
+ |
+
+ Info;
+ required + A JavaToolchainInfo to used to find the ijar tool. + |
+
File java_common.run_ijar(actions, *, jar, target_label=None, java_toolchain)+ + Runs ijar on a jar, stripping it of its method bodies. This helps reduce rebuilding of dependent jars during any recompiles consisting only of simple changes to method implementations. The return value is typically passed to
JavaInfo#compile_jar.
+
+ | Parameter | +Description | +
|---|---|
+ actions
+ |
+
+ actions;
+ required + ctx.actions + |
+
+ jar
+ |
+
+ File;
+ required + The jar to run ijar on. + |
+
+ target_label
+ |
+
+ Label; or None;
+ default is None+ A target label to stamp the jar with. Used for add_dep support. Typically, you would pass ctx.label to stamp the jar with the current rule's label.
+ |
+
+ java_toolchain
+ |
+
+ Info;
+ required + A JavaToolchainInfo to used to find the ijar tool. + |
+
File java_common.stamp_jar(actions, *, jar, target_label, java_toolchain)+ + Stamps a jar with a target label for
add_dep support. The return value is typically passed to JavaInfo#compile_jar. Prefer to use run_ijar when possible.
+
+ | Parameter | +Description | +
|---|---|
+ actions
+ |
+
+ actions;
+ required + ctx.actions + |
+
+ jar
+ |
+
+ File;
+ required + The jar to run stamp_jar on. + |
+
+ target_label
+ |
+
+ Label;
+ required + A target label to stamp the jar with. Used for add_dep support. Typically, you would pass ctx.label to stamp the jar with the current rule's label.
+ |
+
+ java_toolchain
+ |
+
+ Info;
+ required + A JavaToolchainInfo to used to find the stamp_jar tool. + |
+
native.cc_library. Note that the native module is only available in the loading phase (i.e. for macros, not for rule implementations). Attributes will ignore None values, and treat them as if the attribute was unset.unknown native.existing_rule(name)+ + Returns an immutable dict-like object that describes the attributes of a rule instantiated in this thread's package, or
None if no rule instance of that name exists.Here, an immutable dict-like object means a deeply immutable object x supporting dict-like iteration, len(x), name in x, x[name], x.get(name), x.items(), x.keys(), and x.values().
The result contains an entry for each attribute, with the exception of private ones (whose names do not start with a letter) and a few unrepresentable legacy attribute types. In addition, the dict contains entries for the rule instance's name and kind (for example, 'cc_binary').
The values of the result represent attribute values as follows:
':foo' for targets in the same package or '//pkg:name' for targets in a different package.select values are returned with their contents transformed as described above.If possible, use this function only in implementation functions of rule finalizer symbolic macros. Use of this function in other contexts is not recommened, and will be disabled in a future Bazel release; it makes BUILD files brittle and order-dependent. Also, beware that it differs subtly from the two other conversions of rule attribute values from internal form to Starlark: one used by computed defaults, the other used by ctx.attr.foo.
+
+
| Parameter | +Description | +
|---|---|
+ name
+ |
+
+ string;
+ required + The name of the target. + |
+
unknown native.existing_rules()+ + Returns an immutable dict-like object describing the rules so far instantiated in this thread's package. Each entry of the dict-like object maps the name of the rule instance to the result that would be returned by
existing_rule(name).Here, an immutable dict-like object means a deeply immutable object x supporting dict-like iteration, len(x), name in x, x[name], x.get(name), x.items(), x.keys(), and x.values().
If possible, use this function only in implementation functions of rule finalizer symbolic macros. Use of this function in other contexts is not recommened, and will be disabled in a future Bazel release; it makes BUILD files brittle and order-dependent.
+
+
None native.exports_files(srcs, visibility=None, licenses=None)
+
+ Specifies a list of files belonging to this package that are exported to other packages.
+
+ | Parameter | +Description | +
|---|---|
+ srcs
+ |
+
+ sequence of strings;
+ required + The list of files to export. + |
+
+ visibility
+ |
+
+ sequence; or None;
+ default is None+ A visibility declaration can to be specified. The files will be visible to the targets specified. If no visibility is specified, the files will be visible to every package. + |
+
+ licenses
+ |
+
+ sequence of strings; or None;
+ default is None+ Licenses to be specified. + |
+
sequence native.glob(include=[], exclude=[], exclude_directories=1, allow_empty=unbound)+ + Glob returns a new, mutable, sorted list of every file in the current package that:
include.exclude (default []).exclude_directories argument is enabled (set to 1), files of type directory will be omitted from the results (default 1).
+
+ | Parameter | +Description | +
|---|---|
+ include
+ |
+
+ sequence of strings;
+ default is []+ The list of glob patterns to include. + |
+
+ exclude
+ |
+
+ sequence of strings;
+ default is []+ The list of glob patterns to exclude. + |
+
+ exclude_directories
+ |
+
+ int;
+ default is 1+ A flag whether to exclude directories or not. + |
+
+ allow_empty
+ |
+
+ default is unbound+ Whether we allow glob patterns to match nothing. If `allow_empty` is False, each individual include pattern must match something and also the final result must be non-empty (after the matches of the `exclude` patterns are excluded). + |
+
string native.module_name()+ + The name of the Bazel module associated with the repo this package is in. If this package is from a repo defined in WORKSPACE instead of MODULE.bazel, this is empty. For repos generated by module extensions, this is the name of the module hosting the extension. It's the same as the
module.name field seen in module_ctx.modules.
+ May return None.
+
+ string native.module_version()+ + The version of the Bazel module associated with the repo this package is in. If this package is from a repo defined in WORKSPACE instead of MODULE.bazel, this is empty. For repos generated by module extensions, this is the version of the module hosting the extension. It's the same as the
module.version field seen in module_ctx.modules.
+ May return None.
+
+ List native.package_default_visibility()+ + Returns the default visibility of the package being evaluated. This is the value of the
default_visibility parameter of package(), extended to include the package itself.
+
+ None native.package_group(*, name, packages=[], includes=[])
+
+ This function defines a set of packages and assigns a label to the group. The label can be referenced in visibility attributes.
+
+ | Parameter | +Description | +
|---|---|
+ name
+ |
+
+ string;
+ required + The unique name for this rule. + |
+
+ packages
+ |
+
+ sequence of strings;
+ default is []+ A complete enumeration of packages in this group. + |
+
+ includes
+ |
+
+ sequence of strings;
+ default is []+ Other package groups that are included in this one. + |
+
string native.package_name()+ + The name of the package being evaluated, without the repository name. For example, in the BUILD file
some/package/BUILD, its value will be some/package. If the BUILD file calls a function defined in a .bzl file, package_name() will match the caller BUILD file package. The value will always be an empty string for the root package.
+
+ Label native.package_relative_label(input)+ + Converts the input string into a Label object, in the context of the package currently being initialized (that is, the
BUILD file for which the current macro is executing). If the input is already a Label, it is returned unchanged.This function may only be called while evaluating a BUILD file and the macros it directly or indirectly calls; it may not be called in (for instance) a rule implementation function.
The result of this function is the same Label value as would be produced by passing the given string to a label-valued attribute of a target declared in the BUILD file.
Usage note: The difference between this function and Label() is that Label() uses the context of the package of the .bzl file that called it, not the package of the BUILD file. Use Label() when you need to refer to a fixed target that is hardcoded into the macro, such as a compiler. Use package_relative_label() when you need to normalize a label string supplied by the BUILD file to a Label object. (There is no way to convert a string to a Label in the context of a package other than the BUILD file or the calling .bzl file. For that reason, outer macros should always prefer to pass Label objects to inner macros rather than label strings.)
+
+
| Parameter | +Description | +
|---|---|
+ input
+ |
+
+ string; or Label;
+ required + The input label string or Label object. If a Label object is passed, it's returned as is. + |
+
string native.repo_name()+ + The canonical name of the repository containing the package currently being evaluated, with no leading at-signs. + +
string native.repository_name()+ + Experimental. This API is experimental and may change at any time. Please do not depend on it. It may be enabled on an experimental basis by setting
--+incompatible_enable_deprecated_label_apis repo_name instead, which doesn't contain the spurious leading at-sign, but behaves identically otherwise.The canonical name of the repository containing the package currently being evaluated, with a single at-sign (@) prefixed. For example, in packages that are called into existence by the WORKSPACE stanza local_repository(name='local', path=...) it will be set to @local. In packages in the main repository, it will be set to @.
+
+
sequence native.subpackages(*, include, exclude=[], allow_empty=False)+ + Returns a new mutable list of every direct subpackage of the current package, regardless of file-system directory depth. List returned is sorted and contains the names of subpackages relative to the current package. It is advised to prefer using the methods in bazel_skylib.subpackages module rather than calling this function directly. + +
| Parameter | +Description | +
|---|---|
+ include
+ |
+
+ sequence of strings;
+ required + The list of glob patterns to include in subpackages scan. + |
+
+ exclude
+ |
+
+ sequence of strings;
+ default is []+ The list of glob patterns to exclude from subpackages scan. + |
+
+ allow_empty
+ |
+
+ bool;
+ default is False+ Whether we fail if the call returns an empty list. By default empty list indicates potential error in BUILD file where the call to subpackages() is superflous. Setting to true allows this function to succeed in that case. + |
+
Provider platform_common.ConstraintSettingInfo+ + The constructor/key for the ConstraintSettingInfo provider.
--experimental_platforms_api
+
+ Provider platform_common.ConstraintValueInfo+ + The constructor/key for the ConstraintValueInfo provider.
--experimental_platforms_api
+
+ Provider platform_common.PlatformInfo+ + The constructor/key for the PlatformInfo provider.
--experimental_platforms_api
+
+ Provider platform_common.TemplateVariableInfo+ + The constructor/key for the TemplateVariableInfo provider. + +
Provider platform_common.ToolchainInfo+ + The constructor/key for the ToolchainInfo provider. + + + + + + diff --git a/rules/lib/toplevel/proto.mdx b/rules/lib/toplevel/proto.mdx new file mode 100644 index 0000000..8ff60a7 --- /dev/null +++ b/rules/lib/toplevel/proto.mdx @@ -0,0 +1,115 @@ +--- +title: 'proto' +--- + + + + + + + + +
string proto.encode_text(x)+ + Returns the struct argument's encoding as a text-format protocol message. +The data structure must be recursively composed of strings, ints, floats, or bools, or structs, sequences, and dicts of these types. +
A struct is converted to a message. Fields are emitted in name order. +Each struct field whose value is None is ignored. +
A sequence (such as a list or tuple) is converted to a repeated field. +Its elements must not be sequences or dicts. +
A dict is converted to a repeated field of messages with fields named 'key' and 'value'.
+Entries are emitted in iteration (insertion) order.
+The dict's keys must be strings or ints, and its values must not be sequences or dicts.
+Examples:
proto.encode_text(struct(field=123))
+# field: 123
+
+proto.encode_text(struct(field=True))
+# field: true
+
+proto.encode_text(struct(field=[1, 2, 3]))
+# field: 1
+# field: 2
+# field: 3
+
+proto.encode_text(struct(field='text', ignored_field=None))
+# field: "text"
+
+proto.encode_text(struct(field=struct(inner_field='text', ignored_field=None)))
+# field {
+# inner_field: "text"
+# }
+
+proto.encode_text(struct(field=[struct(inner_field=1), struct(inner_field=2)]))
+# field {
+# inner_field: 1
+# }
+# field {
+# inner_field: 2
+# }
+
+proto.encode_text(struct(field=struct(inner_field=struct(inner_inner_field='text'))))
+# field {
+# inner_field {
+# inner_inner_field: "text"
+# }
+# }
+
+proto.encode_text(struct(foo={4: 3, 2: 1}))
+# foo: {
+# key: 4
+# value: 3
+# }
+# foo: {
+# key: 2
+# value: 1
+# }
+
+
+ | Parameter | +Description | +
|---|---|
+ x
+ |
+
+ structure; or NativeInfo;
+ required + + |
+
None testing.analysis_test(name, implementation, attrs={}, fragments=[], toolchains=[], attr_values={})
+
+ Creates a new analysis test target. The number of transitive dependencies of the test are limited. The limit is controlled by --analysis_testing_deps_limit flag.
+
+
| Parameter | +Description | +
|---|---|
+ name
+ |
+
+ string;
+ required + Name of the target. It should be a Starlark identifier, matching pattern '[A-Za-z_][A-Za-z0-9_]*'. + |
+
+ implementation
+ |
+
+ function;
+ required + The Starlark function implementing this analysis test. It must have exactly one parameter: ctx. The function is called during the analysis phase. It can access the attributes declared by attrs and populated via attr_values. The implementation function may not register actions. Instead, it must register a pass/fail result via providing AnalysisTestResultInfo.
+ |
+
+ attrs
+ |
+
+ dict;
+ default is {}+ Dictionary declaring the attributes. See the rule call. Attributes are allowed to use configuration transitions defined using analysis_test_transition. + |
+
+ fragments
+ |
+
+ sequence of strings;
+ default is []+ List of configuration fragments that are available to the implementation of the analysis test. + |
+
+ toolchains
+ |
+
+ sequence;
+ default is []+ The set of toolchains the test requires. See the rule call. + |
+
+ attr_values
+ |
+
+ dict of strings;
+ default is {}+ Dictionary of attribute values to pass to the implementation. + |
+
ExecutionInfo testing.ExecutionInfo+ + testing.ExecutionInfo provider key/constructor + +
RunEnvironmentInfo testing.TestEnvironment(environment, inherited_environment=[])+ + Deprecated: Use RunEnvironmentInfo instead. Creates a new test environment provider. Use this provider to specify extra environment variables to be made available during test execution. + +
| Parameter | +Description | +
|---|---|
+ environment
+ |
+
+ dict;
+ required + A map of string keys and values that represent environment variables and their values. These will be made available during the test execution. + |
+
+ inherited_environment
+ |
+
+ sequence of strings;
+ default is []+ A sequence of names of environment variables. These variables are made available during the test execution with their current value taken from the shell environment. If a variable is contained in both environment and inherited_environment, the value inherited from the shell environment will take precedence if set.
+ |
+
cc_binary(name, deps, srcs, data, additional_linker_inputs, args, aspect_hints, compatible_with, conlyopts, copts, cxxopts, defines, deprecation, distribs, dynamic_deps, env, exec_compatible_with, exec_group_compatible_with, exec_properties, features, hdrs_check, includes, licenses, link_extra_lib, linkopts, linkshared, linkstatic, local_defines, malloc, module_interfaces, nocopts, output_licenses, package_metadata, reexport_deps, restricted_to, stamp, tags, target_compatible_with, testonly, toolchains, visibility, win_def_file)+It produces an executable binary. -
It produces an executable binary.
- -name of the target should be the same as the name of the
+
+The `name` of the target should be the same as the name of the
source file that is the main entry point of the application (minus the extension).
-For example, if your entry point is in main.cc, then your name should
-be main.
+For example, if your entry point is in `main.cc`, then your name should
+be `main`.
-name.stripped (only built if explicitly requested): A stripped
- version of the binary. strip -g is run on the binary to remove debug
- symbols. Additional strip options can be provided on the command line using
- --stripopt=-foo.name.dwp (only built if explicitly requested): If
- Fission is enabled: a debug
- information package file suitable for debugging remotely deployed binaries. Else: an
- empty file.| Attributes | -|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
name |
-
- Name; required -A unique name for this target. - - |
- ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- deps
- |
-
- List of labels; default is
- cc_import -+It can be used to +export symbols during linking a shared library. |
+||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
cc_import(name, deps, data, hdrs, alwayslink, aspect_hints, compatible_with, deprecation, exec_compatible_with, exec_group_compatible_with, exec_properties, features, includes, interface_library, linkopts, objects, package_metadata, pic_objects, pic_static_library, restricted_to, shared_library, static_library, strip_include_prefix, system_provided, tags, target_compatible_with, testonly, toolchains, visibility)+View rule source -
-cc_import rules allows users to import precompiled C/C++ libraries.
-
-The following are the typical use cases:
+`cc_import` rules allows users to import precompiled C/C++ libraries.
+The following are the typical use cases:
1. Linking a static library
-
+
+``` lang-starlark
+
cc_import(
name = "mylib",
hdrs = ["mylib.h"],
@@ -626,21 +412,25 @@ cc_import(
# libmylib.a will be forcely linked into any binary that depends on it.
# alwayslink = 1,
)
-
+```
+
+2\. Linking a shared library (Unix)
+
+``` lang-starlark
-2. Linking a shared library (Unix)
-
cc_import(
name = "mylib",
hdrs = ["mylib.h"],
shared_library = "libmylib.so",
)
-
+```
-3. Linking a shared library with interface library
+3\. Linking a shared library with interface library
+
+On Unix:
+
+``` lang-starlark
-On Unix: -
cc_import(
name = "mylib",
hdrs = ["mylib.h"],
@@ -649,10 +439,12 @@ cc_import(
# libmylib.so will be available for runtime
shared_library = "libmylib.so",
)
-
+```
+
+On Windows:
+
+``` lang-starlark
-On Windows: -
cc_import(
name = "mylib",
hdrs = ["mylib.h"],
@@ -661,12 +453,14 @@ cc_import(
# mylib.dll will be available for runtime
shared_library = "mylib.dll",
)
-
+```
+
+4\. Linking a shared library with `system_provided=True`
-4. Linking a shared library with system_provided=True
+On Unix:
+
+``` lang-starlark
-On Unix: -
cc_import(
name = "mylib",
hdrs = ["mylib.h"],
@@ -675,10 +469,12 @@ cc_import(
# This indicates that Bazel is not responsible for making libmylib.so available.
system_provided = 1,
)
-
+```
+
+On Windows:
+
+``` lang-starlark
-On Windows: -
cc_import(
name = "mylib",
hdrs = ["mylib.h"],
@@ -688,22 +484,26 @@ cc_import(
# This indicates that Bazel is not responsible for making mylib.dll available.
system_provided = 1,
)
-
+```
+
+5\. Linking to static or shared library
-5. Linking to static or shared library
+On Unix:
+
+``` lang-starlark
-On Unix: -
cc_import(
name = "mylib",
hdrs = ["mylib.h"],
static_library = "libmylib.a",
shared_library = "libmylib.so",
)
-
+```
+
+On Windows:
+
+``` lang-starlark
-On Windows: -
cc_import(
name = "mylib",
hdrs = ["mylib.h"],
@@ -711,10 +511,12 @@ cc_import(
interface_library = "mylib.lib", # An import library for mylib.dll
shared_library = "mylib.dll",
)
-
+```
+
+The remaining is the same on Unix and Windows:
+
+``` lang-starlark
-The remaining is the same on Unix and Windows: -
# first will link to libmylib.a (or libmylib.lib)
cc_binary(
name = "first",
@@ -730,87 +532,65 @@ cc_binary(
deps = [":mylib"],
linkstatic = 0,
)
-
+```
+
+`cc_import` supports an include attribute. For example:
+
+``` lang-starlark
-
-cc_import supports an include attribute. For example:
-
cc_import(
name = "curl_lib",
hdrs = glob(["vendor/curl/include/curl/*.h"]),
includes = ["vendor/curl/include"],
shared_library = "vendor/curl/lib/.libs/libcurl.dylib",
)
-
-
-
- | Attributes | -|||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
name |
-
- Name; required -A unique name for this target. - - |
- ||||||||||||||||||||||||||||||||||||||||||||||||||||||
- deps
- |
-
- List of labels; default is
- cc_library -- - - View rule source - - -cc_library(name, deps, srcs, data, hdrs, additional_compiler_inputs, additional_linker_inputs, alwayslink, aspect_hints, compatible_with, conlyopts, copts, cxxopts, defines, deprecation, exec_compatible_with, exec_group_compatible_with, exec_properties, features, hdrs_check, implementation_deps, include_prefix, includes, licenses, linkopts, linkstamp, linkstatic, local_defines, module_interfaces, package_metadata, restricted_to, strip_include_prefix, tags, target_compatible_with, testonly, textual_hdrs, toolchains, visibility, win_def_file)- - Use
- If you build something with static linking that depends on
- a
- The actual output file name is Header inclusion checking- -
- All header files that are used in the build must be declared in
- the
- For
- - To illustrate these rules, look at the following example. - - - |
+||||||||||||||||||||||||||||||||||||||||||||||||||||||
- The allowed direct inclusions in this example are listed in the table below.
- For example foo.cc is allowed to directly
- include foo.h and bar.h, but not baz.h.
-
| Including file | Allowed inclusions |
|---|---|
| foo.h | bar.h |
| foo.cc | foo.h bar.h |
| bar.h | bar-impl.h baz.h |
| bar-impl.h | bar.h baz.h |
| bar.cc | bar.h bar-impl.h baz.h |
| baz.h | baz-impl.h |
| baz-impl.h | baz.h |
| baz.cc | baz.h baz-impl.h |
- The inclusion checking rules only apply to direct
- inclusions. In the example above foo.cc is allowed to
- include bar.h, which may include baz.h, which in
- turn is allowed to include baz-impl.h. Technically, the
- compilation of a .cc file may transitively include any header
- file in the hdrs or srcs in
- any cc_library in the transitive deps closure. In
- this case the compiler may read baz.h and baz-impl.h
- when compiling foo.cc, but foo.cc must not
- contain #include "baz.h". For that to be
- allowed, baz must be added to the deps
- of foo.
-
- Bazel depends on toolchain support to enforce the inclusion checking rules.
- The layering_check feature has to be supported by the toolchain
- and requested explicitly, for example via the
- --features=layering_check command-line flag or the
- features parameter of the
- package function. The toolchains
- provided by Bazel only support this feature with clang on Unix and macOS.
-
- We use the alwayslink flag to force the linker to link in
- this code although the main binary code doesn't reference it.
-
cc_library(
name = "ast_inspector_lib",
srcs = ["ast_inspector_lib.cc"],
@@ -1115,18 +818,17 @@ cc_library(
# debug time, even if they aren't used anywhere in the code.
alwayslink = 1,
)
-
+```
+The following example comes from
+`third_party/python2_4_3/BUILD`.
+Some of the code uses the `dl` library (to load
+another, dynamic library), so this
+rule specifies the `-ldl` link option to link the
+`dl` library.
-The following example comes from
- third_party/python2_4_3/BUILD.
- Some of the code uses the dl library (to load
- another, dynamic library), so this
- rule specifies the -ldl link option to link the
- dl library.
-
cc_library(
name = "python2_4_3",
linkopts = [
@@ -1135,14 +837,14 @@ cc_library(
],
deps = ["//third_party/expat"],
)
-
+```
+
+The following example comes from `third_party/kde/BUILD`.
+We keep pre-built `.so` files in the depot.
+The header files live in a subdirectory named `include`.
-The following example comes from third_party/kde/BUILD.
- We keep pre-built .so files in the depot.
- The header files live in a subdirectory named include.
-
cc_library(
name = "kde",
srcs = [
@@ -1150,19 +852,19 @@ cc_library(
"lib/libkdesu.so",
"lib/libkhtml.so",
"lib/libkparts.so",
- ...more .so files...,
+ ...more .so files...,
],
includes = ["include"],
deps = ["//third_party/X11"],
)
-
+```
+
+The following example comes from `third_party/gles/BUILD`.
+Third-party code often needs some `defines` and
+`linkopts`.
-The following example comes from third_party/gles/BUILD.
- Third-party code often needs some defines and
- linkopts.
-
cc_library(
name = "gles",
srcs = [
@@ -1182,321 +884,223 @@ cc_library(
"//third_party/X11",
],
)
-
-
- | Attributes | -|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
name |
-
- Name; required -A unique name for this target. - - |
- ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- deps
- |
-
- List of labels; default is
- cc_shared_library -+It can be used to +export symbols during linking a shared library. |
+||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
cc_shared_library(name, deps, additional_linker_inputs, aspect_hints, compatible_with, deprecation, dynamic_deps, exec_compatible_with, exec_group_compatible_with, exec_properties, experimental_disable_topo_sort_do_not_use_remove_before_7_0, exports_filter, features, package_metadata, restricted_to, roots, shared_lib_name, static_deps, tags, target_compatible_with, testonly, toolchains, user_link_flags, visibility, win_def_file)+View rule source -
It produces a shared library.
+``` rule-signature +cc_shared_library(name, deps, additional_linker_inputs, aspect_hints, compatible_with, deprecation, dynamic_deps, exec_compatible_with, exec_group_compatible_with, exec_properties, experimental_disable_topo_sort_do_not_use_remove_before_7_0, exports_filter, features, package_metadata, restricted_to, roots, shared_lib_name, static_deps, tags, target_compatible_with, testonly, toolchains, user_link_flags, visibility, win_def_file) +``` -
cc_shared_library(
name = "foo_shared",
deps = [
@@ -1760,644 +1306,484 @@ cc_library(
srcs = ["baz.cc"],
hdrs = ["baz.h"],
)
-
+```
-In the example foo_shared statically links foo
-and baz, the latter being a transitive dependency. It doesn't
-link bar because it is already provided dynamically by the
-dynamic_dep bar_shared.
foo_shared uses a linker script *.lds file to control which
-symbols should be exported. The cc_shared_library rule logic does
+`foo_shared` uses a linker script \*.lds file to control which
+symbols should be exported. The `cc_shared_library` rule logic does
not control which symbols get exported, it only uses what is assumed to be
exported to give errors during analysis phase if two shared libraries export the
-same targets.
Every direct dependency of cc_shared_library is assumed to be
-exported. Therefore, Bazel assumes during analysis that foo is being
-exported by foo_shared. baz is not assumed to be exported
-by foo_shared. Every target matched by the exports_filter
-is also assumed to be exported.
Every single cc_library in the example should appear at most in one
-cc_shared_library. If we wanted to link baz also into
-bar_shared we would need to add
-tags = ["LINKABLE_MORE_THAN_ONCE"] to baz.
Due to the shared_lib_name attribute, the file produced by
-bar_shared will have the name bar.so as opposed
-to the name libbar.so that it would have by default on Linux.
Two shared libraries in dependencies export the same symbols.This will happen whenever you are creating a target with two different
-cc_shared_library dependencies that export the same target. To fix this
+This will happen whenever you are creating a target with two different
+`cc_shared_library` dependencies that export the same target. To fix this
you need to stop the libraries from being exported in one of the
-cc_shared_library dependencies.
Two shared libraries in dependencies link the same library staticallyThis will happen whenever you are creating a new cc_shared_library with two
-different cc_shared_library dependencies that link the same target statically.
-Similar to the error with exports.
One way to fix this is to stop linking the library into one of the
-cc_shared_library dependencies. At the same time, the one that still links it
+One way to fix this is to stop linking the library into one of the
+`cc_shared_library` dependencies. At the same time, the one that still links it
needs to export the library so that the one not linking it keeps visibility to
the symbols. Another way is to pull out a third library that exports the target.
-A third way is to tag the culprit cc_library with LINKABLE_MORE_THAN_ONCE
+A third way is to tag the culprit `cc_library` with `LINKABLE_MORE_THAN_ONCE`
but this fix should be rare and you should absolutely make sure that the
-cc_library is indeed safe to link more than once.
'//foo:foo' is already linked statically in '//bar:bar' but not exported`This means that a library in the transitive closure of your deps is reachable
-without going through one of the cc_shared_library dependencies but is already
-linked into a different cc_shared_library in dynamic_deps and is not
-exported.
The solution is to export it from the cc_shared_library dependency or pull out
-a third cc_shared_library that exports it.
Do not place libraries which only contain a precompiled dynamic library in deps.
-If you have a precompiled dynamic library, this doesn't need to and cannot be
-linked statically into the current cc_shared_library target that you are
-currently creating. Therefore, it doesn't belong in deps of the
-cc_shared_library. If this precompiled dynamic library is a dependency of one
-of your cc_libraries, then the cc_library needs to depend on it
-directly.
Trying to export a library already exported by a different shared libraryYou will see this error if on the current rule you are claiming to export a -target that is already being exported by one of your dynamic dependencies.
- -To fix this, remove the target from deps and just rely on it from the dynamic
-dependency or make sure that the exports_filter doesn't catch this target.
| Attributes | -|||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
name |
-
- Name; required -A unique name for this target. - - |
- ||||||||||||||||||||||||||||||||||||||||||
- deps
- |
-
- List of labels; default is
- cc_static_library -+It can be used to +export symbols during linking a shared library. |
+||||||||||||||||||||||||||||||||||||||||||
cc_static_library(name, deps, aspect_hints, compatible_with, deprecation, exec_compatible_with, exec_group_compatible_with, exec_properties, features, package_metadata, restricted_to, tags, target_compatible_with, testonly, toolchains, visibility)+View rule source - Produces a static library from a list of targets and their transitive dependencies. +``` rule-signature +cc_static_library(name, deps, aspect_hints, compatible_with, deprecation, exec_compatible_with, exec_group_compatible_with, exec_properties, features, package_metadata, restricted_to, tags, target_compatible_with, testonly, toolchains, visibility) +``` -
The resulting static library contains the object files of the targets listed in
-deps as well as their transitive dependencies, with preference given to
-PIC objects.
linkdepsA text file containing the labels of those transitive dependencies of targets listed in
-deps that did not contribute any object files to the static library, but do
+#### Output groups
+
+##### `linkdeps`
+
+A text file containing the labels of those transitive dependencies of targets listed in
+`deps` that did not contribute any object files to the static library, but do
provide at least one static, dynamic or interface library. The resulting static library
-may require these libraries to be available at link time.
linkoptsA text file containing the user-provided linkopts of all transitive
-dependencies of targets listed in deps.
+#### Duplicate symbols
-
By default, the cc_static_library rule checks that the resulting static
+By default, the `cc_static_library` rule checks that the resulting static
library does not contain any duplicate symbols. If it does, the build fails with an error
-message that lists the duplicate symbols and the object files containing them.
This check can be disabled per target or per package by setting
-features = ["-symbol_check"] or globally via
---features=-symbol_check.
symbol_checkThe auto-configured C++ toolchains shipped with Bazel support the
-symbol_check feature on all platforms. Custom toolchains can add support for
-it in one of two ways:
ACTION_NAMES.validate_static_library action and
- enabling it with the symbol_check feature. The tool set in the action is
- invoked with two arguments, the static library to check for duplicate symbols and the
- path of a file that must be created if the check passes.symbol_check feature add archiver flags that cause the
- action creating the static library to fail on duplicate symbols.| Attributes | -|||||||
|---|---|---|---|---|---|---|---|
name |
-
- Name; required -A unique name for this target. - - |
- ||||||
- deps
- |
-
- List of labels; default is
- cc_test -- - - View rule source - - -cc_test(name, deps, srcs, data, additional_linker_inputs, args, aspect_hints, compatible_with, conlyopts, copts, cxxopts, defines, deprecation, distribs, dynamic_deps, env, env_inherit, exec_compatible_with, exec_group_compatible_with, exec_properties, features, flaky, hdrs_check, includes, licenses, link_extra_lib, linkopts, linkshared, linkstatic, local, local_defines, malloc, module_interfaces, nocopts, package_metadata, reexport_deps, restricted_to, shard_count, size, stamp, tags, target_compatible_with, testonly, timeout, toolchains, visibility, win_def_file)- -
-A |
+||||||
By default, C++ tests are dynamically linked.
- To statically link a unit test, specify
- linkstatic=True.
- It would probably be good to comment why your test needs
- linkstatic; this is probably not obvious.
name.stripped (only built if explicitly requested): A stripped
- version of the binary. strip -g is run on the binary to remove debug
- symbols. Additional strip options can be provided on the command line using
- --stripopt=-foo.name.dwp (only built if explicitly requested): If
- Fission is enabled: a debug
- information package file suitable for debugging remotely deployed binaries. Else: an
- empty file.
-See the cc_binary() arguments, except that
-the stamp argument is set to 0 by default for tests and
-that cc_test has extra
-attributes common to all test rules (*_test).
| Attributes | -|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
name |
-
- Name; required -A unique name for this target. - - |
- ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- deps
- |
-
- List of labels; default is
- cc_toolchain -- - - View rule source - - -cc_toolchain(name, all_files, ar_files, as_files, aspect_hints, compatible_with, compiler_files, compiler_files_without_includes, coverage_files, deprecation, dwp_files, dynamic_runtime_lib, exec_compatible_with, exec_group_compatible_with, exec_properties, exec_transition_for_inputs, features, libc_top, licenses, linker_files, module_map, objcopy_files, output_licenses, package_metadata, restricted_to, static_runtime_lib, strip_files, supports_header_parsing, supports_param_files, tags, target_compatible_with, testonly, toolchain_config, toolchain_identifier, toolchains, visibility)- - Represents a C++ toolchain. - -- This rule is responsible for: - -
- Use
- Use Arguments-
- Until issue #5380 is fixed
- this is the recommended way of associating |
- ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
fdo_prefetch_hints(name, aspect_hints, compatible_with, deprecation, exec_compatible_with, exec_group_compatible_with, exec_properties, features, package_metadata, profile, restricted_to, tags, target_compatible_with, testonly, toolchains, visibility)- -
Represents an FDO prefetch hints profile that is either in the workspace. -Examples:
- -
fdo_prefetch_hints(
name = "hints",
profile = "//path/to/hints:profile.afdo",
)
-
-
- | Attributes | -|
|---|---|
name |
-
- Name; required -A unique name for this target. - - |
-
- profile
- |
-
- Label; required - Label of the hints profile. The hints file has the .afdo extension -The label can also point to an fdo_absolute_path_profile rule. - |
-
fdo_profile(name, aspect_hints, compatible_with, deprecation, exec_compatible_with, exec_group_compatible_with, exec_properties, features, memprof_profile, package_metadata, profile, proto_profile, restricted_to, tags, target_compatible_with, testonly, toolchains, visibility)- -
Represents an FDO profile that is in the workspace. -Example:
- -
+```
+
+### Arguments
+
+
+
+
+Attributes
+
+
+
+
+name
+Name; required
+A unique name for this target.
+
+
+profile
+Label; required
+Label of the hints profile. The hints file has the .afdo extension
+The label can also point to an fdo_absolute_path_profile rule.
+
+
+
+
+## fdo_profile
+
+View rule source
+
+``` rule-signature
+fdo_profile(name, aspect_hints, compatible_with, deprecation, exec_compatible_with, exec_group_compatible_with, exec_properties, features, memprof_profile, package_metadata, profile, proto_profile, restricted_to, tags, target_compatible_with, testonly, toolchains, visibility)
+```
+
+Represents an FDO profile that is in the workspace.
+Example:
+
+``` lang-starlark
+
fdo_profile(
name = "fdo",
profile = "//path/to/fdo:profile.zip",
)
-
-
- | Attributes | -|||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
name |
-
- Name; required -A unique name for this target. - - |
- ||||||||||||
- memprof_profile
- |
-
- Label; default is
- memprof_profile -- - - View rule source - - -memprof_profile(name, aspect_hints, compatible_with, deprecation, exec_compatible_with, exec_group_compatible_with, exec_properties, features, package_metadata, profile, restricted_to, tags, target_compatible_with, testonly, toolchains, visibility)- - Represents a MEMPROF profile that is in the workspace. -Example: - - |
+||||||||||||
proto_profile |
+Label; default is |
+||||||||||||
| Attributes | -|||||||
|---|---|---|---|---|---|---|---|
name |
-
- Name; required -A unique name for this target. - - |
- ||||||
- profile
- |
-
- Label; required - Label of the MEMPROF profile. The profile is expected to have +``` + +### Arguments + +
- propeller_optimize -+The label can also point to an fdo_absolute_path_profile rule. |
+||||||
propeller_optimize(name, aspect_hints, cc_profile, compatible_with, deprecation, exec_compatible_with, exec_group_compatible_with, exec_properties, features, ld_profile, package_metadata, restricted_to, tags, target_compatible_with, testonly, toolchains, visibility)+``` rule-signature +propeller_optimize(name, aspect_hints, cc_profile, compatible_with, deprecation, exec_compatible_with, exec_group_compatible_with, exec_properties, features, ld_profile, package_metadata, restricted_to, tags, target_compatible_with, testonly, toolchains, visibility) +``` -
Represents a Propeller optimization profile in the workspace. -Example:
+Represents a Propeller optimization profile in the workspace. +Example: + +``` lang-starlark -
propeller_optimize(
name = "layout",
cc_profile = "//path:cc_profile.txt",
ld_profile = "//path:ld_profile.txt"
)
-
-
- | Attributes | -|
|---|---|
name |
-
- Name; required -A unique name for this target. - - |
-
- cc_profile
- |
-
- Label; required - Label of the profile passed to the various compile actions. This file has -the .txt extension. - |
-
- ld_profile
- |
-
- Label; required - Label of the profile passed to the link action. This file has -the .txt extension. - |
-
| Attributes | +|
|---|---|
name |
+Name; required +A unique name for this target. |
+
cc_profile |
+Label; required +Label of the profile passed to the various compile actions. This file has +the .txt extension. |
+
ld_profile |
+Label; required +Label of the profile passed to the link action. This file has +the .txt extension. |
+
This section defines various terms and concepts that are common to -many functions or build rules. -
- -- Certain string attributes of some rules are split into multiple - words according to the tokenization rules of the Bourne shell: - unquoted spaces delimit separate words, and single- and - double-quotes characters and backslashes are used to prevent - tokenization. -
-- Those attributes that are subject to this tokenization are - explicitly indicated as such in their definitions in this document. -
-
- Attributes subject to "Make" variable expansion and Bourne shell
- tokenization are typically used for passing arbitrary options to
- compilers and other tools. Examples of such attributes are
- cc_library.copts and java_library.javacopts.
- Together these substitutions allow a
- single string variable to expand into a configuration-specific list
- of option words.
-
- Some string attributes of a very few rules are subject to label
- expansion: if those strings contain a valid label as a
- substring, such as //mypkg:target, and that label is a
- declared prerequisite of the current rule, it is expanded into the
- pathname of the file represented by the
- target
- //mypkg:target.
-
- Example attributes include genrule.cmd and
- cc_binary.linkopts. The details may vary significantly in
- each case, over such issues as: whether relative labels are
- expanded; how labels that expand to multiple files are
- treated, etc. Consult the rule attribute documentation for
- specifics.
-
This section describes attributes that are defined by many build rules, +## Contents + +- [Bourne shell tokenization](#sh-tokenization) +- [Label Expansion](#label-expansion) +- [Typical attributes defined by most build rules](#typical-attributes) +- [Attributes common to all build rules](#common-attributes) +- [Attributes common to all test rules (\*\_test)](#common-attributes-tests) +- [Attributes common to all binary rules (\*\_binary)](#common-attributes-binaries) +- [Configurable attributes](#configurable-attributes) +- [Implicit output targets](#implicit-outputs) + +## Bourne shell tokenization + +Certain string attributes of some rules are split into multiple +words according to the tokenization rules of the Bourne shell: +unquoted spaces delimit separate words, and single- and +double-quotes characters and backslashes are used to prevent +tokenization. + +Those attributes that are subject to this tokenization are +explicitly indicated as such in their definitions in this document. + +Attributes subject to "Make" variable expansion and Bourne shell +tokenization are typically used for passing arbitrary options to +compilers and other tools. Examples of such attributes are +`cc_library.copts` and `java_library.javacopts`. +Together these substitutions allow a +single string variable to expand into a configuration-specific list +of option words. + +## Label expansion + +Some string attributes of a very few rules are subject to label +expansion: if those strings contain a valid label as a +substring, such as `//mypkg:target`, and that label is a +declared prerequisite of the current rule, it is expanded into the +pathname of the file represented by the +[target](https://bazel.build/reference/glossary#target) +`//mypkg:target`. + +Example attributes include `genrule.cmd` and +`cc_binary.linkopts`. The details may vary significantly in +each case, over such issues as: whether relative labels are +expanded; how labels that expand to multiple files are +treated, etc. Consult the rule attribute documentation for +specifics. + +## Typical attributes defined by most build rules + +This section describes attributes that are defined by many build rules, but not all. -
-| Attribute | -Description | -||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data |
-
+
Language-specific rules often require that the listed files have particular +file extensions. |
+
This section describes attributes that are implicitly added to all build +This section describes attributes that are implicitly added to all build rules. -
- -| Attribute | -Description | -||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
aspect_hints |
- List of labels; default is
Attributes common to all test rules (*_test)- -This section describes attributes that are common to all test rules. +@bazel_tools//tools/cpp:toolchain_type@rules_java//toolchains:current_java_runtimeNote that this is distinct from the concept of
+toolchain resolution
+that is used by rule implementations for platform-dependent configuration. You cannot use this
+attribute to determine which specific |
+||||||||||||||||||||||||||||||||||||||||||||||||||||||
visibility |
+List of labels; +nonconfigurable; +default varies +The For targets declared directly in a BUILD file or in legacy macros called from
+a BUILD file, the default value is the package's
+ |
+
| Attribute | -Description | -||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
args |
- List of strings; subject to +## Attributes common to all test rules (\*\_test) + +This section describes attributes that are common to all test rules. + +
Attributes common to all binary rules (*_binary)- -This section describes attributes that are common to all binary rules. - -
-Command line arguments that Bazel will pass to the target when it is executed +## Attributes common to all binary rules (\*\_binary) + +This section describes attributes that are common to all binary rules. + +
|
-
- Most attributes are "configurable", meaning that their values may change when - the target is built in different ways. Specifically, configurable attributes - may vary based on the flags passed to the Bazel command line, or what - downstream dependency is requesting the target. This can be used, for - instance, to customize the target for multiple platforms or compilation modes. -
+The following example declares different sources for different target +architectures. Running `bazel build :multiplatform_lib --cpu x86` +will build the target using `x86_impl.cc`, while substituting +`--cpu arm` will instead cause it to use `arm_impl.cc`. -
- The following example declares different sources for different target
- architectures. Running bazel build :multiplatform_lib --cpu x86
- will build the target using x86_impl.cc, while substituting
- --cpu arm will instead cause it to use arm_impl.cc.
-
cc_library(
name = "multiplatform_lib",
srcs = select({
@@ -1046,98 +729,73 @@ config_setting(
name = "arm_mode",
values = { "cpu": "arm" }
)
-
-
-
- The select() function
- chooses among different alternative values for a configurable attribute based
- on which config_setting
- or constraint_value
- criteria the target's configuration satisfies.
-
- Bazel evaluates configurable attributes after processing macros and before
- processing rules (technically, between the
-
- loading and analysis phases).
- Any processing before select() evaluation doesn't know which
- branch the select() chooses. Macros, for example, can't change
- their behavior based on the chosen branch, and bazel query can
- only make conservative guesses about a target's configurable dependencies. See
-
- this FAQ
- for more on using select() with rules and macros.
-
- Attributes marked nonconfigurable in their documentation cannot
- use this feature. Usually an attribute is nonconfigurable because Bazel
- internally needs to know its value before it can determine how to resolve a
- select().
-
- See - Configurable Build Attributes for a detailed overview. -
+``` + +The [`select()`](/reference/be/functions.html#select) function +chooses among different alternative values for a configurable attribute based +on which [`config_setting`](/reference/be/general.html#config_setting) +or [`constraint_value`](/reference/be/platforms-and-toolchains.html#constraint_value) +criteria the target's configuration satisfies. + +Bazel evaluates configurable attributes after processing macros and before +processing rules (technically, between the +[loading and analysis phases](https://bazel.build/rules/concepts#evaluation-model)). +Any processing before `select()` evaluation doesn't know which +branch the `select()` chooses. Macros, for example, can't change +their behavior based on the chosen branch, and `bazel query` can +only make conservative guesses about a target's configurable dependencies. See +[this FAQ](https://bazel.build/docs/configurable-attributes#faq) +for more on using `select()` with rules and macros. + +Attributes marked `nonconfigurable` in their documentation cannot +use this feature. Usually an attribute is nonconfigurable because Bazel +internally needs to know its value before it can determine how to resolve a +`select()`. -- Implicit outputs in C++ are deprecated. Please refrain from using it - in other languages where possible. We don't have a deprecation path yet - but they will eventually be deprecated too. -
- -When you define a build rule in a BUILD file, you are explicitly
- declaring a new, named rule target in a package. Many build rule
- functions also implicitly entail one or more output file
- targets, whose contents and meaning are rule-specific.
-
- For example, when you explicitly declare a
- java_binary(name='foo', ...) rule, you are also
- implicitly declaring an output file
- target foo_deploy.jar as a member of the same package.
- (This particular target is a self-contained Java archive suitable
- for deployment.)
-
- Implicit output targets are first-class members of the global
- target graph. Just like other targets, they are built on demand,
- either when specified in the top-level built command, or when they
- are necessary prerequisites for other build targets. They can be
- referenced as dependencies in BUILD files, and can be observed in
- the output of analysis tools such as bazel query.
-
- For each kind of build rule, the rule's documentation contains a - special section detailing the names and contents of any implicit - outputs entailed by a declaration of that kind of rule. -
- -
- An important but somewhat subtle distinction between the
- two namespaces used by the build system:
- labels identify targets,
- which may be rules or files, and file targets may be divided into
- either source (or input) file targets and derived (or output) file
- targets. These are the things you can mention in BUILD files,
- build from the command-line, or examine using bazel query;
- this is the target namespace. Each file target corresponds
- to one actual file on disk (the "file system namespace"); each rule
- target may correspond to zero, one or more actual files on disk.
- There may be files on disk that have no corresponding target; for
- example, .o object files produced during C++ compilation
- cannot be referenced from within BUILD files or from the command line.
- In this way, the build tool may hide certain implementation details of
- how it does its job. This is explained more fully in
- the BUILD Concept Reference.
-