Command-Line Reference
bazel [<startup options>] <command> [<args>]or
bazel [<startup options>] <command> [<args>] -- [<target patterns>]See the User's Guide for the target patterns syntax.
Option 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]
Commands
analyze-profile |
Analyzes build profile data. |
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. |
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. |
sync |
Syncs all repositories specified in the workspace file |
test |
Builds and runs the specified test targets. |
version |
Prints version information for bazel. |
Startup Options
- Options that appear before the command and are parsed by the client:
--[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 Bazel. 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>
default: see description-
The location of the user .bazelrc file containing default values of Bazel
options. If unspecified, Bazel uses the first .bazelrc file it finds in the
following two locations: the workspace directory, then the user's home
directory. Use /dev/null to disable the search for a user rc file, e.g. in
release builds.
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
--[no]deep_execroot
default: "true"-
If set, the execution root will be under $OUTPUT_BASE/execroot instead of
$OUTPUT_BASE.
Tags:loses_incremental_state
,execution
--[no]expand_configs_in_place
default: "true"-
Changed the expansion of --config flags to be done in-place, as opposed to in a
fixed point expansion between normal rc options and command-line specified
options.
Tags:no_op
,deprecated
--[no]experimental_oom_more_eagerly
default: "false"-
If set, attempt to detect Java heap OOM conditions and exit before thrashing.
Only honored when --batch is also passed. In some cases, builds that previously
succeeded may OOM if they were close to OOMing before. Deprecated: Use the
command argument --experimental_oom_more_eagerly_threshold instead.
Tags:loses_incremental_state
,eagerness_to_exit
--experimental_oom_more_eagerly_threshold=<an integer>
default: "100"-
If this flag is set, Bazel will OOM if, after two full GC's, more than this
percentage of the (old gen) heap is still occupied. Deprecated: Use the command
argument --experimental_oom_more_eagerly_threshold instead.
Tags:loses_incremental_state
,eagerness_to_exit
--[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
--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.
Tags:eagerness_to_exit
,loses_incremental_state
--output_base=<path>
default: see description-
If set, specifies the output location to which all build output will be
written. Otherwise, the location will be ${OUTPUT_ROOT}/_bazel_${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 description-
The 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
--server_jvm_out=<path>
default: see description-
The 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 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]watchfs
default: "false"-
If true, bazel tries to use the operating system's file watch service
for local changes instead of scanning every file for a change.
Tags:deprecated
--[no]workspace_rc
default: "true"-
Whether or not to look for the workspace bazelrc file at $workspace/.bazelrc
Tags:changes_inputs
- Miscellaneous options, not otherwise categorized.:
--host_jvm_args=<jvm_arg>
multiple uses are accumulated- Flags to pass to the JVM executing Bazel.
--host_jvm_debug
-
Convenience 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=-Xdebug
--host_jvm_args=-Xrunjdwp:transport=dt_socket,server=y,address=5005
--host_jvm_profile=<profiler_name>
default: ""- Convenience option to add some profiler/debugger-specific JVM startup flags. Bazel has a list of known values that it maps to hard-coded JVM startup flags, possibly searching some hardcoded paths for certain files.
--server_javabase=<jvm path>
default: ""- Path to the JVM used to execute Bazel itself.
Options Common to all Commands
- Options that control build execution:
--experimental_oom_more_eagerly_threshold=<an integer>
default: "100"-
If this flag is set to a value less than 100, Bazel will OOM if, after two full
GC's, more than this percentage of the (old gen) heap is still occupied.
Tags:host_machine_resource_optimizations
- Options that configure the toolchain used for action execution:
--[no]incompatible_require_feature_configuration_for_pic
default: "false"-
If true, cc_toolchain_info.use_pic_for_dynamic_libraries will require
feature_configuration argument (see #7007).
Tags:loading_and_analysis
,incompatible_change
,triggered_by_all_incompatible_changes
- This option affects semantics of the Starlark language or the build API accessible to BUILD files, .bzl files, or WORKSPACE files.:
--[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_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_starlark_config_transitions
default: "false"-
If set to true, enables creation of configuration transition objects (the
`transition()` function) in Starlark.
Tags:loading_and_analysis
,experimental
--[no]incompatible_bzl_disallow_load_after_statement
default: "false"-
If set to true, all `load` must be called at the top of .bzl files, before any
other statement.
Tags:build_file_semantics
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_depset_is_not_iterable
default: "false"-
If set to true, depset type is not iterable. For loops and functions expecting
an iterable will reject depset objects. Use the `.to_list` method to explicitly
convert to a list.
Tags:build_file_semantics
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_depset_union
default: "false"-
If set to true, depset union using `+`, `|` or `.union` are forbidden. Use the
`depset` constructor instead.
Tags:build_file_semantics
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_disable_deprecated_attr_params
default: "false"-
If set to true, disable the deprecated parameters 'single_file' and
'non_empty' on attribute definition methods, such as attr.label().
Tags:build_file_semantics
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_disable_objc_provider_resources
default: "false"-
If set to true, disallow use of deprecated resource fields on the Objc provider.
Tags:build_file_semantics
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_disallow_conflicting_providers
default: "true"-
If set to true, disallow rule implementation functions from returning multiple
instances of the same type of provider. (If false, only the last in the list
will be used.)
Tags:build_file_semantics
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_disallow_data_transition
default: "false"-
If set to true, rule attributes cannot set 'cfg = "data"',
which is a noop.
Tags:build_file_semantics
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_disallow_dict_plus
default: "false"-
If set to true, the `+` becomes disabled for dicts.
Tags:build_file_semantics
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_disallow_filetype
default: "false"-
If set to true, function `FileType` is not available.
Tags:build_file_semantics
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_disallow_legacy_javainfo
default: "false"-
If set to true, old-style JavaInfo provider construction is disallowed.
Tags:build_file_semantics
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_disallow_load_labels_to_cross_package_boundaries
default: "false"-
If set to true, the label argument to 'load' cannot cross a package
boundary.
Tags:build_file_semantics
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_disallow_old_style_args_add
default: "false"-
If set to true, vectorized calls to Args#add are disallowed.
Tags:build_file_semantics
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_disallow_slash_operator
default: "true"-
If set to true, the `/` operator is disabled. Use `//` for integer division.
Tags:build_file_semantics
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_generate_javacommon_source_jar
default: "false"-
If set to true, java_common.compile will always generate an output source jar.
Tags:build_file_semantics
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_new_actions_api
default: "false"-
If set to true, the API to create actions is only available on `ctx.actions`,
not on `ctx`.
Tags:build_file_semantics
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_no_attr_license
default: "false"-
If set to true, disables the function `attr.license`.
Tags:build_file_semantics
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_no_output_attr_default
default: "false"-
If set to true, disables the `default` parameter of the `attr.output` and `attr.
output_list` attribute definition functions.
Tags:build_file_semantics
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_no_support_tools_in_action_inputs
default: "false"-
If set to true, tools should be passed to `ctx.actions.run()` and `ctx.actions.
run_shell()` using the `tools` parameter instead of the `inputs` parameter.
Furthermore, if this flag is set and a `tools` parameter is not passed to the
action, it is an error for any tools to appear in the `inputs`.
Tags:build_file_semantics
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_no_target_output_group
default: "false"-
If set to true, disables the output_group field of the 'Target'
Starlark type.
Tags:build_file_semantics
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_no_transitive_loads
default: "false"-
If set to true, only symbols explicitly defined in the file can be loaded;
symbols introduced by load are not implicitly re-exported.
Tags:build_file_semantics
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_range_type
default: "true"-
If set to true, range() will use the 'range' type instead of '
list'.
Tags:build_file_semantics
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_remove_native_git_repository
default: "true"-
If set to true, the native git_repository rules are disabled; only the Starlark
version will be available
Tags:build_file_semantics
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_remove_native_http_archive
default: "true"-
If set to true, the native http_archive rules are disabled; only the Starlark
version will be available
Tags:build_file_semantics
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_remove_native_maven_jar
default: "false"-
If set to true, the native maven_jar rule is disabled; only the Starlark
version will be available
Tags:build_file_semantics
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_strict_argument_ordering
default: "false"-
If set to true, the order of arguments is stricter in function calls, see https:
//github.com/bazelbuild/bazel/issues/6611
Tags:build_file_semantics
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_string_is_not_iterable
default: "true"-
If set to true, iterating over a string will throw an error. String indexing
and `len` are still allowed.
Tags:build_file_semantics
,incompatible_change
,triggered_by_all_incompatible_changes
- Options that trigger optimizations of the build time:
--[no]keep_state_after_build
default: "true"-
If false, Bazel 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
--[no]track_incremental_state
default: "true"-
If false, Bazel 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
- Options that affect the verbosity, format or location of logging:
--[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 as HOST or HOST:PORT.
Disabled by default.
Tags:affects_outputs
--[no]bes_best_effort
default: "false"-
BES best effort upload has been removed. The flag has no more functionality
attached to it and will be removed in a future release.
Tags:affects_outputs
--bes_keywords=<comma-separated list of options>
multiple uses are accumulated-
Specifies 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_outerr_buffer_size=<a long 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.
Tags:affects_outputs
--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_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
--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.
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_json_file=<a string>
default: ""-
If non-empty, write a JSON serialisation of the build event protocol to that
file.
Tags:affects_outputs
--build_event_max_named_set_of_file_entries=<an integer>
default: "-1"-
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
--[no]experimental_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
--experimental_build_event_upload_strategy=<a string>
default: see description-
Selects how to upload artifacts referenced in the build event protocol.
Tags:affects_outputs
--[no]experimental_generate_json_trace_profile
default: "false"-
If enabled, Bazel profiles the build and writes a JSON-format profile into a
file in the output base.
Tags:affects_outputs
,bazel_monitoring
--[no]experimental_json_trace_compression
default: "false"-
If enabled, Bazel compresses the JSON-format profile with gzip.
Tags:affects_outputs
,bazel_monitoring
--[no]experimental_post_profile_started_event
default: "false"-
If set, Bazel will post the ProfilerStartedEvent including the path to the
profile.
Tags:affects_outputs
,bazel_monitoring
--[no]experimental_profile_cpu_usage
default: "false"-
If set, Bazel will measure cpu usage and add it to the JSON profile.
Tags:affects_outputs
,bazel_monitoring
--[no]experimental_ui_deduplicate
default: "false"-
Make the experimental UI deduplicate messages to have a cleaner scroll-back log.
Tags:terminal_output
--experimental_workspace_rules_log_file=<a string>
default: see description- Log certain Workspace Rules events into this file as delimited WorkspaceEvent protos.
--[no]legacy_important_outputs
default: "true"-
Use this to suppress generation of the legacy important_outputs field in the
TargetComplete event.
Tags:affects_outputs
--logging=<0 <= an integer <= 6>
default: "3"-
The logging level.
Tags:affects_outputs
--memory_profile_stable_heap_parameters=<two integers, separated by a comma>
default: "1,0"-
Tune memory profile's computation of stable heap at end of build. Should be
two integers separated by a comma. First parameter is the number of GCs to
perform. Second parameter is the number of seconds to wait between GCs.
Tags:bazel_monitoring
--profile=<a path>
default: see description-
If set, profile Bazel and write data to the specified file. Use bazel analyze-
profile to analyze the profile.
Tags:affects_outputs
,bazel_monitoring
--project_id=<a string>
default: see description-
Specifies the BES project identifier. Defaults to null.
Tags:affects_outputs
--tool_tag=<a string>
default: ""-
A tool name to attribute this Bazel invocation to.
Tags:affects_outputs
,bazel_monitoring
- Miscellaneous options, not otherwise categorized.:
--all_incompatible_changes
-
Enables all options of the form --incompatible_*. Use this option to find
places where your build may break in the future due to deprecations or other
changes.
Expands to:
--incompatible_bzl_disallow_load_after_statement
--incompatible_depset_is_not_iterable
--incompatible_depset_union
--incompatible_disable_deprecated_attr_params
--incompatible_disable_objc_provider_resources
--incompatible_disallow_conflicting_providers
--incompatible_disallow_data_transition
--incompatible_disallow_dict_plus
--incompatible_disallow_filetype
--incompatible_disallow_legacy_javainfo
--incompatible_disallow_load_labels_to_cross_package_boundaries
--incompatible_disallow_old_style_args_add
--incompatible_disallow_slash_operator
--incompatible_expand_directories
--incompatible_generate_javacommon_source_jar
--incompatible_new_actions_api
--incompatible_no_attr_license
--incompatible_no_output_attr_default
--incompatible_no_support_tools_in_action_inputs
--incompatible_no_target_output_group
--incompatible_no_transitive_loads
--incompatible_range_type
--incompatible_remove_native_git_repository
--incompatible_remove_native_http_archive
--incompatible_remove_native_maven_jar
--incompatible_require_feature_configuration_for_pic
--incompatible_strict_argument_ordering
--incompatible_string_is_not_iterable
Tags:incompatible_change
--color=<yes, no or auto>
default: "auto"- Use terminal controls to colorize output going to stderr.
--config=<a string>
multiple uses are accumulated- Selects 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, Bazel fails with an error. The config sections and flag combinations they are equivalent to are located in the tools/*.bazelrc config files.
--curses=<yes, no or auto>
default: "auto"- Use terminal cursor controls to minimize scrolling output going to stderr.
--[no]experimental_external_repositories
default: "false"- Use external repositories for improved stability and speed when available.
--[no]experimental_multi_threaded_digest
default: "false"- Whether to always compute MD5 digests of files with multiple threads. Might improve performance when using an SSD.
--[no]experimental_ui
default: "true"- Switches to an alternative progress bar that more explicitly shows progress, such as loaded packages and executed actions.
--experimental_ui_actions_shown=<an integer>
default: "8"- Number of concurrent actions shown in the alternative progress bar; each action is shown on a separate line. The alternative progress bar always shows at least one one, all numbers less than 1 are mapped to 1. This option has no effect unless --experimental_ui is set.
--experimental_ui_limit_console_output=<an integer>
default: "0"- Number of bytes to which the experimental UI will limit its output (non- positive values indicate unlimited). Once the limit is approaching, the experimental UI will try hard to limit in a meaningful way, but will ultimately just drop all output.
--[no]force_experimental_external_repositories
default: "false"- Forces --experimental_external_repositories.
--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 description- Specifies 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.
--[no]incompatible_expand_directories
default: "false"-
Controls whether directories are expanded to the list of files under that
directory when added to Args, instead of replaced by the path of the directory.
Tags:incompatible_change
,triggered_by_all_incompatible_changes
--[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_task_finish
default: "false"- Display progress messages when tasks complete, not just when they start.
--[no]show_timestamps
default: "false"- Include timestamps in messages
--tls_certificate=<a string>
default: see description- Specify the TLS client certificate to use.
--[no]tls_enabled
default: "false"- Specifies whether to use TLS for remote execution/caching and the build event service (BES).
--[no]watchfs
default: "false"- If true, bazel tries to use the operating system's file watch service for local changes instead of scanning every file for a change.
Analyze-profile Options
- Options that affect the verbosity, format or location of logging:
--[no]bep_publish_used_heap_size_post_build
default: "false"- When set we collect and publish used_heap_size_post_build from build_event_stream.proto. This forces a full GC and is off by default.
--[no]chart
default: "true"-
If --nochart is present, do not include the task chart with --html_details. The
default is --chart.
Tags:affects_outputs
--combine=<a string>
default: see description-
If present, the statistics of all given profile files will be combined and
output in text/--html format to the file named in the argument. Does not output
HTML task charts.
Tags:affects_outputs
--dump=<text, raw, text-unsorted or raw-unsorted>
[-d
] default: see description-
output full profile data dump either in human-readable 'text' format or
script-friendly 'raw' format, either sorted or unsorted.
Tags:affects_outputs
--[no]html
default: "false"-
If present, an HTML file visualizing the tasks of the profiled build is
created. The name of the html file is the name of the profile file plus '.
html'.
Tags:affects_outputs
--[no]html_details
default: "false"-
If --html_details is present, the task diagram contains all tasks of the
profile and performance statistics on user-defined and built-in Skylark
functions. If --nohtml_details is present, an aggregated diagram is generated.
The default is to generate an aggregated diagram.
Tags:affects_outputs
--[no]html_histograms
default: "false"-
If --html_histograms and --html_details is present, the HTML output will
display histograms for Skylark functions clicked in the statistics table. This
will increase file size massively.
Tags:affects_outputs
--html_pixels_per_second=<an integer>
default: "50"-
Defines the scale of the time axis of the task diagram. The unit is pixels per
second. Default is 50 pixels per second.
Tags:affects_outputs
--task_tree=<a valid Java regular expression>
default: see description-
Print the tree of profiler tasks from all tasks matching the given regular
expression.
Tags:affects_outputs
--task_tree_threshold=<a long integer>
default: "50"-
When printing a task tree, will skip tasks with a duration that is less than
the given threshold in milliseconds.
Tags:affects_outputs
--[no]vfs_stats
default: "false"-
If present, include VFS path statistics.
Tags:affects_outputs
--vfs_stats_limit=<an integer>
default: "-1"-
Maximum number of VFS path statistics to print.
Tags:affects_outputs
Aquery Options
Inherits all options from build.
- Options relating to query output and semantics:
--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]host_deps
default: "true"-
Query: If disabled, dependencies on 'host configuration' targets will
not be included in the dependency graph over which the query operates. A '
host 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 (on the host machine) rather than a part of the same
'target' program.
Cquery: If disabled, filters out all configured targets which cross a host
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 host configuration, only host configured targets
will be returned.
Tags:build_file_semantics
--[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.
Tags:build_file_semantics
--[no]include_aspects
default: "false"-
Whether to include aspect generated actions in the output.
Tags:terminal_output
--[no]include_commandline
default: "true"-
Includes the content of the action command lines in the output (potentially
large).
Tags:terminal_output
--output=<a string>
default: "text"-
The format in which the aquery results should be printed. Allowed values for
aquery are: text, textproto, proto.
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: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
--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]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
--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
- Options that affect the verbosity, format or location of logging:
--[no]bep_publish_used_heap_size_post_build
default: "false"- When set we collect and publish used_heap_size_post_build from build_event_stream.proto. This forces a full GC and is off by default.
- Options that control build execution:
--[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
--modify_execution_info=<regex=[+-]key,regex=[+-]key,...>
default: ""-
Add 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, SkylarkAction,
TestRunner. When specifying multiple values, order matters because many regexes
may apply to the same mnemonic.
Syntax: "regex=[+-]key,[+-]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_resource_processor
-
Enable the 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
Tags:host_machine_resource_optimizations
,execution
- Options that configure the toolchain used for action execution:
--android_aapt=<aapt, aapt2 or auto>
default: "auto"-
Selects the version of androidAaptVersion to use for android_binary rules.Flag
to help the test and transition to aapt2.
Tags:affects_outputs
,loading_and_analysis
,loses_incremental_state
--android_compiler=<a string>
default: see description-
The Android target compiler.
Tags:affects_outputs
,loading_and_analysis
,loses_incremental_state
--android_crosstool_top=<a build target label>
default: "//external:android/crosstool"-
The location of the C++ compiler used for Android builds.
Tags:affects_outputs
,changes_inputs
,loading_and_analysis
,loses_incremental_state
--android_grte_top=<a label>
default: see description-
The Android target grte_top.
Tags:changes_inputs
,loading_and_analysis
,loses_incremental_state
--android_manifest_merger=<legacy or android>
default: "android"-
Selects the manifest merger to use for android_binary rules. Flag to help
thetransition to the Android manifest merger from the legacy merger.
Tags:affects_outputs
,loading_and_analysis
,loses_incremental_state
--android_sdk=<a build target label>
default: "@bazel_tools//tools/android:sdk"-
Specifies Android SDK/platform that is used to build Android applications.
Tags:changes_inputs
,loading_and_analysis
,loses_incremental_state
--apple_compiler=<a string>
default: see description-
The Apple target compiler. Useful for selecting variants of a toolchain (e.g.
xcode-beta).
Tags:affects_outputs
,loading_and_analysis
,loses_incremental_state
--apple_crosstool_top=<a build target label>
default: "@bazel_tools//tools/cpp:toolchain"-
The label of the crosstool package to be used in Apple and Objc rules and their
dependencies.
Tags:loses_incremental_state
,changes_inputs
--apple_grte_top=<a build target label>
default: see description-
The Apple target grte_top.
Tags:changes_inputs
,loading_and_analysis
,loses_incremental_state
--apple_sdk=<a build target label>
default: see description-
Location of target that will provide the appropriate Apple SDK for the current
build configuration.
Tags:affects_outputs
,loading_and_analysis
--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 description-
The C++ compiler to use for compiling the target.
Tags:loading_and_analysis
,execution
--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
currently be a filegroup that contains a single file, the binary. 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
--crosstool_top=<a build target label>
default: "@bazel_tools//tools/cpp:toolchain"-
The label of the crosstool package to be used for compiling C++ code.
Tags:loading_and_analysis
,changes_inputs
,affects_outputs
--custom_malloc=<a build target label>
default: see description-
Specifies a custom malloc implementation. This setting overrides malloc
attributes in build rules.
Tags:changes_inputs
,affects_outputs
--enabled_toolchain_types=<a build target label>
default: ""-
Enable toolchain resolution for the given toolchain type, if the rules used
support that. This does not directly change the core Bazel machinery, but is a
signal to participating rule implementations that toolchain resolution should
be used.
Tags:loading_and_analysis
--[no]experimental_enable_cc_toolchain_config_info
default: "false"-
If true, Bazel will allow creating a CcToolchainConfigInfo.
Tags:loading_and_analysis
,experimental
--[no]experimental_enable_objc_cc_deps
default: "true"-
Allows objc_* rules to depend on cc_library and causes any objc dependencies to
be built with --cpu set to "ios_<--ios_cpu>" for any values in
--ios_multi_cpu.
Tags:loading_and_analysis
,incompatible_change
--extra_execution_platforms=<comma-separated list of options>
multiple uses are accumulated-
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().
Tags:execution
--extra_toolchains=<comma-separated list of options>
multiple uses are accumulated-
The 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 description-
A 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_crosstool_top=<a build target label>
default: see description-
By default, the --crosstool_top and --compiler options are also used for the
host configuration. If this flag is provided, Bazel uses the default libc and
compiler for the given crosstool_top.
Tags:loading_and_analysis
,changes_inputs
,affects_outputs
--host_grte_top=<a label>
default: see description-
If specified, this setting overrides the libc top-level directory (--grte_top)
for the host configuration.
Tags:action_command_lines
,affects_outputs
--host_platform=<a build target label>
default: "@bazel_tools//platforms:host_platform"-
The label of a platform rule that describes the host system.
Tags:affects_outputs
,changes_inputs
,loading_and_analysis
--[no]incompatible_disable_expand_if_all_available_in_flag_set
default: "false"-
If true, Bazel will not allow specifying expand_if_all_available in flag_sets
(see https://github.com/bazelbuild/bazel/issues/7008 for migration
instructions).
Tags:loading_and_analysis
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_disable_legacy_crosstool_fields
default: "false"-
If true, Bazel will not read crosstool flags from legacy crosstool fields (see
https://github.com/bazelbuild/bazel/issues/6861 for migration instructions).
Tags:loading_and_analysis
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_disable_runtimes_filegroups
default: "false"-
If true, cc_toolchain.static_runtime_libs and cc_toolchain.dynamic_runtime_libs
are replaced by cc_toolchain.static_runtime_lib and cc_toolchain.
dynamic_runtime_lib (see https://github.com/bazelbuild/bazel/issues/6942)
Tags:action_command_lines
,loading_and_analysis
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_dont_emit_static_libgcc
default: "false"-
If true, bazel will not add --static-libgcc to the linking command line, it
will be the responsibility of the C++ toolchain to append this flag.
Tags:action_command_lines
,loading_and_analysis
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_linkopts_in_user_link_flags
default: "false"-
If true, flags coming from --linkopt Bazel option will appear in
user_link_flags crosstool variable, not in legacy_link_flags.
Tags:action_command_lines
,loading_and_analysis
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_strict_objc_module_maps
default: "false"-
Propagates Objective-C module maps only to direct dependencies in the '
objc' provider, not to all transitive dependencies.
Tags:changes_inputs
,loading_and_analysis
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_use_aapt2_by_default
default: "false"-
Switch the Android rules to use aapt2 by default for resource processing. To
resolve issues when migrating your app to build with aapt2, see https:
//developer.android.com/studio/command-line/aapt2#aapt2_changes
Tags:loses_incremental_state
,affects_outputs
,incompatible_change
,triggered_by_all_incompatible_changes
-
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 description-
Specifies the version of the iOS SDK to use to build iOS applications.
Tags:loses_incremental_state
--macos_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')>
default: see description-
Specifies the version of the macOS SDK to use to build macOS applications.
Tags:loses_incremental_state
--minimum_os_version=<a string>
default: see description-
The minimum OS version which your compilation targets.
Tags:loading_and_analysis
,affects_outputs
--objc_header_scanner_tool=<a build target label>
default: "@bazel_tools//tools/objc:header_scanner"-
Location of tool to scan Objective-C code for inclusions and output a .
headers_list file.
Tags:changes_inputs
--platforms=<a build target label>
default: "@bazel_tools//platforms:target_platform"-
The labels of the platform rules describing the target platforms for the
current command.
Tags:affects_outputs
,changes_inputs
,loading_and_analysis
--python2_path=<a string>
default: "python"-
Local path to the Python2 executable. Deprecated, please use python_path or
python_top instead.
Tags:loading_and_analysis
,affects_outputs
,deprecated
--python3_path=<An option for python3 path>
default: "auto"-
Local path to the Python3 executable. Deprecated, please use python_path or
python_top instead.
Tags:loading_and_analysis
,affects_outputs
,deprecated
--python_path=<a string>
default: "python"-
The absolute path of the Python interpreter invoked by Bazel.
Tags:loading_and_analysis
,affects_outputs
--python_top=<a build target label>
default: see description-
The label of py_runtime rule used for the Python interpreter invoked by Bazel.
Tags:loading_and_analysis
,affects_outputs
--tvos_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')>
default: see description-
Specifies the version of the tvOS SDK to use to build tvOS applications.
Tags:loses_incremental_state
--watchos_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')>
default: see description-
Specifies the version of the watchOS SDK to use to build watchOS applications.
Tags:loses_incremental_state
--xcode_version=<a string>
default: see description-
If 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: "@local_config_xcode//: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
- Options that control the output of the command:
--[no]apple_enable_auto_dsym_dbg
default: "false"-
Whether to force enable generating debug symbol(.dSYM) file(s) for dbg builds.
Tags:affects_outputs
,action_command_lines
--[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 only
manifests when possible.
Tags:affects_outputs
--[no]build_runfile_manifests
default: "true"-
If true, write runfiles manifests for all targets. If false, omit them.
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 list of options>
default: ".pb.h"-
Sets the prefixes of header files that a cc_proto_library creates.
Tags:affects_outputs
,loading_and_analysis
--cc_proto_library_source_suffixes=<comma-separated list of options>
default: ".pb.cc"-
Sets the prefixes of source files that a cc_proto_library creates.
Tags:affects_outputs
,loading_and_analysis
--[no]enable_apple_binary_native_protos
default: "true"-
If set, apple_binary will generate and link objc protos into the output binary.
Tags:affects_outputs
,incompatible_change
--[no]experimental_objc_enable_module_maps
default: "false"-
Enables module map generation and interpretation.
Tags:action_command_lines
--[no]experimental_proto_extra_actions
default: "false"-
Run extra actions for alternative Java api versions in a proto_library.
Tags:affects_outputs
,loading_and_analysis
,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]legacy_external_runfiles
default: "true"-
If true, build runfiles symlink forests for external repositories under .
runfiles/wsname/external/repo (in addition to .runfiles/repo).
Tags:affects_outputs
--[no]objc_generate_linkmap
default: "false"-
Specifies whether to generate a linkmap file.
Tags:affects_outputs
--[no]output_symbol_counts
default: "false"-
If enabled, for every C++ binary linked with gold, the number of defined
symbols and the number of used symbols per input file is stored in a .sc file.
Tags:action_command_lines
,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
- Options that let the user configure the intended output, affecting its value, as opposed to its existence:
--action_env=<a 'name=value' assignment with an optional value part>
multiple uses are accumulated-
Specifies the set of environment variables available to actions. Variables can
be either specified by name, in which case the value will be taken from the
invocation environment, or by the name=value pair which sets the value
independent of the invocation environment. 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
--android_cpu=<a string>
default: "armeabi-v7a"-
The Android target CPU.
Tags:affects_outputs
,loading_and_analysis
,loses_incremental_state
--[no]android_databinding_use_v3_4_args
default: "false"-
Use android databinding v2 with 3.4.0 argument
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 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.
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
--apple_bitcode=<none, embedded_markers or embedded>
default: "none"-
Specify the Apple bitcode mode for compile steps. Values: 'none', '
embedded_markers', 'embedded'.
Tags:loses_incremental_state
--[no]build_python_zip
default: "auto"-
Build python executable zip; on on Windows, off on other platforms
Tags: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
--conlyopt=<a string>
multiple uses are accumulated-
Additional option to pass to gcc when compiling C source files.
Tags:action_command_lines
,affects_outputs
--copt=<a string>
multiple uses are accumulated-
Additional options to pass to gcc.
Tags:action_command_lines
,affects_outputs
--cpu=<a string>
default: ""-
The target CPU.
Tags:changes_inputs
,affects_outputs
--cxxopt=<a string>
multiple uses are accumulated-
Additional option to pass to gcc when compiling C++ source files.
Tags:action_command_lines
,affects_outputs
--define=<a 'name=value' assignment>
multiple uses are accumulated-
Each --define option specifies an assignment for a build variable.
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_fdo_profile_absolute_path
default: "true"-
If set, use of fdo_absolute_profile_path 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
--experimental_action_listener=<a build target label>
multiple uses are accumulated-
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: "false"-
Use android databinding v2
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
--[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_cc_coverage
default: "false"-
If specified, Bazel will use gcov to collect code coverage for C++ test
targets. This option only works for gcc compilation.
Tags:changes_inputs
,affects_outputs
,loading_and_analysis
,experimental
--[no]experimental_java_coverage
default: "false"-
If true Bazel will use a new way of computing code coverage for java targets.
Tags:affects_outputs
--[no]experimental_link_compile_output_separately
default: "false"-
This flag is experimental and may go away at any time. If true, dynamically
linked binary targets will build and link their own srcs as a dynamic library
instead of directly linking it in.
Tags:loading_and_analysis
,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
--[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
--fat_apk_cpu=<comma-separated list of options>
default: "armeabi-v7a"-
Setting this option enables fat APKs, which contain native binaries for all
specified target architectures, e.g., --fat_apk_cpu=x86,armeabi-v7a. If this
flag is specified, then --android_cpu is ignored for dependencies of
android_binary rules.
Tags:affects_outputs
,loading_and_analysis
,loses_incremental_state
--fdo_instrument=<a string>
default: see description-
Generate 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 description-
Use FDO profile information to optimize compilation. Specify the name of the
zip file containing the .gcda file tree, or an afdo file containing an auto
profile. This flag also accepts files specified as labels, for example
//foo/bar:file.afdo. Such labels must refer to input files; you may need to add
an exports_files directive to the corresponding package to make the file
visible to Bazel. It also accepts a raw or an indexed LLVM profile file. This
flag will be superseded by fdo_profile rule.
Tags:affects_outputs
--fdo_prefetch_hints=<a build target label>
default: see description-
Use cache prefetch hints.
Tags:affects_outputs
--fdo_profile=<a build target label>
default: see description-
The fdo_profile representing the profile to be used for optimization.
Tags:affects_outputs
--features=<a string>
multiple uses are accumulated-
The given features will be enabled or disabled by default for all packages.
Specifying -<feature> will disable the feature globally. Negative
features always override positive ones. This flag is used to enable rolling out
default feature changes without a Bazel release.
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
--force_python=<PY2 or PY3>
default: see description-
Overrides default_python_version attribute. Can be "PY2" or "
PY3".
Tags:loading_and_analysis
,affects_outputs
--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 accumulated-
Additional option to pass to gcc when compiling C source files for host tools.
Tags:action_command_lines
,affects_outputs
--host_copt=<a string>
multiple uses are accumulated-
Additional options to pass to gcc for host tools.
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 accumulated-
Additional options to pass to gcc for host tools.
Tags:action_command_lines
,affects_outputs
--host_force_python=<PY2 or PY3>
default: see description-
Overrides default_python_version attribute for the host configuration. Can be
"PY2" or "PY3".
Tags:loading_and_analysis
,affects_outputs
--host_linkopt=<a string>
multiple uses are accumulated-
Additional option to pass to gcc when linking host tools.
Tags:action_command_lines
,affects_outputs
--[no]incompatible_merge_genfiles_directory
default: "false"-
If true, the genfiles directory is folded into the bin directory.
Tags:affects_outputs
,incompatible_change
,triggered_by_all_incompatible_changes
--[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_cpu=<a string>
default: "x86_64"-
Specifies to target CPU of iOS compilation.
Tags:no_op
,deprecated
--ios_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')>
default: see description-
Minimum compatible iOS version for target simulators and devices.
Tags:loses_incremental_state
--ios_multi_cpus=<comma-separated list of options>
default: ""-
Comma-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"-
When on, use --whole-archive for cc_binary rules that have linkshared=1 and
either linkstatic=1 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
--linkopt=<a string>
multiple uses are accumulated-
Additional option to pass to gcc when linking.
Tags:action_command_lines
,affects_outputs
--ltobackendopt=<a string>
multiple uses are accumulated-
Additional option to pass to the LTO backend step (under --features=thin_lto).
Tags:action_command_lines
,affects_outputs
--ltoindexopt=<a string>
multiple uses are accumulated-
Additional 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>
default: "x86_64"-
Comma-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 description-
Minimum compatible macOS version for targets.
Tags:loses_incremental_state
--[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 --compilationMode=opt are
specified.
Tags:action_command_lines
--objccopt=<a string>
multiple uses are accumulated-
Additional options to pass to Objective C compilation.
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 accumulated-
Additional 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 accumulated-
Additional 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 description-
Specifies 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 description-
Prefix to insert in front of command before running. Examples:
--run_under=valgrind
--run_under=strace
--run_under='strace -c'
--run_under='valgrind --quiet --num-callers=20'
--run_under=//package:target
--run_under='//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 accumulated-
Additional options to pass to strip when generating a '<name>.
stripped' binary.
Tags:action_command_lines
,affects_outputs
--swiftcopt=<a string>
multiple uses are accumulated-
Additional options to pass to Swift compilation.
Tags:action_command_lines
--tvos_cpus=<comma-separated list of options>
default: "x86_64"-
Comma-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 description-
Minimum compatible tvOS version for target simulators and devices.
Tags:loses_incremental_state
--watchos_cpus=<comma-separated list of options>
default: "i386"-
Comma-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 description-
Minimum compatible watchOS version for target simulators and devices.
Tags:loses_incremental_state
--xbinary_fdo=<a build target label>
default: see description-
Use 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
- Options that affect how strictly Bazel enforces valid build inputs (rule definitions, flag combinations, etc.):
--auto_cpu_environment_group=<a build target label>
default: ""-
Declare the environment_group to use for automatically mapping cpu values to
target_environment values.
Tags:changes_inputs
,loading_and_analysis
,experimental
--[no]check_licenses
default: "false"-
Check that licensing constraints imposed by dependent packages do not conflict
with distribution modes of the targets being built. By default, licenses are
not checked.
Tags:build_file_semantics
--[no]check_visibility
default: "true"-
If disabled, visibility errors are demoted to warnings.
Tags:build_file_semantics
--[no]desugar_for_android
default: "true"-
Whether to desugar Java 8 bytecode before dexing.
Tags:affects_outputs
,loading_and_analysis
,loses_incremental_state
--[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_allow_android_library_deps_without_srcs
default: "false"-
Flag to help transition from allowing to disallowing srcs-less android_library
rules with deps. The depot needs to be cleaned up to roll this out by default.
Tags:eagerness_to_exit
,loading_and_analysis
--[no]experimental_android_throw_on_resource_conflict
default: "false"-
If passed, resource merge conflicts will be treated as errors instead of
warnings
Tags:eagerness_to_exit
,loading_and_analysis
--[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_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
--experimental_import_deps_checking=<off, warning or error>
default: "OFF"-
When enabled, check whether the dependencies of an aar_import are complete.
This enforcement can break the build, or can just result in warnings.
Tags:loading_and_analysis
--[no]experimental_java_proto_add_allowed_public_imports
default: "false"-
If true, add --allowed_public_imports to the java compile actions.
Tags:affects_outputs
,loading_and_analysis
,experimental
--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]strict_filesets
default: "false"-
If this option is enabled, filesets crossing package boundaries are reported as
errors. It does not work when check_fileset_dependencies_recursively is
disabled.
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
--[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 accumulated-
Declares 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
- Options that affect the signing outputs of a build:
--apk_signing_method=<v1, v2 or v1_v2>
default: "v1_v2"-
Implementation to use to sign APKs
Tags:action_command_lines
,affects_outputs
,loading_and_analysis
--default_ios_provisioning_profile=<a build target label>
default: ""-
Tags:changes_inputs
--[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
--extra_entitlements=<a build target label>
default: see description-
Location of a .entitlements file that is merged into any iOS signing action in
this build.
Tags:changes_inputs
--ios_signing_cert_name=<a string>
default: see description-
Certificate 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
- Options that govern the behavior of the test environment or test runner:
--[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: "500"-
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]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]experimental_windows_native_test_wrapper
default: "false"-
On Windows: if true, uses the C++ test wrapper to run tests, otherwise uses
tools/test/test-setup.sh as on other platforms. On other platforms: no-op.
Tags:loading_and_analysis
,test_runner
--[no]ios_memleaks
default: "false"-
Enable checking for memory leaks in ios_test targets.
Tags:action_command_lines
--ios_simulator_device=<a string>
default: "iPhone 5s"-
The 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: "9.3"-
The 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 accumulated- Specifies number of times to run each test. If any of those attempts fail for any reason, the whole test would be 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.
--test_env=<a 'name=value' assignment with an optional value part>
multiple uses are accumulated-
Specifies additional environment variables to be injected into the test runner
environment. Variables can be either specified by name, in which case its value
will be read from the Bazel client environment, or by the name=value pair. 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 bazel to use its default timeouts for that category.
--tvos_simulator_device=<a string>
default: "Apple TV 1080p"-
The device to simulate when running an tvOS application in the simulator, e.g.
'Apple TV 1080p'. 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
--tvos_simulator_version=<a dotted version (for example '2.3' or '3.3alpha2.4')>
default: "9.0"-
The version of tvOS to run on the simulator when running or testing.
Tags:test_runner
--watchos_simulator_device=<a string>
default: "Apple Watch - 38mm"-
The device to simulate when running an watchOS application in the simulator, e.
g. 'Apple Watch - 38mm'. 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
--watchos_simulator_version=<a dotted version (for example '2.3' or '3.3alpha2.4')>
default: "2.0"-
The version of watchOS to run on the simulator when running or testing.
Tags:test_runner
- Options relating to query output and semantics:
--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]host_deps
default: "true"-
Query: If disabled, dependencies on 'host configuration' targets will
not be included in the dependency graph over which the query operates. A '
host 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 (on the host machine) rather than a part of the same
'target' program.
Cquery: If disabled, filters out all configured targets which cross a host
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 host configuration, only host configured targets
will be returned.
Tags:build_file_semantics
--[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.
Tags:build_file_semantics
--[no]include_aspects
default: "false"-
Whether to include aspect generated actions in the output.
Tags:terminal_output
--[no]include_commandline
default: "true"-
Includes the content of the action command lines in the output (potentially
large).
Tags:terminal_output
--output=<a string>
default: "text"-
The format in which the aquery results should be printed. Allowed values for
aquery are: text, textproto, proto.
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: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
--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]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
--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
- Options that trigger optimizations of the build time:
--[no]distinct_host_configuration
default: "true"-
Build all the tools used during the build for a distinct configuration from
that used for the target program. When this is disabled, the same configuration
is used for host and target programs. This may cause undesirable rebuilds of
tools such as the protocol compiler (and then everything downstream) whenever a
minor change is made to the target configuration, such as setting the linker
options. When this is enabled (the default), a distinct configuration will be
used to build the tools, preventing undesired rebuilds. However, certain
libraries will then need to be compiled twice, once for each configuration,
which may cause some builds to be slower. As a rule of thumb, this option is
likely to benefit users that make frequent changes in configuration (e.g.
opt/dbg). Please read the user manual for the full explanation.
Tags:loses_incremental_state
,bazel_internal_configuration
,loading_and_analysis
--[no]experimental_inmemory_dotd_files
default: "false"-
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_objc_header_thinning
default: "false"-
If set then ObjcCompile actions will have their action inputs reduced by
running a tool to detect which headers are actually required for compilation.
Tags:changes_inputs
,loading_and_analysis
,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
--objc_header_thinning_partition_size=<an integer>
default: "120"-
The maximum number of source files to process within in each header scanning
action.
Tags:host_machine_resource_optimizations
--[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]parse_headers_verifies_modules
default: "false"-
If enabled, the parse_headers feature verifies that a header module can be
built for the target in question instead of doing a separate compile of the
header.
Tags:loading_and_analysis
,changes_inputs
--[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: "false"-
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
--[no]use_singlejar_apkbuilder
default: "true"-
Build Android APKs with SingleJar.
Tags:loading_and_analysis
- Options that affect the verbosity, format or location of logging:
--[no]toolchain_resolution_debug
default: "false"-
Print debug information while finding toolchains for a rule. This might help
developers of Bazel or Starlark rules with debugging failures due to missing
toolchains.
Tags:terminal_output
- Miscellaneous options, not otherwise categorized.:
--[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.
--check_constraint=<a string>
multiple uses are accumulated- Check the listed constraint.
--[no]experimental_j2objc_header_map
default: "true"- Whether to generate J2ObjC header map in parallel of J2ObjC transpilation.
--experimental_java_classpath=<off or javabuilder>
default: "javabuilder"- Enables reduced classpaths for Java compilations.
--[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 description- The Java launcher used by tools that are executed during a build.
--host_java_toolchain=<a build target label>
default: "@bazel_tools//tools/jdk:toolchain"- The Java toolchain used to build tools that are executed during a build.
--host_javabase=<a build target label>
default: see description- JAVABASE used for the host JDK. This is the java_runtime which is used to execute tools during a build.
--host_javacopt=<a string>
multiple uses are accumulated- Additional options to pass to javac when building tools that are executed during a build.
--host_platform_remote_properties_override=<a string>
default: see description- Manually set the remote_execution_properties for the host platform if it is not already set.
--[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 or TMPDIR. 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
,triggered_by_all_incompatible_changes
--j2objc_translation_flags=<comma-separated list of options>
multiple uses are accumulated- Additional options to pass to the J2ObjC tool.
--java_debug
-
Causes 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_launcher=<a build target label>
default: see description- The Java launcher to use when building Java binaries. The "launcher" attribute overrides this flag.
--java_toolchain=<a build target label>
default: "@bazel_tools//tools/jdk:toolchain"- The name of the toolchain rule for Java.
--javabase=<a build target label>
default: "@bazel_tools//tools/jdk:jdk"- JAVABASE used for the JDK invoked by Bazel. This is the java_runtime which will be used to execute external Java commands.
--javacopt=<a string>
multiple uses are accumulated- Additional options to pass to javac.
--jvmopt=<a string>
multiple uses are accumulated- Additional options to pass to the Java VM. These options will get added to the VM startup options of each java_binary target.
--message_translations=<a string>
multiple uses are accumulated- The message translations used for translating messages in Java targets.
--plugin=<a build target label>
multiple uses are accumulated- Plugins to use in the build. Currently works with java_plugin.
--proguard_top=<a build target label>
default: see description- Specifies which version of ProGuard to use for code removal when building a Java binary.
--proto_compiler=<a build target label>
default: "@com_google_protobuf//:protoc"-
The label of the proto-compiler.
Tags:affects_outputs
,loading_and_analysis
--proto_toolchain_for_cc=<a build target label>
default: "@com_google_protobuf//: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: "@com_google_protobuf//: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: "@com_google_protobuf_javalite//: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 accumulated-
Additional options to pass to the protobuf compiler.
Tags:affects_outputs
--shell_executable=<a path>
default: see description-
Absolute 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:/tools/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 accumulated- Specifies 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 description- Specifies 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.
--test_sharding_strategy=<explicit, experimental_heuristic or disabled>
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. 'experimental_heuristic' to enable sharding on remotely executed tests without an explicit 'shard_count' attribute which link in a supported framework. Considered experimental.
--[no]translations
default: "auto"- Translate Java messages; bundle all translations into the jar for each affected rule.
--[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.
Build Options
- Options that appear before the command and are parsed by the client:
--distdir=<a path>
multiple uses are accumulated-
Additional 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 inteded to save disk space.
Tags:bazel_internal_configuration
--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
--repository_cache=<a path>
default: see description-
Specifies 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.
Tags:bazel_internal_configuration
- Options that control build 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_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_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_docker_verbose
default: "false"-
If enabled, Bazel will print more verbose messages about the Docker sandbox
strategy.
Tags:execution
--[no]experimental_enable_docker_sandbox
default: "false"-
Enable Docker-based sandboxing. This option has no effect if Docker is not
installed.
Tags:execution
--experimental_sandboxfs_path=<a string>
default: "sandboxfs"- Path to the sandboxfs binary to use when --experimental_use_sandboxfs is true. If a bare name, use the first binary of that name found in the PATH.
--[no]experimental_split_xml_generation
default: "false"-
If this flag is set, and a test action does not generate a test.xml file, then
Bazel uses a separate action to generate a dummy test.xml file containing the
test log. Otherwise, Bazel generates the test.xml as part of the test action.
Tags:execution
--[no]experimental_use_sandboxfs
default: "false"- Use sandboxfs to create the actions' execroot directories instead of building a symlink tree.
--[no]incompatible_remote_symlinks
default: "false"-
If set to true, Bazel will represent symlinks in action outputs in the remote
caching/execution protocol as such. The current behavior is for remote
caches/executors to follow symlinks and represent them as files. See #6631 for
details.
Tags:execution
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_symlinked_sandbox_expands_tree_artifacts_in_runfiles_tree
default: "false"-
If enabled, the sandbox will expand tree artifacts in runfiles, thus the files
that are contained in the tree artifact will be symlinked as individual files.
Tags:execution
,triggered_by_all_incompatible_changes
,incompatible_change
--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 {@value FLAG_SYNTAX}. Values must
be between 1 and5000 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 onhost resources. Must be at least 1.
Tags:bazel_internal_configuration
--[no]remote_allow_symlink_upload
default: "true"-
If true, upload action symlink outputs to the remote cache. If this option is
not enabled, cachable actions that output symlinks will fail.
Tags:execution
- Options that control the output of the command:
--[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
--output_groups=<comma-separated list of options>
multiple uses are accumulated-
Specifies which output groups of the top-level targets to build. If omitted, a
default set of output groups are built. When specified the default set is
overridden. However you may use --output_groups=+<output_group> or --
output_groups=-<output_group> to instead modify the set of output groups.
Tags:execution
,affects_outputs
- Options that let the user configure the intended output, affecting its value, as opposed to its existence:
--aspects=<comma-separated list of options>
multiple uses are accumulated- Comma-separated list of aspects to be applied to top-level targets. All aspects are applied to all top-level targets independently. Aspects are specified in the form <bzl-file-label>%<aspect_name>, for example '//tools: my_def.bzl%my_aspect', where 'my_aspect' is a top-level value from from a file tools/my_def.bzl
--experimental_multi_cpu=<comma-separated list of options>
multiple uses are accumulated-
This flag allows specifying multiple target CPUs. If this is specified, the --
cpu option is ignored.
Tags:affects_outputs
,experimental
--symlink_prefix=<a string>
default: see description-
The prefix that is prepended to any of the convenience symlinks that are
created after a build. If '/' is passed, then no symlinks are created
and no warning is emitted. If omitted, the default value is the name of the
build tool.
Tags:affects_outputs
- Options that affect how strictly Bazel enforces valid build inputs (rule definitions, flag combinations, etc.):
--experimental_repository_hash_file=<a string>
default: ""-
If non-empty, specifies a file containing a resolved value, against which the
repository directory hashes should be verified
Tags:affects_outputs
,experimental
--experimental_verify_repository_rules=<a string>
multiple uses are accumulated-
If list of repository rules for which the hash of the output directory should
be verified, provided a file is specified by --
experimental_repository_hash_file.
Tags:affects_outputs
,experimental
- Options that affect the verbosity, format or location of logging:
--[no]announce
default: "false"-
Deprecated. No-op.
Tags:affects_outputs
--[no]bep_publish_used_heap_size_post_build
default: "false"- When set we collect and publish used_heap_size_post_build from build_event_stream.proto. This forces a full GC and is off by default.
--experimental_repository_resolved_file=<a string>
default: ""-
If non-empty, write a Skylark value with the resolved information of all
Starlark repository rules that were executed.
Tags:affects_outputs
--explain=<a path>
default: see description-
Causes the build system to explain each executed step of the build. The
explanation is written to the specified log file.
Tags:affects_outputs
--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
--output_filter=<a valid Java regular expression>
default: see description-
Only shows warnings 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 two reports on still running jobs. The
default value 0 means to use the default 10:30:60 incremental algorithm.
Tags:affects_outputs
--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.
Tags:affects_outputs
--[no]verbose_explanations
default: "false"-
Increases the verbosity of the explanations issued if --explain is enabled. Has
no effect if --explain is not enabled.
Tags:affects_outputs
- Options specifying or altering a generic input to a Bazel command that does not fall into other categories.:
--experimental_resolved_file_instead_of_workspace=<a string>
default: ""-
If non-empty read the specified resolved file instead of the WORKSPACE file
Tags:changes_inputs
- Miscellaneous options, not otherwise categorized.:
--[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.
--[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.
--[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.
--combined_report=<none or lcov>
default: "none"- Specifies desired cumulative coverage report type. At this point only HTML and LCOV reports are 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>
default: ""- A 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 description- A 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=<string>
default: ""- Embed source control revision or release label in binary
--[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_execution_log_file=<a string>
default: ""- Log the executed spawns into this file as delimited Spawn protos.
--experimental_extra_action_filter=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths>
default: ""- Filters set of targets to schedule extra_actions for.
--[no]experimental_extra_action_top_level_only
default: "false"- Only schedules extra_actions for top level targets.
--[no]experimental_guard_against_concurrent_changes
default: "false"- Turn this off to disable checking the ctime of 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.
--[no]experimental_interleave_loading_and_analysis
default: "true"- No-op.
--experimental_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?
--[no]experimental_local_memory_estimate
default: "false"- Estimate the actual memory available online. By default, Bazel assumes most actions use a fixed amount of memory, and counts that against the total available system memory, regardless of how much memory is actually available. This option enables online estimation of how much memory is available at any given time, and thus does not require accurate estimation of how much memory a given action will take.
--experimental_persistent_javac
-
Enable the experimental persistent Java compiler.
Expands to:
--strategy=Javac=worker
--strategy=JavaIjar=local
--strategy=JavaDeployJar=local
--strategy=JavaSourceJar=local
--strategy=Turbine=local
--experimental_remote_grpc_log=<a string>
default: ""- If 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).
--[no]experimental_remote_retry
default: "true"- Whether to retry transient remote execution/cache errors.
--experimental_remote_retry_jitter=<a double>
default: "0.1"- The random factor to apply to retry delays on transient errors.
--experimental_remote_retry_max_attempts=<an integer>
default: "5"- The maximum number of attempts to retry a transient error.
--experimental_remote_retry_max_delay_millis=<a long integer>
default: "5000"- The maximum delay before retrying a transient error.
--experimental_remote_retry_multiplier=<a double>
default: "2"- The multiplier by which to increase the retry delay on transient errors.
--experimental_remote_retry_start_delay_millis=<a long integer>
default: "100"- The initial delay before retrying a transient error.
--[no]experimental_remote_spawn_cache
default: "false"-
Whether to use the experimental spawn cache infrastructure for remote caching.
Enabling this flag makes Bazel ignore any setting for remote_executor.
Tags:no_op
--experimental_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.
--[no]experimental_sandbox_default_allow_network
default: "true"- Allow network access by default for actions.
--experimental_spawn_scheduler
-
Enable 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
--flaky_test_attempts=<a positive integer, the string "default", or test_regex@attempts. This flag may be passed more than once>
multiple uses are accumulated- Each 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 would be marked as 'FLAKY' in the test summary. If this option is set, it should specify an int N or the string 'default'. If it's an int, then all tests will be run up to N times. If it is not specified or its value is ' 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).
--genrule_strategy=<a string>
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.
--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 description- Specifies 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.
--high_priority_workers=<a string>
multiple uses are accumulated- Mnemonics of workers to run with high priority. When high priority workers are running all other workers are throttled.
--[no]ignore_unsupported_sandboxing
default: "false"- Do not print a warning when sandboxed execution is not supported on this system.
--local_resources=<comma-separated available amount of RAM (in MB), CPU (in cores) and available I/O (1.0 being average workstation)>
default: see description- Explicitly set amount of local resources available to Bazel. By default, Bazel will query system configuration to estimate amount of RAM (in MB) and number of CPU cores available for the locally executed build actions. It would also assume default I/O capabilities of the local workstation (1.0). This options allows to explicitly set all 3 values. Note, that if this option is used, Bazel will ignore --ram_utilization_factor.
--local_termination_grace_seconds=<an integer>
default: "15"- Time to wait between terminating a local process due to timeout and forcefully shutting it down.
--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.
--[no]materialize_param_files
default: "false"- Writes intermediate parameter files to output tree even when using remote action execution. Useful when debugging actions.
--override_repository=<an equals-separated mapping of repository name to path>
multiple uses are accumulated- Overrides a repository with a local directory.
--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'.
--ram_utilization_factor=<an integer>
default: "67"- Specify what percentage of the system's RAM Bazel should try to use for its subprocesses. This option affects how many processes Bazel will try to run in parallel. If you run several Bazel builds in parallel, using a lower value for this option may avoid thrashing and thus improve overall throughput. Using a value higher than the default is NOT recommended. Note that Bazel's estimates are very coarse, so the actual RAM usage may be much higher or much lower than specified. Note also that this option does not affect the amount of memory that the Bazel server itself will use.
--[no]remote_accept_cached
default: "true"- Whether to accept remotely cached action results.
--remote_cache=<a string>
default: see description- HOST or HOST:PORT of a remote caching endpoint.
--remote_cache_proxy=<a string>
default: see description- Connect to the remote cache through a proxy. Currently this flag can only be used to configure a Unix domain socket (unix:/path/to/socket) for the HTTP cache.
--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 description- HOST or HOST:PORT of a remote execution endpoint.
--remote_http_cache=<a string>
default: see description- A base URL of a HTTP caching service. Both http:// and https:// are supported. BLOBs are stored with PUT and retrieved with GET. See remote/README.html for more information.
--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"- The strategy to use when remote execution has to fallback to local execution.
--remote_max_connections=<an integer>
default: "100"-
The max. number of concurrent network connections to the remote cache/executor.
By default Bazel limits the number of TCP connections to 100. Setting this flag
to 0 will make Bazel choose the number of connections automatically.
Tags:host_machine_resource_optimizations
--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_timeout=<an integer>
default: "60"- The maximum number of seconds to wait for remote execution and cache calls.
--[no]remote_upload_local_results
default: "true"- Whether to upload locally executed action results to the remote cache.
--[no]resource_autosense
default: "false"- This flag has no effect, and is deprecated
--[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.
--sandbox_add_mount_pair=<a single path or a 'source:target' pair>
multiple uses are accumulated- Add additional path pair to mount in sandbox.
--sandbox_block_path=<a string>
multiple uses are accumulated- For sandboxed actions, disallow access to this path.
--[no]sandbox_debug
default: "false"- Let the sandbox print debug information on execution. This might help developers of Bazel or Starlark rules with debugging failures due to missing input files, etc.
--[no]sandbox_fake_hostname
default: "false"- Change the current hostname to 'localhost' for sandboxed actions.
--[no]sandbox_fake_username
default: "false"- Change the current username to 'nobody' for sandboxed actions.
--sandbox_tmpfs_path=<a string>
multiple uses are accumulated- For sandboxed actions, mount an empty, writable directory at this path (if supported by the sandboxing implementation, ignored otherwise).
--sandbox_writable_path=<a string>
multiple uses are accumulated- For sandboxed actions, make an existing directory writable in the sandbox (if supported by the sandboxing implementation, ignored otherwise).
--[no]show_loading_progress
default: "true"- If enabled, causes Bazel to print "Loading package:" messages.
--spawn_strategy=<a string>
default: ""- Specify how spawn actions are executed by default. 'standalone' means run all of them locally without any kind of sandboxing. 'sandboxed' means to run them in a sandboxed environment with limited privileges (details depend on platform support).
--strategy=<a 'name=value' assignment>
multiple uses are accumulated- Specify how to distribute compilation of other spawn actions. Example: ' Javac=local' means to spawn Java compilation locally. ' JavaIjar=sandboxed' means to spawn Java Ijar actions in a sandbox.
--strategy_regexp=<a '<RegexFilter>=value' assignment>
multiple uses are accumulated- Override 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 first 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'.
--[no]subcommands
[-s
] default: "false"- Display the subcommands executed during a build.
--[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.
--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_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).
--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_strategy=<a string>
default: ""- Specifies which strategy to use when running tests.
--test_summary=<short, terse, detailed, none or testcase>
default: "short"- Specifies the desired format ot 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, and ' none' to omit the summary.
--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.
--test_tmpdir=<a path>
default: see description- Specifies the base temporary directory for 'bazel test' to use.
--tls_certificate=<a string>
default: see description- Specify the TLS client certificate to use.
--[no]tls_enabled
default: "false"- Specifies whether to use TLS for remote execution/caching and the build event service (BES).
--[no]verbose_failures
default: "false"- If a command fails, print out the full command line.
--worker_extra_flag=<a 'name=value' assignment>
multiple uses are accumulated- Extra command-flags that will be passed to worker processes in addition to -- persistent_worker, keyed by mnemonic (e.g. --worker_extra_flag=Javac=--debug.
--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 accumulated- How many instances of a worker process (like the persistent Java compiler) may be launched if you use the 'worker' strategy. May be specified as [name=value] to give a different value per worker mnemonic. Takesan 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.
--[no]worker_quit_after_build
default: "false"- If enabled, all workers quit after a build is done.
--[no]worker_sandboxing
default: "false"- If enabled, workers will be executed in a sandboxed environment.
--[no]worker_verbose
default: "false"- If enabled, prints verbose messages when workers are started, shutdown, ...
--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.
- Options that control build execution:
--[no]experimental_split_xml_generation
default: "false"-
If this flag is set, and a test action does not generate a test.xml file, then
Bazel uses a separate action to generate a dummy test.xml file containing the
test log. Otherwise, Bazel generates the test.xml as part of the test action.
Tags:execution
--[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
--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 {@value FLAG_SYNTAX}. Values must
be between 1 and5000 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 onhost resources. Must be at least 1.
Tags:bazel_internal_configuration
--modify_execution_info=<regex=[+-]key,regex=[+-]key,...>
default: ""-
Add 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, SkylarkAction,
TestRunner. When specifying multiple values, order matters because many regexes
may apply to the same mnemonic.
Syntax: "regex=[+-]key,[+-]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_resource_processor
-
Enable the 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
Tags:host_machine_resource_optimizations
,execution
- Options that configure the toolchain used for action execution:
--android_aapt=<aapt, aapt2 or auto>
default: "auto"-
Selects the version of androidAaptVersion to use for android_binary rules.Flag
to help the test and transition to aapt2.
Tags:affects_outputs
,loading_and_analysis
,loses_incremental_state
--android_compiler=<a string>
default: see description-
The Android target compiler.
Tags:affects_outputs
,loading_and_analysis
,loses_incremental_state
--android_crosstool_top=<a build target label>
default: "//external:android/crosstool"-
The location of the C++ compiler used for Android builds.
Tags:affects_outputs
,changes_inputs
,loading_and_analysis
,loses_incremental_state
--android_grte_top=<a label>
default: see description-
The Android target grte_top.
Tags:changes_inputs
,loading_and_analysis
,loses_incremental_state
--android_manifest_merger=<legacy or android>
default: "android"-
Selects the manifest merger to use for android_binary rules. Flag to help
thetransition to the Android manifest merger from the legacy merger.
Tags:affects_outputs
,loading_and_analysis
,loses_incremental_state
--android_sdk=<a build target label>
default: "@bazel_tools//tools/android:sdk"-
Specifies Android SDK/platform that is used to build Android applications.
Tags:changes_inputs
,loading_and_analysis
,loses_incremental_state
--apple_compiler=<a string>
default: see description-
The Apple target compiler. Useful for selecting variants of a toolchain (e.g.
xcode-beta).
Tags:affects_outputs
,loading_and_analysis
,loses_incremental_state
--apple_crosstool_top=<a build target label>
default: "@bazel_tools//tools/cpp:toolchain"-
The label of the crosstool package to be used in Apple and Objc rules and their
dependencies.
Tags:loses_incremental_state
,changes_inputs
--apple_grte_top=<a build target label>
default: see description-
The Apple target grte_top.
Tags:changes_inputs
,loading_and_analysis
,loses_incremental_state
--apple_sdk=<a build target label>
default: see description-
Location of target that will provide the appropriate Apple SDK for the current
build configuration.
Tags:affects_outputs
,loading_and_analysis
--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 description-
The C++ compiler to use for compiling the target.
Tags:loading_and_analysis
,execution
--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
currently be a filegroup that contains a single file, the binary. 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
--crosstool_top=<a build target label>
default: "@bazel_tools//tools/cpp:toolchain"-
The label of the crosstool package to be used for compiling C++ code.
Tags:loading_and_analysis
,changes_inputs
,affects_outputs
--custom_malloc=<a build target label>
default: see description-
Specifies a custom malloc implementation. This setting overrides malloc
attributes in build rules.
Tags:changes_inputs
,affects_outputs
--enabled_toolchain_types=<a build target label>
default: ""-
Enable toolchain resolution for the given toolchain type, if the rules used
support that. This does not directly change the core Bazel machinery, but is a
signal to participating rule implementations that toolchain resolution should
be used.
Tags:loading_and_analysis
--[no]experimental_enable_cc_toolchain_config_info
default: "false"-
If true, Bazel will allow creating a CcToolchainConfigInfo.
Tags:loading_and_analysis
,experimental
--[no]experimental_enable_objc_cc_deps
default: "true"-
Allows objc_* rules to depend on cc_library and causes any objc dependencies to
be built with --cpu set to "ios_<--ios_cpu>" for any values in
--ios_multi_cpu.
Tags:loading_and_analysis
,incompatible_change
--extra_execution_platforms=<comma-separated list of options>
multiple uses are accumulated-
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().
Tags:execution
--extra_toolchains=<comma-separated list of options>
multiple uses are accumulated-
The 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 description-
A 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_crosstool_top=<a build target label>
default: see description-
By default, the --crosstool_top and --compiler options are also used for the
host configuration. If this flag is provided, Bazel uses the default libc and
compiler for the given crosstool_top.
Tags:loading_and_analysis
,changes_inputs
,affects_outputs
--host_grte_top=<a label>
default: see description-
If specified, this setting overrides the libc top-level directory (--grte_top)
for the host configuration.
Tags:action_command_lines
,affects_outputs
--host_platform=<a build target label>
default: "@bazel_tools//platforms:host_platform"-
The label of a platform rule that describes the host system.
Tags:affects_outputs
,changes_inputs
,loading_and_analysis
--[no]incompatible_disable_expand_if_all_available_in_flag_set
default: "false"-
If true, Bazel will not allow specifying expand_if_all_available in flag_sets
(see https://github.com/bazelbuild/bazel/issues/7008 for migration
instructions).
Tags:loading_and_analysis
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_disable_legacy_crosstool_fields
default: "false"-
If true, Bazel will not read crosstool flags from legacy crosstool fields (see
https://github.com/bazelbuild/bazel/issues/6861 for migration instructions).
Tags:loading_and_analysis
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_disable_runtimes_filegroups
default: "false"-
If true, cc_toolchain.static_runtime_libs and cc_toolchain.dynamic_runtime_libs
are replaced by cc_toolchain.static_runtime_lib and cc_toolchain.
dynamic_runtime_lib (see https://github.com/bazelbuild/bazel/issues/6942)
Tags:action_command_lines
,loading_and_analysis
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_dont_emit_static_libgcc
default: "false"-
If true, bazel will not add --static-libgcc to the linking command line, it
will be the responsibility of the C++ toolchain to append this flag.
Tags:action_command_lines
,loading_and_analysis
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_linkopts_in_user_link_flags
default: "false"-
If true, flags coming from --linkopt Bazel option will appear in
user_link_flags crosstool variable, not in legacy_link_flags.
Tags:action_command_lines
,loading_and_analysis
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_strict_objc_module_maps
default: "false"-
Propagates Objective-C module maps only to direct dependencies in the '
objc' provider, not to all transitive dependencies.
Tags:changes_inputs
,loading_and_analysis
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_use_aapt2_by_default
default: "false"-
Switch the Android rules to use aapt2 by default for resource processing. To
resolve issues when migrating your app to build with aapt2, see https:
//developer.android.com/studio/command-line/aapt2#aapt2_changes
Tags:loses_incremental_state
,affects_outputs
,incompatible_change
,triggered_by_all_incompatible_changes
-
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 description-
Specifies the version of the iOS SDK to use to build iOS applications.
Tags:loses_incremental_state
--macos_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')>
default: see description-
Specifies the version of the macOS SDK to use to build macOS applications.
Tags:loses_incremental_state
--minimum_os_version=<a string>
default: see description-
The minimum OS version which your compilation targets.
Tags:loading_and_analysis
,affects_outputs
--objc_header_scanner_tool=<a build target label>
default: "@bazel_tools//tools/objc:header_scanner"-
Location of tool to scan Objective-C code for inclusions and output a .
headers_list file.
Tags:changes_inputs
--platforms=<a build target label>
default: "@bazel_tools//platforms:target_platform"-
The labels of the platform rules describing the target platforms for the
current command.
Tags:affects_outputs
,changes_inputs
,loading_and_analysis
--python2_path=<a string>
default: "python"-
Local path to the Python2 executable. Deprecated, please use python_path or
python_top instead.
Tags:loading_and_analysis
,affects_outputs
,deprecated
--python3_path=<An option for python3 path>
default: "auto"-
Local path to the Python3 executable. Deprecated, please use python_path or
python_top instead.
Tags:loading_and_analysis
,affects_outputs
,deprecated
--python_path=<a string>
default: "python"-
The absolute path of the Python interpreter invoked by Bazel.
Tags:loading_and_analysis
,affects_outputs
--python_top=<a build target label>
default: see description-
The label of py_runtime rule used for the Python interpreter invoked by Bazel.
Tags:loading_and_analysis
,affects_outputs
--tvos_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')>
default: see description-
Specifies the version of the tvOS SDK to use to build tvOS applications.
Tags:loses_incremental_state
--watchos_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')>
default: see description-
Specifies the version of the watchOS SDK to use to build watchOS applications.
Tags:loses_incremental_state
--xcode_version=<a string>
default: see description-
If 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: "@local_config_xcode//: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
- Options that control the output of the command:
--[no]apple_enable_auto_dsym_dbg
default: "false"-
Whether to force enable generating debug symbol(.dSYM) file(s) for dbg builds.
Tags:affects_outputs
,action_command_lines
--[no]apple_generate_dsym
default: "false"-
Whether to generate debug symbol(.dSYM) file(s).
Tags:affects_outputs
,action_command_lines
--[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]build_runfile_links
default: "true"-
If true, build runfiles symlink forests for all targets. If false, write only
manifests when possible.
Tags:affects_outputs
--[no]build_runfile_manifests
default: "true"-
If true, write runfiles manifests for all targets. If false, omit them.
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 list of options>
default: ".pb.h"-
Sets the prefixes of header files that a cc_proto_library creates.
Tags:affects_outputs
,loading_and_analysis
--cc_proto_library_source_suffixes=<comma-separated list of options>
default: ".pb.cc"-
Sets the prefixes of source files that a cc_proto_library creates.
Tags:affects_outputs
,loading_and_analysis
--[no]enable_apple_binary_native_protos
default: "true"-
If set, apple_binary will generate and link objc protos into the output binary.
Tags:affects_outputs
,incompatible_change
--[no]experimental_objc_enable_module_maps
default: "false"-
Enables module map generation and interpretation.
Tags:action_command_lines
--[no]experimental_proto_extra_actions
default: "false"-
Run extra actions for alternative Java api versions in a proto_library.
Tags:affects_outputs
,loading_and_analysis
,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]legacy_external_runfiles
default: "true"-
If true, build runfiles symlink forests for external repositories under .
runfiles/wsname/external/repo (in addition to .runfiles/repo).
Tags:affects_outputs
--[no]objc_generate_linkmap
default: "false"-
Specifies whether to generate a linkmap file.
Tags:affects_outputs
--output_groups=<comma-separated list of options>
multiple uses are accumulated-
Specifies which output groups of the top-level targets to build. If omitted, a
default set of output groups are built. When specified the default set is
overridden. However you may use --output_groups=+<output_group> or --
output_groups=-<output_group> to instead modify the set of output groups.
Tags:execution
,affects_outputs
--[no]output_symbol_counts
default: "false"-
If enabled, for every C++ binary linked with gold, the number of defined
symbols and the number of used symbols per input file is stored in a .sc file.
Tags:action_command_lines
,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
- Options that let the user configure the intended output, affecting its value, as opposed to its existence:
--action_env=<a 'name=value' assignment with an optional value part>
multiple uses are accumulated-
Specifies the set of environment variables available to actions. Variables can
be either specified by name, in which case the value will be taken from the
invocation environment, or by the name=value pair which sets the value
independent of the invocation environment. 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
--android_cpu=<a string>
default: "armeabi-v7a"-
The Android target CPU.
Tags:affects_outputs
,loading_and_analysis
,loses_incremental_state
--[no]android_databinding_use_v3_4_args
default: "false"-
Use android databinding v2 with 3.4.0 argument
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 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.
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
--apple_bitcode=<none, embedded_markers or embedded>
default: "none"-
Specify the Apple bitcode mode for compile steps. Values: 'none', '
embedded_markers', 'embedded'.
Tags:loses_incremental_state
--aspects=<comma-separated list of options>
multiple uses are accumulated- Comma-separated list of aspects to be applied to top-level targets. All aspects are applied to all top-level targets independently. Aspects are specified in the form <bzl-file-label>%<aspect_name>, for example '//tools: my_def.bzl%my_aspect', where 'my_aspect' is a top-level value from from a file tools/my_def.bzl
--[no]build_python_zip
default: "auto"-
Build python executable zip; on on Windows, off on other platforms
Tags: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
--conlyopt=<a string>
multiple uses are accumulated-
Additional option to pass to gcc when compiling C source files.
Tags:action_command_lines
,affects_outputs
--copt=<a string>
multiple uses are accumulated-
Additional options to pass to gcc.
Tags:action_command_lines
,affects_outputs
--cpu=<a string>
default: ""-
The target CPU.
Tags:changes_inputs
,affects_outputs
--cxxopt=<a string>
multiple uses are accumulated-
Additional option to pass to gcc when compiling C++ source files.
Tags:action_command_lines
,affects_outputs
--define=<a 'name=value' assignment>
multiple uses are accumulated-
Each --define option specifies an assignment for a build variable.
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_fdo_profile_absolute_path
default: "true"-
If set, use of fdo_absolute_profile_path 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
--experimental_action_listener=<a build target label>
multiple uses are accumulated-
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: "false"-
Use android databinding v2
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
--[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_cc_coverage
default: "false"-
If specified, Bazel will use gcov to collect code coverage for C++ test
targets. This option only works for gcc compilation.
Tags:changes_inputs
,affects_outputs
,loading_and_analysis
,experimental
--[no]experimental_java_coverage
default: "false"-
If true Bazel will use a new way of computing code coverage for java targets.
Tags:affects_outputs
--[no]experimental_link_compile_output_separately
default: "false"-
This flag is experimental and may go away at any time. If true, dynamically
linked binary targets will build and link their own srcs as a dynamic library
instead of directly linking it in.
Tags:loading_and_analysis
,affects_outputs
,experimental
--experimental_multi_cpu=<comma-separated list of options>
multiple uses are accumulated-
This flag allows specifying multiple target CPUs. If this is specified, the --
cpu option is ignored.
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
--[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
--fat_apk_cpu=<comma-separated list of options>
default: "armeabi-v7a"-
Setting this option enables fat APKs, which contain native binaries for all
specified target architectures, e.g., --fat_apk_cpu=x86,armeabi-v7a. If this
flag is specified, then --android_cpu is ignored for dependencies of
android_binary rules.
Tags:affects_outputs
,loading_and_analysis
,loses_incremental_state
--fdo_instrument=<a string>
default: see description-
Generate 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 description-
Use FDO profile information to optimize compilation. Specify the name of the
zip file containing the .gcda file tree, or an afdo file containing an auto
profile. This flag also accepts files specified as labels, for example
//foo/bar:file.afdo. Such labels must refer to input files; you may need to add
an exports_files directive to the corresponding package to make the file
visible to Bazel. It also accepts a raw or an indexed LLVM profile file. This
flag will be superseded by fdo_profile rule.
Tags:affects_outputs
--fdo_prefetch_hints=<a build target label>
default: see description-
Use cache prefetch hints.
Tags:affects_outputs
--fdo_profile=<a build target label>
default: see description-
The fdo_profile representing the profile to be used for optimization.
Tags:affects_outputs
--features=<a string>
multiple uses are accumulated-
The given features will be enabled or disabled by default for all packages.
Specifying -<feature> will disable the feature globally. Negative
features always override positive ones. This flag is used to enable rolling out
default feature changes without a Bazel release.
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
--force_python=<PY2 or PY3>
default: see description-
Overrides default_python_version attribute. Can be "PY2" or "
PY3".
Tags:loading_and_analysis
,affects_outputs
--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 accumulated-
Additional option to pass to gcc when compiling C source files for host tools.
Tags:action_command_lines
,affects_outputs
--host_copt=<a string>
multiple uses are accumulated-
Additional options to pass to gcc for host tools.
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 accumulated-
Additional options to pass to gcc for host tools.
Tags:action_command_lines
,affects_outputs
--host_force_python=<PY2 or PY3>
default: see description-
Overrides default_python_version attribute for the host configuration. Can be
"PY2" or "PY3".
Tags:loading_and_analysis
,affects_outputs
--host_linkopt=<a string>
multiple uses are accumulated-
Additional option to pass to gcc when linking host tools.
Tags:action_command_lines
,affects_outputs
--[no]incompatible_merge_genfiles_directory
default: "false"-
If true, the genfiles directory is folded into the bin directory.
Tags:affects_outputs
,incompatible_change
,triggered_by_all_incompatible_changes
--[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_cpu=<a string>
default: "x86_64"-
Specifies to target CPU of iOS compilation.
Tags:no_op
,deprecated
--ios_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')>
default: see description-
Minimum compatible iOS version for target simulators and devices.
Tags:loses_incremental_state
--ios_multi_cpus=<comma-separated list of options>
default: ""-
Comma-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"-
When on, use --whole-archive for cc_binary rules that have linkshared=1 and
either linkstatic=1 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
--linkopt=<a string>
multiple uses are accumulated-
Additional option to pass to gcc when linking.
Tags:action_command_lines
,affects_outputs
--ltobackendopt=<a string>
multiple uses are accumulated-
Additional option to pass to the LTO backend step (under --features=thin_lto).
Tags:action_command_lines
,affects_outputs
--ltoindexopt=<a string>
multiple uses are accumulated-
Additional 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>
default: "x86_64"-
Comma-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 description-
Minimum compatible macOS version for targets.
Tags:loses_incremental_state
--[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 --compilationMode=opt are
specified.
Tags:action_command_lines
--objccopt=<a string>
multiple uses are accumulated-
Additional options to pass to Objective C compilation.
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 accumulated-
Additional 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 accumulated-
Additional 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 description-
Specifies 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 description-
Prefix to insert in front of command before running. Examples:
--run_under=valgrind
--run_under=strace
--run_under='strace -c'
--run_under='valgrind --quiet --num-callers=20'
--run_under=//package:target
--run_under='//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 accumulated-
Additional options to pass to strip when generating a '<name>.
stripped' binary.
Tags:action_command_lines
,affects_outputs
--swiftcopt=<a string>
multiple uses are accumulated-
Additional options to pass to Swift compilation.
Tags:action_command_lines
--symlink_prefix=<a string>
default: see description-
The prefix that is prepended to any of the convenience symlinks that are
created after a build. If '/' is passed, then no symlinks are created
and no warning is emitted. If omitted, the default value is the name of the
build tool.
Tags:affects_outputs
--tvos_cpus=<comma-separated list of options>
default: "x86_64"-
Comma-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 description-
Minimum compatible tvOS version for target simulators and devices.
Tags:loses_incremental_state
--watchos_cpus=<comma-separated list of options>
default: "i386"-
Comma-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 description-
Minimum compatible watchOS version for target simulators and devices.
Tags:loses_incremental_state
--xbinary_fdo=<a build target label>
default: see description-
Use 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
- Options that affect how strictly Bazel enforces valid build inputs (rule definitions, flag combinations, etc.):
--auto_cpu_environment_group=<a build target label>
default: ""-
Declare the environment_group to use for automatically mapping cpu values to
target_environment values.
Tags:changes_inputs
,loading_and_analysis
,experimental
--[no]check_licenses
default: "false"-
Check that licensing constraints imposed by dependent packages do not conflict
with distribution modes of the targets being built. By default, licenses are
not checked.
Tags:build_file_semantics
--[no]check_visibility
default: "true"-
If disabled, visibility errors are demoted to warnings.
Tags:build_file_semantics
--[no]desugar_for_android
default: "true"-
Whether to desugar Java 8 bytecode before dexing.
Tags:affects_outputs
,loading_and_analysis
,loses_incremental_state
--[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_allow_android_library_deps_without_srcs
default: "false"-
Flag to help transition from allowing to disallowing srcs-less android_library
rules with deps. The depot needs to be cleaned up to roll this out by default.
Tags:eagerness_to_exit
,loading_and_analysis
--[no]experimental_android_throw_on_resource_conflict
default: "false"-
If passed, resource merge conflicts will be treated as errors instead of
warnings
Tags:eagerness_to_exit
,loading_and_analysis
--[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_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
--experimental_import_deps_checking=<off, warning or error>
default: "OFF"-
When enabled, check whether the dependencies of an aar_import are complete.
This enforcement can break the build, or can just result in warnings.
Tags:loading_and_analysis
--[no]experimental_java_proto_add_allowed_public_imports
default: "false"-
If true, add --allowed_public_imports to the java compile actions.
Tags:affects_outputs
,loading_and_analysis
,experimental
--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]strict_filesets
default: "false"-
If this option is enabled, filesets crossing package boundaries are reported as
errors. It does not work when check_fileset_dependencies_recursively is
disabled.
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
--[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 accumulated-
Declares 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
- Options that affect the signing outputs of a build:
--apk_signing_method=<v1, v2 or v1_v2>
default: "v1_v2"-
Implementation to use to sign APKs
Tags:action_command_lines
,affects_outputs
,loading_and_analysis
--default_ios_provisioning_profile=<a build target label>
default: ""-
Tags:changes_inputs
--[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
--extra_entitlements=<a build target label>
default: see description-
Location of a .entitlements file that is merged into any iOS signing action in
this build.
Tags:changes_inputs
--ios_signing_cert_name=<a string>
default: see description-
Certificate 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
- Options that govern the behavior of the test environment or test runner:
--[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: "500"-
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]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]experimental_windows_native_test_wrapper
default: "false"-
On Windows: if true, uses the C++ test wrapper to run tests, otherwise uses
tools/test/test-setup.sh as on other platforms. On other platforms: no-op.
Tags:loading_and_analysis
,test_runner
--[no]ios_memleaks
default: "false"-
Enable checking for memory leaks in ios_test targets.
Tags:action_command_lines
--ios_simulator_device=<a string>
default: "iPhone 5s"-
The 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: "9.3"-
The 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 accumulated- Specifies number of times to run each test. If any of those attempts fail for any reason, the whole test would be 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.
--test_env=<a 'name=value' assignment with an optional value part>
multiple uses are accumulated-
Specifies additional environment variables to be injected into the test runner
environment. Variables can be either specified by name, in which case its value
will be read from the Bazel client environment, or by the name=value pair. 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 bazel to use its default timeouts for that category.
--tvos_simulator_device=<a string>
default: "Apple TV 1080p"-
The device to simulate when running an tvOS application in the simulator, e.g.
'Apple TV 1080p'. 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
--tvos_simulator_version=<a dotted version (for example '2.3' or '3.3alpha2.4')>
default: "9.0"-
The version of tvOS to run on the simulator when running or testing.
Tags:test_runner
--watchos_simulator_device=<a string>
default: "Apple Watch - 38mm"-
The device to simulate when running an watchOS application in the simulator, e.
g. 'Apple Watch - 38mm'. 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
--watchos_simulator_version=<a dotted version (for example '2.3' or '3.3alpha2.4')>
default: "2.0"-
The version of watchOS to run on the simulator when running or testing.
Tags:test_runner
- Options that trigger optimizations of the build time:
--[no]distinct_host_configuration
default: "true"-
Build all the tools used during the build for a distinct configuration from
that used for the target program. When this is disabled, the same configuration
is used for host and target programs. This may cause undesirable rebuilds of
tools such as the protocol compiler (and then everything downstream) whenever a
minor change is made to the target configuration, such as setting the linker
options. When this is enabled (the default), a distinct configuration will be
used to build the tools, preventing undesired rebuilds. However, certain
libraries will then need to be compiled twice, once for each configuration,
which may cause some builds to be slower. As a rule of thumb, this option is
likely to benefit users that make frequent changes in configuration (e.g.
opt/dbg). Please read the user manual for the full explanation.
Tags:loses_incremental_state
,bazel_internal_configuration
,loading_and_analysis
--[no]experimental_inmemory_dotd_files
default: "false"-
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_objc_header_thinning
default: "false"-
If set then ObjcCompile actions will have their action inputs reduced by
running a tool to detect which headers are actually required for compilation.
Tags:changes_inputs
,loading_and_analysis
,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
--objc_header_thinning_partition_size=<an integer>
default: "120"-
The maximum number of source files to process within in each header scanning
action.
Tags:host_machine_resource_optimizations
--[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]parse_headers_verifies_modules
default: "false"-
If enabled, the parse_headers feature verifies that a header module can be
built for the target in question instead of doing a separate compile of the
header.
Tags:loading_and_analysis
,changes_inputs
--[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: "false"-
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
--[no]use_singlejar_apkbuilder
default: "true"-
Build Android APKs with SingleJar.
Tags:loading_and_analysis
- Options that affect the verbosity, format or location of logging:
--[no]announce
default: "false"-
Deprecated. No-op.
Tags:affects_outputs
--explain=<a path>
default: see description-
Causes the build system to explain each executed step of the build. The
explanation is written to the specified log file.
Tags:affects_outputs
--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
--output_filter=<a valid Java regular expression>
default: see description-
Only shows warnings 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 two reports on still running jobs. The
default value 0 means to use the default 10:30:60 incremental algorithm.
Tags:affects_outputs
--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.
Tags:affects_outputs
--[no]toolchain_resolution_debug
default: "false"-
Print debug information while finding toolchains for a rule. This might help
developers of Bazel or Starlark rules with debugging failures due to missing
toolchains.
Tags:terminal_output
--[no]verbose_explanations
default: "false"-
Increases the verbosity of the explanations issued if --explain is enabled. Has
no effect if --explain is not enabled.
Tags:affects_outputs
- Miscellaneous options, not otherwise categorized.:
--[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.
--[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.
--check_constraint=<a string>
multiple uses are accumulated- Check the listed constraint.
--[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.
--[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.
--[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>
default: ""- A 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.
--[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_execution_log_file=<a string>
default: ""- Log the executed spawns into this file as delimited Spawn protos.
--experimental_extra_action_filter=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths>
default: ""- Filters set of targets to schedule extra_actions for.
--[no]experimental_extra_action_top_level_only
default: "false"- Only schedules extra_actions for top level targets.
--[no]experimental_interleave_loading_and_analysis
default: "true"- No-op.
--[no]experimental_j2objc_header_map
default: "true"- Whether to generate J2ObjC header map in parallel of J2ObjC transpilation.
--experimental_java_classpath=<off or javabuilder>
default: "javabuilder"- Enables reduced classpaths for Java compilations.
--[no]experimental_local_memory_estimate
default: "false"- Estimate the actual memory available online. By default, Bazel assumes most actions use a fixed amount of memory, and counts that against the total available system memory, regardless of how much memory is actually available. This option enables online estimation of how much memory is available at any given time, and thus does not require accurate estimation of how much memory a given action will take.
--[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.
--flaky_test_attempts=<a positive integer, the string "default", or test_regex@attempts. This flag may be passed more than once>
multiple uses are accumulated- Each 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 would be marked as 'FLAKY' in the test summary. If this option is set, it should specify an int N or the string 'default'. If it's an int, then all tests will be run up to N times. If it is not specified or its value is ' 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).
--genrule_strategy=<a string>
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.
--host_java_launcher=<a build target label>
default: see description- The Java launcher used by tools that are executed during a build.
--host_java_toolchain=<a build target label>
default: "@bazel_tools//tools/jdk:toolchain"- The Java toolchain used to build tools that are executed during a build.
--host_javabase=<a build target label>
default: see description- JAVABASE used for the host JDK. This is the java_runtime which is used to execute tools during a build.
--host_javacopt=<a string>
multiple uses are accumulated- Additional options to pass to javac when building tools that are executed during a build.
--host_platform_remote_properties_override=<a string>
default: see description- Manually set the remote_execution_properties for the host platform if it is not already set.
--[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 or TMPDIR. 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
,triggered_by_all_incompatible_changes
--j2objc_translation_flags=<comma-separated list of options>
multiple uses are accumulated- Additional options to pass to the J2ObjC tool.
--java_debug
-
Causes 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_launcher=<a build target label>
default: see description- The Java launcher to use when building Java binaries. The "launcher" attribute overrides this flag.
--java_toolchain=<a build target label>
default: "@bazel_tools//tools/jdk:toolchain"- The name of the toolchain rule for Java.
--javabase=<a build target label>
default: "@bazel_tools//tools/jdk:jdk"- JAVABASE used for the JDK invoked by Bazel. This is the java_runtime which will be used to execute external Java commands.
--javacopt=<a string>
multiple uses are accumulated- Additional options to pass to javac.
--jvmopt=<a string>
multiple uses are accumulated- Additional options to pass to the Java VM. These options will get added to the VM startup options of each java_binary target.
--local_resources=<comma-separated available amount of RAM (in MB), CPU (in cores) and available I/O (1.0 being average workstation)>
default: see description- Explicitly set amount of local resources available to Bazel. By default, Bazel will query system configuration to estimate amount of RAM (in MB) and number of CPU cores available for the locally executed build actions. It would also assume default I/O capabilities of the local workstation (1.0). This options allows to explicitly set all 3 values. Note, that if this option is used, Bazel will ignore --ram_utilization_factor.
--local_termination_grace_seconds=<an integer>
default: "15"- Time to wait between terminating a local process due to timeout and forcefully shutting it down.
--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.
--[no]materialize_param_files
default: "false"- Writes intermediate parameter files to output tree even when using remote action execution. Useful when debugging actions.
--message_translations=<a string>
multiple uses are accumulated- The message translations used for translating messages in Java targets.
--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'.
--plugin=<a build target label>
multiple uses are accumulated- Plugins to use in the build. Currently works with java_plugin.
--proguard_top=<a build target label>
default: see description- Specifies which version of ProGuard to use for code removal when building a Java binary.
--proto_compiler=<a build target label>
default: "@com_google_protobuf//:protoc"-
The label of the proto-compiler.
Tags:affects_outputs
,loading_and_analysis
--proto_toolchain_for_cc=<a build target label>
default: "@com_google_protobuf//: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: "@com_google_protobuf//: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: "@com_google_protobuf_javalite//: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 accumulated-
Additional options to pass to the protobuf compiler.
Tags:affects_outputs
--ram_utilization_factor=<an integer>
default: "67"- Specify what percentage of the system's RAM Bazel should try to use for its subprocesses. This option affects how many processes Bazel will try to run in parallel. If you run several Bazel builds in parallel, using a lower value for this option may avoid thrashing and thus improve overall throughput. Using a value higher than the default is NOT recommended. Note that Bazel's estimates are very coarse, so the actual RAM usage may be much higher or much lower than specified. Note also that this option does not affect the amount of memory that the Bazel server itself will use.
--[no]resource_autosense
default: "false"- This flag has no effect, and is deprecated
--[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 description-
Absolute 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:/tools/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
--[no]show_loading_progress
default: "true"- If enabled, causes Bazel to print "Loading package:" messages.
--spawn_strategy=<a string>
default: ""- Specify how spawn actions are executed by default. 'standalone' means run all of them locally without any kind of sandboxing. 'sandboxed' means to run them in a sandboxed environment with limited privileges (details depend on platform support).
--strategy=<a 'name=value' assignment>
multiple uses are accumulated- Specify how to distribute compilation of other spawn actions. Example: ' Javac=local' means to spawn Java compilation locally. ' JavaIjar=sandboxed' means to spawn Java Ijar actions in a sandbox.
--strategy_regexp=<a '<RegexFilter>=value' assignment>
multiple uses are accumulated- Override 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 first 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'.
--[no]subcommands
[-s
] default: "false"- Display the subcommands executed during a build.
--test_arg=<a string>
multiple uses are accumulated- Specifies 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 description- Specifies a filter to forward to the test framework. Used to limit the tests run. Note that this does not affect which targets are built.
--[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.
--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_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).
--test_result_expiration=<an integer>
default: "-1"- This option is deprecated and has no effect.
--test_sharding_strategy=<explicit, experimental_heuristic or disabled>
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. 'experimental_heuristic' to enable sharding on remotely executed tests without an explicit 'shard_count' attribute which link in a supported framework. Considered experimental.
--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_strategy=<a string>
default: ""- Specifies which strategy to use when running tests.
--test_summary=<short, terse, detailed, none or testcase>
default: "short"- Specifies the desired format ot 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, and ' none' to omit the summary.
--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.
--test_tmpdir=<a path>
default: see description- Specifies the base temporary directory for 'bazel test' to use.
--[no]translations
default: "auto"- Translate Java messages; bundle all translations into the jar for each affected rule.
--[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]verbose_failures
default: "false"- If a command fails, print out the full command line.
Canonicalize-flags Options
- Options that control the output of the command:
--[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]show_warnings
default: "false"-
Output parser warnings to standard error (e.g. for conflicting flag options).
Tags:affects_outputs
,terminal_output
- Options that affect the verbosity, format or location of logging:
--[no]bep_publish_used_heap_size_post_build
default: "false"- When set we collect and publish used_heap_size_post_build from build_event_stream.proto. This forces a full GC and is off by default.
- Options specifying or altering a generic input to a Bazel command that does not fall into other categories.:
--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
Clean Options
Inherits all options from build.
- Options that control the output of the command:
--[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_async
-
If specified, clean asynchronously removes the entire working tree for this %
{product} 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
- Options that affect the verbosity, format or location of logging:
--[no]bep_publish_used_heap_size_post_build
default: "false"- When set we collect and publish used_heap_size_post_build from build_event_stream.proto. This forces a full GC and is off by default.
Coverage Options
Inherits all options from test.
- Options that affect the verbosity, format or location of logging:
--[no]bep_publish_used_heap_size_post_build
default: "false"- When set we collect and publish used_heap_size_post_build from build_event_stream.proto. This forces a full GC and is off by default.
Cquery Options
Inherits all options from build.
- Options relating to query output and semantics:
--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]host_deps
default: "true"-
Query: If disabled, dependencies on 'host configuration' targets will
not be included in the dependency graph over which the query operates. A '
host 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 (on the host machine) rather than a part of the same
'target' program.
Cquery: If disabled, filters out all configured targets which cross a host
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 host configuration, only host configured targets
will be returned.
Tags:build_file_semantics
--[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.
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, textproto, transitions, proto. If you select '
transitions', you also have to specify the --transitions=(lite|full) option.
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: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_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
--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]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
--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
- Options that affect the verbosity, format or location of logging:
--[no]bep_publish_used_heap_size_post_build
default: "false"- When set we collect and publish used_heap_size_post_build from build_event_stream.proto. This forces a full GC and is off by default.
- Options that control build execution:
--[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
--modify_execution_info=<regex=[+-]key,regex=[+-]key,...>
default: ""-
Add 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, SkylarkAction,
TestRunner. When specifying multiple values, order matters because many regexes
may apply to the same mnemonic.
Syntax: "regex=[+-]key,[+-]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_resource_processor
-
Enable the 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
Tags:host_machine_resource_optimizations
,execution
- Options that configure the toolchain used for action execution:
--android_aapt=<aapt, aapt2 or auto>
default: "auto"-
Selects the version of androidAaptVersion to use for android_binary rules.Flag
to help the test and transition to aapt2.
Tags:affects_outputs
,loading_and_analysis
,loses_incremental_state
--android_compiler=<a string>
default: see description-
The Android target compiler.
Tags:affects_outputs
,loading_and_analysis
,loses_incremental_state
--android_crosstool_top=<a build target label>
default: "//external:android/crosstool"-
The location of the C++ compiler used for Android builds.
Tags:affects_outputs
,changes_inputs
,loading_and_analysis
,loses_incremental_state
--android_grte_top=<a label>
default: see description-
The Android target grte_top.
Tags:changes_inputs
,loading_and_analysis
,loses_incremental_state
--android_manifest_merger=<legacy or android>
default: "android"-
Selects the manifest merger to use for android_binary rules. Flag to help
thetransition to the Android manifest merger from the legacy merger.
Tags:affects_outputs
,loading_and_analysis
,loses_incremental_state
--android_sdk=<a build target label>
default: "@bazel_tools//tools/android:sdk"-
Specifies Android SDK/platform that is used to build Android applications.
Tags:changes_inputs
,loading_and_analysis
,loses_incremental_state
--apple_compiler=<a string>
default: see description-
The Apple target compiler. Useful for selecting variants of a toolchain (e.g.
xcode-beta).
Tags:affects_outputs
,loading_and_analysis
,loses_incremental_state
--apple_crosstool_top=<a build target label>
default: "@bazel_tools//tools/cpp:toolchain"-
The label of the crosstool package to be used in Apple and Objc rules and their
dependencies.
Tags:loses_incremental_state
,changes_inputs
--apple_grte_top=<a build target label>
default: see description-
The Apple target grte_top.
Tags:changes_inputs
,loading_and_analysis
,loses_incremental_state
--apple_sdk=<a build target label>
default: see description-
Location of target that will provide the appropriate Apple SDK for the current
build configuration.
Tags:affects_outputs
,loading_and_analysis
--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 description-
The C++ compiler to use for compiling the target.
Tags:loading_and_analysis
,execution
--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
currently be a filegroup that contains a single file, the binary. 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
--crosstool_top=<a build target label>
default: "@bazel_tools//tools/cpp:toolchain"-
The label of the crosstool package to be used for compiling C++ code.
Tags:loading_and_analysis
,changes_inputs
,affects_outputs
--custom_malloc=<a build target label>
default: see description-
Specifies a custom malloc implementation. This setting overrides malloc
attributes in build rules.
Tags:changes_inputs
,affects_outputs
--enabled_toolchain_types=<a build target label>
default: ""-
Enable toolchain resolution for the given toolchain type, if the rules used
support that. This does not directly change the core Bazel machinery, but is a
signal to participating rule implementations that toolchain resolution should
be used.
Tags:loading_and_analysis
--[no]experimental_enable_cc_toolchain_config_info
default: "false"-
If true, Bazel will allow creating a CcToolchainConfigInfo.
Tags:loading_and_analysis
,experimental
--[no]experimental_enable_objc_cc_deps
default: "true"-
Allows objc_* rules to depend on cc_library and causes any objc dependencies to
be built with --cpu set to "ios_<--ios_cpu>" for any values in
--ios_multi_cpu.
Tags:loading_and_analysis
,incompatible_change
--extra_execution_platforms=<comma-separated list of options>
multiple uses are accumulated-
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().
Tags:execution
--extra_toolchains=<comma-separated list of options>
multiple uses are accumulated-
The 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 description-
A 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_crosstool_top=<a build target label>
default: see description-
By default, the --crosstool_top and --compiler options are also used for the
host configuration. If this flag is provided, Bazel uses the default libc and
compiler for the given crosstool_top.
Tags:loading_and_analysis
,changes_inputs
,affects_outputs
--host_grte_top=<a label>
default: see description-
If specified, this setting overrides the libc top-level directory (--grte_top)
for the host configuration.
Tags:action_command_lines
,affects_outputs
--host_platform=<a build target label>
default: "@bazel_tools//platforms:host_platform"-
The label of a platform rule that describes the host system.
Tags:affects_outputs
,changes_inputs
,loading_and_analysis
--[no]incompatible_disable_expand_if_all_available_in_flag_set
default: "false"-
If true, Bazel will not allow specifying expand_if_all_available in flag_sets
(see https://github.com/bazelbuild/bazel/issues/7008 for migration
instructions).
Tags:loading_and_analysis
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_disable_legacy_crosstool_fields
default: "false"-
If true, Bazel will not read crosstool flags from legacy crosstool fields (see
https://github.com/bazelbuild/bazel/issues/6861 for migration instructions).
Tags:loading_and_analysis
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_disable_runtimes_filegroups
default: "false"-
If true, cc_toolchain.static_runtime_libs and cc_toolchain.dynamic_runtime_libs
are replaced by cc_toolchain.static_runtime_lib and cc_toolchain.
dynamic_runtime_lib (see https://github.com/bazelbuild/bazel/issues/6942)
Tags:action_command_lines
,loading_and_analysis
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_dont_emit_static_libgcc
default: "false"-
If true, bazel will not add --static-libgcc to the linking command line, it
will be the responsibility of the C++ toolchain to append this flag.
Tags:action_command_lines
,loading_and_analysis
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_linkopts_in_user_link_flags
default: "false"-
If true, flags coming from --linkopt Bazel option will appear in
user_link_flags crosstool variable, not in legacy_link_flags.
Tags:action_command_lines
,loading_and_analysis
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_strict_objc_module_maps
default: "false"-
Propagates Objective-C module maps only to direct dependencies in the '
objc' provider, not to all transitive dependencies.
Tags:changes_inputs
,loading_and_analysis
,incompatible_change
,triggered_by_all_incompatible_changes
--[no]incompatible_use_aapt2_by_default
default: "false"-
Switch the Android rules to use aapt2 by default for resource processing. To
resolve issues when migrating your app to build with aapt2, see https:
//developer.android.com/studio/command-line/aapt2#aapt2_changes
Tags:loses_incremental_state
,affects_outputs
,incompatible_change
,triggered_by_all_incompatible_changes
-
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 description-
Specifies the version of the iOS SDK to use to build iOS applications.
Tags:loses_incremental_state
--macos_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')>
default: see description-
Specifies the version of the macOS SDK to use to build macOS applications.
Tags:loses_incremental_state
--minimum_os_version=<a string>
default: see description-
The minimum OS version which your compilation targets.
Tags:loading_and_analysis
,affects_outputs
--objc_header_scanner_tool=<a build target label>
default: "@bazel_tools//tools/objc:header_scanner"-
Location of tool to scan Objective-C code for inclusions and output a .
headers_list file.
Tags:changes_inputs
--platforms=<a build target label>
default: "@bazel_tools//platforms:target_platform"-
The labels of the platform rules describing the target platforms for the
current command.
Tags:affects_outputs
,changes_inputs
,loading_and_analysis
--python2_path=<a string>
default: "python"-
Local path to the Python2 executable. Deprecated, please use python_path or
python_top instead.
Tags:loading_and_analysis
,affects_outputs
,deprecated
--python3_path=<An option for python3 path>
default: "auto"-
Local path to the Python3 executable. Deprecated, please use python_path or
python_top instead.
Tags:loading_and_analysis
,affects_outputs
,deprecated
--python_path=<a string>
default: "python"-
The absolute path of the Python interpreter invoked by Bazel.
Tags:loading_and_analysis
,affects_outputs
--python_top=<a build target label>
default: see description-
The label of py_runtime rule used for the Python interpreter invoked by Bazel.
Tags:loading_and_analysis
,affects_outputs
--tvos_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')>
default: see description-
Specifies the version of the tvOS SDK to use to build tvOS applications.
Tags:loses_incremental_state
--watchos_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')>
default: see description-
Specifies the version of the watchOS SDK to use to build watchOS applications.
Tags:loses_incremental_state
--xcode_version=<a string>
default: see description-
If 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: "@local_config_xcode//: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
- Options that control the output of the command:
--[no]apple_enable_auto_dsym_dbg
default: "false"-
Whether to force enable generating debug symbol(.dSYM) file(s) for dbg builds.
Tags:affects_outputs
,action_command_lines
--[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 only
manifests when possible.
Tags:affects_outputs
--[no]build_runfile_manifests
default: "true"-
If true, write runfiles manifests for all targets. If false, omit them.
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 list of options>
default: ".pb.h"-
Sets the prefixes of header files that a cc_proto_library creates.
Tags:affects_outputs
,loading_and_analysis
--cc_proto_library_source_suffixes=<comma-separated list of options>
default: ".pb.cc"-
Sets the prefixes of source files that a cc_proto_library creates.
Tags:affects_outputs
,loading_and_analysis
--[no]enable_apple_binary_native_protos
default: "true"-
If set, apple_binary will generate and link objc protos into the output binary.
Tags:affects_outputs
,incompatible_change
--[no]experimental_objc_enable_module_maps
default: "false"-
Enables module map generation and interpretation.
Tags:action_command_lines
--[no]experimental_proto_extra_actions
default: "false"-
Run extra actions for alternative Java api versions in a proto_library.
Tags:affects_outputs
,loading_and_analysis
,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]legacy_external_runfiles
default: "true"-
If true, build runfiles symlink forests for external repositories under .
runfiles/wsname/external/repo (in addition to .runfiles/repo).
Tags:affects_outputs
--[no]objc_generate_linkmap
default: "false"-
Specifies whether to generate a linkmap file.
Tags:affects_outputs
--[no]output_symbol_counts
default: "false"-
If enabled, for every C++ binary linked with gold, the number of defined
symbols and the number of used symbols per input file is stored in a .sc file.
Tags:action_command_lines
,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
- Options that let the user configure the intended output, affecting its value, as opposed to its existence:
--action_env=<a 'name=value' assignment with an optional value part>
multiple uses are accumulated-
Specifies the set of environment variables available to actions. Variables can
be either specified by name, in which case the value will be taken from the
invocation environment, or by the name=value pair which sets the value
independent of the invocation environment. 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
--android_cpu=<a string>
default: "armeabi-v7a"-
The Android target CPU.
Tags:affects_outputs
,loading_and_analysis
,loses_incremental_state
--[no]android_databinding_use_v3_4_args
default: "false"-
Use android databinding v2 with 3.4.0 argument
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 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.
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
--apple_bitcode=<none, embedded_markers or embedded>
default: "none"-
Specify the Apple bitcode mode for compile steps. Values: 'none', '
embedded_markers', 'embedded'.
Tags:loses_incremental_state
--[no]build_python_zip
default: "auto"-
Build python executable zip; on on Windows, off on other platforms
Tags: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
--conlyopt=<a string>
multiple uses are accumulated-
Additional option to pass to gcc when compiling C source files.
Tags:action_command_lines
,affects_outputs
--copt=<a string>
multiple uses are accumulated-
Additional options to pass to gcc.
Tags:action_command_lines
,affects_outputs
--cpu=<a string>
default: ""-
The target CPU.
Tags:changes_inputs
,affects_outputs
--cxxopt=<a string>
multiple uses are accumulated-
Additional option to pass to gcc when compiling C++ source files.
Tags:action_command_lines
,affects_outputs
--define=<a 'name=value' assignment>
multiple uses are accumulated-
Each --define option specifies an assignment for a build variable.
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_fdo_profile_absolute_path
default: "true"-
If set, use of fdo_absolute_profile_path 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
--experimental_action_listener=<a build target label>
multiple uses are accumulated-
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: "false"-
Use android databinding v2
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
--[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_cc_coverage
default: "false"-
If specified, Bazel will use gcov to collect code coverage for C++ test
targets. This option only works for gcc compilation.
Tags:changes_inputs
,affects_outputs
,loading_and_analysis
,experimental
--[no]experimental_java_coverage
default: "false"-
If true Bazel will use a new way of computing code coverage for java targets.
Tags:affects_outputs
--[no]experimental_link_compile_output_separately
default: "false"-
This flag is experimental and may go away at any time. If true, dynamically
linked binary targets will build and link their own srcs as a dynamic library
instead of directly linking it in.
Tags:loading_and_analysis
,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
--[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
--fat_apk_cpu=<comma-separated list of options>
default: "armeabi-v7a"-
Setting this option enables fat APKs, which contain native binaries for all
specified target architectures, e.g., --fat_apk_cpu=x86,armeabi-v7a. If this
flag is specified, then --android_cpu is ignored for dependencies of
android_binary rules.
Tags:affects_outputs
,loading_and_analysis
,loses_incremental_state
--fdo_instrument=<a string>
default: see description-
Generate 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 description-
Use FDO profile information to optimize compilation. Specify the name of the
zip file containing the .gcda file tree, or an afdo file containing an auto
profile. This flag also accepts files specified as labels, for example
//foo/bar:file.afdo. Such labels must refer to input files; you may need to add
an exports_files directive to the corresponding package to make the file
visible to Bazel. It also accepts a raw or an indexed LLVM profile file. This
flag will be superseded by fdo_profile rule.
Tags:affects_outputs
--fdo_prefetch_hints=<a build target label>
default: see description-
Use cache prefetch hints.
Tags:affects_outputs
--fdo_profile=<a build target label>
default: see description-
The fdo_profile representing the profile to be used for optimization.
Tags:affects_outputs
--features=<a string>
multiple uses are accumulated-
The given features will be enabled or disabled by default for all packages.
Specifying -<feature> will disable the feature globally. Negative
features always override positive ones. This flag is used to enable rolling out
default feature changes without a Bazel release.
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
--force_python=<PY2 or PY3>
default: see description-
Overrides default_python_version attribute. Can be "PY2" or "
PY3".
Tags:loading_and_analysis
,affects_outputs
--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 accumulated-
Additional option to pass to gcc when compiling C source files for host tools.
Tags:action_command_lines
,affects_outputs
--host_copt=<a string>
multiple uses are accumulated-
Additional options to pass to gcc for host tools.
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 accumulated-
Additional options to pass to gcc for host tools.
Tags:action_command_lines
,affects_outputs
--host_force_python=<PY2 or PY3>
default: see description-
Overrides default_python_version attribute for the host configuration. Can be
"PY2" or "PY3".
Tags:loading_and_analysis
,affects_outputs
--host_linkopt=<a string>
multiple uses are accumulated-
Additional option to pass to gcc when linking host tools.
Tags:action_command_lines
,affects_outputs
--[no]incompatible_merge_genfiles_directory
default: "false"-
If true, the genfiles directory is folded into the bin directory.
Tags:affects_outputs
,incompatible_change
,triggered_by_all_incompatible_changes
--[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_cpu=<a string>
default: "x86_64"-
Specifies to target CPU of iOS compilation.
Tags:no_op
,deprecated
--ios_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')>
default: see description-
Minimum compatible iOS version for target simulators and devices.
Tags:loses_incremental_state
--ios_multi_cpus=<comma-separated list of options>
default: ""-
Comma-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"-
When on, use --whole-archive for cc_binary rules that have linkshared=1 and
either linkstatic=1 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
--linkopt=<a string>
multiple uses are accumulated-
Additional option to pass to gcc when linking.
Tags:action_command_lines
,affects_outputs
--ltobackendopt=<a string>
multiple uses are accumulated-
Additional option to pass to the LTO backend step (under --features=thin_lto).
Tags:action_command_lines
,affects_outputs
--ltoindexopt=<a string>
multiple uses are accumulated-
Additional 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>
default: "x86_64"-
Comma-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 description-
Minimum compatible macOS version for targets.
Tags:loses_incremental_state
--[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 --compilationMode=opt are
specified.
Tags:action_command_lines
--objccopt=<a string>
multiple uses are accumulated-
Additional options to pass to Objective C compilation.
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 accumulated-
Additional 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 accumulated-
Additional 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 description-
Specifies 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 description-
Prefix to insert in front of command before running. Examples:
--run_under=valgrind
--run_under=strace
--run_under='strace -c'
--run_under='valgrind --quiet --num-callers=20'
--run_under=//package:target
--run_under='//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 accumulated-
Additional options to pass to strip when generating a '<name>.
stripped' binary.
Tags:action_command_lines
,affects_outputs
--swiftcopt=<a string>
multiple uses are accumulated-
Additional options to pass to Swift compilation.
Tags:action_command_lines
--tvos_cpus=<comma-separated list of options>
default: "x86_64"-
Comma-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 description-
Minimum compatible tvOS version for target simulators and devices.
Tags:loses_incremental_state
--watchos_cpus=<comma-separated list of options>
default: "i386"-
Comma-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 description-
Minimum compatible watchOS version for target simulators and devices.
Tags:loses_incremental_state
--xbinary_fdo=<a build target label>
default: see description-
Use 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
- Options that affect how strictly Bazel enforces valid build inputs (rule definitions, flag combinations, etc.):
--auto_cpu_environment_group=<a build target label>
default: ""-
Declare the environment_group to use for automatically mapping cpu values to
target_environment values.
Tags:changes_inputs
,loading_and_analysis
,experimental
--[no]check_licenses
default: "false"-
Check that licensing constraints imposed by dependent packages do not conflict
with distribution modes of the targets being built. By default, licenses are
not checked.
Tags:build_file_semantics
--[no]check_visibility
default: "true"-
If disabled, visibility errors are demoted to warnings.
Tags:build_file_semantics
--[no]desugar_for_android
default: "true"-
Whether to desugar Java 8 bytecode before dexing.
Tags:affects_outputs
,loading_and_analysis
,loses_incremental_state
--[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_allow_android_library_deps_without_srcs
default: "false"-
Flag to help transition from allowing to disallowing srcs-less android_library
rules with deps. The depot needs to be cleaned up to roll this out by default.
Tags:eagerness_to_exit
,loading_and_analysis
--[no]experimental_android_throw_on_resource_conflict
default: "false"-
If passed, resource merge conflicts will be treated as errors instead of
warnings
Tags:eagerness_to_exit
,loading_and_analysis
--[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_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
--experimental_import_deps_checking=<off, warning or error>
default: "OFF"-
When enabled, check whether the dependencies of an aar_import are complete.
This enforcement can break the build, or can just result in warnings.
Tags:loading_and_analysis
--[no]experimental_java_proto_add_allowed_public_imports
default: "false"-
If true, add --allowed_public_imports to the java compile actions.
Tags:affects_outputs
,loading_and_analysis
,experimental
--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]strict_filesets
default: "false"-
If this option is enabled, filesets crossing package boundaries are reported as
errors. It does not work when check_fileset_dependencies_recursively is
disabled.
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
--[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 accumulated-
Declares 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
- Options that affect the signing outputs of a build:
--apk_signing_method=<v1, v2 or v1_v2>
default: "v1_v2"-
Implementation to use to sign APKs
Tags:action_command_lines
,affects_outputs
,loading_and_analysis
--default_ios_provisioning_profile=<a build target label>
default: ""-
Tags:changes_inputs
--[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
--extra_entitlements=<a build target label>
default: see description-
Location of a .entitlements file that is merged into any iOS signing action in
this build.
Tags:changes_inputs
--ios_signing_cert_name=<a string>
default: see description-
Certificate 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
- Options that govern the behavior of the test environment or test runner:
--[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: "500"-
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]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]experimental_windows_native_test_wrapper
default: "false"-
On Windows: if true, uses the C++ test wrapper to run tests, otherwise uses
tools/test/test-setup.sh as on other platforms. On other platforms: no-op.
Tags:loading_and_analysis
,test_runner
--[no]ios_memleaks
default: "false"-
Enable checking for memory leaks in ios_test targets.
Tags:action_command_lines
--ios_simulator_device=<a string>
default: "iPhone 5s"-
The 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: "9.3"-
The 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 accumulated- Specifies number of times to run each test. If any of those attempts fail for any reason, the whole test would be 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.
--test_env=<a 'name=value' assignment with an optional value part>
multiple uses are accumulated-
Specifies additional environment variables to be injected into the test runner
environment. Variables can be either specified by name, in which case its value
will be read from the Bazel client environment, or by the name=value pair. 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 bazel to use its default timeouts for that category.
--tvos_simulator_device=<a string>
default: "Apple TV 1080p"-
The device to simulate when running an tvOS application in the simulator, e.g.
'Apple TV 1080p'. 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
--tvos_simulator_version=<a dotted version (for example '2.3' or '3.3alpha2.4')>
default: "9.0"-
The version of tvOS to run on the simulator when running or testing.
Tags:test_runner
--watchos_simulator_device=<a string>
default: "Apple Watch - 38mm"-
The device to simulate when running an watchOS application in the simulator, e.
g. 'Apple Watch - 38mm'. 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
--watchos_simulator_version=<a dotted version (for example '2.3' or '3.3alpha2.4')>
default: "2.0"-
The version of watchOS to run on the simulator when running or testing.
Tags:test_runner
- Options relating to query output and semantics:
--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]host_deps
default: "true"-
Query: If disabled, dependencies on 'host configuration' targets will
not be included in the dependency graph over which the query operates. A '
host 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 (on the host machine) rather than a part of the same
'target' program.
Cquery: If disabled, filters out all configured targets which cross a host
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 host configuration, only host configured targets
will be returned.
Tags:build_file_semantics
--[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.
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, textproto, transitions, proto. If you select '
transitions', you also have to specify the --transitions=(lite|full) option.
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: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_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
--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]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
--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
- Options that trigger optimizations of the build time:
--[no]distinct_host_configuration
default: "true"-
Build all the tools used during the build for a distinct configuration from
that used for the target program. When this is disabled, the same configuration
is used for host and target programs. This may cause undesirable rebuilds of
tools such as the protocol compiler (and then everything downstream) whenever a
minor change is made to the target configuration, such as setting the linker
options. When this is enabled (the default), a distinct configuration will be
used to build the tools, preventing undesired rebuilds. However, certain
libraries will then need to be compiled twice, once for each configuration,
which may cause some builds to be slower. As a rule of thumb, this option is
likely to benefit users that make frequent changes in configuration (e.g.
opt/dbg). Please read the user manual for the full explanation.
Tags:loses_incremental_state
,bazel_internal_configuration
,loading_and_analysis
--[no]experimental_inmemory_dotd_files
default: "false"-
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_objc_header_thinning
default: "false"-
If set then ObjcCompile actions will have their action inputs reduced by
running a tool to detect which headers are actually required for compilation.
Tags:changes_inputs
,loading_and_analysis
,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
--objc_header_thinning_partition_size=<an integer>
default: "120"-
The maximum number of source files to process within in each header scanning
action.
Tags:host_machine_resource_optimizations
--[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]parse_headers_verifies_modules
default: "false"-
If enabled, the parse_headers feature verifies that a header module can be
built for the target in question instead of doing a separate compile of the
header.
Tags:loading_and_analysis
,changes_inputs
--[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: "false"-
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
--[no]use_singlejar_apkbuilder
default: "true"-
Build Android APKs with SingleJar.
Tags:loading_and_analysis
- Options that affect the verbosity, format or location of logging:
--[no]toolchain_resolution_debug
default: "false"-
Print debug information while finding toolchains for a rule. This might help
developers of Bazel or Starlark rules with debugging failures due to missing
toolchains.
Tags:terminal_output
- Miscellaneous options, not otherwise categorized.:
--[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.
--check_constraint=<a string>
multiple uses are accumulated- Check the listed constraint.
--[no]experimental_j2objc_header_map
default: "true"- Whether to generate J2ObjC header map in parallel of J2ObjC transpilation.
--experimental_java_classpath=<off or javabuilder>
default: "javabuilder"- Enables reduced classpaths for Java compilations.
--[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 description- The Java launcher used by tools that are executed during a build.
--host_java_toolchain=<a build target label>
default: "@bazel_tools//tools/jdk:toolchain"- The Java toolchain used to build tools that are executed during a build.
--host_javabase=<a build target label>
default: see description- JAVABASE used for the host JDK. This is the java_runtime which is used to execute tools during a build.
--host_javacopt=<a string>
multiple uses are accumulated- Additional options to pass to javac when building tools that are executed during a build.
--host_platform_remote_properties_override=<a string>
default: see description- Manually set the remote_execution_properties for the host platform if it is not already set.
--[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 or TMPDIR. 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
,triggered_by_all_incompatible_changes
--j2objc_translation_flags=<comma-separated list of options>
multiple uses are accumulated- Additional options to pass to the J2ObjC tool.
--java_debug
-
Causes 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_launcher=<a build target label>
default: see description- The Java launcher to use when building Java binaries. The "launcher" attribute overrides this flag.
--java_toolchain=<a build target label>
default: "@bazel_tools//tools/jdk:toolchain"- The name of the toolchain rule for Java.
--javabase=<a build target label>
default: "@bazel_tools//tools/jdk:jdk"- JAVABASE used for the JDK invoked by Bazel. This is the java_runtime which will be used to execute external Java commands.
--javacopt=<a string>
multiple uses are accumulated- Additional options to pass to javac.
--jvmopt=<a string>
multiple uses are accumulated- Additional options to pass to the Java VM. These options will get added to the VM startup options of each java_binary target.
--message_translations=<a string>
multiple uses are accumulated- The message translations used for translating messages in Java targets.
--plugin=<a build target label>
multiple uses are accumulated- Plugins to use in the build. Currently works with java_plugin.
--proguard_top=<a build target label>
default: see description- Specifies which version of ProGuard to use for code removal when building a Java binary.
--proto_compiler=<a build target label>
default: "@com_google_protobuf//:protoc"-
The label of the proto-compiler.
Tags:affects_outputs
,loading_and_analysis
--proto_toolchain_for_cc=<a build target label>
default: "@com_google_protobuf//: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: "@com_google_protobuf//: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: "@com_google_protobuf_javalite//: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 accumulated-
Additional options to pass to the protobuf compiler.
Tags:affects_outputs
--shell_executable=<a path>
default: see description-
Absolute 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:/tools/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 accumulated- Specifies 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 description- Specifies 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.
--test_sharding_strategy=<explicit, experimental_heuristic or disabled>
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. 'experimental_heuristic' to enable sharding on remotely executed tests without an explicit 'shard_count' attribute which link in a supported framework. Considered experimental.
--[no]translations
default: "auto"- Translate Java messages; bundle all translations into the jar for each affected rule.
--[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.
Dump Options
- Options that control the output of the command:
--[no]action_cache
default: "false"-
Dump action cache content.
Tags:bazel_monitoring
--action_graph=<a string>
default: see description-
Dump action graph to the specified path.
Tags:bazel_monitoring
--[no]action_graph:include_cmdline
default: "false"-
Include command line of actions in the action graph dump. This option does only
apply to --action_graph.
Tags:bazel_monitoring
--action_graph:targets=<comma-separated list of options>
default: "..."-
Comma separated list of targets to include in action graph dump. Defaults to
all attributes. This option does only apply to --action_graph.
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 or detailed>
default: "off"-
Dump Skyframe graph: 'off', 'summary', or 'detailed'.
Tags:bazel_monitoring
--skylark_memory=<a string>
default: see description-
Dumps a pprof-compatible memory profile to the specified path. To learn more
please see <a href=https://github.com/google/pprof>pprof</a>.
Tags:bazel_monitoring
- Options that affect the verbosity, format or location of logging:
--[no]bep_publish_used_heap_size_post_build
default: "false"- When set we collect and publish used_heap_size_post_build from build_event_stream.proto. This forces a full GC and is off by default.
Fetch Options
- Options that appear before the command and are parsed by the client:
--distdir=<a path>
multiple uses are accumulated-
Additional 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 inteded to save disk space.
Tags:bazel_internal_configuration
--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
--repository_cache=<a path>
default: see description-
Specifies 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.
Tags:bazel_internal_configuration
- Options that control build 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 onhost resources. Must be at least 1.
Tags:bazel_internal_configuration
- Options that affect how strictly Bazel enforces valid build inputs (rule definitions, flag combinations, etc.):
--experimental_repository_hash_file=<a string>
default: ""-
If non-empty, specifies a file containing a resolved value, against which the
repository directory hashes should be verified
Tags:affects_outputs
,experimental
--experimental_verify_repository_rules=<a string>
multiple uses are accumulated-
If list of repository rules for which the hash of the output directory should
be verified, provided a file is specified by --
experimental_repository_hash_file.
Tags:affects_outputs
,experimental
- Options that affect the verbosity, format or location of logging:
--[no]bep_publish_used_heap_size_post_build
default: "false"- When set we collect and publish used_heap_size_post_build from build_event_stream.proto. This forces a full GC and is off by default.
--experimental_repository_resolved_file=<a string>
default: ""-
If non-empty, write a Skylark value with the resolved information of all
Starlark repository rules that were executed.
Tags:affects_outputs
- Options specifying or altering a generic input to a Bazel command that does not fall into other categories.:
--experimental_resolved_file_instead_of_workspace=<a string>
default: ""-
If non-empty read the specified resolved file instead of the WORKSPACE file
Tags:changes_inputs
- Miscellaneous options, not otherwise categorized.:
--deleted_packages=<comma-separated list of package names>
default: ""- A 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.
--override_repository=<an equals-separated mapping of repository name to path>
multiple uses are accumulated- Overrides a repository with a local directory.
--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.
Help Options
- Options that affect the verbosity, format or location of logging:
--[no]bep_publish_used_heap_size_post_build
default: "false"- When set we collect and publish used_heap_size_post_build from build_event_stream.proto. This forces a full GC and is off by default.
--help_verbosity=<long, medium or short>
default: "medium"-
Select the verbosity of the help command.
Tags:affects_outputs
,terminal_output
--long
[-l
]-
Show full description of each option, instead of just its name.
Expands to:
--help_verbosity=long
Tags:affects_outputs
,terminal_output
--short
-
Show only the names of the options, not their types or meanings.
Expands to:
--help_verbosity=short
Tags:affects_outputs
,terminal_output
Info Options
Inherits all options from build.
- Options that affect the verbosity, format or location of logging:
--[no]bep_publish_used_heap_size_post_build
default: "false"- When set we collect and publish used_heap_size_post_build from build_event_stream.proto. This forces a full GC and is off by default.
--[no]show_make_env
default: "false"-
Include the "Make" environment in the output.
Tags:affects_outputs
,terminal_output
License Options
- Options that affect the verbosity, format or location of logging:
--[no]bep_publish_used_heap_size_post_build
default: "false"- When set we collect and publish used_heap_size_post_build from build_event_stream.proto. This forces a full GC and is off by default.
Mobile-install Options
Inherits all options from build.
- Options that control build execution:
--mode=<classic, classic_internal_test_do_not_use or skylark>
default: "classic"-
Select how to run mobile-install. "classic" runs the current version
of mobile-install. "skylark" uses the new skylark version, which has
support for android_test.
Tags:loading_and_analysis
,execution
,incompatible_change
- Options that configure the toolchain used for action execution:
--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 command line option (or
the default SDK if --android_sdk is not specified) is used.
Tags:changes_inputs
- Options that control the output of the command:
--[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
- Options that let the user configure the intended output, affecting its value, as opposed to its existence:
--adb_arg=<a string>
multiple uses are accumulated-
Extra arguments to pass to adb. Usually used to designate a device to install
to.
Tags:action_command_lines
--debug_app
-
Whether 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_app
-
Whether to start the app after installing it.
Expands to:
--start=COLD
Tags:execution
- Options that affect the verbosity, format or location of logging:
--[no]bep_publish_used_heap_size_post_build
default: "false"- When set we collect and publish used_heap_size_post_build from build_event_stream.proto. This forces a full GC and is off by default.
--incremental_install_verbosity=<a string>
default: ""-
The verbosity for incremental install. Set to 1 for debug logging.
Tags:bazel_monitoring
Print_action Options
Inherits all options from build.
- Options that affect the verbosity, format or location of logging:
--[no]bep_publish_used_heap_size_post_build
default: "false"- When set we collect and publish used_heap_size_post_build from build_event_stream.proto. This forces a full GC and is off by default.
- Miscellaneous options, not otherwise categorized.:
--print_action_mnemonics=<a string>
multiple uses are accumulated- Lists which mnemonics to filter print_action data by, no filtering takes place when left empty.
Query Options
- Options that appear before the command and are parsed by the client:
--distdir=<a path>
multiple uses are accumulated-
Additional 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 inteded to save disk space.
Tags:bazel_internal_configuration
--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
--repository_cache=<a path>
default: see description-
Specifies 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.
Tags:bazel_internal_configuration
- Options that control build 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 onhost resources. Must be at least 1.
Tags:bazel_internal_configuration
- Options that affect how strictly Bazel enforces valid build inputs (rule definitions, flag combinations, etc.):
--experimental_repository_hash_file=<a string>
default: ""-
If non-empty, specifies a file containing a resolved value, against which the
repository directory hashes should be verified
Tags:affects_outputs
,experimental
--experimental_verify_repository_rules=<a string>
multiple uses are accumulated-
If list of repository rules for which the hash of the output directory should
be verified, provided a file is specified by --
experimental_repository_hash_file.
Tags:affects_outputs
,experimental
- Options relating to query output and semantics:
--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
--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]host_deps
default: "true"-
Query: If disabled, dependencies on 'host configuration' targets will
not be included in the dependency graph over which the query operates. A '
host 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 (on the host machine) rather than a part of the same
'target' program.
Cquery: If disabled, filters out all configured targets which cross a host
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 host configuration, only host configured targets
will be returned.
Tags:build_file_semantics
--[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.
Tags:build_file_semantics
--[no]line_terminator_null
default: "false"-
Whether each format is terminated with instead of newline.
Tags:terminal_output
--noorder_results
-
Output 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
--null
-
Whether each format is terminated with 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 that would otherwise be
unordered by the output formatter are alphabetized before output.
Tags:terminal_output
--order_results
-
Output 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, label, label_kind, locations, maxrank, minrank,
package, proto, xml.
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: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
--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
--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
--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
- Options that affect the verbosity, format or location of logging:
--[no]bep_publish_used_heap_size_post_build
default: "false"- When set we collect and publish used_heap_size_post_build from build_event_stream.proto. This forces a full GC and is off by default.
--experimental_repository_resolved_file=<a string>
default: ""-
If non-empty, write a Skylark value with the resolved information of all
Starlark repository rules that were executed.
Tags:affects_outputs
- Options specifying or altering a generic input to a Bazel command that does not fall into other categories.:
--experimental_resolved_file_instead_of_workspace=<a string>
default: ""-
If non-empty read the specified resolved file instead of the WORKSPACE file
Tags:changes_inputs
- Miscellaneous options, not otherwise categorized.:
--deleted_packages=<comma-separated list of package names>
default: ""- A 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.
--override_repository=<an equals-separated mapping of repository name to path>
multiple uses are accumulated- Overrides a repository with a local directory.
--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.
Run Options
Inherits all options from build.
- Options that let the user configure the intended output, affecting its value, as opposed to its existence:
--script_path=<a path>
default: see description-
If 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 %
{product} lock is released and the executable is connected to the terminal'
s stdin.
Tags:affects_outputs
,execution
- Options that affect the verbosity, format or location of logging:
--[no]bep_publish_used_heap_size_post_build
default: "false"- When set we collect and publish used_heap_size_post_build from build_event_stream.proto. This forces a full GC and is off by default.
Shutdown Options
- Options that control the output of the command:
--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
- Options that affect the verbosity, format or location of logging:
--[no]bep_publish_used_heap_size_post_build
default: "false"- When set we collect and publish used_heap_size_post_build from build_event_stream.proto. This forces a full GC and is off by default.
Sync Options
- Options that appear before the command and are parsed by the client:
--distdir=<a path>
multiple uses are accumulated-
Additional 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 inteded to save disk space.
Tags:bazel_internal_configuration
--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
--repository_cache=<a path>
default: see description-
Specifies 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.
Tags:bazel_internal_configuration
- Options that control build 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 onhost resources. Must be at least 1.
Tags:bazel_internal_configuration
- Options that affect how strictly Bazel enforces valid build inputs (rule definitions, flag combinations, etc.):
--experimental_repository_hash_file=<a string>
default: ""-
If non-empty, specifies a file containing a resolved value, against which the
repository directory hashes should be verified
Tags:affects_outputs
,experimental
--experimental_verify_repository_rules=<a string>
multiple uses are accumulated-
If list of repository rules for which the hash of the output directory should
be verified, provided a file is specified by --
experimental_repository_hash_file.
Tags:affects_outputs
,experimental
- Options that affect the verbosity, format or location of logging:
--[no]bep_publish_used_heap_size_post_build
default: "false"- When set we collect and publish used_heap_size_post_build from build_event_stream.proto. This forces a full GC and is off by default.
--experimental_repository_resolved_file=<a string>
default: ""-
If non-empty, write a Skylark value with the resolved information of all
Starlark repository rules that were executed.
Tags:affects_outputs
- Options specifying or altering a generic input to a Bazel command that does not fall into other categories.:
--experimental_resolved_file_instead_of_workspace=<a string>
default: ""-
If non-empty read the specified resolved file instead of the WORKSPACE file
Tags:changes_inputs
- Miscellaneous options, not otherwise categorized.:
--deleted_packages=<comma-separated list of package names>
default: ""- A 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.
--override_repository=<an equals-separated mapping of repository name to path>
multiple uses are accumulated- Overrides a repository with a local directory.
--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 Options
Inherits all options from build.
- Options that affect the verbosity, format or location of logging:
--[no]bep_publish_used_heap_size_post_build
default: "false"- When set we collect and publish used_heap_size_post_build from build_event_stream.proto. This forces a full GC and is off by default.
--[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
Version Options
- Options that let the user configure the intended output, affecting its value, as opposed to its existence:
--[no]gnu_format
default: "false"-
If set, write the version to stdout using the conventions described in the GNU
standards.
Tags:affects_outputs
,execution
- Options that affect the verbosity, format or location of logging:
--[no]bep_publish_used_heap_size_post_build
default: "false"- When set we collect and publish used_heap_size_post_build from build_event_stream.proto. This forces a full GC and is off by default.
Option Effect Tags
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. |
Option Metadata Tags
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. |
triggered_by_all_incompatible_changes |
This option is triggered by the expansion option --all_incompatible_changes. |