bazel [<startup options>] <command> [<args>]
bazel [<startup options>] <command> [<args>] -- [<target patterns>]
選項語法
您可以透過不同方式將選項傳遞至 Bazel。需要值的選項可以透過等號或空格傳遞:
--<option>=<value> --<option> <value>
-<short_form> <value>
您可以按照下列方式啟用布林值選項:
--<option> --<option>=[true|yes|1]
--no<option> --<option>=[false|no|0]
三態選項預設通常會設為自動,您可以按照下列方式強制啟用:
--<option>=[true|yes|1]
--no<option> --<option>=[false|no|0]
指令
analyze-profile |
分析建構設定檔資料。 |
aquery |
分析指定目標並查詢動作圖。 |
build |
建構指定目標。 |
canonicalize-flags |
將 Bazel 選項清單正規化。 |
clean |
移除輸出檔案,並視需要停止伺服器。 |
coverage |
為指定測試目標產生程式碼涵蓋率報告。 |
cquery |
載入、分析及查詢指定目標和設定。 |
dump |
傾印 Bazel 伺服器程序的內部狀態。 |
fetch |
擷取目標的必要外部存放區。 |
help |
列印指令或索引的說明。 |
info |
顯示 Bazel 伺服器的執行階段資訊。 |
license |
列印這個軟體的授權。 |
mobile-install |
在行動裝置上安裝目標。 |
mod |
查詢 Bzlmod 外部依附元件圖表 |
print_action |
列印用於編譯檔案的指令列引數。 |
query |
執行依附元件圖表查詢。 |
run |
執行指定目標。 |
shutdown |
停止 Bazel 伺服器。 |
sync |
同步處理工作區檔案中指定的所有存放區 |
test |
建構及執行指定的測試目標。 |
vendor |
將外部存放區擷取至 --vendor_dir 標記指定的資料夾。 |
version |
列印 bazel 的版本資訊。 |
開機選項
- 顯示在指令之前並由用戶端剖析的選項:
--[no]autodetect_server_javabase
預設值:「true」-
傳遞 --noautodetect_server_javabase 時,Bazel 不會改用本機 JDK 執行 Bazel 伺服器,而是會結束。
標記:affects_outputs
、loses_incremental_state
--[no]batch
預設值:「false」-
如果設定,Bazel 會以純用戶端程序執行,而非標準用戶端/伺服器模式。這項功能已淘汰並將移除,如要避免伺服器閒置,建議明確關閉伺服器。
標籤:loses_incremental_state
、bazel_internal_configuration
、deprecated
--[no]batch_cpu_scheduling
預設值:「false」-
僅適用於 Linux;使用 Blaze 的「批次」CPU 排程。這項政策適用於非互動式工作負載,但不想降低 nice 值。請參閱「man 2 sched_setscheduler」。如果為 false,Bazel 就不會執行系統呼叫。
標記:host_machine_resource_optimizations
--bazelrc=<path>
預設值:請參閱說明-
使用者 .bazelrc 檔案的位置,其中包含 Bazel 選項的預設值。/dev/null 表示系統會忽略所有後續的 `--bazelrc`,這有助於停用使用者 rc 檔案的搜尋功能,例如在發布版本中。
這個選項也可以多次指定。
舉例來說,使用 `--bazelrc=x.rc --bazelrc=y.rc --bazelrc=/dev/null --bazelrc=z.rc` 時,
1) 系統會讀取 x.rc 和 y.rc。
2) 由於先前的 /dev/null,系統會忽略 z.rc。
如未指定,Bazel 會使用在下列兩個位置找到的第一個 .bazelrc 檔案:工作區目錄,然後是使用者的主目錄。
注意:指令列選項一律會取代 bazelrc 中的任何選項。
標記:changes_inputs
--[no]block_for_lock
預設值:「true」-
如果傳遞 --noblock_for_lock,Bazel 不會等待執行中的指令完成,而是會立即結束。
標記:eagerness_to_exit
--[no]client_debug
預設值:「false」-
如果為 true,請將用戶端的偵錯資訊記錄到 stderr。變更這項選項不會導致伺服器重新啟動。
標記:affects_outputs
、bazel_monitoring
--connect_timeout_secs=<an integer>
預設值:「30」-
用戶端每次嘗試連線至伺服器時的等待時間
標記:bazel_internal_configuration
--digest_function=<hash function>
預設值:請參閱說明-
計算檔案摘要時使用的雜湊函式。
標記:loses_incremental_state
、bazel_internal_configuration
--experimental_cgroup_parent=<path>
預設值:請參閱說明-
以絕對路徑表示的 cgroup,用於啟動 bazel 伺服器。系統會為每個支援的控制器,在指定的 cgroup 中啟動伺服器程序。舉例來說,如果這個旗標的值是 /build/bazel,且 CPU 和記憶體控制器分別掛接在 /sys/fs/cgroup/cpu 和 /sys/fs/cgroup/memory,伺服器就會在 cgroup /sys/fs/cgroup/cpu/build/bazel 和 /sys/fs/cgroup/memory/build/bazel 中啟動。如果指定的 cgroup 無法供一或多個控制器寫入,這並非錯誤。如果平台不支援 cgroup,這個選項不會有任何作用。
標記:bazel_monitoring
、execution
--failure_detail_out=<path>
預設值:請參閱說明-
如果設定此項,當伺服器發生錯誤且無法透過 gRPC 正常回報時,系統會將 failure_detail protobuf 訊息寫入指定位置。否則,位置會是 ${OUTPUT_BASE}/failure_detail.rawproto。
標記:affects_outputs
、loses_incremental_state
--[no]home_rc
預設值:「true」-
是否要在 $HOME/.bazelrc 尋找主目錄 bazelrc 檔案
標記:changes_inputs
--[no]idle_server_tasks
預設值:「true」-
伺服器閒置時執行 System.gc()
標記:loses_incremental_state
、host_machine_resource_optimizations
--[no]ignore_all_rc_files
預設值:「false」-
無論其他 rc 修改旗標的值為何,都會停用所有 rc 檔案,即使這些旗標位於啟動選項清單的後方也一樣。
標記:changes_inputs
--io_nice_level={-1,0,1,2,3,4,5,6,7}
預設值:「-1」-
僅限 Linux;使用 sys_ioprio_set 系統呼叫,將層級設為 0 到 7,盡可能排定 I/O。0 為最高優先順序,7 為最低。預測排程器最多只會處理優先順序 4 的工作。如果設為負值,Bazel 就不會執行系統呼叫。
標記:host_machine_resource_optimizations
--local_startup_timeout_secs=<an integer>
預設值:「120」-
用戶端等待連線至伺服器的最長時間
標記:bazel_internal_configuration
--macos_qos_class=<a string>
預設值:「default」-
在 macOS 上執行時,設定 bazel 伺服器的 QoS 服務類別。這個標記不會影響所有其他平台,但支援這個標記可確保 rc 檔案能在這些平台之間共用,不必進行變更。可能的值包括:user-interactive、user-initiated、default、utility 和 background。
標記:host_machine_resource_optimizations
--max_idle_secs=<integer>
預設值:「10800」-
建構伺服器在關閉前等待閒置的秒數。如果設為零,伺服器就不會關機。這項設定只會在伺服器啟動時讀取,變更這項設定不會導致伺服器重新啟動。
標記:eagerness_to_exit
、loses_incremental_state
--output_base=<path>
預設值:請參閱說明-
如果設定,則指定所有建構輸出內容的寫入位置。否則,位置會是 ${OUTPUT_ROOT}/_blaze_${USER}/${MD5_OF_WORKSPACE_ROOT}。注意:如果為這個值指定不同選項,您可能會啟動新的額外 Bazel 伺服器。Bazel 會為每個指定的輸出基礎啟動一個伺服器。一般來說,每個工作區都有一個輸出基礎,但使用這個選項時,每個工作區可以有多個輸出基礎,因此您可以在同一部機器上,同時為同一位用戶執行多個建構作業。如要瞭解如何關閉 Bazel 伺服器,請參閱「bazel help shutdown」。
標記:affects_outputs
、loses_incremental_state
--output_user_root=<path>
預設值:請參閱說明-
所有建構輸出內容寫入的特定使用者目錄;根據預設,這是 $USER 的函式,但指定常數後,建構輸出內容就能在協作使用者之間共用。
標記:affects_outputs
、loses_incremental_state
--[no]preemptible
預設值:「false」-
如果為 true,當啟動其他指令時,這個指令可能會遭到搶占。
標記:eagerness_to_exit
--[no]quiet
預設值:「false」-
如果為 true,主控台不會發出任何資訊訊息,只會發出錯誤訊息。變更這項選項不會導致伺服器重新啟動。
標記:affects_outputs
、bazel_monitoring
--server_jvm_out=<path>
預設值:請參閱說明-
要寫入伺服器 JVM 輸出的位置。如未設定,預設為 output_base 中的位置。
標記:affects_outputs
、loses_incremental_state
--[no]shutdown_on_low_sys_mem
預設值:「false」-
如果已設定 max_idle_secs,且建構伺服器閒置一段時間,系統在可用 RAM 不足時就會關閉伺服器。僅適用於 Linux。
標記:eagerness_to_exit
、loses_incremental_state
--[no]system_rc
預設值:「true」-
是否要尋找系統層級的 bazelrc。
標記:changes_inputs
--[no]unlimit_coredumps
預設值:「false」-
將軟性核心傾轉限制提高至硬性限制,以便在一般情況下傾轉伺服器 (包括 JVM) 和用戶端的核心。在 bazelrc 中插入這個標記一次,然後忘記它,這樣當您實際遇到觸發標記的條件時,就會取得核心傾印。
標記:bazel_internal_configuration
--[no]watchfs
預設值:「false」-
如果為 true,Bazel 會嘗試使用作業系統的檔案監控服務來偵測本機變更,而不是掃描每個檔案來找出變更。
標記:deprecated
--[no]windows_enable_symlinks
預設值:「false」-
如果為 true,系統會在 Windows 上建立實際的符號連結,而不是複製檔案。必須啟用 Windows 開發人員模式,並使用 Windows 10 1703 以上版本。
標記:bazel_internal_configuration
--[no]workspace_rc
預設值:「true」-
是否要在 $workspace/.bazelrc 尋找工作區 bazelrc 檔案
標記:changes_inputs
- 其他選項,未分類:
--host_jvm_args=<jvm_arg>
累積多次使用- 要傳遞至執行 Blaze 的 JVM 的旗標。
--host_jvm_debug
-
方便的選項,可新增一些額外的 JVM 啟動標記,讓 JVM 在啟動期間等待,直到您從符合 JDWP 的偵錯工具 (例如 Eclipse) 連線至 5005 連接埠為止。
展開後:
--host_jvm_args=-Xdebug
--host_jvm_args=-Xrunjdwp:transport=dt_socket,server=y,address=5005
--server_javabase=<jvm path>
預設值:「」- 用於執行 Bazel 本身的 JVM 路徑。
所有指令通用的選項
- 顯示在指令之前並由用戶端剖析的選項:
--distdir=<a path>
累積多次使用-
存取網路下載封存內容前,請先在其他位置搜尋封存內容。
標記:bazel_internal_configuration
--[no]experimental_repository_cache_hardlinks
預設值:「false」-
如果已設定,存放區快取會在快取命中時硬連結檔案,而不是複製檔案。這項功能可節省磁碟空間。
標記:bazel_internal_configuration
--experimental_repository_downloader_retries=<an integer>
預設值:「5」-
下載錯誤的重試次數上限。如果設為 0,系統會停用重試功能。
標記:experimental
--experimental_scale_timeouts=<a double>
預設值:「1.0」-
依此因數縮放 Starlark 存放區規則中的所有逾時。這樣一來,外部存放區就能在速度比規則作者預期慢的機器上運作,不必變更原始碼
標記:bazel_internal_configuration
、experimental
--http_connector_attempts=<an integer>
預設值:「8」-
HTTP 下載的嘗試次數上限。
標記:bazel_internal_configuration
--http_connector_retry_max_timeout=<An immutable length of time.>
預設值:「0s」-
HTTP 下載重試的逾時上限。如果值為 0,則未定義逾時上限。
標記:bazel_internal_configuration
--http_max_parallel_downloads=<an integer>
預設值:「8」-
可同時進行的 HTTP 下載數量上限。
標記:bazel_internal_configuration
--http_timeout_scaling=<a double>
預設值:「1.0」-
將所有與 HTTP 下載相關的逾時時間,依指定係數調整比例
標記:bazel_internal_configuration
--[no]incompatible_disable_native_repo_rules
預設值:「false」-
如果設為 false,則可在 WORKSPACE 中使用原生存放區規則;否則必須改用 Starlark 存放區規則。原生存放區規則包括 local_repository、new_local_repository、local_config_platform 和 android_sdk_repository。
標記:bazel_internal_configuration
--repository_cache=<a path>
預設值:請參閱說明-
指定擷取外部存放區時下載值的快取位置。如果引數為空字串,系統會要求停用快取,否則會使用預設值「<output_user_root>/cache/repos/v1」
標記:bazel_internal_configuration
--[no]repository_disable_download
預設值:「false」-
如果已設定,在擷取存放區期間,系統不允許使用 ctx.download{,_and_extract} 下載檔案。請注意,網路存取權並未完全停用,ctx.execute 仍可執行存取網際網路的任意可執行檔。
標記:bazel_internal_configuration
- 控制建構執行的選項:
--experimental_ui_max_stdouterr_bytes=<an integer in (-1)-1073741819 range>
預設值:「1048576」-
列印到控制台的 stdout / stderr 檔案大小上限。-1 表示沒有限制。
標記:execution
--gc_thrashing_threshold=<an integer in 0-100 range>
預設值:「100」-
當長期佔用的空間百分比 (0 到 100) 超過 GcThrashingDetector 的限制 (--gc_thrashing_limits) 時,系統會將記憶體壓力事件納入考量。如果設為 100,系統會停用 GcThrashingDetector。
標記:host_machine_resource_optimizations
- 設定用於執行動作的工具鍊選項:
--[no]incompatible_enable_proto_toolchain_resolution
預設值:「false」-
如為 true,proto 語言規則會從 protobuf 存放區定義工具鍊。
標記:loading_and_analysis
、incompatible_change
- 可讓使用者設定預期輸出內容的選項,會影響輸出內容的值,而非存在與否:
--bep_maximum_open_remote_upload_files=<an integer>
預設值:「-1」-
上傳 BEP 構件時允許開啟的檔案數量上限。
標記:affects_outputs
--remote_download_all
-
將所有遠端輸出內容下載到本機。這個旗標是 --remote_download_outputs=all 的別名。
展開後:
--remote_download_outputs=all
標記:affects_outputs
--remote_download_minimal
-
不會將任何遠端建構輸出內容下載到本機。這個旗標是 --remote_download_outputs=minimal 的別名。
展開後:
--remote_download_outputs=minimal
標記:affects_outputs
--remote_download_outputs=<all, minimal or toplevel>
預設值:「toplevel」-
如果設為「minimal」,除了本機動作所需的項目外,不會將任何遠端建構輸出內容下載至本機電腦。如果設為「toplevel」,行為會與「minimal」類似,但也會將頂層目標的輸出內容下載到本機。如果網路頻寬是瓶頸,這兩個選項都能大幅縮短建構時間。
標記:affects_outputs
--remote_download_symlink_template=<a string>
預設值:「」-
建立符號連結,而非將遠端建構輸出內容下載至本機電腦。符號連結的目標可以範本字串的形式指定。這個範本字串可能包含 {hash} 和 {size_bytes},分別會擴充為物件的雜湊和大小 (以位元組為單位)。舉例來說,這些符號連結可能會指向 FUSE 檔案系統,該系統會視需要從 CAS 載入物件。
標記:affects_outputs
--remote_download_toplevel
-
只會將頂層目標的遠端輸出內容下載到本機。這個旗標是 --remote_download_outputs=toplevel 的別名。
展開後:
--remote_download_outputs=toplevel
標記:affects_outputs
--repo_env=<a 'name=value' assignment with an optional value part>
累積多次使用-
指定其他環境變數,僅供存放區規則使用。請注意,存放區規則無論如何都會看到完整環境,但透過這種方式,設定資訊可以透過選項傳遞至存放區,而不會使動作圖失效。
標記:action_command_lines
- 影響 Bazel 嚴格程度的選項,可強制執行有效的建構輸入內容 (規則定義、旗標組合等):
--[no]check_bzl_visibility
預設值:「true」-
如果停用,.bzl 載入可見度錯誤會降級為警告。
標記:build_file_semantics
- 這個選項會影響 Starlark 語言的語意,或可供 BUILD 檔案、.bzl 檔案或 WORKSPACE 檔案存取的建構 API:
--[no]enable_bzlmod
預設值:「true」-
如果為 true,系統會啟用 Bzlmod 依附元件管理系統,優先於 WORKSPACE。詳情請參閱 https://bazel.build/docs/bzlmod。
標記:loading_and_analysis
--[no]enable_workspace
預設值:「false」-
如為 true,則會為外部依附元件啟用舊版 WORKSPACE 系統。詳情請參閱 https://bazel.build/external/overview。
標記:loading_and_analysis
--[no]experimental_action_resource_set
預設值:「true」-
如果設為 true,ctx.actions.run() 和 ctx.actions.run_shell() 會接受 resource_set 參數,用於在本機執行。否則記憶體會預設為 250 MB,CPU 則為 1 個。
標籤:execution
、build_file_semantics
、experimental
--[no]experimental_bzl_visibility
預設值:「true」-
如果啟用,會新增 `visibility()` 函式,.bzl 檔案可在頂層評估期間呼叫該函式,以便為 load() 陳述式設定可見度。
標記:loading_and_analysis
、experimental
-
如果設為 true,規則屬性和規則 cc_shared_library 必要的 Starlark API 方法就會可用
標記:build_file_semantics
、loading_and_analysis
、experimental
--[no]experimental_cc_static_library
預設值:「false」-
如果設為 true,規則屬性和規則 cc_static_library 必要的 Starlark API 方法就會可用
標記:build_file_semantics
、loading_and_analysis
、experimental
--[no]experimental_disable_external_package
預設值:「false」-
如果設為 true,系統將不再提供自動產生的 //external 套件。Bazel 仍無法剖析「external/BUILD」檔案,但從未命名套件進入 external/ 的 glob 仍可運作。
標籤:loading_and_analysis
、loses_incremental_state
、experimental
--[no]experimental_dormant_deps
預設值:「false」-
如果設為 true,則允許 attr.label(materializer=)、attr(for_dependency_resolution=)、attr.dormant_label()、attr.dormant_label_list() 和 rule(for_dependency_resolution=)。
標記:build_file_semantics
、experimental
--[no]experimental_enable_android_migration_apis
預設值:「false」-
如果設為 true,系統會啟用支援 Android Starlark 遷移作業所需的 API。
標記:build_file_semantics
--[no]experimental_enable_first_class_macros
預設值:「true」-
如果設為 true,即可使用 `macro()` 建構函式定義符號巨集。
標記:build_file_semantics
--[no]experimental_enable_scl_dialect
預設值:「true」-
如果設為 true,.scl 檔案可能會用於 load() 陳述式。
標記:build_file_semantics
--[no]experimental_google_legacy_api
預設值:「false」-
如果設為 true,會公開與 Google 舊版程式碼相關的 Starlark 建構 API 實驗性部分。
標記:loading_and_analysis
、experimental
--[no]experimental_isolated_extension_usages
預設值:「false」-
如果為 true,則啟用 <a href="https://bazel.build/rules/lib/globals/module#use_extension"><code>use_extension</code></a> 函式中的<code>isolate</code> 參數。
標記:loading_and_analysis
--[no]experimental_java_library_export
預設值:「false」-
啟用後,即可使用 experimental_java_library_export_do_not_use 模組。
標記:loading_and_analysis
、incompatible_change
--[no]experimental_platforms_api
預設值:「false」-
如果設為 true,系統會啟用多個與平台相關的 Starlark API,方便進行偵錯。
標記:loading_and_analysis
、experimental
--[no]experimental_repo_remote_exec
預設值:「false」-
如果設為 true,repository_rule 會取得部分遠端執行功能。
標籤:build_file_semantics
、loading_and_analysis
、experimental
--[no]experimental_sibling_repository_layout
預設值:「false」-
如果設為 true,非主要存放區會以符號連結的形式,植入執行根目錄中的主要存放區。也就是說,所有存放區都是 $output_base/execution_root 目錄的直接子項。這會產生副作用,也就是為真正的頂層「external」目錄釋出 $output_base/execution_root/__main__/external。
標記:action_command_lines
、bazel_internal_configuration
、loading_and_analysis
、loses_incremental_state
、experimental
--[no]experimental_single_package_toolchain_binding
預設值:「false」-
如果啟用,register_toolchain 函式可能不會包含目標模式,這類模式可能會參照多個套件。
標記:loading_and_analysis
、incompatible_change
-
如果設為 true,標記會從目標傳播至動作的執行需求;否則標記不會傳播。詳情請參閱 https://github.com/bazelbuild/bazel/issues/8830。
標記:build_file_semantics
、experimental
--[no]incompatible_always_check_depset_elements
預設值:「true」-
在所有建構函式中,檢查新增至 depsets 的元素是否有效。元素必須是不可變動的,但從歷史來看,depsset(direct=...) 建構函式忘記檢查。在 depset 元素中使用元組,而非清單。詳情請參閱 https://github.com/bazelbuild/bazel/issues/10313。
標記:build_file_semantics
、incompatible_change
--incompatible_autoload_externally=<comma-separated set of options>
default: "+@rules_python,+java_common,+JavaInfo,+JavaPluginInfo,ProguardSpecProvider,java_binary,java_import,java_library,java_plugin,java_test,java_runtime,java_toolchain,java_package_configuration,@com_google_protobuf,@rules_shell,+@rules_android"-
以逗號分隔的規則 (或其他符號) 清單,這些規則先前屬於 Bazel,現在則要從各自的外部存放區擷取。這個標記的用途是協助將規則從 Bazel 遷移出去。另請參閱 https://github.com/bazelbuild/bazel/issues/23043。
在檔案中自動載入的符號,其行為就像是內建於 Bazel 的定義,已由外部存放區中的標準新定義取代。如果是 BUILD 檔案,這基本上是指隱含新增 load() 陳述式。如果是 .bzl 檔案,則為 load() 陳述式或 `native` 物件的欄位變更,視自動載入的符號是否為規則而定。Bazel 會維護所有可能自動載入的符號硬式編碼清單,只有這些符號可能會出現在這個標記中。對於每個符號,Bazel 都知道外部存放區中的新定義位置,以及一組不得自動載入的特殊情況存放區,以免建立循環。
如果這個標記中的項目清單包含「+foo」,系統就會自動載入符號 foo,但 foo 的豁免存放區除外,因為在這些存放區中,foo 的 Bazel 定義版本仍可使用。
「foo」的清單項目會如上觸發自動載入,但 Bazel 定義的 foo 版本不會提供給排除的存放區。這可確保 foo 的外部存放區不會依附於 foo 的舊版 Bazel 實作項目。清單項目「-foo」不會觸發任何自動載入作業,但會導致整個工作區無法存取 Bazel 定義的 foo 版本。這項功能用於驗證工作區是否已準備好從 Bazel 刪除 foo 的定義。
如果這個旗標中未命名符號,則符號會繼續正常運作,不會自動載入,也不會抑制 Bazel 定義的版本。如需設定,請參閱 https://github.com/bazelbuild/bazel/blob/master/src/main/java/com/google/devtools/build/lib/packages/AutoloadSymbols.java。您也可以使用整個存放區做為捷徑,例如 +@rules_python 會自動載入所有 Python 規則。
標籤:loses_incremental_state
、build_file_semantics
、incompatible_change
--[no]incompatible_depset_for_libraries_to_link_getter
預設值:「true」-
如果為 true,Bazel 不會再從 linking_context.libraries_to_link 傳回清單,而是傳回 depset。
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_disable_objc_library_transition
預設值:「true」-
停用 objc_library 的自訂轉換,改為從頂層目標繼承 (在 Bazel 中為 No-op)
標記:build_file_semantics
、incompatible_change
--[no]incompatible_disable_starlark_host_transitions
預設值:「false」-
如果設為 true,規則屬性就無法設定「cfg = "host"」。規則應改為設定「cfg = "exec"」。
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_disable_target_default_provider_fields
預設值:「false」-
如果設為 true,則無法透過欄位語法存取「target」物件上的供應器。請改用 provider-key 語法。舉例來說,請使用 `ctx.attr.dep[MyInfo]`,而非 `ctx.attr.dep.my_info`,從規則實作函式內部存取 `my_info`。詳情請參閱 https://github.com/bazelbuild/bazel/issues/9014。
標記:build_file_semantics
、incompatible_change
--[no]incompatible_disable_target_provider_fields
預設值:「false」-
如果設為 true,系統會停用透過欄位語法使用預設供應商的功能。請改用 provider-key 語法。舉例來說,請使用 `ctx.attr.dep[DefaultInfo].files` 存取 `files`,而不要使用 `ctx.attr.dep.files`。詳情請參閱 https://github.com/bazelbuild/bazel/issues/9014。
標記:build_file_semantics
、incompatible_change
--[no]incompatible_disallow_ctx_resolve_tools
預設值:「true」-
如果設為 true,呼叫已淘汰的 ctx.resolve_tools API 一律會失敗。這個 API 的用途應替換為 ctx.actions.run 或 ctx.actions.run_shell 的可執行檔或工具引數。
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_disallow_empty_glob
預設值:「true」-
如果設為 true,glob() 的 `allow_empty` 引數預設值為 False。
標記:build_file_semantics
、incompatible_change
--[no]incompatible_disallow_struct_provider_syntax
預設值:「true」-
如果設為 true,規則實作函式可能不會傳回結構體。而是必須傳回供應商例項清單。
標記:build_file_semantics
、incompatible_change
--[no]incompatible_enable_deprecated_label_apis
預設值:「true」-
啟用後,即可使用特定已淘汰的 API (native.repository_name、Label.workspace_name、Label.relative)。
標記:loading_and_analysis
--[no]incompatible_fail_on_unknown_attributes
預設值:「true」-
如果啟用,屬性不明的目標會設為 None,並失敗。
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_fix_package_group_reporoot_syntax
預設值:「true」-
在 package_group 的 `packages` 屬性中,將值「//...」的意義變更為參照目前存放區中的所有套件,而非任何存放區中的所有套件。您可以使用特殊值「public」取代「//...」,以取得舊版行為。這個旗標需要同時啟用 --incompatible_package_group_has_public_syntax。
標記:build_file_semantics
、incompatible_change
--[no]incompatible_java_common_parameters
預設值:「true」-
如果設為 true,系統會移除 pack_sources 和 compile 中的 output_jar 和 host_javabase 參數。
標記:build_file_semantics
、incompatible_change
--[no]incompatible_merge_fixed_and_default_shell_env
預設值:「true」-
如果啟用,使用 ctx.actions.run 和 ctx.actions.run_shell 註冊的動作,且同時指定「env」和「use_default_shell_env = True」,將使用從預設殼層環境取得的環境,並以傳遞至「env」的值覆寫。如果停用,系統會完全忽略這個情況下的「env」值。
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_no_attr_license
預設值:「true」-
如果設為 true,系統會停用 `attr.license` 函式。
標記:build_file_semantics
、incompatible_change
--[no]incompatible_no_implicit_file_export
預設值:「false」-
如果已設定,除非明確匯出,否則 (使用的) 來源檔案會是套件私有。請參閱 https://github.com/bazelbuild/proposals/blob/master/designs/2019-10-24-file-visibility.md
標記:build_file_semantics
、incompatible_change
--[no]incompatible_no_implicit_watch_label
預設值:「true」-
如果為 true,即使 <code>watch ="no"</code>,傳遞 Label 的 <code>repository_ctx</code> 方法也不會再自動監看該標籤下的檔案是否有變更,且 <code>repository_ctx.path</code> 不會再導致系統監看傳回的路徑。請改用 <code>repository_ctx.watch</code>。
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_no_rule_outputs_param
預設值:「false」-
如設為 true,則會停用 `rule()` Starlark 函式的 `outputs` 參數。
標記:build_file_semantics
、incompatible_change
--[no]incompatible_package_group_has_public_syntax
預設值:「true」-
在 package_group 的 `packages` 屬性中,允許寫入「public」或「private」,分別是指所有套件或沒有任何套件。
標記:build_file_semantics
、incompatible_change
--[no]incompatible_require_linker_input_cc_api
預設值:「true」-
如果設為 true,規則 create_linking_context 會需要 linker_inputs,而不是 libraries_to_link。系統也會停用 linking_context 的舊版 getter,只提供 linker_inputs。
標籤:build_file_semantics
、loading_and_analysis
、incompatible_change
--[no]incompatible_run_shell_command_string
預設值:「true」-
如果設為 true,actions.run_shell 的指令參數只會接受字串
標記:build_file_semantics
、incompatible_change
--[no]incompatible_simplify_unconditional_selects_in_rule_attrs
預設值:「true」-
如果是,請簡化只包含無條件選取的規則屬性;舉例來說,如果 ["a"] + select("//conditions:default", ["b"]) 指派給規則屬性,系統會將其儲存為 ["a", "b"]。這個選項不會影響符號巨集或屬性預設值的屬性。
標記:build_file_semantics
、incompatible_change
--[no]incompatible_stop_exporting_build_file_path
預設值:「false」-
如果設為 true,系統就不會提供已淘汰的 ctx.build_file_path,但可改用 ctx.label.package + '/BUILD'。
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_stop_exporting_language_modules
預設值:「false」-
啟用後,使用者 .bzl 檔案中就無法使用特定語言專屬的模組 (例如 `cc_common`),且只能從各自的規則存放區呼叫。
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_top_level_aspects_require_providers
預設值:「true」-
如果設為 true,頂層方面會遵守其必要供應商,且只會在規則的廣告供應商符合方面必要供應商的頂層目標上執行。
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_unambiguous_label_stringification
預設值:「true」-
如果為 true,Bazel 會將標籤 @//foo:bar 字串化為 @//foo:bar,而不是 //foo:bar。這只會影響 str()、% 運算子等的行為,repr() 的行為則不會改變。詳情請參閱 https://github.com/bazelbuild/bazel/issues/15916。
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_use_cc_configure_from_rules_cc
預設值:「false」-
設為 true 時,Bazel 不再允許使用 @bazel_tools 中的 cc_configure。如需詳細資料和遷移操作說明,請參閱 https://github.com/bazelbuild/bazel/issues/10134。
標記:loading_and_analysis
、incompatible_change
--max_computation_steps=<a long integer>
預設值:「0」-
BUILD 檔案可執行的 Starlark 計算步驟數量上限 (零表示沒有限制)。
標記:build_file_semantics
--nested_set_depth_limit=<an integer>
預設值:「3500」-
depsset 內部圖形的深度上限 (也稱為 NestedSet),超過此上限時,depsset() 建構函式就會失敗。
標記:loading_and_analysis
--repositories_without_autoloads=<comma-separated set of options>
預設值:「」- 除了 Bazel 已知的硬式編碼存放區外,還有其他存放區清單,這些存放區不會新增自動載入項目。這通常應包含可自動載入的存放區 (因此可能建立週期) 遞移依附的存放區。
--allow_yanked_versions=<a string>
累積多次使用標記:
loading_and_analysis
--check_bazel_compatibility=<error, warning or off>
預設值:「error」標記:
loading_and_analysis
--check_direct_dependencies=<off, warning or error>
預設值:「warning」標記:
loading_and_analysis
--[no]ignore_dev_dependency
預設值:「false」標記:
loading_and_analysis
--lockfile_mode=<off, update, refresh or error>
預設值:「update」標記:
loading_and_analysis
--override_module=<an equals-separated mapping of module name to path>
累積多次使用--registry=<a string>
累積多次使用標記:
changes_inputs
--vendor_dir=<a path>
預設值:請參閱說明標記:
loading_and_analysis
- 可觸發建構時間最佳化的選項:
--gc_thrashing_limits=<comma separated pairs of <period>:<count>>
預設值:「1s:2,20s:3,1m:5」-
限制,如果達到這些限制,GcThrashingDetector 會導致 Bazel 因 OOM 而當機。每個限制都指定為 <period>:<count>,其中 period 是時間長度,count 則是正整數。如果在 <period> 內連續執行 <count> 次完整 GC 後,仍有超過 --gc_thrashing_threshold 百分比的舊空間 (舊代堆積) 處於占用狀態,就會觸發 OOM。你可以指定多個限制,並以半形逗號分隔。
標記:host_machine_resource_optimizations
--[no]heuristically_drop_nodes
預設值:「false」-
如果為 true,Blaze 會在相關的 File 和 DirectoryListing 節點完成後移除 FileState 和 DirectoryListingState 節點,以節省記憶體。我們預期這些節點不太可能再次派上用場。如果這樣,系統會重新評估。
標記:loses_incremental_state
--[no]incompatible_do_not_split_linking_cmdline
預設值:「true」-
如果設為 true,Bazel 就不會再修改用於連結的指令列旗標,也不會選擇性地決定哪些旗標要傳送至參數檔案。詳情請參閱 https://github.com/bazelbuild/bazel/issues/7670。
標記:loading_and_analysis
、incompatible_change
--[no]keep_state_after_build
預設值:「true」-
如果為 false,Blaze 會在建構完成時捨棄此建構的記憶體內狀態。後續版本與這個版本相比,不會有任何增量。
標記:loses_incremental_state
--skyframe_high_water_mark_full_gc_drops_per_invocation=<an integer, >= 0>
預設值:「10」-
用於進階設定 Bazel 的內部 Skyframe 引擎。如果 Bazel 偵測到保留的堆積百分比用量超過 --skyframe_high_water_mark_threshold 設定的門檻,當發生完整 GC 事件時,就會捨棄不必要的暫時性 Skyframe 狀態,每次叫用最多可捨棄這麼多次。預設值為 10。如果設為零,表示完整 GC 事件絕不會觸發捨棄作業。達到上限後,如果發生完整 GC 事件,且保留的堆積百分比超過門檻,系統就不會再捨棄 Skyframe 狀態。
標記:host_machine_resource_optimizations
--skyframe_high_water_mark_minor_gc_drops_per_invocation=<an integer, >= 0>
預設值:「10」-
用於進階設定 Bazel 的內部 Skyframe 引擎。如果 Bazel 偵測到保留的堆積百分比用量超過 --skyframe_high_water_mark_threshold 設定的門檻,就會在發生次要 GC 事件時,捨棄不必要的暫時性 Skyframe 狀態,每次叫用最多可捨棄這麼多次。預設值為 10。如果設為零,表示次要 GC 事件絕不會觸發捨棄。達到上限後,如果發生次要 GC 事件,且保留的堆積百分比超過門檻,系統就不會再捨棄 Skyframe 狀態。
標記:host_machine_resource_optimizations
--skyframe_high_water_mark_threshold=<an integer>
預設值:「85」-
用於進階設定 Bazel 的內部 Skyframe 引擎。如果 Bazel 偵測到保留的堆積百分比用量至少達到這個門檻,就會捨棄不必要的暫時性 Skyframe 狀態。如果 GC 顛簸是 (i) 由這個暫時狀態的記憶體用量所導致,且 (ii) 比在需要時重構狀態更耗費資源,調整這項設定或許就能減輕 GC 顛簸對實際時間的影響。
標記:host_machine_resource_optimizations
--[no]track_incremental_state
預設值:「true」-
如果為 false,Blaze 將不會保留資料,以便在增量建構中失效和重新評估,進而節省這項建構的記憶體。後續版本不會再有任何增量。通常將此值設為 false 時,您會想要指定 --batch。
標記:loses_incremental_state
- 影響記錄詳細程度、格式或位置的選項:
--[no]announce_rc
預設值:「false」-
是否要公布 rc 選項。
標記:affects_outputs
--[no]attempt_to_print_relative_paths
預設值:「false」-
列印訊息的位置部分時,請嘗試使用相對於工作區目錄的路徑,或 --package_path 指定的其中一個目錄。
標記:terminal_output
--bes_backend=<a string>
預設值:「」-
以 [SCHEME://]HOST[:PORT] 格式指定建構事件服務 (BES) 後端端點。預設設定是停用 BES 上傳作業。支援的配置為 grpc 和 grpcs (已啟用 TLS 的 grpc)。如未提供配置,Bazel 會假設為 grpcs。
標記:affects_outputs
--[no]bes_check_preceding_lifecycle_events
預設值:「false」-
在 PublishBuildToolEventStreamRequest 上設定 check_preceding_lifecycle_events_present 欄位,告知 BES 檢查先前是否收到與目前工具事件相符的 InvocationAttemptStarted 和 BuildEnqueued 事件。
標記:affects_outputs
--bes_header=<a 'name=value' assignment>
累積多次使用-
以 NAME=VALUE 格式指定要納入 BES 要求的標頭。您可以多次指定標記來傳遞多個標頭。相同名稱的多個值會轉換為以半形逗號分隔的清單。
標記:affects_outputs
--bes_instance_name=<a string>
預設值:請參閱說明-
指定 BES 將用來保存上傳 BEP 的執行個體名稱。預設值為空值。
標記:affects_outputs
--bes_keywords=<comma-separated list of options>
累積多次使用-
指定要新增至發布至 BES 的預設關鍵字組合的通知關鍵字清單 (「command_name=<command_name>」和「protocol_name=BEP」)。預設值為「無」。
標記:affects_outputs
--[no]bes_lifecycle_events
預設值:「true」-
指定是否要發布 BES 生命週期事件。(預設為「true」)。
標記:affects_outputs
--bes_oom_finish_upload_timeout=<An immutable length of time.>
預設值:「10m」-
指定 Bazel 在發生 OOM 錯誤時,應等待 BES/BEP 上傳完成的時間長度。這個標記可確保 JVM 嚴重 GC 顛簸時終止,且無法在任何使用者執行緒上取得進展。
標記:bazel_monitoring
--bes_outerr_buffer_size=<an integer>
預設值:「10240」-
指定要緩衝處理至 BEP 的 stdout 或 stderr 大小上限,之後會回報為進度事件。即使個別寫入作業大於指定值,仍會以單一事件回報,上限為 --bes_outerr_chunk_size。
標記:affects_outputs
--bes_outerr_chunk_size=<an integer>
預設值:「1048576」-
指定單一訊息中要傳送至 BEP 的 stdout 或 stderr 大小上限。
標記:affects_outputs
--bes_proxy=<a string>
預設值:請參閱說明- 透過 Proxy 連線至 Build Event Service。目前這個旗標只能用來設定 Unix 網域通訊端 (unix:/path/to/socket)。
--bes_results_url=<a string>
預設值:「」-
指定使用者可查看串流至 BES 後端資訊的基本網址。Bazel 會將附加叫用 ID 的網址輸出至終端機。
標記:terminal_output
--bes_system_keywords=<comma-separated list of options>
累積多次使用-
指定要直接加入的通知關鍵字清單,透過 --bes_keywords 提供的關鍵字不含「user_keyword=」前置字元。適用於設定 --bes_lifecycle_events=false,並在呼叫 PublishLifecycleEvent 時加入關鍵字的 Build 服務運算子。使用這個旗標的建構服務運算子應禁止使用者覆寫旗標值。
標記:affects_outputs
--bes_timeout=<An immutable length of time.>
預設值:「0s」-
指定 Bazel 在建構和測試完成後,應等待多久才完成 BES/BEP 上傳作業。有效逾時時間為後接單位的自然數,單位可以是天 (d)、小時 (h)、分鐘 (m)、秒 (s) 和毫秒 (ms)。預設值為「0」,表示沒有逾時時間。
標記:affects_outputs
--bes_upload_mode=<wait_for_upload_complete, nowait_for_upload_complete or fully_async>
預設值:「wait_for_upload_complete」-
指定 Build Event Service 上傳作業是否應封鎖建構完成作業,或應立即結束叫用作業,並在背景完成上傳作業。可以是「wait_for_upload_complete」(預設)、「nowait_for_upload_complete」或「fully_async」。
標記:eagerness_to_exit
--build_event_binary_file=<a string>
預設值:「」-
如果檔案不為空白,請將建構事件通訊協定的 varint 分隔二進位表示法寫入該檔案。這個選項表示 --bes_upload_mode=wait_for_upload_complete。
標記:affects_outputs
--[no]build_event_binary_file_path_conversion
預設值:「true」-
盡可能將建構事件通訊協定的二進位檔案表示法中的路徑,轉換為更全域有效的 URI;如果停用,系統一律會使用 file:// URI 配置
標記:affects_outputs
--build_event_binary_file_upload_mode=<wait_for_upload_complete, nowait_for_upload_complete or fully_async>
預設值:「wait_for_upload_complete」-
指定 --build_event_binary_file 的建構事件服務上傳作業是否應封鎖建構完成作業,或應立即結束叫用作業,並在背景完成上傳作業。可以是「wait_for_upload_complete」(預設)、「nowait_for_upload_complete」或「fully_async」。
標記:eagerness_to_exit
--build_event_json_file=<a string>
預設值:「」-
如果檔案不為空,請將建構事件通訊協定的 JSON 序列化寫入該檔案。這個選項表示 --bes_upload_mode=wait_for_upload_complete。
標記:affects_outputs
--[no]build_event_json_file_path_conversion
預設值:「true」-
盡可能將建構事件通訊協定的 JSON 檔案表示法中的路徑轉換為更全域有效的 URI;如果停用,系統一律會使用 file:// URI 結構
標記:affects_outputs
--build_event_json_file_upload_mode=<wait_for_upload_complete, nowait_for_upload_complete or fully_async>
預設值:「wait_for_upload_complete」-
指定 --build_event_json_file 的建構事件服務上傳作業是否應封鎖建構完成,或應立即結束叫用並在背景完成上傳作業。可以是「wait_for_upload_complete」(預設)、「nowait_for_upload_complete」或「fully_async」。
標記:eagerness_to_exit
--build_event_max_named_set_of_file_entries=<an integer>
預設值:「5000」-
單一 named_set_of_files 事件的項目數量上限;系統會忽略小於 2 的值,且不會執行事件分割。這項設定的目的是限制建構事件通訊協定中的事件大小上限,但不會直接控制事件大小。事件總大小是集合結構以及檔案和 URI 長度的函式,而這些長度可能取決於雜湊函式。
標記:affects_outputs
--[no]build_event_publish_all_actions
預設值:「false」-
是否應發布所有動作。
標記:affects_outputs
--build_event_text_file=<a string>
預設值:「」-
如果不是空白,請將建構事件通訊協定的文字表示法寫入該檔案
標記:affects_outputs
--[no]build_event_text_file_path_conversion
預設值:「true」-
盡可能將建構事件通訊協定的文字檔表示法中的路徑轉換為更全域有效的 URI;如果停用,系統一律會使用 file:// URI 結構
標記:affects_outputs
--build_event_text_file_upload_mode=<wait_for_upload_complete, nowait_for_upload_complete or fully_async>
預設值:「wait_for_upload_complete」-
指定 --build_event_text_file 的建構事件服務上傳作業是否應封鎖建構完成,或立即結束叫用並在背景完成上傳作業。可以是「wait_for_upload_complete」(預設)、「nowait_for_upload_complete」或「fully_async」。
標記:eagerness_to_exit
--build_event_upload_max_retries=<an integer>
預設值:「4」-
Bazel 應重試上傳建構事件的次數上限。
標記:bazel_internal_configuration
--[no]experimental_bep_target_summary
預設值:「false」- 是否要發布 TargetSummary 事件。
--[no]experimental_build_event_expand_filesets
預設值:「false」-
如果是 true,則在顯示輸出檔案時,展開 BEP 中的檔案集。
標記:affects_outputs
--[no]experimental_build_event_fully_resolve_fileset_symlinks
預設值:「false」-
如果為 true,在顯示輸出檔案時,BEP 會完整解析 Fileset 中的相對符號連結。需要 --experimental_build_event_expand_filesets。
標記:affects_outputs
--experimental_build_event_output_group_mode=<an output group name followed by an OutputGroupFileMode, e.g. default=both>
累積多次使用-
指定輸出群組的檔案在 TargetComplete/AspectComplete BEP 事件中的表示方式。值是將輸出群組名稱指派給「NAMED_SET_OF_FILES_ONLY」、「INLINE_ONLY」或「BOTH」其中之一。預設值為「NAMED_SET_OF_FILES_ONLY」。如果輸出群組重複,系統會使用最後顯示的值。預設值會將涵蓋範圍構件的模式設為 BOTH:--experimental_build_event_output_group_mode=baseline.lcov=both
標記:affects_outputs
--experimental_build_event_upload_retry_minimum_delay=<An immutable length of time.>
預設值:「1s」-
BEP 上傳失敗時,指數輪詢重試的初始最短延遲時間。(指數:1.6)
標記:bazel_internal_configuration
--experimental_build_event_upload_strategy=<a string>
預設值:請參閱說明-
選取上傳建構事件通訊協定中參照構件的方式。
標記:affects_outputs
--[no]experimental_collect_load_average_in_profiler
預設值:「true」-
啟用後,剖析器會收集系統的整體平均負載。
標記:bazel_monitoring
--[no]experimental_collect_pressure_stall_indicators
預設值:「false」-
啟用後,分析器會收集 Linux PSI 資料。
標記:bazel_monitoring
--[no]experimental_collect_resource_estimation
預設值:「false」-
啟用後,分析器會收集本機動作的 CPU 和記憶體用量估計值。
標記:bazel_monitoring
--[no]experimental_collect_skyframe_counts_in_profiler
預設值:「false」-
啟用後,剖析器會收集 Skyframe 圖表中一段時間內的主要函式類型 (例如已設定目標和動作執行) 的 SkyFunction 計數。這項作業會在每個分析時間單位造訪整個 Skyframe 圖表,因此可能會影響效能。請勿將這個標記用於效能關鍵評估。
標記:bazel_monitoring
--[no]experimental_collect_system_network_usage
預設值:「true」-
啟用後,分析器會收集系統的網路用量。
標記:bazel_monitoring
--[no]experimental_collect_worker_data_in_profiler
預設值:「false」-
啟用後,分析器會收集工作人員的匯總資源資料。
標記:bazel_monitoring
--experimental_command_profile=<cpu, wall, alloc or lock>
預設值:請參閱說明- 在指令執行期間記錄 Java Flight Recorder 設定檔。您必須提供其中一種支援的剖析事件類型 (cpu、wall、alloc 或 lock) 做為引數。設定檔會寫入輸出基本目錄下,以事件類型命名的檔案。為支援其他設定檔類型或輸出格式,這個旗標的語法和語意日後可能會變更,請自行承擔使用風險。
--experimental_profile_additional_tasks=<phase, action, discover_inputs, action_check, action_lock, action_update, action_complete, action_rewinding, bzlmod, info, create_package, remote_execution, local_execution, scanner, local_parse, upload_time, remote_process_time, remote_queue, remote_setup, fetch, local_process_time, vfs_stat, vfs_dir, vfs_readlink, vfs_md5, vfs_xattr, vfs_delete, vfs_open, vfs_read, vfs_write, vfs_glob, vfs_vmfs_stat, vfs_vmfs_dir, vfs_vmfs_read, wait, thread_name, thread_sort_index, skyframe_eval, skyfunction, critical_path, critical_path_component, handle_gc_notification, local_action_counts, starlark_parser, starlark_user_fn, starlark_builtin_fn, starlark_user_compiled_fn, starlark_repository_fn, action_fs_staging, remote_cache_check, remote_download, remote_network, filesystem_traversal, worker_execution, worker_setup, worker_borrow, worker_working, worker_copying_outputs, credential_helper, conflict_check, dynamic_lock, repository_fetch, repository_vendor or unknown>
累積多次使用-
指定要納入設定檔的其他設定檔工作。
標記:bazel_monitoring
--[no]experimental_profile_include_primary_output
預設值:「false」-
在動作事件中加入額外的「out」屬性,其中包含動作主要輸出的執行路徑。
標記:bazel_monitoring
--[no]experimental_profile_include_target_configuration
預設值:「false」-
在動作事件的 JSON 設定檔資料中加入目標設定雜湊。
標記:bazel_monitoring
--[no]experimental_profile_include_target_label
預設值:「false」-
在動作事件的 JSON 設定檔資料中加入目標標籤。
標記:bazel_monitoring
--[no]experimental_record_metrics_for_all_mnemonics
預設值:「false」- 控制 BEP ActionSummary 和 BuildGraphMetrics 的輸出內容,限制 ActionData 中的助記符數量,以及 BuildGraphMetrics.AspectCount/RuleClassCount 中回報的項目數量。根據預設,類型數量會限制為前 20 個,依據 ActionData 的執行動作數量,以及 RuleClass 和 Asepcts 的執行個體數量。設定這個選項會寫入所有助記符、規則類別和層面的統計資料。
--[no]experimental_record_skyframe_metrics
預設值:「false」- 控制 BEP BuildGraphMetrics 的輸出內容,包括與 Skykeys、RuleClasses 和 Aspects 相關的運算成本高昂 Skyframe 指標。如果將這個標記設為 false,BEP 中就不會填入 BuildGraphMetrics.rule_count 和 aspectfields。
--[no]experimental_run_bep_event_include_residue
預設值:「false」-
是否要在可能含有殘餘項目的執行建構事件中,加入指令列殘餘項目。根據預設,殘餘物不會納入可能含有殘餘物的執行指令建構事件。
標記:affects_outputs
--[no]experimental_stream_log_file_uploads
預設值:「false」-
將串流記錄檔直接上傳至遠端儲存空間,而非寫入磁碟。
標記:affects_outputs
--experimental_workspace_rules_log_file=<a path>
預設值:請參閱說明- 將特定 Workspace 規則事件記錄到這個檔案中,做為以分隔符號分隔的 WorkspaceEvent Proto。
--[no]generate_json_trace_profile
預設值:「auto」-
如果啟用,Bazel 會分析建構作業,並將 JSON 格式的設定檔寫入輸出基底的檔案中。載入 chrome://tracing 即可查看設定檔。根據預設,Bazel 會為所有類似建構的指令和查詢寫入設定檔。
標記:bazel_monitoring
--[no]heap_dump_on_oom
預設值:「false」-
是否要在擲回 OOM 時手動輸出堆積傾印 (包括因達到 --gc_thrashing_limits 而手動 OOM)。傾印檔會寫入 <output_base>/<invocation_id>.heapdump.hprof。這個選項可有效取代 -XX:+HeapDumpOnOutOfMemoryError,後者對手動 OOM 沒有影響。
標記:bazel_monitoring
--jvm_heap_histogram_internal_object_pattern=<a valid Java regular expression>
預設值:「jdk\.internal\.vm\.Filler.+」- 用於覆寫 JDK21 以上版本 JVM 堆積記憶體收集作業的相符邏輯。我們依賴不穩定的內部 G1 GC 實作詳細資料來取得乾淨的記憶體指標,這個選項可讓我們適應內部實作的變更,而不必等待二進位版本發布。Passed to JDK Matcher.find()
--[no]legacy_important_outputs
預設值:「false」-
使用這個選項可禁止在 TargetComplete 事件中產生舊版 important_outputs 欄位。Bazel 整合至 ResultStore/BTX 時需要 important_outputs。
標記:affects_outputs
--logging=<0 <= an integer <= 6>
預設值:「3」-
記錄層級。
標記:affects_outputs
--memory_profile=<a path>
預設值:請參閱說明-
如果已設定,請在階段結束時將記憶體用量資料寫入指定檔案,並在建構完成時將穩定堆積寫入主要記錄檔。
標記:bazel_monitoring
--memory_profile_stable_heap_parameters=<integers, separated by a comma expected in pairs>
預設值:「1,0」-
在建構結束時調整記憶體設定檔的穩定堆積計算。應為以半形逗號分隔的偶數個整數。在每對整數中,第一個整數是要執行的 GC 數量。每個配對中的第二個整數是 GC 之間的等待秒數。例如:2,4,4,0 代表 2 個 GC,暫停 4 秒,接著是 4 個 GC,暫停 0 秒
標記:bazel_monitoring
--profile=<a path>
預設值:請參閱說明-
如果已設定,請分析 Bazel 並將資料寫入指定檔案。使用 bazel analyze-profile 分析設定檔。
標記:bazel_monitoring
--profiles_to_retain=<an integer>
預設值:「5」-
要在輸出基準中保留的設定檔數量。如果輸出資料庫中的設定檔超過這個數量,系統會刪除最舊的設定檔,直到總數低於上限為止。
標記:bazel_monitoring
--[no]record_full_profiler_data
預設值:「false」-
根據預設,Bazel 分析器只會記錄快速但數量眾多的事件 (例如 statting 檔案) 的匯總資料。如果啟用這個選項,剖析器會記錄每個事件,產生更精確的剖析資料,但效能會大幅降低。只有同時使用 --profile 時,這個選項才會生效。
標記:bazel_monitoring
--[no]redirect_local_instrumentation_output_writes
預設值:「false」-
如果為 true 且支援,系統會重新導向插樁輸出內容,以便在 Bazel 執行的機器以外的機器上寫入本機。
標記:bazel_monitoring
--remote_print_execution_messages=<failure, success or all>
預設值:「failure」-
選擇列印遠端執行訊息的時間。有效值包括 `failure` (僅在失敗時列印)、`success` (僅在成功時列印) 和 `all` (一律列印)。
標記:terminal_output
--[no]slim_profile
預設值:「true」-
如果設定檔過大,系統會合併事件,縮減 JSON 設定檔的大小。
標記:bazel_monitoring
--starlark_cpu_profile=<a string>
預設值:「」-
將所有 Starlark 執行緒的 CPU 用量 pprof 設定檔寫入指定檔案。
標記:bazel_monitoring
--tool_tag=<a string>
預設值:「」-
要將這個 Bazel 叫用歸因於的工具名稱。
標記:affects_outputs
、bazel_monitoring
--ui_event_filters=<Convert list of comma separated event kind to list of filters>
累積多次使用-
指定要在 UI 中顯示的事件。您可以使用前置 +/-,在預設事件中新增或移除事件,也可以直接指派事件,完全覆寫預設事件集。支援的事件種類包括 INFO、DEBUG、ERROR 等。
標記:terminal_output
- 指定或變更 Bazel 指令一般輸入內容的選項,不屬於其他類別:
--experimental_resolved_file_instead_of_workspace=<a string>
預設值:「」-
如果非空白,請讀取指定的已解析檔案,而非 WORKSPACE 檔案
標記:changes_inputs
- 遠端快取和執行選項:
--experimental_circuit_breaker_strategy=<failure>
預設值:請參閱說明-
指定斷路器要使用的策略。可用的策略為「failure」。如果選項值無效,系統的行為會與未設定選項時相同。
標記:execution
--experimental_downloader_config=<a string>
預設值:請參閱說明- 指定要用來設定遠端下載器的檔案。這個檔案包含多行,每一行開頭都是指令 (`allow`、`block` 或 `rewrite`),後面接著主機名稱 (適用於 `allow` 和 `block`) 或兩個模式,一個用於比對,另一個則用做替代網址,反向參照則從 `$1` 開始。同一個網址可以有多個 `rewrite` 指令,在這種情況下,系統會傳回多個網址。
--[no]experimental_guard_against_concurrent_changes
預設值:「false」- 關閉這項設定,即可停用在將動作上傳至遠端快取前,檢查動作輸入檔案的 ctime。在某些情況下,Linux 核心可能會延遲寫入檔案,導致誤判。
--experimental_remote_cache_compression_threshold=<an integer>
預設值:「100」- 使用 zstd 壓縮/解壓縮所需的最小 Blob 大小。除非設定 --remote_cache_compression,否則無效。
--[no]experimental_remote_cache_lease_extension
預設值:「false」- 如果設為 true,Bazel 會在建構期間定期傳送 `FindMissingBlobs` 呼叫至遠端快取,延長遠端動作輸出內容的租約。頻率取決於 `--experimental_remote_cache_ttl` 的值。
--experimental_remote_cache_ttl=<An immutable length of time.>
預設值:「3h」-
在最近參考摘要後,遠端快取中 Blob 的保證最短存留時間,例如 ActionResult 或 FindMissingBlobs。Bazel 會根據 Blob 的 TTL 進行多項最佳化,例如不會在漸進式建構作業中重複呼叫 GetActionResult。由於伺服器傳回摘要和 Bazel 接收摘要之間存在時間差,因此這個值應略小於實際 TTL。
標記:execution
--experimental_remote_capture_corrupted_outputs=<a path>
預設值:請參閱說明- 要擷取損毀輸出內容的目錄路徑。
--[no]experimental_remote_discard_merkle_trees
預設值:「true」- 如果設為 true,在呼叫 GetActionResult() 和 Execute() 時,系統會捨棄輸入根目錄 Merkle 樹狀結構的記憶體內副本,以及相關聯的輸入對應。這會大幅減少記憶體用量,但如果遠端快取未命中並重試,Bazel 就必須重新計算。
--experimental_remote_downloader=<a string>
預設值:請參閱說明- Remote Asset API 端點 URI,用做遠端下載 Proxy。支援的結構定義包括 grpc、grpcs (已啟用 TLS 的 grpc) 和 unix (本機 UNIX 通訊端)。如果未提供架構,Bazel 會預設為 grpcs。請參閱:https://github.com/bazelbuild/remote-apis/blob/master/build/bazel/remote/asset/v1/remote_asset.proto
--[no]experimental_remote_downloader_local_fallback
預設值:「false」- 是否要在遠端下載器失敗時,改用本機下載器。
--[no]experimental_remote_downloader_propagate_credentials
預設值:「false」- 是否要將憑證從 netrc 和憑證輔助程式傳播至遠端下載器伺服器。伺服器實作需要支援新的 `http_header_url:<url-index>:<header-key>` 限定符,其中 `<url-index>` 是 FetchBlobRequest 的 `uris` 欄位中網址的從零開始計算位置。網址專屬標頭的優先順序應高於全域標頭。
--[no]experimental_remote_execution_keepalive
預設值:「false」- 是否要為遠端執行呼叫使用 Keepalive。
--experimental_remote_failure_rate_threshold=<an integer in 0-100 range>
預設值:「10」-
設定特定時間範圍內允許的失敗率百分比,超過這個百分比後,系統就會停止呼叫遠端快取/執行器。預設值為 10。設為 0 表示沒有限制。
標記:execution
--experimental_remote_failure_window_interval=<An immutable length of time.>
預設值:「60 秒」-
計算遠端要求失敗率的時間間隔。如果值為零或負數,系統會將整個執行時間計算為失敗時間。可使用的單位包括:天 (d)、小時 (h)、分鐘 (m)、秒 (s) 和毫秒 (ms)。如果省略單位,系統會將值解讀為秒。
標記:execution
--[no]experimental_remote_mark_tool_inputs
預設值:「false」- 如果設為 true,Bazel 會將輸入內容標示為遠端執行器的工具輸入內容。這可用於實作遠端持續性工作者。
--[no]experimental_remote_merkle_tree_cache
預設值:「false」- 如果設為 true,系統會記憶 Merkle 樹狀結構計算結果,以提升遠端快取命中檢查速度。快取的記憶體用量由 --experimental_remote_merkle_tree_cache_size 控制。
--experimental_remote_merkle_tree_cache_size=<a long integer>
預設值:「1000」- 要記憶的 Merkle 樹狀結構數量,可提升遠端快取命中檢查速度。雖然系統會根據 Java 處理軟參照的方式自動修剪快取,但如果設定過高,仍可能發生記憶體不足錯誤。如果設為 0,快取大小就不會受到限制。最佳值會因專案大小而異。預設值為 1000。
--experimental_remote_output_service=<a string>
預設值:請參閱說明- 遠端輸出服務端點的 HOST 或 HOST:PORT。支援的結構定義包括 grpc、grpcs (已啟用 TLS 的 grpc) 和 unix (本機 UNIX 通訊端)。如果未提供架構,Bazel 會預設為 grpcs。指定 grpc:// 或 unix: 結構定義,即可停用 TLS。
--experimental_remote_output_service_output_path_prefix=<a string>
預設值:「」- 由 --experimental_remote_output_service 管理的輸出目錄內容所在路徑。建構作業使用的實際輸出目錄會是這個路徑的子項,並由輸出服務決定。
--[no]experimental_remote_require_cached
預設值:「false」- 如果設為 true,則強制將所有可遠端執行的動作快取,否則建構作業會失敗。這有助於排解非決定性問題,因為這樣就能檢查應快取的動作是否實際快取,而不會將新結果錯誤地插入快取中。
--experimental_remote_scrubbing_config=<Converts to a Scrubber>
預設值:請參閱說明- 使用提供的設定檔啟用遠端快取金鑰清除功能,該設定檔必須是文字格式的通訊協定緩衝區 (請參閱 src/main/protobuf/remote_scrubbing.proto)。 這項功能旨在協助在不同平台上執行的動作之間共用遠端/磁碟快取,但目標平台相同。請務必謹慎使用,因為設定不當可能會導致快取項目意外共用,進而造成建構錯誤。 清除作業不會影響動作的執行方式,只會影響其遠端/磁碟快取鍵的計算方式,以便擷取或儲存動作結果。經過清除的動作與遠端執行作業不相容,因此一律會在本地執行。 修改清除設定不會使本機檔案系統或內部快取中的輸出內容失效;您必須進行乾淨的建構作業,才能重新執行受影響的動作。 如要順利使用這項功能,您可能需要一併設定自訂的 --host_platform、--experimental_platform_in_output_dir (用於正規化輸出前置字元) 和 --incompatible_strict_action_env (用於正規化環境變數)。
--experimental_worker_for_repo_fetching=<off, platform, virtual or auto>
預設值:「auto」- 用於擷取存放區的執行緒模式。如果設為「off」,系統不會使用任何工作執行緒,且存放區擷取作業可能會重新啟動。否則會使用虛擬工作執行緒。
--[no]remote_accept_cached
預設值:「true」- 是否接受遠端快取的動作結果。
--remote_build_event_upload=<all or minimal>
預設值:「minimal」- 如果設為「all」,BEP 參照的所有本機輸出內容都會上傳至遠端快取。 如果設為「minimal」,BEP 參照的本機輸出內容不會上傳至遠端快取,BEP 消費者重要的檔案 (例如測試記錄和時間設定檔) 除外。即使檔案遺失遠端快取,檔案的 URI 一律會使用 bytestream:// 配置。 預設值為「minimal」。
--remote_bytestream_uri_prefix=<a string>
預設值:請參閱說明- 要用於寫入建構事件串流的 bytestream:// URI 中的主機名稱和執行個體名稱。使用 Proxy 執行建構作業時,可以設定這個選項,這會導致 --remote_executor 和 --remote_instance_name 的值不再對應至遠端執行服務的標準名稱。如未設定,預設值為「${hostname}/${instance_name}」。
--remote_cache=<a string>
預設值:請參閱說明- 快取端點的 URI。支援的結構定義包括 http、https、grpc、grpcs (已啟用 TLS 的 grpc) 和 unix (本機 UNIX 通訊端)。如果未提供架構,Bazel 會預設為 grpcs。指定 grpc://、http:// 或 unix: 架構即可停用 TLS。請參閱 https://bazel.build/remote/caching
--[no]remote_cache_async
預設值:「true」- 如果設為 true,系統會在背景將動作結果上傳至磁碟或遠端快取,不會阻礙動作完成。部分動作與背景上傳作業不相容,即使設定這個標記,仍可能遭到封鎖。
--[no]remote_cache_compression
預設值:「false」- 啟用後,當快取 Blob 的大小至少為 --experimental_remote_cache_compression_threshold 時,會使用 zstd 壓縮/解壓縮快取 Blob。
--remote_cache_header=<a 'name=value' assignment>
累積多次使用- 指定要納入快取要求的標頭:--remote_cache_header=Name=Value。您可以多次指定標記來傳遞多個標頭。相同名稱的多個值會轉換為以半形逗號分隔的清單。
--remote_default_exec_properties=<a 'name=value' assignment>
累積多次使用-
如果執行平台尚未設定 exec_properties,請將預設的 exec 屬性設為遠端執行平台。
標記:affects_outputs
--remote_default_platform_properties=<a string>
預設值:「」- 如果執行平台尚未設定 remote_execution_properties,請設定要為遠端執行 API 設定的預設平台屬性。如果選取主機平台做為遠端執行的執行平台,也會使用這個值。
--remote_download_regex=<a valid Java regular expression>
累積多次使用-
強制下載路徑符合此模式的遠端建構輸出內容,無論 --remote_download_outputs 為何。重複使用這個旗標即可指定多個模式。
標記:affects_outputs
--remote_downloader_header=<a 'name=value' assignment>
累積多次使用- 指定要納入遠端下載器要求的標頭:--remote_downloader_header=Name=Value。您可以多次指定標記來傳遞多個標頭。相同名稱的多個值會轉換為以半形逗號分隔的清單。
--remote_exec_header=<a 'name=value' assignment>
累積多次使用- 指定要納入執行要求的標頭:--remote_exec_header=Name=Value。您可以多次指定標記來傳遞多個標頭。相同名稱的多個值會轉換為以半形逗號分隔的清單。
--remote_execution_priority=<an integer>
預設值:「0」- 要遠端執行的動作的相對優先順序。特定優先級值的語意取決於伺服器。
--remote_executor=<a string>
預設值:請參閱說明- 遠端執行端點的 HOST 或 HOST:PORT。支援的結構定義包括 grpc、grpcs (已啟用 TLS 的 grpc) 和 unix (本機 UNIX 通訊端)。如果未提供架構,Bazel 會預設為 grpcs。指定 grpc:// 或 unix: 結構定義,即可停用 TLS。
--remote_grpc_log=<a path>
預設值:請參閱說明- 如果指定,則為記錄 gRPC 呼叫相關詳細資料的檔案路徑。這份記錄包含一連串序列化的 com.google.devtools.build.lib.remote.logging.RemoteExecutionLog.LogEntry protobuf,每個訊息都以 varint 為前置字元,表示後續序列化 protobuf 訊息的大小,如方法 LogEntry.writeDelimitedTo(OutputStream) 所執行。
--remote_header=<a 'name=value' assignment>
累積多次使用- 指定要納入要求中的標頭:--remote_header=Name=Value。您可以多次指定標記來傳遞多個標頭。相同名稱的多個值會轉換為以半形逗號分隔的清單。
--remote_instance_name=<a string>
預設值:「」- 要在遠端執行 API 中做為 instance_name 傳遞的值。
--[no]remote_local_fallback
預設值:「false」- 是否要在遠端執行失敗時,改用獨立的本機執行策略。
--remote_local_fallback_strategy=<a string>
預設值:「local」- 已淘汰。詳情請參閱 https://github.com/bazelbuild/bazel/issues/7480。
--remote_max_connections=<an integer>
預設值:「100」-
限制遠端快取/執行器的並行連線數上限。系統預設的分數值為 100。設為 0 表示沒有限制。
如果是 HTTP 遠端快取,一個 TCP 連線一次只能處理一個要求,因此 Bazel 最多可以發出 --remote_max_connections 個並行要求。
對於 gRPC 遠端快取/執行器,一個 gRPC 管道通常可以處理 100 多個並行要求,因此 Bazel 可以發出約 `--remote_max_connections * 100` 個並行要求。
標記:host_machine_resource_optimizations
--remote_proxy=<a string>
預設值:請參閱說明- 透過 Proxy 連線至遠端快取。目前這個旗標只能用來設定 Unix 網域通訊端 (unix:/path/to/socket)。
--remote_result_cache_priority=<an integer>
預設值:「0」- 要儲存在遠端快取中的遠端動作相對優先順序。特定優先級值的語意取決於伺服器。
--remote_retries=<an integer>
預設值:「5」- 暫時性錯誤的重試次數上限。如果設為 0,系統會停用重試功能。
--remote_retry_max_delay=<An immutable length of time.>
預設值:「5 秒」- 遠端重試嘗試之間的最大輪詢延遲時間。可用的單位包括:天 (d)、小時 (h)、分鐘 (m)、秒 (s) 和毫秒 (ms)。如果省略單位,系統會將值解讀為秒。
--remote_timeout=<An immutable length of time.>
預設值:「60 秒」- 等待遠端執行和快取呼叫的時間上限。如果是 REST 快取,這會是連線和讀取逾時。可用的單位包括:天 (d)、小時 (h)、分鐘 (m)、秒 (s) 和毫秒 (ms)。如果省略單位,系統會將值解讀為秒。
--[no]remote_upload_local_results
預設值:「true」- 是否要將在本機執行的動作結果上傳至遠端快取 (如果遠端快取支援這項功能,且使用者已獲得授權)。
--[no]remote_verify_downloads
預設值:「true」- 如果設為 true,Bazel 會計算所有遠端下載內容的雜湊總和,並捨棄與預期值不符的遠端快取值。
- 其他選項,未歸類於其他類別:
--build_metadata=<a 'name=value' assignment>
累積多次使用-
要在建構事件中提供的自訂鍵/值字串組合。
標記:terminal_output
--color=<yes, no or auto>
預設值:「auto」- 使用終端機控制項為輸出內容加上顏色。
--config=<a string>
累積多次使用- 從 rc 檔案選取其他設定區段;針對每個 <command>,也會從 <command>:<config> 中提取選項 (如果存在這類區段)。如果任何 .rc 檔案中都沒有這個區段,Blaze 會失敗並顯示錯誤。對應的設定區段和標記組合位於 tools/*.blazerc 設定檔中。
--credential_helper=<Path to a credential helper. It may be absolute, relative to the PATH environment variable, or %workspace%-relative. The path be optionally prefixed by a scope followed by an '='. The scope is a domain name, optionally with a single leading '*' wildcard component. A helper applies to URIs matching its scope, with more specific scopes preferred. If a helper has no scope, it applies to every URI.>
累積多次使用- 設定符合 <a href="https://github.com/EngFlow/credential-helper-spec">憑證輔助程式規格</a>的憑證輔助程式,用於擷取存放區擷取、遠端快取和執行作業,以及建構事件服務的授權憑證。 由輔助程式提供的憑證,優先於 `--google_default_credentials`、`--google_credentials`、`.netrc` 檔案,或 `repository_ctx.download()` 和 `repository_ctx.download_and_extract()` 的驗證參數。 可多次指定,設定多個輔助程式。 如需操作說明,請參閱 https://blog.engflow.com/2023/10/09/configuring-bazels-credential-helper/。
--credential_helper_cache_duration=<An immutable length of time.>
預設值:「30m」- 如果憑證輔助程式未提供憑證到期時間,憑證輔助程式提供的憑證預設快取時間。
--credential_helper_timeout=<An immutable length of time.>
預設值:「10 秒」- 設定憑證輔助程式的逾時時間。 如果憑證輔助程式未在逾時時間內回應,呼叫就會失敗。
--curses=<yes, no or auto>
預設值:「auto」- 使用終端機游標控制項,盡量減少捲動輸出內容。
--disk_cache=<a path>
預設值:請參閱說明- Bazel 可讀取及寫入動作和動作輸出的目錄路徑。如果目錄不存在,系統會自動建立。
--[no]enable_platform_specific_config
預設值:「false」- 如果為 true,Bazel 會從 bazelrc 檔案中挑選主機 OS 專屬的設定行。舉例來說,如果主機 OS 是 Linux,且您執行 bazel build,Bazel 會挑選以 build:linux 開頭的行。支援的 OS ID 包括 linux、macos、windows、freebsd 和 openbsd。啟用這個標記等同於在 Linux 上使用 --config=linux,在 Windows 上使用 --config=windows 等。
--experimental_disk_cache_gc_idle_delay=<An immutable length of time.>
預設值:「5m」- 伺服器必須閒置多久,才會對磁碟快取進行垃圾收集。如要指定垃圾收集政策,請設定 --experimental_disk_cache_gc_max_size 和/或 --experimental_disk_cache_gc_max_age。
--experimental_disk_cache_gc_max_age=<An immutable length of time.>
預設值:「0」- 如果設為正值,系統會定期進行垃圾收集,移除超過這個時間的磁碟快取項目。如果與 --experimental_disk_cache_gc_max_size 一併設定,則會套用這兩項條件。伺服器閒置時,系統會在背景執行垃圾收集作業,閒置時間由 --experimental_disk_cache_gc_idle_delay 旗標決定。
--experimental_disk_cache_gc_max_size=<a size in bytes, optionally followed by a K, M, G or T multiplier>
預設值:「0」- 如果設為正值,系統會定期進行垃圾收集,確保磁碟快取大小不超過這個值。如果與 --experimental_disk_cache_gc_max_age 一併設定,系統會套用這兩項條件。伺服器閒置時,系統會在背景執行垃圾收集作業,閒置時間由 --experimental_disk_cache_gc_idle_delay 旗標決定。
--[no]experimental_rule_extension_api
預設值:「true」-
啟用實驗性規則擴充功能 API 和子規則 API
代碼:loading_and_analysis
、experimental
--[no]experimental_windows_watchfs
預設值:「false」- 如果為 true,系統會啟用 --watchfs 的實驗性 Windows 支援功能。否則,--watchfs 在 Windows 上不會執行任何作業。請務必同時啟用 --watchfs。
--google_auth_scopes=<comma-separated list of options>
預設值:「https://www.googleapis.com/auth/cloud-platform」- 以半形逗號分隔的 Google Cloud 驗證範圍清單。
--google_credentials=<a string>
預設值:請參閱說明- 指定要從哪個檔案取得驗證憑證。詳情請參閱 https://cloud.google.com/docs/authentication。
--[no]google_default_credentials
預設值:「false」- 是否使用「Google 應用程式預設憑證」進行驗證。詳情請參閱 https://cloud.google.com/docs/authentication。預設為停用。
--grpc_keepalive_time=<An immutable length of time.>
預設值:請參閱說明- 設定外送 gRPC 連線的保持運作 Ping。如果設定了這個值,Bazel 會在連線沒有讀取作業這麼久的時間後傳送 Ping,但前提是至少有一個待處理的 gRPC 呼叫。時間會以秒為單位處理,設定小於一秒的值會導致錯誤。根據預設,系統會停用連線存續信號。啟用這項設定前,請先與服務擁有者協調。舉例來說,如要將這個旗標的值設為 30 秒,應執行以下操作:--grpc_keepalive_time=30s
--grpc_keepalive_timeout=<An immutable length of time.>
預設值:「20 秒」- 設定外送 gRPC 連線的保持運作逾時。如果使用 --grpc_keepalive_time 啟用 Keep-Alive Ping,Bazel 會在經過這段時間後未收到 Ping 回覆時,將連線設為逾時。時間會以秒為單位處理,設定小於一秒的值會導致錯誤。如果停用連線存續信號,系統會忽略這項設定。
--[no]incompatible_disable_non_executable_java_binary
預設值:「false」-
如為 true,java_binary 一律可執行。create_executable 屬性會移除。
標記:loading_and_analysis
、incompatible_change
--inject_repository=<an equals-separated mapping of repository name to path>
累積多次使用- 以 <repository name>=<path> 形式新增具有本機路徑的存放區。這只會在 --enable_bzlmod 生效,且等同於透過 `use_repo_rule` 將對應的 `local_repository` 新增至根模組的 MODULE.bazel 檔案。如果指定路徑是絕對路徑,系統會照常使用。如果指定路徑是相對路徑,則會相對於目前的工作目錄。如果指定路徑以「%workspace%」開頭,則該路徑會相對於工作區根目錄,也就是 `bazel info workspace` 的輸出內容。如果指定路徑為空白,請移除先前所有插入內容。
--invocation_id=<a UUID>
預設值:「」-
正在執行的指令專屬 ID,格式為 UUID。如果明確指定,呼叫端必須確保唯一性。UUID 會列印至 stderr、BEP 和遠端執行通訊協定。
標記:bazel_monitoring
、bazel_internal_configuration
--override_repository=<an equals-separated mapping of repository name to path>
累積多次使用- 以 <存放區名稱>=<路徑> 形式的本機路徑覆寫存放區。如果指定路徑是絕對路徑,系統會照常使用。如果指定路徑是相對路徑,則會以目前的工作目錄為基準。如果指定路徑以「%workspace%」開頭,則該路徑會相對於工作區根目錄,也就是 `bazel info workspace` 的輸出內容。如果指定路徑為空白,則移除任何先前的覆寫。
--[no]progress_in_terminal_title
預設值:「false」- 在終端機標題中顯示指令進度。如果有多個終端機分頁,這項功能有助於瞭解 Bazel 的運作情形。
--[no]show_progress
預設值:「true」- 在建構期間顯示進度訊息。
--show_progress_rate_limit=<a double>
預設值:「0.2」- 輸出內容中進度訊息之間的間隔秒數下限。
--[no]show_timestamps
預設值:「false」- 在訊息中加入時間戳記
--tls_certificate=<a string>
預設值:請參閱說明- 指定 TLS 憑證的路徑,該憑證可信任簽署伺服器憑證。
--tls_client_certificate=<a string>
預設值:請參閱說明- 指定要使用的 TLS 用戶端憑證;您也需要提供用戶端金鑰,才能啟用用戶端驗證。
--tls_client_key=<a string>
預設值:請參閱說明- 指定要使用的 TLS 用戶端金鑰;您也需要提供用戶端憑證,才能啟用用戶端驗證。
--ui_actions_shown=<an integer>
預設值:「8」-
詳細進度列中顯示的並行動作數量,每個動作會顯示在不同行。進度列一律會顯示至少一個 1,所有小於 1 的數字都會對應至 1。
標記:terminal_output
--[no]watchfs
預設值:「false」- 在 Linux/macOS 上:如果為 true,Bazel 會嘗試使用作業系統的檔案監控服務來偵測本機變更,而不是掃描每個檔案來找出變更。在 Windows 上:這個標記目前為非作業,但可與 --experimental_windows_watchfs 一併啟用。在任何作業系統上:如果工作區位於網路檔案系統,且檔案是在遠端電腦上編輯,則行為未定義。
分析設定檔選項
- 這個選項會影響 Starlark 語言的語意,或可供 BUILD 檔案、.bzl 檔案或 WORKSPACE 檔案存取的建構 API。
--[no]incompatible_use_plus_in_repo_names
預設值:「true」-
No-op。
標記:loading_and_analysis
- 影響記錄詳細程度、格式或位置的選項:
--dump=<text or raw>
[-d
] 預設:請參閱說明-
以人類可判讀的「文字」格式或適合指令碼的「原始」格式,輸出完整的設定檔資料傾印。
標記:bazel_monitoring
Aquery 選項
繼承 build 的所有選項。
- 這個選項會影響 Starlark 語言的語意,或可供 BUILD 檔案、.bzl 檔案或 WORKSPACE 檔案存取的建構 API。
--[no]incompatible_use_plus_in_repo_names
預設值:「true」-
無運算。
標記:loading_and_analysis
- 與查詢輸出和語意相關的選項:
--aspect_deps=<off, conservative or precise>
預設值:「conservative」-
如果輸出格式為 {xml、proto、record},如何解決層面依附元件問題?「off」表示不會解析任何層面依附元件;「conservative」(預設值) 表示會新增所有已宣告的層面依附元件,無論這些依附元件是否具有直接依附元件的規則類別;「precise」表示只會新增可能處於啟用狀態的層面,前提是這些層面具有直接依附元件的規則類別。請注意,精確模式需要載入其他套件來評估單一目標,因此比其他模式慢。另請注意,即使是精確模式也不會完全精確:是否要計算某個層面是在分析階段決定,而分析階段不會在「bazel query」期間執行。
標記:build_file_semantics
--[no]consistent_labels
預設值:「false」-
如果啟用這項功能,每個查詢指令都會發出標籤,就像是將 Starlark <code>str</code> 函式套用至 <code>Label</code> 執行個體一樣。如果工具需要比對規則發出的不同查詢指令和/或標籤的輸出內容,這項功能就非常實用。如果未啟用,輸出格式化工具可以改為發出明顯的存放區名稱 (相對於主要存放區),讓輸出內容更易於閱讀。
標記:terminal_output
--[no]experimental_explicit_aspects
預設值:「false」-
aquery、cquery:是否要在輸出內容中加入層面產生的動作。query:無運算 (一律會追蹤層面)。
標記:terminal_output
--[no]graph:factored
預設值:「true」-
如果為 true,系統會「分解」圖表,也就是合併拓撲等效節點,並串連標籤。這個選項僅適用於 --output=graph。
標記:terminal_output
--graph:node_limit=<an integer>
預設值:「512」-
輸出內容中圖形節點的標籤字串長度上限。較長的標籤會遭到截斷;-1 表示不會截斷。這個選項僅適用於 --output=graph。
標記:terminal_output
--[no]implicit_deps
預設值:「true」-
如果啟用,查詢作業所依附的依附元件圖表會包含隱含依附元件。隱含依附元件是指未在 BUILD 檔案中明確指定,但由 Bazel 新增的依附元件。如果是 cquery,這個選項會控管已解析工具鍊的篩選作業。
標記:build_file_semantics
--[no]include_artifacts
預設值:「true」-
輸出內容包含動作輸入和輸出內容的名稱 (可能很大)。
標記:terminal_output
--[no]include_aspects
預設值:「true」-
aquery、cquery:是否要在輸出內容中加入層面產生的動作。query:無運算 (一律會追蹤層面)。
標記:terminal_output
--[no]include_commandline
預設值:「true」-
輸出內容包含動作指令列的內容 (可能很大)。
標記:terminal_output
--[no]include_file_write_contents
預設值:「false」-
包含 FileWrite、SourceSymlinkManifest 和 RepoMappingManifest 動作的檔案內容 (可能很大)。
標記:terminal_output
--[no]include_param_files
預設值:「false」-
包含指令中使用的參數檔案內容 (可能很大)。注意:啟用這個標記後,系統會自動啟用 --include_commandline 標記。
標記:terminal_output
--[no]include_pruned_inputs
預設值:「true」-
包括在動作執行期間修剪的動作輸入內容。只會影響探索輸入內容的動作,且這些動作已在先前的叫用中執行。只有在同時設定 --include_artifacts 時才會生效。
標記:terminal_output
--[no]incompatible_package_group_includes_double_slash
預設值:「true」-
如果啟用,輸出 package_group 的 `packages` 屬性時,不會省略開頭的 `//`。
標記:terminal_output
、incompatible_change
--[no]infer_universe_scope
預設值:「false」-
如果已設定,但未設定 --universe_scope,則 --universe_scope 的值會推斷為查詢運算式中的不重複目標模式清單。請注意,如果查詢運算式使用宇宙範圍函式 (例如 `allrdeps`),推斷出的 --universe_scope 值可能不是您要的值,因此只有在您瞭解自己的做法時,才應使用這個選項。如需詳細資料和範例,請參閱 https://bazel.build/reference/query#sky-query。如果已設定 --universe_scope,系統會忽略這個選項的值。注意:這個選項僅適用於 `query` (即非 `cquery`)。
標記:loading_and_analysis
--[no]line_terminator_null
預設值:「false」-
每個格式是否以 \0 結尾,而非換行符號。
標記:terminal_output
--[no]nodep_deps
預設值:「true」-
如果啟用,來自「nodep」屬性的依附元件會納入查詢運作的依附元件圖。「nodep」屬性的常見範例是「visibility」。執行並剖析 `info build-language` 的輸出內容,瞭解建構語言中的所有「nodep」屬性。
標記:build_file_semantics
--output=<a string>
預設值:「text」-
應列印查詢結果的格式。aquery 的允許值為:text、textproto、proto、streamed_proto、jsonproto。
標記:terminal_output
--[no]proto:default_values
預設值:「true」-
如果為 true,系統會納入 BUILD 檔案中未明確指定值的屬性;否則會省略這些屬性。這個選項適用於 --output=proto
標記:terminal_output
--[no]proto:definition_stack
預設值:「false」-
填入 definition_stack proto 欄位,記錄定義規則類別時的每個規則執行個體 Starlark 呼叫堆疊。
標記:terminal_output
--[no]proto:flatten_selects
預設值:「true」-
啟用後,系統會將 select() 建立的可設定屬性扁平化。如果是清單類型,扁平化表示法就是清單,其中每個選取對應的值只會出現一次。純量型別會扁平化為空值。
標記:build_file_semantics
--[no]proto:include_attribute_source_aspects
預設值:「false」-
使用屬性來源的來源構面,填入每個屬性的 source_aspect_name proto 欄位 (如果沒有來源構面,則填入空字串)。
標記:terminal_output
--[no]proto:include_synthetic_attribute_hash
預設值:「false」-
是否要計算及填入 $internal_attr_hash 屬性。
標記:terminal_output
--[no]proto:instantiation_stack
預設值:「false」-
填入每項規則的例項化呼叫堆疊。請注意,這需要堆疊存在
標記:terminal_output
--[no]proto:locations
預設值:「true」-
是否要在 Proto 輸出中輸出位置資訊。
標記:terminal_output
--proto:output_rule_attrs=<comma-separated list of options>
預設值:「all」-
以半形逗號分隔的屬性清單,這些屬性會納入輸出內容。預設值為所有屬性。如要不輸出任何屬性,請設為空字串。這個選項適用於 --output=proto。
標記:terminal_output
--[no]proto:rule_classes
預設值:「false」-
填入每項規則的 rule_class_key 欄位;如果是具有特定 rule_class_key 的第一項規則,請一併填入其 rule_class_info proto 欄位。rule_class_key 欄位會專屬識別規則類別,而 rule_class_info 欄位則是 Stardoc 格式的規則類別 API 定義。
標記:terminal_output
--[no]proto:rule_inputs_and_outputs
預設值:「true」-
是否要填入 rule_input 和 rule_output 欄位。
標記:terminal_output
--query_file=<a string>
預設值:「」-
如果已設定,查詢會從這裡命名的檔案讀取查詢,而不是從指令列讀取。在此處指定檔案和指令列查詢都是錯誤的做法。
標記:changes_inputs
--[no]relative_locations
預設值:「false」-
如果為 true,xml 和 proto 輸出內容中的 BUILD 檔案位置會是相對位置。根據預設,位置輸出為絕對路徑,且在不同電腦上不會保持一致。您可以將這個選項設為 true,確保不同機器的結果一致。
標記:terminal_output
--[no]skyframe_state
預設值:「false」-
不必執行額外分析,即可從 Skyframe 傾印目前的動作圖。注意:目前不支援使用 --skyframe_state 指定目標。這個旗標只能搭配 --output=proto 或 --output=textproto 使用。
標記:terminal_output
--[no]tool_deps
預設值:「true」-
查詢:如果停用,查詢作業的依附元件圖表就不會納入「執行設定」的依附元件。「執行設定」依附元件邊緣 (例如從任何「proto_library」規則到通訊協定編譯器) 通常是指在建構期間執行的工具,而不是相同「目標」程式的一部分。Cquery:如果停用,會篩除所有已設定的目標,這些目標會從發現這個已設定目標的頂層目標,跨越執行轉換。也就是說,如果頂層目標位於目標設定中,系統只會傳回目標設定中已設定的目標。如果頂層目標位於執行設定中,系統只會傳回已設定的執行目標。這個選項「不會」排除已解決的工具鍊。
標記:build_file_semantics
--universe_scope=<comma-separated list of options>
預設值:「」-
以逗號分隔的目標模式集 (加法和減法)。查詢可能會在指定目標的遞移閉包所定義的範圍內執行。這個選項適用於 query 和 cquery 指令。
如果是 cquery,這個選項的輸入內容是所有答案的建構目標,因此這個選項可能會影響設定和轉換。如未指定這個選項,系統會假設頂層目標是從查詢運算式剖析的目標。注意:如果是 cquery,如果從查詢運算式剖析的目標無法使用頂層選項建構,則不指定這個選項可能會導致建構作業中斷。
標記:loading_and_analysis
- 控制建構執行的選項:
--[no]experimental_inprocess_symlink_creation
預設值:「true」-
是否要直接呼叫檔案系統來建立符號連結樹狀結構,而不是委派給輔助程序。
標籤:loading_and_analysis
、execution
、experimental
--[no]experimental_persistent_aar_extractor
預設值:「false」-
使用 Worker 啟用持續性 AAR 擷取器。
標記:execution
、experimental
--[no]experimental_remotable_source_manifests
預設值:「false」-
是否要讓來源資訊清單動作可遠端執行
標記:loading_and_analysis
、execution
、experimental
--[no]experimental_split_coverage_postprocessing
預設值:「false」-
如果為 true,Bazel 會在新衍生程序中執行測試的涵蓋範圍後續處理作業。
標記:execution
、experimental
--[no]experimental_strict_fileset_output
預設值:「false」-
如果啟用這個選項,檔案集會將所有輸出構件視為一般檔案。不會遍歷目錄或對符號連結敏感。
標記:execution
、experimental
--[no]incompatible_modify_execution_info_additive
預設值:「false」-
啟用後,傳遞多個 --modify_execution_info 標記會產生加成效果。停用時,系統只會考量最後一個旗標。
標記:execution
、affects_outputs
、loading_and_analysis
、incompatible_change
--modify_execution_info=<regex=[+-]key,regex=[+-]key,...>
累積多次使用-
根據動作助記符,在動作的執行資訊中新增或移除鍵。僅適用於支援執行資訊的動作。許多常見動作都支援執行資訊,例如 Genrule、CppCompile、Javac、StarlarkAction、TestRunner。指定多個值時,順序很重要,因為許多正則運算式可能會套用至相同助記符。
語法:「regex=[+-]key,regex=[+-]key,...」。
範例:
「.*=+x,.*=-y,.*=+z」會將「x」和「z」新增至所有動作的執行資訊,並從中移除「y」。
「Genrule=+requires-x」會將「requires-x」新增至所有 Genrule 動作的執行資訊。
'(?!Genrule).*=-requires-x' 會從所有非 Genrule 動作的執行資訊中移除 'requires-x'。
標籤:execution
、affects_outputs
、loading_and_analysis
--persistent_android_dex_desugar
-
使用 Worker 啟用持續性 Android dex 和 desugar 動作。
展開後:
--internal_persistent_android_dex_desugar
--strategy=Desugar=worker
--strategy=DexBuilder=worker
標記:host_machine_resource_optimizations
、execution
--persistent_android_resource_processor
-
使用 Worker 啟用永久性 Android 資源處理器。
展開後:
--internal_persistent_busybox_tools
--strategy=AaptPackage=worker
--strategy=AndroidResourceParser=worker
--strategy=AndroidResourceValidator=worker
--strategy=AndroidResourceCompiler=worker
--strategy=RClassGenerator=worker
--strategy=AndroidResourceLink=worker
--strategy=AndroidAapt2=worker
--strategy=AndroidAssetMerger=worker
--strategy=AndroidResourceMerger=worker
--strategy=AndroidCompiledResourceMerger=worker
--strategy=ManifestMerger=worker
--strategy=AndroidManifestMerger=worker
--strategy=Aapt2Optimize=worker
--strategy=AARGenerator=worker
--strategy=ProcessDatabinding=worker
--strategy=GenerateDataBindingBaseClasses=worker
標記:host_machine_resource_optimizations
、execution
--persistent_multiplex_android_dex_desugar
-
使用 Worker 啟用持續性多工 Android dex 和 desugar 動作。
展開後會顯示:
--persistent_android_dex_desugar
--internal_persistent_multiplex_android_dex_desugar
標記:host_machine_resource_optimizations
、execution
--persistent_multiplex_android_resource_processor
-
使用工作人員啟用持續性多工 Android 資源處理器。
展開後:
--persistent_android_resource_processor
--modify_execution_info=AaptPackage=+supports-multiplex-workers
--modify_execution_info=AndroidResourceParser=+supports-multiplex-workers
--modify_execution_info=AndroidResourceValidator=+supports-multiplex-workers
--modify_execution_info=AndroidResourceCompiler=+supports-multiplex-workers
--modify_execution_info=RClassGenerator=+supports-multiplex-workers
--modify_execution_info=AndroidResourceLink=+supports-multiplex-workers
--modify_execution_info=AndroidAapt2=+supports-multiplex-workers
--modify_execution_info=AndroidAssetMerger=+supports-multiplex-workers
--modify_execution_info=AndroidResourceMerger=+supports-multiplex-workers
--modify_execution_info=AndroidCompiledResourceMerger=+supports-multiplex-workers
--modify_execution_info=ManifestMerger=+supports-multiplex-workers
--modify_execution_info=AndroidManifestMerger=+supports-multiplex-workers
--modify_execution_info=Aapt2Optimize=+supports-multiplex-workers
--modify_execution_info=AARGenerator=+supports-multiplex-workers
標記:host_machine_resource_optimizations
、execution
--persistent_multiplex_android_tools
-
啟用持續性及多工 Android 工具 (dexing、desugaring、資源處理)。
展開後:
--internal_persistent_multiplex_busybox_tools
--persistent_multiplex_android_resource_processor
--persistent_multiplex_android_dex_desugar
標記:host_machine_resource_optimizations
、execution
--[no]use_target_platform_for_tests
預設值:「false」-
如果為 true,Bazel 會使用目標平台執行測試,而非測試執行群組。
標記:execution
- 設定用於執行動作的工具鍊選項:
--android_compiler=<a string>
預設值:請參閱說明-
Android 目標編譯器。
標籤:affects_outputs
、loading_and_analysis
、loses_incremental_state
--android_manifest_merger=<legacy, android or force_android>
預設值:「android」-
選取要用於 android_binary 規則的資訊清單合併工具。這個標記可協助從舊版合併工具轉換至 Android 資訊清單合併工具。
標籤:affects_outputs
、loading_and_analysis
、loses_incremental_state
--android_platforms=<a build target label>
預設值:「」-
設定 android_binary 目標使用的平台。如果指定多個平台,則二進位檔為笨重的 APK,其中包含每個指定目標平台的原生二進位檔。
標籤:changes_inputs
、loading_and_analysis
、loses_incremental_state
--apple_crosstool_top=<a build target label>
default: "@bazel_tools//tools/cpp:toolchain"-
要在 Apple 和 Objc 規則及其依附元件中使用的 crosstool 套件標籤。
標記:loses_incremental_state
、changes_inputs
--cc_output_directory_tag=<a string>
預設值:「」-
指定要加到設定目錄的後置字串。
標記:affects_outputs
--compiler=<a string>
預設值:請參閱說明-
用於編譯目標的 C++ 編譯器。
標記:loading_and_analysis
、execution
--coverage_output_generator=<a build target label>
default: "@bazel_tools//tools/test:lcov_merger"-
用於後續處理原始涵蓋範圍報表的二進位檔位置。目前必須是包含單一檔案 (二進位檔) 的檔案群組。預設值為「//tools/test:lcov_merger」。
標籤:changes_inputs
、affects_outputs
、loading_and_analysis
--coverage_report_generator=<a build target label>
預設值:「@bazel_tools//tools/test:coverage_report_generator」-
用於產生涵蓋範圍報表的二進位檔位置。目前必須是包含單一檔案 (二進位檔) 的檔案群組。預設值為「//tools/test:coverage_report_generator」。
標籤:changes_inputs
、affects_outputs
、loading_and_analysis
--coverage_support=<a build target label>
預設值:「@bazel_tools//tools/test:coverage_support」-
每個收集程式碼涵蓋範圍的測試動作輸入內容中,所需支援檔案的位置。預設值為「//tools/test:coverage_support」。
標籤:changes_inputs
、affects_outputs
、loading_and_analysis
--custom_malloc=<a build target label>
預設值:請參閱說明-
指定自訂 malloc 實作項目。這項設定會覆寫建構規則中的 malloc 屬性。
標記:changes_inputs
、affects_outputs
--experimental_add_exec_constraints_to_targets=<a '<RegexFilter>=<label1>[,<label2>,...]' assignment>
累積多次使用-
以逗號分隔的規則運算式清單,每個運算式可選擇性加上前置字元「-」(負運算式),並以「=」指派給以逗號分隔的限制值目標清單。如果目標與任何負運算式都不相符,但與至少一個正運算式相符,工具鍊解析就會執行,就像目標已將限制值宣告為執行限制一樣。範例://demo,-test=@platforms//cpus:x86_64 會將「x86_64」新增至 //demo 下的所有目標,但名稱包含「test」的目標除外。
標記:loading_and_analysis
--[no]experimental_include_xcode_execution_requirements
預設值:「false」-
如果已設定,請為每個 Xcode 動作新增「requires-xcode:{version}」執行需求。如果 Xcode 版本有連字號標籤,請一併新增「requires-xcode-label:{version_label}」執行需求。
標記:loses_incremental_state
、loading_and_analysis
、execution
、experimental
--[no]experimental_prefer_mutual_xcode
預設值:「true」-
如果為 true,請使用本機和遠端可用的最新 Xcode。如果為 false,或沒有可用的共同版本,請使用透過 xcode-select 選取的本機 Xcode 版本。
標記:loses_incremental_state
、experimental
--extra_execution_platforms=<comma-separated list of options>
預設值:「」-
可做為執行平台來執行動作的平台。平台可以指定為確切目標,或指定為目標模式。系統會優先考慮這些平台,再考慮 register_execution_platforms() 在 WORKSPACE 檔案中宣告的平台。這個選項只能設定一次,後續的例項會覆寫先前的標記設定。
標記:execution
--extra_toolchains=<comma-separated list of options>
累積多次使用-
工具鍊解析期間要考慮的工具鍊規則。工具鍊可指定為確切目標,或目標模式。系統會優先考量這些工具鍊,再考量由 register_toolchains() 在 WORKSPACE 檔案中宣告的工具鍊。
標記:affects_outputs
、changes_inputs
、loading_and_analysis
--grte_top=<a label>
預設值:請參閱說明-
已簽入 libc 程式庫的標籤。預設值是由 crosstool 工具鍊選取,您幾乎不需要覆寫這個值。
標記:action_command_lines
、affects_outputs
--host_compiler=<a string>
預設值:請參閱說明-
無作業旗標。將在日後推出的版本中移除。
標記:loading_and_analysis
、execution
--host_grte_top=<a label>
預設值:請參閱說明-
如果指定,這項設定會覆寫 exec 設定的 libc 頂層目錄 (--grte_top)。
標記:action_command_lines
、affects_outputs
--host_platform=<a build target label>
default: "@bazel_tools//tools:host_platform"-
平台規則的標籤,用於說明主機系統。
標籤:affects_outputs
、changes_inputs
、loading_and_analysis
--[no]incompatible_bazel_test_exec_run_under
預設值:「false」-
如果啟用,系統會在執行設定中建構「bazel test --run_under=//:runner」的「//:runner」。如果停用,系統會在目標設定中建構「//:runner」。Bazel 會在執行機器上執行測試,因此前者較為正確。這不會影響「bazel run」,因為「bazel run」一律會在目標設定中建構「`--run_under=//foo」。
標記:affects_outputs
、incompatible_change
--[no]incompatible_dont_enable_host_nonhost_crosstool_features
預設值:「true」-
如果為 true,Bazel 將不會在 C++ 工具鍊中啟用「主機」和「非主機」功能 (詳情請參閱 https://github.com/bazelbuild/bazel/issues/7407)。
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_enable_apple_toolchain_resolution
預設值:「false」-
使用工具鍊解析度,為 Apple 規則 (Starlark 和原生) 選取 Apple SDK
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_remove_legacy_whole_archive
預設值:「true」-
如果為 true,Bazel 預設不會將程式庫依附元件連結為整個封存檔 (如需遷移操作說明,請參閱 https://github.com/bazelbuild/bazel/issues/7362)。
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_strip_executable_safely
預設值:「false」-
如為 true,可執行檔的 strip 動作會使用 -x 標記,不會中斷動態符號解析。
標記:action_command_lines
、incompatible_change
-
如果工具鍊支援,請使用介面共用物件。目前所有 ELF 工具鍊都支援這項設定。
標籤:loading_and_analysis
、affects_outputs
、affects_outputs
--ios_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
指定用於建構 iOS 應用程式的 iOS SDK 版本。如未指定,則會使用「xcode_version」中的預設 iOS SDK 版本。
標記:loses_incremental_state
--macos_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
指定用於建構 macOS 應用程式的 macOS SDK 版本。如未指定,則會使用「xcode_version」中的預設 macOS SDK 版本。
標記:loses_incremental_state
--minimum_os_version=<a string>
預設值:請參閱說明-
編譯目標的最低作業系統版本。
標記:loading_and_analysis
、affects_outputs
--platform_mappings=<a main workspace-relative path>
預設值:「」-
對應檔案的位置,用於說明在未設定平台時要使用哪個平台,或是在平台已存在時要設定哪些旗標。必須相對於主要工作區根目錄。預設值為「platform_mappings」(工作區根目錄下的檔案)。
標記:affects_outputs
、changes_inputs
、loading_and_analysis
、immutable
--platforms=<a build target label>
預設值:「」-
平台規則的標籤,說明目前指令的目標平台。
標籤:affects_outputs
、changes_inputs
、loading_and_analysis
--python_path=<a string>
預設值:請參閱說明-
在目標平台上執行 Python 目標時,所叫用的 Python 解譯器絕對路徑。已淘汰;由 --incompatible_use_python_toolchains 停用。
標記:loading_and_analysis
、affects_outputs
--python_top=<a build target label>
預設值:請參閱說明-
代表 Python 解譯器的 py_runtime 標籤,用於在目標平台上執行 Python 目標。已淘汰;由 --incompatible_use_python_toolchains 停用。
標記:loading_and_analysis
、affects_outputs
--tvos_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
指定用於建構 tvOS 應用程式的 tvOS SDK 版本。如未指定,則會使用「xcode_version」中的預設 tvOS SDK 版本。
標記:loses_incremental_state
--watchos_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
指定用於建構 watchOS 應用程式的 watchOS SDK 版本。如未指定,則會使用「xcode_version」中的預設 watchOS SDK 版本。
標記:loses_incremental_state
--xcode_version=<a string>
預設值:請參閱說明-
如果指定,則會使用指定版本的 Xcode 執行相關建構動作。如未指定,則會使用 Xcode 的執行器預設版本。
標記:loses_incremental_state
--xcode_version_config=<a build target label>
default: "@bazel_tools//tools/cpp:host_xcodes"-
用於在建構設定中選取 Xcode 版本的 xcode_config 規則標籤。
標記:loses_incremental_state
、loading_and_analysis
- 控管指令輸出的選項:
--[no]apple_generate_dsym
預設值:「false」-
是否要產生偵錯符號 (.dSYM) 檔案。
標記:affects_outputs
、action_command_lines
--[no]build_runfile_links
預設值:「true」-
如果為 true,則為所有目標建構 Runfile 符號連結樹狀結構。 如果為 false,則只有在本地動作、測試或執行指令需要時,才會寫入這些檔案。
標記:affects_outputs
--[no]build_runfile_manifests
預設值:「true」-
如果是 true,則為所有目標編寫執行檔資訊清單。如果為 false,請省略這些屬性。如果為 false,本機測試將無法執行。
標記:affects_outputs
--[no]build_test_dwp
預設值:「false」-
如果啟用這項功能,系統會以靜態方式建構 C++ 測試,並使用 fission,自動建構測試二進位檔的 .dwp 檔案。
標記:loading_and_analysis
、affects_outputs
--cc_proto_library_header_suffixes=<comma-separated set of options>
預設值:「.pb.h」-
設定 cc_proto_library 建立的標頭檔案後置字元。
標記:affects_outputs
、loading_and_analysis
--cc_proto_library_source_suffixes=<comma-separated set of options>
預設值:「.pb.cc」-
設定 cc_proto_library 建立的來源檔案後置字元。
標記:affects_outputs
、loading_and_analysis
--[no]experimental_proto_descriptor_sets_include_source_info
預設值:「false」-
在 proto_library 中,針對替代的 Java API 版本執行額外動作。
標籤:affects_outputs
、loading_and_analysis
、experimental
--[no]experimental_save_feature_state
預設值:「false」-
將已啟用和要求的特徵狀態儲存為編譯輸出內容。
標記:affects_outputs
、experimental
--fission=<a set of compilation modes>
預設值:「no」-
指定哪些編譯模式會使用分裂功能進行 C++ 編譯和連結。可以是 {'fastbuild'、'dbg'、'opt'} 的任意組合,也可以是特殊值 'yes' (啟用所有模式) 和 'no' (停用所有模式)。
標籤:loading_and_analysis
、action_command_lines
、affects_outputs
--[no]incompatible_always_include_files_in_data
預設值:「true」-
如果是 true,原生規則會將資料依附元件的 <code>DefaultInfo.files</code> 新增至執行檔,這與 Starlark 規則的建議行為相符 (https://bazel.build/extending/rules#runfiles_features_to_avoid)。
標記:affects_outputs
、incompatible_change
--[no]legacy_external_runfiles
預設值:「false」-
如果為 true,請為 .runfiles/repo 底下的外部存放區建構執行檔案符號連結樹狀結構 (除了 .runfiles/repo 以外)。
標記:affects_outputs
--[no]objc_generate_linkmap
預設值:「false」-
指定是否要產生連結對應檔案。
標記:affects_outputs
--[no]save_temps
預設值:「false」-
如果設定,系統會儲存 gcc 的暫時輸出內容。包括 .s 檔案 (組語程式碼)、.i 檔案 (前置處理的 C) 和 .ii 檔案 (前置處理的 C++)。
標記:affects_outputs
- 可讓使用者設定預期輸出內容的選項,影響輸出內容的值,而非輸出內容是否存在:
--action_env=<a 'name=value' assignment with an optional value part>
累積多次使用-
指定可供具有目標設定的動作使用的環境變數集。變數可以依名稱指定 (此時值會取自叫用環境),也可以依名稱=值組合指定 (此時值會獨立於叫用環境)。這個選項可以多次使用;如果是相同變數的選項,系統會採用最新的選項,如果是不同變數的選項,則會累加。
標記:action_command_lines
--allowed_cpu_values=<comma-separated set of options>
預設值:「」-
--cpu 標記的允許值。
標記:changes_inputs
、affects_outputs
--[no]android_databinding_use_androidx
預設值:「true」-
產生與 AndroidX 相容的資料繫結檔案。這項功能僅適用於資料繫結 v2。這個旗標是無運算。
標記:affects_outputs
、loading_and_analysis
、loses_incremental_state
、experimental
--[no]android_databinding_use_v3_4_args
預設值:「true」-
使用 3.4.0 引數搭配 Android 資料繫結 v2。這個旗標是無運算。
標記:affects_outputs
、loading_and_analysis
、loses_incremental_state
、experimental
--android_dynamic_mode=<off, default or fully>
預設值:「off」-
判斷 cc_binary 未明確建立共用程式庫時,是否要動態連結 Android 規則的 C++ 依附元件。「default」表示 Bazel 會選擇是否要動態連結。「完全」表示所有程式庫都會動態連結。「off」表示所有程式庫都會以靜態模式連結。
標記:affects_outputs
、loading_and_analysis
--android_manifest_merger_order=<alphabetical, alphabetical_by_configuration or dependency>
預設值:「alphabetical」-
設定傳遞至 Android 二進位檔資訊清單合併工具的資訊清單順序。ALPHABETICAL 表示資訊清單會依據相對於 execroot 的路徑排序。ALPHABETICAL_BY_CONFIGURATION 表示資訊清單會依路徑排序,路徑是相對於輸出目錄中的設定目錄。DEPENDENCY 表示資訊清單的排序方式為:每個程式庫的資訊清單會出現在其依附元件的資訊清單之前。
標記:action_command_lines
、execution
--[no]android_resource_shrinking
預設值:「false」-
為使用 ProGuard 的 android_binary APK 啟用資源壓縮功能。
標記:affects_outputs
、loading_and_analysis
--[no]build_python_zip
預設值:「auto」-
建構 Python 可執行檔 ZIP;在 Windows 上為開啟,在其他平台上為關閉
標記:affects_outputs
--catalyst_cpus=<comma-separated list of options>
累積多次使用-
以半形逗號分隔的架構清單,用於建構 Apple Catalyst 二進位檔。
標記:loses_incremental_state
、loading_and_analysis
--[no]collect_code_coverage
預設值:「false」-
如果指定,Bazel 會檢測程式碼 (盡可能使用離線檢測),並在測試期間收集涵蓋範圍資訊。只有符合 --instrumentation_filter 的目標會受到影響。通常不應直接指定這個選項,而是應使用「bazel coverage」指令。
標記:affects_outputs
--compilation_mode=<fastbuild, dbg or opt>
[-c
] 預設值:「fastbuild」-
指定建構二進位檔的模式。值:「fastbuild」、「dbg」、「opt」。
標記:affects_outputs
、action_command_lines
--conlyopt=<a string>
累積多次使用-
編譯 C 來源檔案時,要傳遞至 gcc 的其他選項。
標記:action_command_lines
、affects_outputs
--copt=<a string>
累積多次使用-
要傳遞至 gcc 的其他選項。
標記:action_command_lines
、affects_outputs
--cpu=<a string>
預設值:「」-
目標 CPU。
標記:changes_inputs
、affects_outputs
--cs_fdo_absolute_path=<a string>
預設值:請參閱說明-
使用 CSFDO 設定檔資訊,盡可能改良編譯作業。指定包含設定檔、原始或已編列索引 LLVM 設定檔的 zip 檔絕對路徑名稱。
標記:affects_outputs
--cs_fdo_instrument=<a string>
預設值:請參閱說明-
使用情境感應 FDO 檢測功能產生二進位檔。使用 Clang/LLVM 編譯器時,系統也會接受目錄名稱,執行階段會將原始設定檔傾印至該目錄。
標記:affects_outputs
--cs_fdo_profile=<a build target label>
預設值:請參閱說明-
代表要用於最佳化的內容相關設定檔的 cs_fdo_profile。
標記:affects_outputs
--cxxopt=<a string>
累積多次使用-
編譯 C++ 來源檔案時,要傳遞至 gcc 的其他選項。
標記:action_command_lines
、affects_outputs
--define=<a 'name=value' assignment>
累積多次使用-
每個 --define 選項都會指定建構變數的指派作業。如果變數有多個值,則最後一個值會勝出。
標記:changes_inputs
、affects_outputs
--dynamic_mode=<off, default or fully>
預設值:「default」-
決定是否要動態連結 C++ 二進位檔。 「default」表示 Bazel 會選擇是否要動態連結。「完全」表示所有程式庫都會動態連結。「off」表示所有程式庫都會以靜態模式連結。
標記:loading_and_analysis
、affects_outputs
--[no]enable_propeller_optimize_absolute_paths
預設值:「true」-
如果已設定,任何使用螺旋槳最佳化絕對路徑的行為都會引發錯誤。
標記:affects_outputs
--[no]enable_remaining_fdo_absolute_paths
預設值:「true」-
如果設定,使用 FDO 的絕對路徑時會引發錯誤。
標記:affects_outputs
--[no]enable_runfiles
預設值:「auto」-
啟用 Runfiles 符號連結樹狀結構;預設為在 Windows 上關閉,在其他平台上開啟。
標記:affects_outputs
--experimental_action_listener=<a build target label>
累積多次使用-
已淘汰,請改用切面。使用 action_listener 將 extra_action 附加至現有的建構動作。
標記:execution
、experimental
--[no]experimental_android_compress_java_resources
預設值:「false」-
壓縮 APK 中的 Java 資源
標記:affects_outputs
、loading_and_analysis
、experimental
--[no]experimental_android_databinding_v2
預設值:「true」-
使用 Android 資料繫結 v2。這個旗標是無運算。
標記:affects_outputs
、loading_and_analysis
、loses_incremental_state
、experimental
--[no]experimental_android_resource_shrinking
預設值:「false」-
為使用 ProGuard 的 android_binary APK 啟用資源壓縮功能。
標籤:affects_outputs
、loading_and_analysis
、experimental
--[no]experimental_android_rewrite_dexes_with_rex
預設值:「false」-
use rex tool to rewrite dex files
標記:affects_outputs
、loading_and_analysis
、loses_incremental_state
、experimental
--[no]experimental_collect_code_coverage_for_generated_files
預設值:「false」-
如有指定,Bazel 也會為產生的檔案產生收集涵蓋範圍資訊。
標記:affects_outputs
、experimental
--experimental_objc_fastbuild_options=<comma-separated list of options>
預設值:「-O0,-DDEBUG=1」-
將這些字串做為 objc 快速建構編譯器選項。
標記:action_command_lines
--[no]experimental_omitfp
預設值:「false」-
如果設為 true,則使用 libunwind 進行堆疊解除,並使用 -fomit-frame-pointer 和 -fasynchronous-unwind-tables 進行編譯。
標籤:action_command_lines
、affects_outputs
、experimental
--experimental_output_paths=<off, content or strip>
預設值:「off」-
輸出樹狀結構規則應使用哪個模型來寫入輸出內容,特別是針對多平台 / 多設定建構作業。這項功能仍在實驗階段,詳情請參閱 https://github.com/bazelbuild/bazel/issues/6526。如要選擇加入路徑對應,請將「supports-path-mapping」鍵新增至「execution_requirements」字典。
標記:loses_incremental_state
、bazel_internal_configuration
、affects_outputs
、execution
--experimental_override_name_platform_in_output_dir=<a 'label=value' assignment>
累積多次使用-
每個項目都應採用 label=value 格式,其中 label 是指平台,value 則是要在輸出路徑中使用的所需簡短名稱。只有在 --experimental_platform_in_output_dir 為 true 時才會使用。命名優先順序最高。
標記:affects_outputs
、experimental
--[no]experimental_platform_in_output_dir
預設值:「false」-
如果為 true,輸出目錄名稱會使用目標平台的簡短名稱,而非 CPU。確切的架構是實驗性質,可能會有所變更:首先,如果 --platforms 選項沒有剛好一個值,系統會使用平台選項的雜湊。接著,如果目前平台有任何簡稱是透過 --experimental_override_name_platform_in_output_dir 登錄,系統就會使用該簡稱。然後,如果設定了 --experimental_use_platforms_in_output_dir_legacy_heuristic,請使用以目前平台標籤為準的簡短名稱。最後,平台選項的雜湊會做為最後手段。
標記:affects_outputs
、experimental
--[no]experimental_py_binaries_include_label
預設值:「false」-
即使停用蓋章功能,py_binary 目標仍會包含標籤。
標記:affects_outputs
、experimental
--[no]experimental_use_llvm_covmap
預設值:「false」-
如果指定,啟用 collect_code_coverage 時,Bazel 會產生 llvm-cov 涵蓋範圍對應資訊,而不是 gcov。
標記:changes_inputs
、affects_outputs
、loading_and_analysis
、experimental
--[no]experimental_use_platforms_in_output_dir_legacy_heuristic
預設值:「true」-
請僅在建議的遷移或測試策略中使用這個標記。請注意,這個啟發式方法有已知缺點,建議改為只依賴 --experimental_override_name_platform_in_output_dir。
標記:affects_outputs
、experimental
--fdo_instrument=<a string>
預設值:請參閱說明-
使用 FDO 檢測生成二進位檔。使用 Clang/LLVM 編譯器時,系統也會接受目錄名稱,執行階段會將原始設定檔傾印至該目錄。
標記:affects_outputs
--fdo_optimize=<a string>
預設值:請參閱說明-
使用 FDO 設定檔資訊,最佳化編譯作業。指定包含 .gcda 檔案樹狀結構、包含自動設定檔的 afdo 檔案,或 LLVM 設定檔檔案的 ZIP 檔案名稱。這個旗標也接受指定為標籤的檔案 (例如 `//foo/bar:file.afdo` - 您可能需要在對應的套件中新增 `exports_files` 指令),以及指向 `fdo_profile` 目標的標籤。這項標記會由 `fdo_profile` 規則取代。
標記:affects_outputs
--fdo_prefetch_hints=<a build target label>
預設值:請參閱說明-
使用快取預先擷取提示。
標記:affects_outputs
--fdo_profile=<a build target label>
預設值:請參閱說明-
代表用於最佳化的設定檔。
標記:affects_outputs
--features=<a string>
累積多次使用-
系統會根據目標設定,預設啟用或停用目標中建構的指定功能。指定 -<feature> 會停用該功能。負面特徵一律會覆寫正面特徵。另請參閱 --host_features
標記:changes_inputs
、affects_outputs
--[no]force_pic
預設值:「false」-
啟用後,所有 C++ 編譯作業都會產生與位置無關的程式碼 (「-fPIC」),連結會優先使用 PIC 預先建構的程式庫,而非非 PIC 程式庫,且連結會產生與位置無關的可執行檔 (「-pie」)。
標記:loading_and_analysis
、affects_outputs
--host_action_env=<a 'name=value' assignment with an optional value part>
累積多次使用-
指定可供具有執行設定的動作使用的環境變數集。變數可以依名稱指定 (此時值會取自叫用環境),也可以依名稱=值組合指定 (此時值會獨立於叫用環境)。這個選項可以多次使用;如果是相同變數的選項,系統會採用最新的選項,如果是不同變數的選項,則會累加。
標記:action_command_lines
--host_compilation_mode=<fastbuild, dbg or opt>
預設值:「opt」-
指定建構期間使用的工具建構模式。值:「fastbuild」、「dbg」、「opt」。
標記:affects_outputs
、action_command_lines
--host_conlyopt=<a string>
累積多次使用-
在 exec 設定中編譯 C (而非 C++) 來源檔案時,要傳遞至 C 編譯器的其他選項。
標記:action_command_lines
、affects_outputs
--host_copt=<a string>
累積多次使用-
要傳遞至 C 編譯器的其他選項,適用於在 exec 設定中建構的工具。
標記:action_command_lines
、affects_outputs
--host_cpu=<a string>
預設值:「」-
主機 CPU。
標記:changes_inputs
、affects_outputs
--host_cxxopt=<a string>
累積多次使用-
要傳遞至 C++ 編譯器的其他選項,適用於在 exec 設定中建構的工具。
標記:action_command_lines
、affects_outputs
--host_features=<a string>
累積多次使用-
系統會為在執行設定中建構的目標,預設啟用或停用指定功能。指定 -<feature> 會停用該功能。負面特徵一律會覆寫正面特徵。
標記:changes_inputs
、affects_outputs
--host_force_python=<PY2 or PY3>
預設值:請參閱說明-
覆寫執行設定的 Python 版本。可以是「PY2」或「PY3」。
標記:loading_and_analysis
、affects_outputs
--host_linkopt=<a string>
累積多次使用-
在執行設定中連結工具時,傳遞至連結器的其他選項。
標記:action_command_lines
、affects_outputs
--host_macos_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
主機目標的最低相容 macOS 版本。如未指定,則會使用「macos_sdk_version」。
標記:loses_incremental_state
--host_per_file_copt=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths followed by an @ and a comma separated list of options>
累積多次使用-
在執行設定中編譯特定檔案時,選擇性傳遞至 C/C++ 編譯器的其他選項。這個選項可以多次傳遞。語法:regex_filter@option_1,option_2,...,option_n。其中 regex_filter 代表包含和排除規則運算式模式的清單 (另請參閱 --instrumentation_filter)。option_1 到 option_n 代表任意指令列選項。如果選項含有半形逗號,則必須以反斜線加上引號。選項可以包含 @。系統只會使用第一個 @ 分割字串。範例:--host_per_file_copt=//foo/.*\.cc,-//foo/bar\.cc@-O0 會將 -O0 指令列選項新增至 //foo/ 中所有 cc 檔案的 gcc 指令列,但 bar.cc 除外。
標記:action_command_lines
、affects_outputs
--[no]incompatible_auto_exec_groups
預設值:「false」-
啟用後,系統會為規則使用的每個工具鍊自動建立執行群組。如要讓這項規則運作,必須在動作中指定 `toolchain` 參數。詳情請參閱 https://github.com/bazelbuild/bazel/issues/17134。
標記:affects_outputs
、incompatible_change
--[no]incompatible_merge_genfiles_directory
預設值:「true」-
如果是 true,genfiles 目錄會摺疊到 bin 目錄中。
標記:affects_outputs
、incompatible_change
--[no]instrument_test_targets
預設值:「false」-
啟用涵蓋範圍時,指定是否要考慮插樁測試規則。設定後,--instrumentation_filter 包含的測試規則會經過檢測。否則,測試規則一律會從涵蓋範圍插樁中排除。
標記:affects_outputs
--instrumentation_filter=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths>
default: "-/javatests[/:],-/test/java[/:]"-
啟用涵蓋範圍後,系統只會檢測名稱符合指定 regex 篩選器的規則。以「-」為前置字元的規則則會遭到排除。請注意,除非啟用 --instrument_test_targets,否則系統只會檢測非測試規則。
標記:affects_outputs
--ios_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
目標模擬器和裝置的最低相容 iOS 版本。如未指定,則使用「ios_sdk_version」。
標記:loses_incremental_state
--ios_multi_cpus=<comma-separated list of options>
累積多次使用-
以半形逗號分隔的架構清單,用於建構 ios_application。結果是包含所有指定架構的通用二進位檔。
標記:loses_incremental_state
、loading_and_analysis
--[no]legacy_whole_archive
預設值:「true」-
已淘汰,由 --incompatible_remove_legacy_whole_archive 取代 (詳情請參閱 https://github.com/bazelbuild/bazel/issues/7362)。開啟後,請為具有 linkshared=True,且 linkopts 中有 linkstatic=True 或「-static」的 cc_binary 規則使用 --whole-archive。這項功能僅適用於回溯相容性。更好的替代方案是在必要時使用 alwayslink=1。
標籤:action_command_lines
、affects_outputs
、deprecated
--linkopt=<a string>
累積多次使用-
連結時傳遞至 gcc 的其他選項。
標記:action_command_lines
、affects_outputs
--ltobackendopt=<a string>
累積多次使用-
傳遞至 LTO 後端步驟的其他選項 (位於 --features=thin_lto 下)。
標記:action_command_lines
、affects_outputs
--ltoindexopt=<a string>
累積多次使用-
可傳遞至 LTO 索引步驟的其他選項 (位於 --features=thin_lto 下)。
標記:action_command_lines
、affects_outputs
--macos_cpus=<comma-separated list of options>
累積多次使用-
要建構 Apple macOS 二進位檔的架構清單 (以半形逗號分隔)。
標記:loses_incremental_state
、loading_and_analysis
--macos_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
目標的最低相容 macOS 版本。如未指定,則會使用「macos_sdk_version」。
標記:loses_incremental_state
--memprof_profile=<a build target label>
預設值:請參閱說明-
使用 memprof 設定檔。
標記:affects_outputs
--[no]objc_debug_with_GLIBCXX
預設值:「false」-
如果已設定,且編譯模式設為「dbg」,請定義 GLIBCXX_DEBUG、GLIBCXX_DEBUG_PEDANTIC 和 GLIBCPP_CONCEPT_CHECKS。
標記:action_command_lines
--[no]objc_enable_binary_stripping
預設值:「false」-
是否要對連結的二進位檔執行符號和無效程式碼剝除作業。如果同時指定這個旗標和 --compilation_mode=opt,系統就會執行二進位檔剝除作業。
標記:action_command_lines
--objccopt=<a string>
累積多次使用-
編譯 Objective-C/C++ 來源檔案時,要傳遞給 gcc 的其他選項。
標記: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>
累積多次使用-
編譯特定檔案時,可選擇性傳遞至 gcc 的其他選項。這個選項可以多次傳遞。語法:regex_filter@option_1,option_2,...,option_n。其中 regex_filter 代表包含和排除規則運算式模式的清單 (另請參閱 --instrumentation_filter)。option_1 到 option_n 代表任意指令列選項。如果選項含有半形逗號,則必須以反斜線加上引號。選項可以包含 @。系統只會使用第一個 @ 分割字串。範例:--per_file_copt=//foo/.*\.cc,-//foo/bar\.cc@-O0 會將 -O0 指令列選項新增至 //foo/ 中所有 cc 檔案 (bar.cc 除外) 的 gcc 指令列。
標記: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>
累積多次使用-
編譯特定後端物件時,可選擇性傳遞至 LTO 後端的其他選項 (位於 --features=thin_lto 下)。這個選項可以多次傳遞。語法:regex_filter@option_1,option_2,...,option_n。其中 regex_filter 代表包含和排除規則運算式模式的清單,option_1 到 option_n 則代表任意指令列選項。如果選項含有半形逗號,則必須以反斜線加上引號。選項可以包含 @。系統只會使用第一個 @ 分割字串。範例:--per_file_ltobackendopt=//foo/.*\.o,-//foo/bar\.o@-O0 會將 -O0 指令列選項新增至 //foo/ 中所有 o 檔案 (bar.o 除外) 的 LTO 後端指令列。
標記:action_command_lines
、affects_outputs
--platform_suffix=<a string>
預設值:請參閱說明-
指定要加到設定目錄的後置字串。
標籤:loses_incremental_state
、affects_outputs
、loading_and_analysis
--propeller_optimize=<a build target label>
預設值:請參閱說明-
使用 Propeller 設定檔資訊,最佳化建構目標。Propeller 設定檔必須包含至少一個檔案,即 cc 設定檔和 ld 設定檔。這個標記接受建構標籤,該標籤必須參照螺旋槳設定檔輸入檔案。舉例來說,在 a/b/BUILD 中定義標籤的 BUILD 檔案:propeller_optimize( name = "propeller_profile", cc_profile = "propeller_cc_profile.txt", ld_profile = "propeller_ld_profile.txt",)可能必須將 exports_files 指令新增至對應的套件,才能讓 Bazel 看到這些檔案。這個選項必須做為下列項目使用:--propeller_optimize=//a/b:propeller_profile
標記:action_command_lines
、affects_outputs
--propeller_optimize_absolute_cc_profile=<a string>
預設值:請參閱說明-
Propeller 最佳化建構版本的 cc_profile 檔案絕對路徑名稱。
標記:affects_outputs
--propeller_optimize_absolute_ld_profile=<a string>
預設值:請參閱說明-
Propeller 最佳化建構版本的 ld_profile 檔案絕對路徑名稱。
標記:affects_outputs
--run_under=<a prefix in front of command>
預設值:請參閱說明-
要插入「test」和「run」指令可執行檔之前的字首。如果值為「foo -bar」,而執行指令列為「test_binary -baz」,則最終指令列為「foo -bar test_binary -baz」。這也可以是可執行目標的標籤。例如:'valgrind'、'strace'、'strace -c'、'valgrind --quiet --num-callers=20'、'//package:target'、'//package:target --options'。
標記:action_command_lines
-
如果為 true,不同目標之間會共用包含相同功能的原生程式庫。
標記:loading_and_analysis
、affects_outputs
--[no]stamp
預設值:「false」-
在二進位檔中蓋上日期、使用者名稱、主機名稱、工作區資訊等。
標記:affects_outputs
--strip=<always, sometimes or never>
預設值:「有時」-
指定是否要剝除二進位檔和共用程式庫 (使用「-Wl,--strip-debug」)。預設值「sometimes」表示僅在 --compilation_mode=fastbuild 時移除。
標記:affects_outputs
--stripopt=<a string>
累積多次使用-
產生 '<name>.stripped' 二進位檔時,要傳遞至 strip 的其他選項。
標記:action_command_lines
、affects_outputs
--tvos_cpus=<comma-separated list of options>
累積多次使用-
要建構 Apple tvOS 二進位檔的架構清單 (以半形逗號分隔)。
標記:loses_incremental_state
、loading_and_analysis
--tvos_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
目標模擬器和裝置的最低相容 tvOS 版本。如未指定,則會使用「tvos_sdk_version」。
標記:loses_incremental_state
--visionos_cpus=<comma-separated list of options>
累積多次使用-
要建構 Apple visionOS 二進位檔的架構清單 (以半形逗號分隔)。
標記:loses_incremental_state
、loading_and_analysis
--watchos_cpus=<comma-separated list of options>
累積多次使用-
以半形逗號分隔的架構清單,用於建構 Apple watchOS 二進位檔。
標記:loses_incremental_state
、loading_and_analysis
--watchos_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
目標模擬器和裝置的最低相容 watchOS 版本。如未指定,則會使用「watchos_sdk_version」。
標記:loses_incremental_state
--xbinary_fdo=<a build target label>
預設值:請參閱說明-
使用 XbinaryFDO 設定檔資訊,最佳化編譯作業。指定預設跨二進位檔設定檔的名稱。如果這個選項與 --fdo_instrument/--fdo_optimize/--fdo_profile 搭配使用,這些選項一律會優先採用,如同從未指定 xbinary_fdo 一樣。
標記:affects_outputs
- 影響 Bazel 嚴格程度的選項,可強制執行有效的建構輸入內容 (規則定義、旗標組合等):
--[no]check_licenses
預設值:「false」-
確認依附套件的授權限制不會與建構目標的發布模式衝突。根據預設,系統不會檢查授權。
標記:build_file_semantics
--[no]check_visibility
預設值:「true」-
如果停用,目標依附元件中的顯示設定錯誤會降級為警告。
標記:build_file_semantics
--[no]desugar_for_android
預設值:「true」-
是否要在 dexing 前脫糖 Java 8 位元碼。
標籤:affects_outputs
、loading_and_analysis
、loses_incremental_state
--[no]desugar_java8_libs
預設值:「false」-
是否要在舊版裝置的應用程式中加入支援的 Java 8 程式庫。
標記:affects_outputs
、loading_and_analysis
、loses_incremental_state
、experimental
--[no]enforce_constraints
預設值:「true」-
檢查每個目標相容的環境,並在任何目標有不支援相同環境的依附元件時回報錯誤。
標記:build_file_semantics
--[no]experimental_check_desugar_deps
預設值:「true」-
是否要在 Android 二進位層級重複檢查正確的解除糖化程序。
標籤:eagerness_to_exit
、loading_and_analysis
、experimental
--experimental_import_deps_checking=<a string>
預設值:請參閱說明-
無作業,僅為回溯相容性而保留
標記:loading_and_analysis
--experimental_one_version_enforcement=<off, warning or error>
預設值:「OFF」-
啟用後,系統會強制執行 java_binary 規則,確保類別路徑中不會包含相同類別檔案的多個版本。這項強制執行措施可能會導致建構作業中斷,或只是產生警告。
標記:loading_and_analysis
--experimental_strict_java_deps=<off, warn, error, strict or default>
預設值:「default」-
如果為 true,則檢查 Java 目標是否明確將所有直接使用的目標宣告為依附元件。
標記:build_file_semantics
、eagerness_to_exit
--[no]incompatible_check_testonly_for_output_files
預設值:「false」-
如果已啟用,請查閱產生規則的 testonly,找出輸出檔案的必要條件目標。這與可見度檢查相符。
標記:build_file_semantics
、incompatible_change
--[no]incompatible_check_visibility_for_toolchains
預設值:「false」-
如果啟用,可見度檢查也會套用至工具鍊實作項目。
標記:build_file_semantics
、incompatible_change
--[no]incompatible_disable_native_android_rules
預設值:「false」-
如果啟用,系統會停用 Android 原生規則的直接使用權。請使用 https://github.com/bazelbuild/rules_android 中的 Starlark Android 規則
標記:eagerness_to_exit
、incompatible_change
--[no]incompatible_disable_native_apple_binary_rule
預設值:「false」-
無作業。為保持回溯相容性而保留。
標記:eagerness_to_exit
、incompatible_change
--[no]incompatible_python_disable_py2
預設值:「true」-
如果為 true,使用 Python 2 設定會導致錯誤。包括 python_version=PY2、srcs_version=PY2 和 srcs_version=PY2ONLY。詳情請參閱 https://github.com/bazelbuild/bazel/issues/15684。
標記:loading_and_analysis
、incompatible_change
--[no]one_version_enforcement_on_java_tests
預設值:「true」-
啟用後,如果 experimental_one_version_enforcement 設為非 NONE 值,系統就會對 java_test 目標強制執行單一版本。您可以停用此標記,以改善增量測試效能,但可能會因此錯過潛在的單一版本違規事項。
標記:loading_and_analysis
--python_native_rules_allowlist=<a build target label>
預設值:請參閱說明-
強制執行 --incompatible_python_disallow_native_rules 時使用的許可清單 (package_group 目標)。
標記:loading_and_analysis
--[no]strict_filesets
預設值:「false」-
如果啟用這個選項,系統會將跨越套件界線的檔案集回報為錯誤。
標記:build_file_semantics
、eagerness_to_exit
--strict_proto_deps=<off, warn, error, strict or default>
預設值:「error」-
除非設為 OFF,否則會檢查 proto_library 目標是否明確將所有直接使用的目標宣告為依附元件。
標籤:build_file_semantics
、eagerness_to_exit
、incompatible_change
--strict_public_imports=<off, warn, error, strict or default>
預設值:「off」-
除非設為 OFF,否則會檢查 proto_library 目標是否明確將「import public」中使用的所有目標宣告為已匯出。
標籤:build_file_semantics
、eagerness_to_exit
、incompatible_change
--[no]strict_system_includes
預設值:「false」-
如果是 true,系統也必須宣告透過系統包含路徑 (-isystem) 找到的標頭。
標記:loading_and_analysis
、eagerness_to_exit
--target_environment=<a build target label>
累積多次使用-
宣告這個建構作業的目標環境。必須是「環境」規則的標籤參照。如果指定,所有頂層目標都必須與這個環境相容。
標記:changes_inputs
- 影響建構簽署輸出的選項:
--apk_signing_method=<v1, v2, v1_v2 or v4>
預設值:「v1_v2」-
用來簽署 APK 的實作項目
標記:action_command_lines
、affects_outputs
、loading_and_analysis
--[no]device_debug_entitlements
預設值:「true」-
如果已設定,且編譯模式不是「opt」,objc 應用程式會在簽署時加入偵錯授權。
標記:changes_inputs
--ios_signing_cert_name=<a string>
預設值:請參閱說明-
用於 iOS 簽署的憑證名稱。如未設定,系統會改用佈建設定檔。可能是憑證的鑰匙圈身分偏好設定,或憑證通用名稱的 (子字串),如 codesign 的說明頁面 (SIGNING IDENTITIES) 所示。
標記:action_command_lines
- 這個選項會影響 Starlark 語言的語意,或可供 BUILD 檔案、.bzl 檔案或 WORKSPACE 檔案存取的建構 API:
--[no]incompatible_disallow_legacy_py_provider
預設值:「true」-
No-op, will be removed soon.
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_disallow_sdk_frameworks_attributes
預設值:「false」-
如果設為 true,則 objc_library 和 objc_import 中的 sdk_frameworks 和 weak_sdk_frameworks 屬性會遭到禁止。
標記:build_file_semantics
、incompatible_change
--[no]incompatible_objc_alwayslink_by_default
預設值:「false」-
如果為 true,請將 objc_library 和 objc_import 中的 alwayslink 屬性預設值設為 true。
標記:build_file_semantics
、incompatible_change
--[no]incompatible_python_disallow_native_rules
預設值:「false」-
如果為 true,使用內建 py_* 規則時會發生錯誤,此時應改用 rule_python 規則。如需更多資訊和遷移操作說明,請參閱 https://github.com/bazelbuild/bazel/issues/17773。
標記:loading_and_analysis
、incompatible_change
- 控管測試環境或測試執行器行為的選項:
--[no]allow_analysis_failures
預設值:「false」-
如果為 true,規則目標的分析失敗會導致目標傳播包含錯誤說明的 AnalysisFailureInfo 執行個體,而不是導致建構失敗。
標記:loading_and_analysis
、experimental
--analysis_testing_deps_limit=<an integer>
預設值:「2000」-
透過具有 for_analysis_testing 設定轉換的規則屬性,設定遞移依附元件數量上限。如果超出這項限制,系統就會產生規則錯誤。
標記:loading_and_analysis
--[no]break_build_on_parallel_dex2oat_failure
預設值:「false」-
如果為 true,dex2oat 動作失敗會導致建構中斷,而不是在測試執行階段執行 dex2oat。
標記:loading_and_analysis
、experimental
--default_test_resources=<a resource name followed by equal and 1 float or 4 float, e.g. memory=10,30,60,100>
累積多次使用- 覆寫測試的預設資源量。預期格式為 <resource>=<value>。如果將單一正數指定為 <value>,系統會覆寫所有測試大小的預設資源。如果指定 4 個以半形逗號分隔的數字,系統會分別覆寫小型、中型、大型和特大型測試大小的資源量。值也可以是 HOST_RAM/HOST_CPU,後面可選擇性加上 [-|*]<float> (例如 memory=HOST_RAM*.1,HOST_RAM*.2,HOST_RAM*.3,HOST_RAM*.4)。這個旗標指定的預設測試資源,會遭到標記中明確指定的資源覆寫。
--[no]experimental_android_use_parallel_dex2oat
預設值:「false」-
使用 dex2oat 平行處理,可能可加快 android_test 的速度。
標籤:loading_and_analysis
、host_machine_resource_optimizations
、experimental
--[no]ios_memleaks
預設值:「false」-
在 ios_test 目標中啟用記憶體洩漏檢查。
標記:action_command_lines
--ios_simulator_device=<a string>
預設值:請參閱說明-
在模擬器中執行 iOS 應用程式時要模擬的裝置,例如「iPhone 6」。您可以在要執行模擬器的電腦上執行「xcrun simctl list devicetypes」,取得裝置清單。
標記:test_runner
--ios_simulator_version=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
執行或測試時,要在模擬器上執行的 iOS 版本。如果規則中指定目標裝置,系統會忽略 ios_test 規則的這項設定。
標記:test_runner
--runs_per_test=<a positive integer or test_regex@runs. This flag may be passed more than once>
累積多次使用- 指定每次測試的執行次數。如果其中任何一項嘗試因任何原因失敗,整個測試就會視為失敗。通常指定的值只會是整數。範例:--runs_per_test=3 會執行所有測試 3 次。替代語法:regex_filter@runs_per_test。其中 runs_per_test 代表整數值,regex_filter 代表包含和排除規則運算式模式的清單 (另請參閱 --instrumentation_filter)。範例:--runs_per_test=//foo/.*,-//foo/bar/.*@3 會執行 //foo/ 中的所有測試,但 foo/bar 下的測試除外,且執行次數為 3 次。這個選項可以多次傳遞。系統會優先採用最近傳遞且相符的引數。如果沒有相符的項目,測試只會執行一次。
--test_env=<a 'name=value' assignment with an optional value part>
累積多次使用-
指定要注入測試執行器環境的其他環境變數。變數可依名稱指定 (系統會從 Bazel 用戶端環境讀取變數值),或依名稱/值組合指定。這個選項可多次使用,指定多個變數。僅供「bazel test」指令使用。
標記:test_runner
--test_timeout=<a single integer or comma-separated list of 4 integers>
預設值:「-1」- 覆寫測試逾時的預設測試逾時值 (以秒為單位)。如果指定單一正整數值,系統會覆寫所有類別。如果指定 4 個以半形逗號分隔的整數,系統會依序覆寫短、中、長和永久的逾時時間。不論採用哪種形式,值為 -1 都會告知 Blaze 對該類別使用預設逾時。
--[no]zip_undeclared_test_outputs
預設值:「false」-
如果設為 true,系統會將未宣告的測試輸出內容封存至 zip 檔案。
標記:test_runner
- 可觸發建構時間最佳化的選項:
--[no]experimental_filter_library_jar_with_program_jar
預設值:「false」-
篩選 ProGuard ProgramJar,移除 LibraryJar 中也存在的任何類別。
標記:action_command_lines
、experimental
--[no]experimental_inmemory_dotd_files
預設值:「true」-
啟用後,系統會直接從遠端建構節點在記憶體中傳遞 C++ .d 檔案,而不是寫入磁碟。
標記:loading_and_analysis
、execution
、affects_outputs
、experimental
--[no]experimental_inmemory_jdeps_files
預設值:「true」-
啟用後,從 Java 編譯作業產生的依附元件 (.jdeps) 檔案會直接從遠端建構節點在記憶體中傳遞,而不是寫入磁碟。
標記:loading_and_analysis
、execution
、affects_outputs
、experimental
--[no]experimental_retain_test_configuration_across_testonly
預設值:「false」-
啟用後,--trim_test_configuration 不會修剪標示為 testonly=1 的規則測試設定。如果非測試規則依附於 cc_test 規則,這項做法可減少動作衝突問題。如果 --trim_test_configuration 為 False,則不會有任何作用。
標籤:loading_and_analysis
、loses_incremental_state
、experimental
--[no]experimental_starlark_cc_import
預設值:「false」-
如果啟用,即可使用 cc_import 的 Starlark 版本。
標記:loading_and_analysis
、experimental
--[no]experimental_unsupported_and_brittle_include_scanning
預設值:「false」-
是否要剖析輸入檔案中的 #include 行,藉此縮小 C/C++ 編譯的輸入範圍。這項做法可縮減編譯輸入樹狀結構的大小,進而提升成效和增量。不過,由於 include 掃描器並未完整實作 C 前置處理器語意,因此也可能導致建構作業中斷。特別是,它無法解讀動態 #include 指令,且會忽略前置處理器條件邏輯。您必須自行承擔使用風險。系統會關閉與此標記相關的所有問題。
標記:loading_and_analysis
、execution
、changes_inputs
、experimental
--[no]incremental_dexing
預設值:「true」-
針對每個 Jar 檔案分別執行大部分的 dexing 工作。
標籤:affects_outputs
、loading_and_analysis
、loses_incremental_state
--[no]objc_use_dotd_pruning
預設值:「true」-
如果設定這項引數,clang 發出的 .d 檔案會用於修剪傳遞至 objc 編譯的輸入集。
標記:changes_inputs
、loading_and_analysis
--[no]process_headers_in_dependencies
預設值:「false」-
建構目標 //a:a 時,處理 //a:a 所依附的所有目標中的標頭 (如果工具鍊已啟用標頭處理)。
標記:execution
--[no]trim_test_configuration
預設值:「true」-
啟用後,系統會清除建構作業頂層以下的測試相關選項。啟用這個標記後,測試無法建構為非測試規則的依附元件,但變更測試相關選項不會導致系統重新分析非測試規則。
標記:loading_and_analysis
、loses_incremental_state
- 影響記錄詳細程度、格式或位置的選項:
--toolchain_resolution_debug=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths>
預設值:「-.*」-
在工具鍊解析期間列印偵錯資訊。這個旗標會採用正規運算式,並根據工具鍊類型和特定目標進行檢查,判斷要偵錯的項目。多個規則運算式可以逗號分隔,然後系統會分別檢查每個規則運算式。注意:這個標記的輸出內容非常複雜,可能只對工具鍊解析專家有用。
標記:terminal_output
- 指定或變更 Bazel 指令一般輸入內容的選項,不屬於其他類別:
--flag_alias=<a 'name=value' flag alias>
累積多次使用-
為 Starlark 旗標設定簡短名稱。這個函式會以「<key>=<value>」形式的單一鍵/值組合做為引數。
標記:changes_inputs
--[no]incompatible_default_to_explicit_init_py
預設值:「false」-
這個標記會變更預設行為,因此系統不會再自動在 Python 目標的執行檔中建立 __init__.py 檔案。具體來說,如果 py_binary 或 py_test 目標的 legacy_create_init 設為「auto」(預設值),則只有在設定這個旗標時,系統才會將其視為 false。詳情請參閱 https://github.com/bazelbuild/bazel/issues/10076。
標記:affects_outputs
、incompatible_change
--[no]incompatible_py2_outputs_are_suffixed
預設值:「true」-
如果為 true,以 Python 2 設定建構的目標會顯示在包含「-py2」後置字串的輸出根目錄下,而為 Python 3 建構的目標則會顯示在沒有 Python 相關後置字串的根目錄中。也就是說,`bazel-bin` 便利符號連結會指向 Python 3 目標,而非 Python 2。啟用這個選項時,建議一併啟用 `--incompatible_py3_is_default`。
標記:affects_outputs
、incompatible_change
--[no]incompatible_py3_is_default
預設值:「true」-
如果為 true,未設定 `python_version` (或 `default_python_version`) 屬性的 `py_binary` 和 `py_test` 目標,預設會使用 PY3,而非 PY2。如果設定這個旗標,建議一併設定 `--incompatible_py2_outputs_are_suffixed`。
標記:loading_and_analysis
、affects_outputs
、incompatible_change
--[no]incompatible_use_python_toolchains
預設值:「true」-
如果設為 true,可執行的原生 Python 規則會使用 Python 工具鍊指定的 Python 執行階段,而不是舊版旗標 (例如 --python_top) 提供的執行階段。
標記:loading_and_analysis
、incompatible_change
--python_version=<PY2 or PY3>
預設值:請參閱說明-
Python 主要版本模式,可以是 `PY2` 或 `PY3`。請注意,這會遭到 `py_binary` 和 `py_test` 目標覆寫 (即使這些目標未明確指定版本),因此通常沒有太多理由提供這個旗標。
標記:loading_and_analysis
、affects_outputs
- 其他選項,未歸類於其他類別:
--[no]cache_test_results
[-t
] 預設值:「auto」- 如果設為「auto」,只有在下列情況下,Bazel 才會重新執行測試:(1) Bazel 偵測到測試或其依附元件有變更;(2) 測試標示為外部;(3) 使用 --runs_per_test 要求多次執行測試;或(4) 測試先前失敗。如果設為「yes」,Bazel 會快取所有測試結果,但標示為外部的測試除外。如果設為「no」,Bazel 不會快取任何測試結果。
--[no]experimental_cancel_concurrent_tests
預設值:「false」-
如果為 true,Blaze 會在第一次成功執行時,取消同時執行的測試。只有在搭配 --runs_per_test_detects_flakes 時才會有作用。
標籤:affects_outputs
、loading_and_analysis
、experimental
--[no]experimental_fetch_all_coverage_outputs
預設值:「false」-
如果為 true,Bazel 會在執行涵蓋範圍時,擷取每項測試的整個涵蓋範圍資料目錄。
標籤:affects_outputs
、loading_and_analysis
、experimental
--[no]experimental_generate_llvm_lcov
預設值:「false」-
如果為 true,clang 的涵蓋範圍會產生 LCOV 報表。
標籤:affects_outputs
、loading_and_analysis
、experimental
--[no]experimental_j2objc_header_map
預設值:「true」-
是否要與 J2ObjC 轉譯作業平行產生 J2ObjC 標頭對應檔。
標記:experimental
--[no]experimental_j2objc_shorter_header_path
預設值:「false」-
是否要使用較短的標頭路徑生成 (使用「_ios」而非「_j2objc」)。
標記:affects_outputs
、experimental
--experimental_java_classpath=<off, javabuilder or bazel>
預設值:「javabuilder」- 啟用 Java 編譯的縮減類別路徑。
--[no]experimental_limit_android_lint_to_android_constrained_java
預設值:「false」-
無作業,僅保留向後相容性
標記:affects_outputs
、experimental
--[no]experimental_run_android_lint_on_java_rules
預設值:「false」-
是否要驗證 java_* 來源。
標記:affects_outputs
、experimental
--[no]explicit_java_test_deps
預設值:「false」- 在 java_test 中明確指定 JUnit 或 Hamcrest 的依附元件,而不是從 TestRunner 的 deps 意外取得。目前僅適用於 Bazel。
--host_java_launcher=<a build target label>
預設值:請參閱說明- 建構期間執行的工具所用的 Java 啟動器。
--host_javacopt=<a string>
累積多次使用- 建構在建構期間執行的工具時,要傳遞至 javac 的其他選項。
--host_jvmopt=<a string>
累積多次使用- 建構在建構期間執行的工具時,要傳遞至 Java VM 的其他選項。這些選項會新增至每個 java_binary 目標的 VM 啟動選項。
--[no]incompatible_check_sharding_support
預設值:「true」-
如果設為 true,且測試執行器未透過觸控 TEST_SHARD_STATUS_FILE 路徑中的檔案,指出支援分片,Bazel 就會讓分片測試失敗。如果為 false,不支援分片的測試執行器會導致所有測試在每個分片中執行。
標記:incompatible_change
--[no]incompatible_exclusive_test_sandboxed
預設值:「true」-
如果是 true,系統會使用沙箱策略執行專屬測試。新增「local」標記,強制在本機執行專屬測試
Tags:incompatible_change
--[no]incompatible_strict_action_env
預設值:「false」-
如果設為 true,Bazel 會使用 PATH 的靜態值環境,且不會繼承 LD_LIBRARY_PATH。如要從用戶端繼承特定環境變數,請使用 --action_env=ENV_VARIABLE,但請注意,如果使用共用快取,這麼做可能會導致無法跨使用者快取。
標記:loading_and_analysis
、incompatible_change
--j2objc_translation_flags=<comma-separated list of options>
累積多次使用- 傳遞至 J2ObjC 工具的其他選項。
--java_debug
-
導致 Java 測試的 Java 虛擬機器等待來自符合 JDWP 規範的偵錯工具 (例如 jdb) 的連線,然後才開始測試。這表示 -test_output=streamed。
展開後會顯示:
--test_arg=--wrapper_script_flag=--debug
--test_output=streamed
--test_strategy=exclusive
--test_timeout=9999
--nocache_test_results
--[no]java_deps
預設值:「true」- 為每個 Java 目標產生依附元件資訊 (目前為編譯時間類別路徑)。
--[no]java_header_compilation
預設值:「true」- 直接從來源編譯 ijars。
--java_language_version=<a string>
預設值:「」- Java 語言版本
--java_launcher=<a build target label>
預設值:請參閱說明- 建構 Java 二進位檔時要使用的 Java 啟動器。如果將這個標記設為空字串,系統會使用 JDK 啟動器。「啟動器」屬性會覆寫這個旗標。
--java_runtime_version=<a string>
預設值:「local_jdk」- Java 執行階段版本
--javacopt=<a string>
累積多次使用- 要傳遞至 javac 的其他選項。
--jvmopt=<a string>
累積多次使用- 要傳遞至 Java VM 的其他選項。這些選項會新增至每個 java_binary 目標的 VM 啟動選項。
--legacy_main_dex_list_generator=<a build target label>
預設值:請參閱說明- 指定要使用的二進位檔,以便在編譯舊版 multidex 時,產生必須位於主要 dex 中的類別清單。
--optimizing_dexer=<a build target label>
預設值:請參閱說明- 指定用於執行 Dexing 的二進位檔,不需分片。
--plugin=<a build target label>
累積多次使用- 建構作業中要使用的外掛程式。目前適用於 java_plugin。
--proguard_top=<a build target label>
預設值:請參閱說明- 指定建構 Java 二進位檔時,要使用哪個版本的 ProGuard 移除程式碼。
--proto_compiler=<a build target label>
預設值:「@bazel_tools//tools/proto:protoc」-
proto 編譯器的標籤。
標記:affects_outputs
、loading_and_analysis
--[no]proto_profile
預設值:「true」-
是否要將 profile_path 傳遞至 proto 編譯器。
標記:affects_outputs
、loading_and_analysis
--proto_profile_path=<a build target label>
預設值:請參閱說明-
要傳遞至 proto 編譯器的設定檔,做為 profile_path。如果未設定,但 --proto_profile 為 true (預設值),則會從 --fdo_optimize 推斷路徑。
標記:affects_outputs
、loading_and_analysis
--proto_toolchain_for_cc=<a build target label>
default: "@bazel_tools//tools/proto:cc_toolchain"-
proto_lang_toolchain() 的標籤,說明如何編譯 C++ proto
標記:affects_outputs
、loading_and_analysis
--proto_toolchain_for_j2objc=<a build target label>
預設值:「@bazel_tools//tools/j2objc:j2objc_proto_toolchain」-
proto_lang_toolchain() 的標籤,說明如何編譯 j2objc proto
標記:affects_outputs
、loading_and_analysis
--proto_toolchain_for_java=<a build target label>
預設值:「@bazel_tools//tools/proto:java_toolchain」-
proto_lang_toolchain() 的標籤,說明如何編譯 Java Proto
標記:affects_outputs
、loading_and_analysis
--proto_toolchain_for_javalite=<a build target label>
預設值:「@bazel_tools//tools/proto:javalite_toolchain」-
proto_lang_toolchain() 的標籤,說明如何編譯 JavaLite proto
標記:affects_outputs
、loading_and_analysis
--protocopt=<a string>
累積多次使用-
要傳遞至 protobuf 編譯器的其他選項。
標記:affects_outputs
--[no]runs_per_test_detects_flakes
預設值:「false」- 如果為 true,只要分片中至少有一次執行/嘗試通過,且至少有一次執行/嘗試失敗,就會獲得 FLAKY 狀態。
--shell_executable=<a path>
預設值:請參閱說明-
Bazel 要使用的 Shell 可執行檔絕對路徑。如果未設定這個變數,但 BAZEL_SH 環境變數是在第一次叫用 Bazel 時設定 (這會啟動 Bazel 伺服器),Bazel 會使用該變數。如果兩者皆未設定,Bazel 會根據執行的作業系統使用硬式編碼的預設路徑 (Windows:c:/msys64/usr/bin/bash.exe、FreeBSD:/usr/local/bin/bash,其他:/bin/bash)。請注意,使用與 Bash 不相容的殼層可能會導致建構失敗,或導致產生的二進位檔發生執行階段錯誤。
標記:loading_and_analysis
--test_arg=<a string>
累積多次使用- 指定應傳遞至測試執行檔的其他選項和引數。可多次使用,指定多個引數。如果執行多項測試,每項測試都會收到相同的引數。僅供「bazel test」指令使用。
--test_filter=<a string>
預設值:請參閱說明- 指定要轉送至測試架構的篩選器。用於限制執行的測試。請注意,這不會影響建構的目標。
--test_result_expiration=<an integer>
預設值:「-1」- 這個選項已淘汰,因此不會產生任何作用。
--[no]test_runner_fail_fast
預設值:「false」- 將快速失敗選項轉送至測試執行器。測試執行器應在第一次失敗時停止執行。
--test_sharding_strategy=<explicit, disabled or forced=k where k is the number of shards to enforce>
預設值:「explicit」- 指定測試分片策略:「explicit」表示只有在存在「shard_count」BUILD 屬性時,才使用分片。「disabled」則表示永不使用測試分片。「forced=k」可強制測試使用「k」個分片,無論「shard_count」BUILD 屬性為何。
--tool_java_language_version=<a string>
預設值:「」- 用於執行建構期間所需工具的 Java 語言版本
--tool_java_runtime_version=<a string>
default: "remotejdk_11"- 建構期間執行工具時使用的 Java 執行階段版本
--[no]use_ijars
預設值:「true」- 啟用後,這項選項會讓 Java 編譯使用介面 JAR。這樣一來,增量編譯速度會更快,但錯誤訊息可能有所不同。
建構選項
- 控制建構執行的選項:
--[no]check_up_to_date
預設值:「false」-
請勿執行建構作業,只要檢查是否為最新版本即可。 如果所有目標都是最新版本,建構作業就會順利完成。如果需要執行任何步驟,系統會回報錯誤,且建構作業會失敗。
標記:execution
--dynamic_local_execution_delay=<an integer>
預設值:「1000」-
如果建構作業至少有一次遠端執行速度較快,本機執行作業應延遲多少毫秒?
標記:execution
、host_machine_resource_optimizations
--dynamic_local_strategy=<a '[name=]value1[,..,valueN]' assignment>
累積多次使用-
要用於指定助記符的本機策略 (依序排列) - 系統會使用第一個適用的策略。舉例來說,`worker,sandboxed` 會使用 worker 策略執行支援持續性工作站的動作,並使用沙箱策略執行所有其他動作。如未提供助記符,系統會將策略清單做為所有助記符的備用選項。預設備援清單為 `worker,sandboxed`,如果設定`experimental_local_lockfree_output`,則為 `worker,sandboxed,standalone`。Takes [mnemonic=]local_strategy[,local_strategy,...]
標記:execution
、host_machine_resource_optimizations
--dynamic_remote_strategy=<a '[name=]value1[,..,valueN]' assignment>
累積多次使用-
要用於指定助記符的遠端策略 (依序排列) - 系統會使用第一個適用的策略。如未提供助記符,系統會將策略清單做為所有助記符的備用選項。預設的回溯清單為 `remote`,因此通常不需要明確設定這個標記。Takes [mnemonic=]remote_strategy[,remote_strategy,...]
標記:execution
、host_machine_resource_optimizations
--experimental_docker_image=<a string>
預設值:「」-
使用 Docker 策略時,如果動作本身在平台說明中的 remote_execution_properties 內沒有 container-image 屬性,請指定應使用的 Docker 映像檔名稱 (例如「ubuntu:latest」),以便執行沙箱動作。這個旗標的值會逐字傳遞至「docker run」,因此支援與 Docker 相同的語法和機制。
標記:execution
--[no]experimental_docker_use_customized_images
預設值:「true」-
如果啟用,系統會在 Docker 映像檔中插入目前使用者的 UID 和 GID,然後再使用該映像檔。如果建構 / 測試作業需要使用者在容器內擁有名稱和主目錄,則必須執行這項操作。這項功能預設為開啟,但如果自動圖片自訂功能無法正常運作,或您知道不需要這項功能,可以將其停用。
標記:execution
--[no]experimental_dynamic_exclude_tools
預設值:「true」-
設定後,「為工具建構」的目標就不會受到動態執行影響。這類目標極不可能逐步建構,因此不值得花費本機週期。
標記:execution
、host_machine_resource_optimizations
--experimental_dynamic_local_load_factor=<a double>
預設值:「0」-
控制要將多少動態執行作業的負載放在本機上。這個標記會調整動態執行中要同時排程的動作數量。這項設定是根據 Blaze 認為可用的 CPU 數量而定,可透過 --local_cpu_resources 標記控制。
如果這個標記為 0,所有動作都會立即在本機排定。如果大於 0,則本機排定的動作數量會受限於可用的 CPU 數量。如果 < 1,當等待排定的動作數量偏高時,系統會使用負載係數減少本機排定的動作數量。這樣可減輕本機電腦的負擔,因為在乾淨建構的情況下,本機電腦的貢獻不大。
標記:execution
、host_machine_resource_optimizations
--experimental_dynamic_slow_remote_time=<An immutable length of time.>
預設值:「0」-
如果大於 0,動態執行的動作必須先遠端執行,我們才會優先在本機執行,以免遠端逾時。這可能會隱藏遠端執行系統上的部分問題。請勿在未監控遠端執行問題的情況下開啟這項功能。
標記:execution
、host_machine_resource_optimizations
--[no]experimental_enable_docker_sandbox
預設值:「false」-
啟用以 Docker 為基礎的沙箱。如果未安裝 Docker,這個選項不會有任何作用。
標記:execution
--[no]experimental_inmemory_sandbox_stashes
預設值:「false」-
如果設為 true,系統會在記憶體中追蹤要用於 reuse_sandbox_directories 的暫存沙箱內容。這樣可減少重複使用期間所需的 I/O 量。視建構版本而定,這個標記可能會縮短實際時間。視建構版本而定,這個標記可能會耗用大量額外記憶體。
標記:host_machine_resource_optimizations
、execution
--experimental_sandbox_async_tree_delete_idle_threads=<an integer, or a keyword ("auto", "HOST_CPUS", "HOST_RAM"), optionally followed by an operation ([-|*]<float>) eg. "auto", "HOST_CPUS*.5">
預設值:「4」-
如果為 0,系統會在動作完成後立即刪除沙箱樹狀結構 (導致動作完成時間延遲)。如果大於零,則在建構作業執行時,於大小為 1 的非同步執行緒集區中刪除這類三元組,並在伺服器閒置時,將大小擴充至這個旗標指定的大小。
標記:host_machine_resource_optimizations
、execution
--experimental_sandbox_enforce_resources_regexp=<a valid Java regular expression>
預設值:「」-
如果為 true,系統會將資源要求強制設為限制,並覆寫 --experimental_sandbox_limits 的值 (如果資源類型支援的話),但前提是動作的助記符符合輸入的 regex。舉例來說,如果測試宣告 cpu:3 和 resources:memory:10,則最多會使用 3 個 CPU 和 10 MB 的記憶體。
標記:execution
--experimental_sandbox_limits=<a named double, 'name=value', where value is an integer, or a keyword ("auto", "HOST_CPUS", "HOST_RAM"), optionally followed by an operation ([-|*]<float>) eg. "auto", "HOST_CPUS*.5">
累積多次使用-
如果 > 0,每個 Linux 沙箱的指定資源用量上限為指定數量。需要 --incompatible_use_new_cgroup_implementation,並會覆寫 --experimental_sandbox_memory_limit_mb。需要 cgroups v1 或 v2,以及使用者對 cgroups 目錄的權限。
標記:execution
--experimental_sandbox_memory_limit_mb=<an integer number of MBs, or "HOST_RAM", optionally followed by [-|*]<float>.>
預設值:「0」-
如果 > 0,每個 Linux 沙箱的記憶體用量上限為指定數量 (以 MB 為單位)。需要 cgroups v1 或 v2,以及使用者對 cgroups 目錄的權限。
標記:execution
--[no]experimental_shrink_worker_pool
預設值:「false」-
啟用後,如果工作站記憶體壓力過高,可能會縮減工作站集區。只有在啟用 experimental_total_worker_memory_limit_mb 旗標時,這個旗標才會生效。
標記:execution
、host_machine_resource_optimizations
--[no]experimental_split_xml_generation
預設值:「true」-
如果設定這個標記,且測試動作未產生 test.xml 檔案,Bazel 會使用個別動作產生含有測試記錄的虛擬 test.xml 檔案。否則,Bazel 會在測試動作中產生 test.xml。
標記:execution
--experimental_total_worker_memory_limit_mb=<an integer number of MBs, or "HOST_RAM", optionally followed by [-|*]<float>.>
預設值:「0」-
如果這個限制大於零,當所有工作站的總記憶體用量超過限制時,系統可能會終止閒置工作站。
標記:execution
、host_machine_resource_optimizations
--[no]experimental_use_hermetic_linux_sandbox
預設值:「false」-
如果設為 true,請勿掛接根目錄,只掛接 sandbox_add_mount_pair 提供的內容。輸入檔案會硬連結至沙箱,而非從沙箱符號連結。如果動作輸入檔案位於與沙箱不同的檔案系統,系統會改為複製輸入檔案。
標記:execution
--[no]experimental_use_semaphore_for_jobs
預設值:「true」-
如果設為 true,請額外使用信號燈限制並行工作數量。
標記:host_machine_resource_optimizations
、execution
--[no]experimental_use_windows_sandbox
預設值:「false」-
使用 Windows 沙箱執行動作。如果為「yes」,--experimental_windows_sandbox_path 提供的二進位檔必須有效,且對應支援的 sandboxfs 版本。如果為「auto」,則表示二進位檔可能遺失或不相容。
標記:execution
--experimental_windows_sandbox_path=<a string>
default: "BazelSandbox.exe"-
當 --experimental_use_windows_sandbox 為 true 時,要使用的 Windows 沙箱二進位檔路徑。如果是裸名,請使用 PATH 中找到的該名稱的第一個二進位檔。
標記:execution
--experimental_worker_allowlist=<comma-separated set of options>
預設值:請參閱說明-
如果不是空白,則只允許使用具有指定工作站金鑰助記符的持續性工作站。
標記:execution
、host_machine_resource_optimizations
--[no]experimental_worker_cancellation
預設值:「false」-
啟用後,Bazel 可能會將取消要求傳送給支援要求的 Worker。
標記:execution
--experimental_worker_memory_limit_mb=<an integer number of MBs, or "HOST_RAM", optionally followed by [-|*]<float>.>
預設值:「0」-
如果這個限制大於零,工作站的記憶體用量超過限制時,工作站可能會遭到終止。如果沒有搭配動態執行和 `--experimental_dynamic_ignore_local_signals=9` 使用,可能會導致建構作業當機。
標記:execution
、host_machine_resource_optimizations
--experimental_worker_metrics_poll_interval=<An immutable length of time.>
預設值:「5 秒」-
收集工作站指標和嘗試驅逐作業之間的時間間隔。基於效能考量,無法有效縮短至 1 秒以下。
標記:execution
、host_machine_resource_optimizations
--[no]experimental_worker_multiplex_sandboxing
預設值:「false」-
啟用後,具有「supports-multiplex-sandboxing」執行需求的複用工作人員會在沙箱環境中執行,每個工作要求使用不同的沙箱目錄。無論這個標記為何,在動態執行策略下執行時,具有執行需求的 Multiplex 工作人員一律會受到沙箱保護。
標記:execution
--[no]experimental_worker_sandbox_hardening
預設值:「false」-
如果啟用這項功能,且實作方式允許,系統會在強化型沙箱中執行工作站。如果啟用強化功能,不同工作站的 tmp 目錄會有所不同。
標記:execution
--experimental_worker_sandbox_inmemory_tracking=<a string>
累積多次使用-
工作站金鑰助記符,沙箱目錄的內容會追蹤到記憶體中。這可能會提高建構效能,但會增加記憶體用量。只會影響沙箱化工作人員。可針對不同助記符多次指定。
標記:execution
--[no]experimental_worker_strict_flagfiles
預設值:「false」-
啟用後,如果工作站的動作引數不符合工作站規格,就會發生錯誤。工作站引數清單的最後一個引數必須是 @flagfile 引數。
標記:execution
--genrule_strategy=<comma-separated list of options>
預設值:「」-
指定如何執行 genrule。這項標記即將停用,請改用 --spawn_strategy=<value> 控制所有動作,或使用 --strategy=Genrule=<value> 僅控制 genrule。
標記:execution
--[no]incompatible_sandbox_hermetic_tmp
預設值:「true」-
如果設為 true,每個 Linux 沙箱都會有專屬的空白目錄,並掛接為 /tmp,而不是與主機檔案系統共用 /tmp。使用 --sandbox_add_mount_pair=/tmp,在所有沙箱中繼續查看主機的 /tmp。
標記:execution
--[no]incompatible_use_new_cgroup_implementation
預設值:「false」-
如果為 true,請使用 cgroup 的新實作方式。舊版實作方式僅支援記憶體控制器,並會忽略 --experimental_sandbox_limits 的值。
標記:execution
--[no]internal_spawn_scheduler
預設值:「true」-
占位元選項,方便我們在 Blaze 中判斷是否已啟用產生排程器。
標記:execution
、host_machine_resource_optimizations
--jobs=<an integer, or a keyword ("auto", "HOST_CPUS", "HOST_RAM"), optionally followed by an operation ([-|*]<float>) eg. "auto", "HOST_CPUS*.5">
[-j
] 預設值:「auto」-
要執行的並行工作數量。可接受整數或關鍵字 (「auto」、「HOST_CPUS」、「HOST_RAM」),後面可選擇性加上運算 ([-|*]<float>),例如 「auto」、「HOST_CPUS*.5」。值必須介於 1 至 5000 之間。如果值超過 2500,可能會導致記憶體問題。「auto」會根據主機資源計算合理的預設值。
標記:host_machine_resource_optimizations
、execution
--[no]keep_going
[-k
] 預設值:「false」-
盡可能在發生錯誤後繼續作業。雖然系統無法分析失敗的目標和依附於該目標的目標,但可以分析這些目標的其他必要條件。
標記: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">
預設值:「auto」-
用於載入/分析階段的平行執行緒數量。可使用整數或關鍵字 (「auto」、「HOST_CPUS」、「HOST_RAM」),後面可選擇性加上運算符號 ([-|*]<float>),例如 「auto」、「HOST_CPUS*.5」。「auto」會根據主機資源設定合理的預設值。不得小於 1。
標記:bazel_internal_configuration
--[no]reuse_sandbox_directories
預設值:「true」-
如果設為 true,沙箱非工作站執行作業使用的目錄可能會重複使用,避免不必要的設定費用。
標記:host_machine_resource_optimizations
、execution
--sandbox_base=<a string>
預設值:「」-
讓沙箱在這個路徑下方建立沙箱目錄。如果建構 /測試作業有許多輸入檔案,請在 tmpfs 上指定路徑 (例如/run / shm),這可能會大幅提升效能。注意:您需要足夠的 RAM 和 tmpfs 可用空間,才能存放執行動作產生的輸出和中繼檔案。
標記:host_machine_resource_optimizations
、execution
--[no]sandbox_explicit_pseudoterminal
預設值:「false」-
明確啟用沙箱動作的偽終端機建立作業。部分 Linux 發行版本需要在沙箱內將程序的群組 ID 設為「tty」,才能讓虛擬終端機正常運作。如果這導致問題,可以停用這個標記,以便使用其他群組。
標記:execution
--sandbox_tmpfs_path=<an absolute path>
累積多次使用-
如果是沙箱化動作,請在這個絕對路徑掛接空白的可寫入目錄 (如果沙箱化實作支援,否則會忽略)。
標記:host_machine_resource_optimizations
、execution
--[no]skip_incompatible_explicit_targets
預設值:「false」-
略過指令列上明確列出的不相容目標。根據預設,建構這類目標會導致錯誤,但啟用這個選項後,系統會自動略過這些目標。請參閱:https://bazel.build/extending/platforms#skipping-incompatible-targets
標記:loading_and_analysis
--spawn_strategy=<comma-separated list of options>
預設值:「」-
指定預設執行衍生動作的方式。接受以半形逗號分隔的策略清單,並依優先順序由高至低排序。針對每個動作,Bazel 會選擇優先順序最高的策略來執行動作。預設值為「remote,worker,sandboxed,local」。詳情請參閱 https://blog.bazel.build/2019/06/19/list-strategy.html。
標記:execution
--strategy=<a '[name=]value1[,..,valueN]' assignment>
累積多次使用-
指定如何發布其他產生動作的編譯。接受以半形逗號分隔的策略清單,並依優先順序由高至低排序。針對每個動作,Bazel 會選擇優先順序最高的策略來執行動作。預設值為「remote,worker,sandboxed,local」。這個標記會覆寫 --spawn_strategy 設定的值 (如果與助記符 Genrule 搭配使用,則會覆寫 --genrule_strategy 設定的值)。詳情請參閱 https://blog.bazel.build/2019/06/19/list-strategy.html。
標記:execution
--strategy_regexp=<a '<RegexFilter>=value[,value]' assignment>
累積多次使用-
覆寫應使用哪種衍生策略,來執行說明符合特定 regex_filter 的衍生動作。如要進一步瞭解 regex_filter 比對,請參閱 --per_file_copt。系統會使用與說明相符的最後一個 regex_filter。這個選項會覆寫其他指定策略的旗標。範例:--strategy_regexp=//foo.*\.cc,-//foo/bar=local 表示如果動作說明符合 //foo.*.cc 但不符合 //foo/bar,則使用本機策略執行動作。範例:--strategy_regexp='Compiling.*/bar=local --strategy_regexp=Compiling=sandboxed 會以「local」策略執行「Compiling //foo/bar/baz」,但如果反轉順序,則會以「sandboxed」執行。
標記:execution
--worker_extra_flag=<a 'name=value' assignment>
累積多次使用-
除了 --persistent_worker 之外,還會傳遞至工作站程序的額外指令標記,以助記符做為鍵 (例如 --worker_extra_flag=Javac=--debug)。
標記:execution
、host_machine_resource_optimizations
--worker_max_instances=<[name=]value, where value is an integer, or a keyword ("auto", "HOST_CPUS", "HOST_RAM"), optionally followed by an operation ([-|*]<float>) eg. "auto", "HOST_CPUS*.5">
累積多次使用-
如果使用「工作站」策略,每種永久工作站可啟動多少個執行個體。可指定為 [name=value],為每個助記符提供不同的值。這項限制是以工作站金鑰為準,而工作站金鑰是根據助記符、啟動旗標和環境來區分,因此在某些情況下,每個助記符的工作站數量可能會超過這個旗標指定的數量。可接受整數或關鍵字 (「auto」、「HOST_CPUS」、「HOST_RAM」),後面可選擇性加上運算 ([-|*]<float>),例如 「auto」、「HOST_CPUS*.5」。「auto」會根據機器容量計算合理的預設值。「=value」會為未指定的助記符設定預設值。
標記:execution
、host_machine_resource_optimizations
--worker_max_multiplex_instances=<[name=]value, where value is an integer, or a keyword ("auto", "HOST_CPUS", "HOST_RAM"), optionally followed by an operation ([-|*]<float>) eg. "auto", "HOST_CPUS*.5">
累積多次使用-
如果您使用「worker」策略搭配 --worker_multiplex,多工工作站程序最多可並行接收多少個 WorkRequest。可指定為 [name=value],為每個助記符提供不同的值。這項限制是以工作站金鑰為準,而工作站金鑰是根據助記符、啟動旗標和環境來區分,因此在某些情況下,每個助記符的工作站數量可能會超過這個旗標指定的數量。可接受整數或關鍵字 (「auto」、「HOST_CPUS」、「HOST_RAM」),後面可選擇性加上運算 ([-|*]<float>),例如 「auto」、「HOST_CPUS*.5」。「auto」會根據機器容量計算合理的預設值。「=value」會為未指定的助記符設定預設值。
標記:execution
、host_machine_resource_optimizations
--[no]worker_multiplex
預設值:「true」-
如果啟用,工作站會使用多路複用 (如果支援)。
標記:execution
、host_machine_resource_optimizations
--[no]worker_quit_after_build
預設值:「false」-
如果啟用,所有工作站會在建構完成後退出。
標記:execution
、host_machine_resource_optimizations
--[no]worker_sandboxing
預設值:「false」-
啟用後,單工工作站會在沙箱環境中執行。無論這個標記為何,以動態執行策略執行的 Singleplex 工作站一律會經過沙箱處理。
標記:execution
--[no]worker_verbose
預設值:「false」- 啟用後,系統會在啟動、關閉工作人員時列印詳細訊息。
- 控制指令輸出的選項:
--[no]build
預設值:「true」-
執行建構作業,這是正常行為。指定 --nobuild 會導致建構作業在執行建構動作前停止,且只有在套件載入和分析階段順利完成時,才會傳回零;這個模式適用於測試這些階段。
標記:execution
、affects_outputs
--[no]experimental_use_validation_aspect
預設值:「false」-
是否要使用構面執行驗證動作 (用於測試的平行處理)。
標記:execution
、affects_outputs
--output_groups=<comma-separated list of options>
累積多次使用-
以半形逗號分隔的輸出群組名稱清單,每個名稱可選擇加上 + 或 - 前置字元。加上 + 前置字元的群組會新增至預設輸出群組集,加上 - 前置字元的群組則會從預設群組集移除。如果至少有一個群組沒有前置字元,系統就會省略預設的輸出群組集。舉例來說,--output_groups=+foo,+bar 會建構預設集、foo 和 bar 的聯集,而 --output_groups=foo,bar 則會覆寫預設集,只建構 foo 和 bar。
標記:execution
、affects_outputs
--[no]run_validations
預設值:「true」-
是否要在建構作業中執行驗證動作。請參閱 https://bazel.build/extending/rules#validation_actions
標記:execution
、affects_outputs
--serialized_frontier_profile=<a string>
預設值:「」-
傾印序列化前沿位元組的設定檔。指定輸出路徑。
標記:bazel_monitoring
- 可讓使用者設定預期輸出內容的選項,會影響輸出內容的值,而非存在與否:
--aspects=<comma-separated list of options>
累積多次使用- 以半形逗號分隔的層面清單,將套用至頂層目標。在清單中,如果 aspect some_aspect 透過 required_aspect_providers 指定必要 aspect 供應商,則在 aspects 清單中,如果 some_aspect 之前提及的每個 aspect 的廣告供應商都符合 some_aspect 的必要 aspect 供應商,some_aspect 就會執行。此外,some_aspect 會在 requires 屬性指定的所有必要構面之後執行。接著,some_aspect 就能存取這些構面供應商的值。<bzl-file-label>%<aspect_name>,例如「//tools:my_def.bzl%my_aspect」,其中「my_aspect」是來自檔案 tools/my_def.bzl 的頂層值
--bep_maximum_open_remote_upload_files=<an integer>
預設值:「-1」-
上傳 BEP 構件時允許開啟的檔案數量上限。
標記:affects_outputs
--[no]experimental_convenience_symlinks
預設值:「normal」-
這項標記可控管便利符號連結 (建構後顯示在工作區中的符號連結) 的管理方式。可能的值:
normal (預設):系統會根據建構作業,建立或刪除各類便利符號連結。
clean:系統會無條件刪除所有符號連結。
ignore:不會建立或清除符號連結。
log_only:產生記錄訊息,就像傳遞「normal」一樣,但實際上不會執行任何檔案系統作業 (適用於工具)。請注意,只有名稱是由 --symlink_prefix 目前值產生的符號連結會受到影響;如果前置字串變更,任何先前存在的符號連結都會維持不變。
標記:affects_outputs
--[no]experimental_convenience_symlinks_bep_event
預設值:「true」-
這項標記可控管是否要將建構事件 ConvenienceSymlinksIdentified 發布至 BuildEventProtocol。如果值為 true,BuildEventProtocol 會包含便利符號連結的項目,列出工作區中建立的所有便利符號連結。如果為 false,BuildEventProtocol 中的 convenienceSymlinksIdentified 項目會是空白。
標記:affects_outputs
--remote_download_all
-
將所有遠端輸出內容下載到本機。這個旗標是 --remote_download_outputs=all 的別名。
展開後:
--remote_download_outputs=all
標記:affects_outputs
--remote_download_minimal
-
不會將任何遠端建構輸出內容下載到本機。這個旗標是 --remote_download_outputs=minimal 的別名。
展開後:
--remote_download_outputs=minimal
標記:affects_outputs
--remote_download_outputs=<all, minimal or toplevel>
預設值:「toplevel」-
如果設為「minimal」,除了本機動作所需的項目外,不會將任何遠端建構輸出內容下載至本機電腦。如果設為「toplevel」,行為會與「minimal」類似,但也會將頂層目標的輸出內容下載到本機。如果網路頻寬是瓶頸,這兩個選項都能大幅縮短建構時間。
標記:affects_outputs
--remote_download_symlink_template=<a string>
預設值:「」-
建立符號連結,而非將遠端建構輸出內容下載至本機電腦。符號連結的目標可以範本字串的形式指定。這個範本字串可能包含 {hash} 和 {size_bytes},分別會擴充為物件的雜湊和大小 (以位元組為單位)。舉例來說,這些符號連結可能會指向 FUSE 檔案系統,該系統會視需要從 CAS 載入物件。
標記:affects_outputs
--remote_download_toplevel
-
只會將頂層目標的遠端輸出內容下載到本機。這個旗標是 --remote_download_outputs=toplevel 的別名。
展開後:
--remote_download_outputs=toplevel
標記:affects_outputs
--symlink_prefix=<a string>
預設值:請參閱說明-
建構後建立的任何便利符號連結,都會加上這個前置字串。如未填寫此欄位,預設值為建構工具的名稱,後面加上連字號。如果傳遞「/」,系統就不會建立任何符號連結,也不會發出任何警告。警告:'/' 的特殊功能即將淘汰,請改用 --experimental_convenience_symlinks=ignore。
標記:affects_outputs
- 影響 Bazel 嚴格程度的選項,可強制執行有效的建構輸入內容 (規則定義、旗標組合等):
--[no]experimental_docker_privileged
預設值:「false」-
啟用後,Bazel 會在執行動作時,將 --privileged 標記傳遞至「docker run」。建構作業可能需要這項功能,但這也可能導致密封性降低。
標記:execution
--[no]experimental_sandboxfs_map_symlink_targets
預設值:「false」-
無作業
標記:host_machine_resource_optimizations
、execution
--[no]incompatible_legacy_local_fallback
預設值:「false」-
如設為 true,系統會啟用從沙箱到本機策略的舊版隱含回溯機制。這項標記最終會預設為 false,然後成為無運算元。請改用 --strategy、--spawn_strategy 或 --dynamic_local_strategy 設定備援。
標記:execution
、incompatible_change
--sandbox_add_mount_pair=<a single path or a 'source:target' pair>
累積多次使用-
在沙箱中新增要掛接的其他路徑配對。
標記:execution
--sandbox_block_path=<a string>
累積多次使用-
如果是沙箱化動作,請禁止存取這個路徑。
標記:execution
--[no]sandbox_default_allow_network
預設值:「true」-
預設允許動作存取網路;這可能不適用於所有沙箱實作。
標記:execution
--[no]sandbox_fake_hostname
預設值:「false」-
將目前的 hostname 變更為沙箱動作的「localhost」。
標記:execution
--[no]sandbox_fake_username
預設值:「false」-
將目前的使用者名稱變更為沙箱動作的「nobody」。
標記:execution
--sandbox_writable_path=<a string>
累積多次使用-
如果是沙箱化動作,請在沙箱中建立可寫入的現有目錄 (如果沙箱化實作支援,否則會遭到忽略)。
標記:execution
- 這個選項會影響 Starlark 語言的語意,或可供 BUILD 檔案、.bzl 檔案或 WORKSPACE 檔案存取的建構 API:
--[no]incompatible_config_setting_private_default_visibility
預設值:「false」-
如果 incompatible_enforce_config_setting_visibility=false,這就是 noop。否則,如果這個旗標為 false,任何沒有明確顯示屬性的 config_setting 都是 //visibility:public。如果這個標記為 true,config_setting 會遵循與所有其他規則相同的瀏覽權限邏輯。詳情請參閱 https://github.com/bazelbuild/bazel/issues/12933。
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_enforce_config_setting_visibility
預設值:「true」-
如果為 true,則強制執行 config_setting 可見度限制。如果為 false,每個目標都會看到所有 config_setting。詳情請參閱 https://github.com/bazelbuild/bazel/issues/12932。
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_use_plus_in_repo_names
預設值:「true」-
無作業。
標記:loading_and_analysis
- 控管測試環境或測試執行器行為的選項:
--[no]check_tests_up_to_date
預設值:「false」-
不要執行測試,只要檢查是否為最新版本即可。 如果所有測試結果都是最新狀態,表示測試已順利完成。如果需要建構或執行任何測試,系統會回報錯誤,且測試會失敗。這個選項會隱含 --check_up_to_date 行為。
標記:execution
--flaky_test_attempts=<a positive integer, the string "default", or test_regex@attempts. This flag may be passed more than once>
累積多次使用-
如果測試失敗,系統會重試測試,次數最多為指定次數。如果測試需要多次嘗試才能通過,測試摘要會將其標示為「FLAKY」。通常指定的值只是整數或字串「default」。如果是整數,則所有測試最多會執行 N 次。如果是「default」,系統只會嘗試執行一次一般測試,如果是規則明確標示為不穩定的測試 (flaky=1 屬性),則會嘗試執行三次。替代語法:regex_filter@flaky_test_attempts。其中 flaky_test_attempts 如上所述,regex_filter 則代表包含和排除規則運算式模式的清單 (另請參閱 --runs_per_test)。範例:--flaky_test_attempts=//foo/.*,-//foo/bar/.*@3 會對 //foo/ 中的所有測試 (foo/bar 下的測試除外) 執行 3 次去不穩定測試。這個選項可以多次傳遞。系統會優先採用最近傳遞且相符的引數。如果沒有任何相符的項目,行為就如同上述的「default」。
標記:execution
--local_test_jobs=<an integer, or a keyword ("auto", "HOST_CPUS", "HOST_RAM"), optionally followed by an operation ([-|*]<float>) eg. "auto", "HOST_CPUS*.5">
預設值:「auto」-
可同時執行的本機測試工作數量上限。可接受整數或關鍵字 (「auto」、「HOST_CPUS」、「HOST_RAM」),後面可選擇性加上運算 ([-|*]<float>),例如 「auto」、「HOST_CPUS*.5」。如果設為 0,本機資源就會限制可並行執行的本機測試工作數量。如果這個值大於 --jobs 的值,則無效。
標記:execution
--[no]test_keep_going
預設值:「true」-
如果停用這項設定,任何未通過的測試都會導致整個建構作業停止。預設會執行所有測試,即使部分測試未通過也一樣。
標記:execution
--test_strategy=<a string>
預設值:「」-
指定執行測試時要使用的策略。
標記:execution
--test_tmpdir=<a path>
預設值:請參閱說明- 指定「bazel test」要使用的基本暫時目錄。
- 可觸發建構時間最佳化的選項:
--cache_computed_file_digests=<a long integer>
預設值:「50000」- 如果大於 0,Bazel 會根據檔案的中繼資料將檔案摘要儲存在記憶體中,而不是在每次需要時重新計算磁碟中的摘要。將此值設為 0 可確保正確性,因為並非所有檔案變更都能從檔案中繼資料中得知。如果不是 0,這個數字表示快取大小,也就是要快取的檔案摘要數量。
--[no]experimental_cpu_load_scheduling
預設值:「false」-
根據 CPU 負載啟用實驗性本機執行排程,而非逐一估算動作。實驗性排程顯示,在具有大量核心的強大機器上進行大型本機建構時,可大幅提升效能。建議搭配 --local_resources=cpu=HOST_CPUS 使用
標記:execution
--experimental_dynamic_ignore_local_signals=<a comma-separated list of signal numbers>
預設值:請參閱說明-
接受作業系統信號編號清單。如果動態執行的本機分支版本因上述任一信號而終止,系統會允許遠端分支版本完成作業。如果是持續性工作者,這只會影響終止工作者程序的信號。
標記:execution
--[no]experimental_enable_skyfocus
預設值:「false」-
如果設為 true,系統會啟用 --experimental_working_set,以減少 Bazel 的記憶體用量,用於增量建構。這項功能稱為「天空對焦」。
標記:host_machine_resource_optimizations
--experimental_working_set=<comma-separated list of options>
預設值:「」-
Skyfocus 的工作組。請以半形逗號分隔工作區根目錄相關路徑。這是有狀態的旗標,定義工作集後,系統會保留該工作集,供後續呼叫使用,直到您使用新工作集重新定義為止。
標記:host_machine_resource_optimizations
--local_cpu_resources=<an integer, or "HOST_CPUS", optionally followed by [-|*]<float>.>
預設值:「HOST_CPUS」-
明確設定 Bazel 可用於本機執行的建構動作的本機 CPU 核心總數。可接受整數或「HOST_CPUS」,後方可選擇性加上 [-|*]<float> (例如 HOST_CPUS*.5,使用一半的可用 CPU 核心)。根據預設,("HOST_CPUS") Bazel 會查詢系統設定,估算可用的 CPU 核心數。
標記:host_machine_resource_optimizations
--local_extra_resources=<a named float, 'name=value'>
累積多次使用-
設定 Bazel 可用的額外資源數量。擷取字串和浮點數的配對。可多次使用,指定多種額外資源。Bazel 會根據可用的額外資源和所需的額外資源,限制並行執行的動作。測試可以透過「resources:<resoucename>:<amount>」格式的標記,宣告所需的額外資源量。您無法使用這個標記設定可用的 CPU、RAM 和資源。
標記:host_machine_resource_optimizations
--local_ram_resources=<an integer number of MBs, or "HOST_RAM", optionally followed by [-|*]<float>.>
預設值:「HOST_RAM*.67」-
明確設定 Bazel 可用於本機執行的建構動作的本機主機 RAM 總量 (以 MB 為單位)。可接受整數或「HOST_RAM」,後方可選擇性加上 [-|*]<float> (例如 HOST_RAM*.5,使用一半的可用 RAM)。根據預設,("HOST_RAM*.67") Bazel 會查詢系統設定,估算可用 RAM 容量,並使用其中的 67%。
標記:host_machine_resource_optimizations
--local_resources=<a named double, 'name=value', where value is an integer, or a keyword ("auto", "HOST_CPUS", "HOST_RAM"), optionally followed by an operation ([-|*]<float>) eg. "auto", "HOST_CPUS*.5">
累積多次使用-
設定 Bazel 可用的資源數量。接受指派給浮點數或 HOST_RAM/HOST_CPUS 的值,後面可選擇性加上 [-|*]<float> (例如 memory=HOST_RAM*.5,表示使用一半的可用 RAM)。可多次使用,指定多種資源類型。Bazel 會根據可用資源和所需資源,限制並行執行的動作。測試可使用「resources:<resource name>:<amount>」格式的標記,宣告所需的資源量。覆寫 --local_{cpu|ram|extra}_resources 指定的資源。
標記:host_machine_resource_optimizations
- 影響記錄詳細程度、格式或位置的選項:
--build_event_upload_max_retries=<an integer>
預設值:「4」-
Bazel 應重試上傳建構事件的次數上限。
標記:bazel_internal_configuration
--[no]debug_spawn_scheduler
預設值:「false」--[no]experimental_bep_target_summary
預設值:「false」- 是否要發布 TargetSummary 事件。
--[no]experimental_build_event_expand_filesets
預設值:「false」-
如果是 true,則在顯示輸出檔案時,展開 BEP 中的檔案集。
標記:affects_outputs
--[no]experimental_build_event_fully_resolve_fileset_symlinks
預設值:「false」-
如果為 true,在顯示輸出檔案時,BEP 會完整解析 Fileset 中的相對符號連結。需要 --experimental_build_event_expand_filesets。
標記:affects_outputs
--experimental_build_event_output_group_mode=<an output group name followed by an OutputGroupFileMode, e.g. default=both>
累積多次使用-
指定輸出群組的檔案在 TargetComplete/AspectComplete BEP 事件中的表示方式。值是將輸出群組名稱指派給「NAMED_SET_OF_FILES_ONLY」、「INLINE_ONLY」或「BOTH」其中之一。預設值為「NAMED_SET_OF_FILES_ONLY」。如果輸出群組重複,系統會使用最後顯示的值。預設值會將涵蓋範圍構件的模式設為 BOTH:--experimental_build_event_output_group_mode=baseline.lcov=both
標記:affects_outputs
--experimental_build_event_upload_retry_minimum_delay=<An immutable length of time.>
預設值:「1s」-
BEP 上傳失敗時,指數輪詢重試的初始最短延遲時間。(指數:1.6)
標記:bazel_internal_configuration
--experimental_build_event_upload_strategy=<a string>
預設值:請參閱說明-
選取上傳建構事件通訊協定中參照構件的方式。
標記:affects_outputs
--[no]experimental_docker_verbose
預設值:「false」-
啟用後,Bazel 會列印有關 Docker 沙箱策略的詳細訊息。
標記:execution
--[no]experimental_materialize_param_files_directly
預設值:「false」-
如果具體化參數檔案,請直接寫入磁碟。
標記:execution
--experimental_repository_resolved_file=<a string>
預設值:「」-
如果不是空白,請寫入 Starlark 值,其中包含所有已執行的 Starlark 存放區規則的已解析資訊。
標記:affects_outputs
--[no]experimental_run_bep_event_include_residue
預設值:「false」-
是否要在可能含有殘餘項目的執行建構事件中,加入指令列殘餘項目。根據預設,殘餘物不會納入可能含有殘餘物的執行指令建構事件。
標記:affects_outputs
--experimental_skyfocus_dump_keys=<none, count or verbose>
預設值:「none」-
用於偵錯 Skyfocus。傾印聚焦的 SkyKeys (根、葉、聚焦的依附元件、聚焦的 rdeps)。
標記:terminal_output
--[no]experimental_skyfocus_dump_post_gc_stats
預設值:「false」-
用於偵錯 Skyfocus。如果啟用,請在聚焦前後觸發手動 GC,以回報堆積大小縮減情形。這會增加 Skyfocus 延遲時間。
標記:terminal_output
--experimental_skyfocus_handling_strategy=<strict or warn>
預設值:「strict」-
Strategies for Skyfocus to handle changes outside of the working set.
標記:eagerness_to_exit
--[no]experimental_stream_log_file_uploads
預設值:「false」-
將串流記錄檔直接上傳至遠端儲存空間,而非寫入磁碟。
標記:affects_outputs
--explain=<a path>
預設值:請參閱說明-
讓建構系統說明建構作業執行的每個步驟。說明會寫入指定的記錄檔。
標記:affects_outputs
--[no]ignore_unsupported_sandboxing
預設值:「false」-
如果這個系統不支援沙箱執行作業,請勿列印警告。
標記:terminal_output
--[no]legacy_important_outputs
預設值:「false」-
使用這個選項可禁止在 TargetComplete 事件中產生舊版 important_outputs 欄位。Bazel 整合至 ResultStore/BTX 時需要 important_outputs。
標記:affects_outputs
--[no]materialize_param_files
預設值:「false」-
即使使用遠端動作執行作業,也會將中繼參數檔案寫入輸出樹狀結構。可用於偵錯動作。--subcommands 和 --verbose_failures 會隱含這項設定。
標記:execution
--max_config_changes_to_show=<an integer>
預設值:「3」-
如果因建構選項變更而捨棄分析快取,最多會顯示指定數量的變更選項名稱。如果指定 -1,系統會顯示所有已變更的選項。
標記:terminal_output
--max_test_output_bytes=<an integer>
預設值:「-1」-
指定在 --test_output 為「errors」或「all」時,可發出的每個測試記錄大小上限。有助於避免測試輸出內容過於雜亂,導致輸出結果難以解讀。測試標頭會計入記錄大小。負值表示沒有限制。輸出內容只能是全部或完全沒有。
標籤:test_runner
、terminal_output
、execution
--output_filter=<a valid Java regular expression>
預設值:請參閱說明-
只會顯示名稱符合所提供規則運算式的規則警告和動作輸出內容。
標記:affects_outputs
--progress_report_interval=<an integer in 0-3600 range>
預設值:「0」-
等待回報仍在執行的工作之間間隔的秒數。預設值 0 表示系統會在 10 秒後列印第一份報表,接著每 30 秒列印一份,之後每分鐘列印一份。啟用 --curses 時,系統會每秒回報進度。
標記:affects_outputs
--remote_print_execution_messages=<failure, success or all>
預設值:「failure」-
選擇列印遠端執行訊息的時間。有效值包括 `failure` (僅在失敗時列印)、`success` (僅在成功時列印) 和 `all` (一律列印)。
標記:terminal_output
--[no]sandbox_debug
預設值:「false」-
啟用沙箱功能的偵錯功能。這包括兩件事:第一,建構後沙箱根內容會保持不變;第二,在執行時列印額外的偵錯資訊。這有助於 Bazel 或 Starlark 規則的開發人員,偵錯因缺少輸入檔案等原因而導致的失敗。
標記:terminal_output
--show_result=<an integer>
預設值:「1」-
顯示建構結果。 針對每個目標,說明是否已更新至最新狀態,如果是,請提供建構的輸出檔案清單。列印的檔案是方便的字串,可複製並貼到殼層執行。
這個選項需要整數引數,也就是目標的門檻數,超過這個門檻就不會列印結果資訊。因此,零會導致訊息遭到抑制,而 MAX_INT 則會導致一律列印結果。預設值為 1。如果沒有為目標建構任何內容,系統可能會省略結果,以確保輸出內容不超過門檻。
標記:affects_outputs
--[no]subcommands
[-s
] 預設值:「false」-
顯示建構期間執行的子指令。相關旗標:--execution_log_json_file、--execution_log_binary_file (將子指令記錄到檔案中,方便工具使用)。
標記:terminal_output
--test_output=<summary, errors, all or streamed>
預設值:「summary」-
指定所需的輸出模式。有效值包括:只輸出測試狀態摘要的「summary」、同時列印失敗測試的測試記錄的「errors」、列印所有測試的記錄的「all」,以及即時輸出所有測試記錄的「streamed」(無論 --test_strategy 值為何,這都會強制測試一次執行一個)。
標籤:test_runner
、terminal_output
、execution
--test_summary=<short, terse, detailed, none or testcase>
預設值:「short」-
指定測試摘要的所需格式。有效值包括「short」(僅列印執行的測試相關資訊)、「terse」(僅列印執行的測試中失敗的測試相關資訊)、「detailed」(列印失敗測試案例的詳細資訊)、「testcase」(列印測試案例解決方案的摘要,不列印失敗測試案例的詳細資訊),以及「none」(省略摘要)。
標記:terminal_output
--[no]verbose_explanations
預設值:「false」-
如果啟用 --explain,會提高發布的說明詳細程度。如果未啟用 --explain,這個指令就不會產生任何作用。
標記:affects_outputs
--[no]verbose_failures
預設值:「false」-
如果指令失敗,請輸出完整指令列。
標記:terminal_output
- 指定或變更 Bazel 指令一般輸入內容的選項,不屬於其他類別:
--aspects_parameters=<a 'name=value' assignment>
累積多次使用-
指定指令列層面參數的值。每個參數值都是透過 <param_name>=<param_value> 指定,例如「my_param=my_val」,其中「my_param」是 --aspects 清單中某個層面的參數,或是清單中某個層面所需的參數。這個選項可以多次使用。不過,您不得為同一參數指派多個值。
標記:loading_and_analysis
--target_pattern_file=<a string>
預設值:「」-
如果已設定,建構作業會從這裡命名的檔案讀取模式,而不是從指令列讀取。如果同時指定檔案和指令列模式,就會發生錯誤。
標記:changes_inputs
- 遠端快取和執行選項:
--experimental_circuit_breaker_strategy=<failure>
預設值:請參閱說明-
指定斷路器要使用的策略。可用的策略為「failure」。如果選項值無效,系統的行為會與未設定選項時相同。
標記:execution
--[no]experimental_guard_against_concurrent_changes
預設值:「false」- 關閉這項設定,即可停用在將動作上傳至遠端快取前,檢查動作輸入檔案的 ctime。在某些情況下,Linux 核心可能會延遲寫入檔案,導致誤判。
--experimental_remote_cache_compression_threshold=<an integer>
預設值:「100」- 使用 zstd 壓縮/解壓縮所需的最小 Blob 大小。除非設定 --remote_cache_compression,否則無效。
--experimental_remote_cache_eviction_retries=<an integer>
預設值:「5」-
如果建構作業遇到暫時性遠端快取錯誤,導致建構作業失敗,系統會嘗試重試的次數上限。舉例來說,當構件從遠端快取中逐出,或在特定快取失敗情況下,就會發生這種情況。非零值會隱含地將 --incompatible_remote_use_new_exit_code_for_lost_inputs 設為 true。每次嘗試都會產生新的叫用 ID。如果您產生叫用 ID 並透過 --invocation_id 提供給 Bazel,就不應使用這個旗標。請改為設定 --incompatible_remote_use_new_exit_code_for_lost_inputs 標記,並檢查結束代碼 39。
標記:execution
--[no]experimental_remote_cache_lease_extension
預設值:「false」- 如果設為 true,Bazel 會在建構期間定期傳送 `FindMissingBlobs` 呼叫至遠端快取,延長遠端動作輸出內容的租約。頻率取決於 `--experimental_remote_cache_ttl` 的值。
--experimental_remote_cache_ttl=<An immutable length of time.>
預設值:「3h」-
在最近參考摘要後,遠端快取中 Blob 的保證最短存留時間,例如 ActionResult 或 FindMissingBlobs。Bazel 會根據 Blob 的 TTL 進行多項最佳化,例如不會在漸進式建構作業中重複呼叫 GetActionResult。由於伺服器傳回摘要和 Bazel 接收摘要之間存在時間差,因此這個值應略小於實際 TTL。
標記:execution
--experimental_remote_capture_corrupted_outputs=<a path>
預設值:請參閱說明- 要擷取損毀輸出內容的目錄路徑。
--[no]experimental_remote_discard_merkle_trees
預設值:「true」- 如果設為 true,在呼叫 GetActionResult() 和 Execute() 時,系統會捨棄輸入根目錄 Merkle 樹狀結構的記憶體內副本,以及相關聯的輸入對應。這會大幅減少記憶體用量,但如果遠端快取未命中並重試,Bazel 就必須重新計算。
--experimental_remote_downloader=<a string>
預設值:請參閱說明- Remote Asset API 端點 URI,用做遠端下載 Proxy。支援的結構定義包括 grpc、grpcs (已啟用 TLS 的 grpc) 和 unix (本機 UNIX 通訊端)。如果未提供架構,Bazel 會預設為 grpcs。請參閱:https://github.com/bazelbuild/remote-apis/blob/master/build/bazel/remote/asset/v1/remote_asset.proto
--[no]experimental_remote_downloader_local_fallback
預設值:「false」- 是否要在遠端下載器失敗時,改用本機下載器。
--[no]experimental_remote_downloader_propagate_credentials
預設值:「false」- 是否要將憑證從 netrc 和憑證輔助程式傳播至遠端下載器伺服器。伺服器實作需要支援新的 `http_header_url:<url-index>:<header-key>` 限定符,其中 `<url-index>` 是 FetchBlobRequest 的 `uris` 欄位中網址的從零開始計算位置。網址專屬標頭的優先順序應高於全域標頭。
--[no]experimental_remote_execution_keepalive
預設值:「false」- 是否要為遠端執行呼叫使用 Keepalive。
--experimental_remote_failure_rate_threshold=<an integer in 0-100 range>
預設值:「10」-
設定特定時間範圍內允許的失敗率百分比,超過這個百分比後,系統就會停止呼叫遠端快取/執行器。預設值為 10。設為 0 表示沒有限制。
標記:execution
--experimental_remote_failure_window_interval=<An immutable length of time.>
預設值:「60 秒」-
計算遠端要求失敗率的時間間隔。如果值為零或負數,系統會將整個執行時間計算為失敗時間。可使用的單位包括:天 (d)、小時 (h)、分鐘 (m)、秒 (s) 和毫秒 (ms)。如果省略單位,系統會將值解讀為秒。
標記:execution
--[no]experimental_remote_mark_tool_inputs
預設值:「false」- 如果設為 true,Bazel 會將輸入內容標示為遠端執行器的工具輸入內容。這可用於實作遠端持續性工作者。
--[no]experimental_remote_merkle_tree_cache
預設值:「false」- 如果設為 true,系統會記憶 Merkle 樹狀結構計算結果,以提升遠端快取命中檢查速度。快取的記憶體用量由 --experimental_remote_merkle_tree_cache_size 控制。
--experimental_remote_merkle_tree_cache_size=<a long integer>
預設值:「1000」- 要記憶的 Merkle 樹狀結構數量,可提升遠端快取命中檢查速度。雖然系統會根據 Java 處理軟參照的方式自動修剪快取,但如果設定過高,仍可能發生記憶體不足錯誤。如果設為 0,快取大小就不會受到限制。最佳值會因專案大小而異。預設值為 1000。
--experimental_remote_output_service=<a string>
預設值:請參閱說明- 遠端輸出服務端點的 HOST 或 HOST:PORT。支援的結構定義包括 grpc、grpcs (已啟用 TLS 的 grpc) 和 unix (本機 UNIX 通訊端)。如果未提供架構,Bazel 會預設為 grpcs。指定 grpc:// 或 unix: 結構定義,即可停用 TLS。
--experimental_remote_output_service_output_path_prefix=<a string>
預設值:「」- 由 --experimental_remote_output_service 管理的輸出目錄內容所在路徑。建構作業使用的實際輸出目錄會是這個路徑的子項,並由輸出服務決定。
--[no]experimental_remote_require_cached
預設值:「false」- 如果設為 true,則強制將所有可遠端執行的動作快取,否則建構作業會失敗。這有助於排解非決定性問題,因為這樣就能檢查應快取的動作是否實際快取,而不會將新結果錯誤地插入快取中。
--experimental_remote_scrubbing_config=<Converts to a Scrubber>
預設值:請參閱說明- 使用提供的設定檔啟用遠端快取金鑰清除功能,該設定檔必須是文字格式的通訊協定緩衝區 (請參閱 src/main/protobuf/remote_scrubbing.proto)。 這項功能旨在協助在不同平台上執行的動作之間共用遠端/磁碟快取,但目標平台相同。請務必謹慎使用,因為設定不當可能會導致快取項目意外共用,進而造成建構錯誤。 清除作業不會影響動作的執行方式,只會影響其遠端/磁碟快取鍵的計算方式,以便擷取或儲存動作結果。經過清除的動作與遠端執行作業不相容,因此一律會在本地執行。 修改清除設定不會使本機檔案系統或內部快取中的輸出內容失效;您必須進行乾淨的建構作業,才能重新執行受影響的動作。 如要順利使用這項功能,您可能需要一併設定自訂的 --host_platform、--experimental_platform_in_output_dir (用於正規化輸出前置字元) 和 --incompatible_strict_action_env (用於正規化環境變數)。
--[no]incompatible_remote_use_new_exit_code_for_lost_inputs
預設值:「true」-
如果設為 true,當遠端快取發生錯誤 (包括快取清除) 導致建構作業失敗時,Bazel 會使用新的結束代碼 39,而非 34。
標記:incompatible_change
--[no]remote_accept_cached
預設值:「true」- 是否接受遠端快取的動作結果。
--remote_build_event_upload=<all or minimal>
預設值:「minimal」- 如果設為「all」,BEP 參照的所有本機輸出內容都會上傳至遠端快取。 如果設為「minimal」,BEP 參照的本機輸出內容不會上傳至遠端快取,BEP 消費者重要的檔案 (例如測試記錄和時間設定檔) 除外。即使檔案遺失遠端快取,檔案的 URI 一律會使用 bytestream:// 配置。 預設值為「minimal」。
--remote_bytestream_uri_prefix=<a string>
預設值:請參閱說明- 要用於寫入建構事件串流的 bytestream:// URI 中的主機名稱和執行個體名稱。使用 Proxy 執行建構作業時,可以設定這個選項,這會導致 --remote_executor 和 --remote_instance_name 的值不再對應至遠端執行服務的標準名稱。如未設定,預設值為「${hostname}/${instance_name}」。
--remote_cache=<a string>
預設值:請參閱說明- 快取端點的 URI。支援的結構定義包括 http、https、grpc、grpcs (已啟用 TLS 的 grpc) 和 unix (本機 UNIX 通訊端)。如果未提供架構,Bazel 會預設為 grpcs。指定 grpc://、http:// 或 unix: 架構即可停用 TLS。請參閱 https://bazel.build/remote/caching
--[no]remote_cache_async
預設值:「true」- 如果設為 true,系統會在背景將動作結果上傳至磁碟或遠端快取,不會阻礙動作完成。部分動作與背景上傳作業不相容,即使設定這個標記,仍可能遭到封鎖。
--[no]remote_cache_compression
預設值:「false」- 啟用後,當快取 Blob 的大小至少為 --experimental_remote_cache_compression_threshold 時,會使用 zstd 壓縮/解壓縮快取 Blob。
--remote_cache_header=<a 'name=value' assignment>
累積多次使用- 指定要納入快取要求的標頭:--remote_cache_header=Name=Value。您可以多次指定標記來傳遞多個標頭。相同名稱的多個值會轉換為以半形逗號分隔的清單。
--remote_default_exec_properties=<a 'name=value' assignment>
累積多次使用-
如果執行平台尚未設定 exec_properties,請將預設的 exec 屬性設為遠端執行平台。
標記:affects_outputs
--remote_default_platform_properties=<a string>
預設值:「」- 如果執行平台尚未設定 remote_execution_properties,請設定要為遠端執行 API 設定的預設平台屬性。如果選取主機平台做為遠端執行的執行平台,也會使用這個值。
--remote_download_regex=<a valid Java regular expression>
累積多次使用-
強制下載路徑符合此模式的遠端建構輸出內容,無論 --remote_download_outputs 為何。重複使用這個旗標即可指定多個模式。
標記:affects_outputs
--remote_downloader_header=<a 'name=value' assignment>
累積多次使用- 指定要納入遠端下載器要求的標頭:--remote_downloader_header=Name=Value。您可以多次指定標記來傳遞多個標頭。相同名稱的多個值會轉換為以半形逗號分隔的清單。
--remote_exec_header=<a 'name=value' assignment>
累積多次使用- 指定要納入執行要求的標頭:--remote_exec_header=Name=Value。您可以多次指定標記來傳遞多個標頭。相同名稱的多個值會轉換為以半形逗號分隔的清單。
--remote_execution_priority=<an integer>
預設值:「0」- 要遠端執行的動作的相對優先順序。特定優先級值的語意取決於伺服器。
--remote_executor=<a string>
預設值:請參閱說明- 遠端執行端點的 HOST 或 HOST:PORT。支援的結構定義包括 grpc、grpcs (已啟用 TLS 的 grpc) 和 unix (本機 UNIX 通訊端)。如果未提供架構,Bazel 會預設為 grpcs。指定 grpc:// 或 unix: 結構定義,即可停用 TLS。
--remote_grpc_log=<a path>
預設值:請參閱說明- 如果指定,則為記錄 gRPC 呼叫相關詳細資料的檔案路徑。這份記錄包含一連串序列化的 com.google.devtools.build.lib.remote.logging.RemoteExecutionLog.LogEntry protobuf,每個訊息都以 varint 為前置字元,表示後續序列化 protobuf 訊息的大小,如方法 LogEntry.writeDelimitedTo(OutputStream) 所執行。
--remote_header=<a 'name=value' assignment>
累積多次使用- 指定要納入要求中的標頭:--remote_header=Name=Value。您可以多次指定標記來傳遞多個標頭。相同名稱的多個值會轉換為以半形逗號分隔的清單。
--remote_instance_name=<a string>
預設值:「」- 要在遠端執行 API 中做為 instance_name 傳遞的值。
--[no]remote_local_fallback
預設值:「false」- 是否要在遠端執行失敗時,改用獨立的本機執行策略。
--remote_local_fallback_strategy=<a string>
預設值:「local」- 已淘汰。詳情請參閱 https://github.com/bazelbuild/bazel/issues/7480。
--remote_max_connections=<an integer>
預設值:「100」-
限制遠端快取/執行器的並行連線數上限。系統預設的分數值為 100。設為 0 表示沒有限制。
如果是 HTTP 遠端快取,一個 TCP 連線一次只能處理一個要求,因此 Bazel 最多可以發出 --remote_max_connections 個並行要求。
對於 gRPC 遠端快取/執行器,一個 gRPC 管道通常可以處理 100 多個並行要求,因此 Bazel 可以發出約 `--remote_max_connections * 100` 個並行要求。
標記:host_machine_resource_optimizations
--remote_proxy=<a string>
預設值:請參閱說明- 透過 Proxy 連線至遠端快取。目前這個旗標只能用來設定 Unix 網域通訊端 (unix:/path/to/socket)。
--remote_result_cache_priority=<an integer>
預設值:「0」- 要儲存在遠端快取中的遠端動作相對優先順序。特定優先級值的語意取決於伺服器。
--remote_retries=<an integer>
預設值:「5」- 暫時性錯誤的重試次數上限。如果設為 0,系統會停用重試功能。
--remote_retry_max_delay=<An immutable length of time.>
預設值:「5 秒」- 遠端重試嘗試之間的最大輪詢延遲時間。可用的單位包括:天 (d)、小時 (h)、分鐘 (m)、秒 (s) 和毫秒 (ms)。如果省略單位,系統會將值解讀為秒。
--remote_timeout=<An immutable length of time.>
預設值:「60 秒」- 等待遠端執行和快取呼叫的時間上限。如果是 REST 快取,這會是連線和讀取逾時。可用的單位包括:天 (d)、小時 (h)、分鐘 (m)、秒 (s) 和毫秒 (ms)。如果省略單位,系統會將值解讀為秒。
--[no]remote_upload_local_results
預設值:「true」- 是否要將在本機執行的動作結果上傳至遠端快取 (如果遠端快取支援這項功能,且使用者已獲得授權)。
--[no]remote_verify_downloads
預設值:「true」- 如果設為 true,Bazel 會計算所有遠端下載內容的雜湊總和,並捨棄與預期值不符的遠端快取值。
- 其他選項,未歸類於其他類別:
--[no]allow_analysis_cache_discard
預設值:「true」-
如果因建構系統變更而捨棄分析快取,將這個選項設為 false 會導致 bazel 結束,而不是繼續建構。如果同時設定了「discard_analysis_cache」,這個選項不會起任何作用。
標記:eagerness_to_exit
--auto_output_filter=<none, all, packages or subpackages>
預設值:「none」- 如未指定 --output_filter,系統會使用這個選項的值自動建立篩選條件。允許的值包括「none」(不篩選任何項目 / 顯示所有項目)、「all」(篩選所有項目 / 不顯示任何項目)、「packages」(包含 Blaze 指令列上提及的套件中規則的輸出內容),以及「subpackages」(與「packages」類似,但也會包含子套件)。對於「packages」和「subpackages」值,//java/foo 和 //javatests/foo 會視為一個套件。
--[no]build_manual_tests
預設值:「false」- 強制建構標記為「manual」的測試目標。系統不會處理「手動」測試。這個選項會強制建構這些項目 (但不會執行)。
--build_tag_filters=<comma-separated list of options>
預設值:「」- 指定以逗號分隔的標記清單。每個標記可選擇加上前置的「-」,指定要排除的標記。系統只會建構包含至少一個已納入標記,且不含任何已排除標記的目標。這個選項不會影響使用「test」指令執行的測試集;這些測試集會受到測試篩選選項 (例如「--test_tag_filters」) 的控管。
--[no]build_tests_only
預設值:「false」- 如果指定,系統只會建構 *_test 和 test_suite 規則,並忽略指令列上指定的其他目標。根據預設,系統會建構所有要求項目。
--combined_report=<none or lcov>
預設值:「none」- 指定所需的累計涵蓋範圍報表類型。目前僅支援 LCOV。
--[no]compile_one_dependency
預設值:「false」- 編譯引數檔案的單一依附元件。這項功能有助於在 IDE 中檢查來源檔案的語法,例如重建依附於來源檔案的單一目標,盡可能在編輯/建構/測試週期中及早偵測到錯誤。這個引數會影響所有非旗標引數的解讀方式,這些引數會成為來源檔案名稱,而非要建構的目標。系統會為每個來源檔案名建構任意目標,視來源檔案名而定。
--deleted_packages=<comma-separated list of package names>
累積多次使用- 以半形逗號分隔的套件名稱清單。即使這些套件顯示在套件路徑的某處,建構系統也會視為不存在。 刪除現有套件「x」的子套件「x/y」時,請使用這個選項。舉例來說,如果您在用戶端中刪除 x/y/BUILD,但另一個 package_path 項目仍提供「//x:y/z」標籤,建構系統可能會發出警告。指定 --deleted_packages x/y 即可避免這個問題。
--[no]discard_analysis_cache
預設值:「false」- 分析階段完成後,立即捨棄分析快取。可減少約 10% 的記憶體用量,但會進一步減緩漸進式建構作業的速度。
--disk_cache=<a path>
預設值:請參閱說明- Bazel 可讀取及寫入動作和動作輸出的目錄路徑。如果目錄不存在,系統會自動建立。
--embed_label=<a one-line string>
預設值:「」- 在二進位檔中嵌入來源控管修訂版本或發布標籤
--execution_log_binary_file=<a path>
預設值:請參閱說明- 根據 src/main/protobuf/spawn.proto,將執行的衍生項目記錄到這個檔案中,做為長度分隔的 SpawnExec proto。建議使用 --execution_log_compact_file,因為這個檔案小得多,產生費用也較低。相關標記:--execution_log_compact_file (精簡格式;互斥)、--execution_log_json_file (文字 JSON 格式;互斥)、--execution_log_sort (是否排序執行記錄)、--subcommands (在終端機輸出內容中顯示子指令)。
--execution_log_compact_file=<a path>
預設值:請參閱說明- 根據 src/main/protobuf/spawn.proto,將執行的衍生項目記錄到這個檔案中,做為長度分隔的 ExecLogEntry proto。整個檔案都經過 zstd 壓縮。相關標記:--execution_log_binary_file (二進位 protobuf 格式;互斥)、--execution_log_json_file (文字 JSON 格式;互斥)、--subcommands (用於在終端機輸出內容中顯示子指令)。
--execution_log_json_file=<a path>
預設值:請參閱說明- 根據 src/main/protobuf/spawn.proto,將執行的衍生項目記錄到這個檔案中,做為以換行符號分隔的 SpawnExec 原型 JSON 表示法。建議使用 --execution_log_compact_file,因為這個檔案小得多,產生費用也較低。相關標記:--execution_log_compact_file (精簡格式;互斥)、--execution_log_binary_file (二進位 protobuf 格式;互斥)、--execution_log_sort (是否排序執行記錄)、--subcommands (在終端機輸出中顯示子指令)。
--[no]execution_log_sort
預設值:「true」- 是否要排序執行記錄,方便比較不同呼叫的記錄。設為 false 可避免在叫用結束時可能出現的 CPU 和記憶體用量偏高問題,但會以非決定性執行順序產生記錄。僅適用於二進位和 JSON 格式;緊湊格式一律不會排序。
--[no]expand_test_suites
預設值:「true」-
分析前,請先將 test_suite 目標展開為其組成測試。開啟這項旗標 (預設) 後,負向目標模式會套用至測試套件的測試,否則不會套用。如果頂層層面是在指令列套用,關閉這個標記就很有用,因為這樣就能分析 test_suite 目標。
標記:loading_and_analysis
--experimental_disk_cache_gc_idle_delay=<An immutable length of time.>
預設值:「5m」- 伺服器必須閒置多久,才會對磁碟快取進行垃圾收集。如要指定垃圾收集政策,請設定 --experimental_disk_cache_gc_max_size 和/或 --experimental_disk_cache_gc_max_age。
--experimental_disk_cache_gc_max_age=<An immutable length of time.>
預設值:「0」- 如果設為正值,系統會定期進行垃圾收集,移除超過這個時間的磁碟快取項目。如果與 --experimental_disk_cache_gc_max_size 一併設定,則會套用這兩項條件。伺服器閒置時,系統會在背景執行垃圾收集作業,閒置時間由 --experimental_disk_cache_gc_idle_delay 旗標決定。
--experimental_disk_cache_gc_max_size=<a size in bytes, optionally followed by a K, M, G or T multiplier>
預設值:「0」- 如果設為正值,系統會定期進行垃圾收集,確保磁碟快取大小不超過這個值。如果與 --experimental_disk_cache_gc_max_age 一併設定,系統會套用這兩項條件。伺服器閒置時,系統會在背景執行垃圾收集作業,閒置時間由 --experimental_disk_cache_gc_idle_delay 旗標決定。
--experimental_extra_action_filter=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths>
預設值:「」- 已淘汰,請改用切面。篩選要排定 extra_actions 的目標集。
--[no]experimental_extra_action_top_level_only
預設值:「false」- 已淘汰,請改用切面。只會為頂層目標安排 extra_actions。
--experimental_spawn_scheduler
-
平行在本機和遠端執行動作,啟用動態執行。Bazel 會在本機和遠端產生每個動作,並挑選先完成的動作。如果動作支援工作站,本機動作就會以持續性工作站模式執行。如要為個別動作助記符啟用動態執行,請改用 `--internal_spawn_scheduler` 和 `--strategy=<mnemonic>=dynamic` 標記。
展開後:
--internal_spawn_scheduler
--spawn_strategy=dynamic
--[no]fetch
預設值:「true」- 允許指令擷取外部依附元件。如果設為 false,指令會使用依附元件的任何快取版本,如果沒有,指令就會失敗。
--local_termination_grace_seconds=<an integer>
預設值:「15」- 因逾時而終止本機程序,以及強制關閉程序之間的等待時間。
--package_path=<colon-separated list of options>
預設值:「%workspace%」- 以半形冒號分隔的清單,列出要尋找套件的位置。以「%workspace%」開頭的元素與封閉工作區相關。如果省略或為空,預設值為「bazel info default-package-path」的輸出內容。
--[no]show_loading_progress
預設值:「true」- 啟用後,Bazel 會列印「正在載入套件:」訊息。
--test_lang_filters=<comma-separated list of options>
預設值:「」- 指定以半形逗號分隔的測試語言清單。每種語言都可以選擇性地加上「-」,指定要排除的語言。系統只會找出以指定語言撰寫的測試目標。每種語言使用的名稱應與 *_test 規則中的語言前置字元相同,例如「cc」、「java」、「py」等。這個選項會影響 --build_tests_only 行為和測試指令。
--test_size_filters=<comma-separated list of values: small, medium, large, or enormous>
預設值:「」- 指定測試大小的逗號分隔清單。每個大小都可以選擇性地加上「-」,指定要排除的大小。系統只會找出包含至少一個已納入大小,且不包含任何已排除大小的測試目標。這個選項會影響 --build_tests_only 行為和測試指令。
--test_tag_filters=<comma-separated list of options>
預設值:「」- 指定以半形逗號分隔的測試標記清單。每個標記可選擇加上前置的「-」,指定要排除的標記。系統只會找出包含至少一個已納入標記,且不含任何已排除標記的測試目標。這個選項會影響 --build_tests_only 行為和測試指令。
--test_timeout_filters=<comma-separated list of values: short, moderate, long, or eternal>
預設值:「」- 指定以逗號分隔的測試逾時清單。每個逾時時間可選擇性地加上「-」,指定要排除的逾時時間。系統只會找出包含至少一個納入逾時,且不包含任何排除逾時的測試目標。這個選項會影響 --build_tests_only 行為和測試指令。
--workspace_status_command=<path>
預設值:「」- 在建構開始時叫用的指令,以鍵/值組合的形式提供工作區的狀態資訊。如需完整規格,請參閱使用手冊。如需範例,請參閱 tools/buildstamp/get_workspace_status。
- 控管建構作業執行的選項:
--[no]experimental_inprocess_symlink_creation
預設值:「true」-
是否要直接呼叫檔案系統來建立符號連結樹狀結構,而不是委派給輔助程序。
標籤:loading_and_analysis
、execution
、experimental
--[no]experimental_persistent_aar_extractor
預設值:「false」-
使用 Worker 啟用持續性 AAR 擷取器。
標記:execution
、experimental
--[no]experimental_remotable_source_manifests
預設值:「false」-
是否要讓來源資訊清單動作可遠端執行
標記:loading_and_analysis
、execution
、experimental
--[no]experimental_split_coverage_postprocessing
預設值:「false」-
如果為 true,Bazel 會在新衍生程序中執行測試的涵蓋範圍後續處理作業。
標記:execution
、experimental
--[no]experimental_strict_fileset_output
預設值:「false」-
如果啟用這個選項,檔案集會將所有輸出構件視為一般檔案。不會遍歷目錄或對符號連結敏感。
標記:execution
、experimental
--[no]incompatible_modify_execution_info_additive
預設值:「false」-
啟用後,傳遞多個 --modify_execution_info 標記會產生加成效果。停用時,系統只會考量最後一個旗標。
標記:execution
、affects_outputs
、loading_and_analysis
、incompatible_change
--modify_execution_info=<regex=[+-]key,regex=[+-]key,...>
累積多次使用-
根據動作助記符,在動作的執行資訊中新增或移除鍵。僅適用於支援執行資訊的動作。許多常見動作都支援執行資訊,例如 Genrule、CppCompile、Javac、StarlarkAction、TestRunner。指定多個值時,順序很重要,因為許多正則運算式可能會套用至相同助記符。
語法:「regex=[+-]key,regex=[+-]key,...」。
範例:
「.*=+x,.*=-y,.*=+z」會將「x」和「z」新增至所有動作的執行資訊,並從中移除「y」。
「Genrule=+requires-x」會將「requires-x」新增至所有 Genrule 動作的執行資訊。
'(?!Genrule).*=-requires-x' 會從所有非 Genrule 動作的執行資訊中移除 'requires-x'。
標籤:execution
、affects_outputs
、loading_and_analysis
--persistent_android_dex_desugar
-
使用 Worker 啟用持續性 Android dex 和 desugar 動作。
展開後:
--internal_persistent_android_dex_desugar
--strategy=Desugar=worker
--strategy=DexBuilder=worker
標記:host_machine_resource_optimizations
、execution
--persistent_android_resource_processor
-
使用 Worker 啟用永久性 Android 資源處理器。
展開後:
--internal_persistent_busybox_tools
--strategy=AaptPackage=worker
--strategy=AndroidResourceParser=worker
--strategy=AndroidResourceValidator=worker
--strategy=AndroidResourceCompiler=worker
--strategy=RClassGenerator=worker
--strategy=AndroidResourceLink=worker
--strategy=AndroidAapt2=worker
--strategy=AndroidAssetMerger=worker
--strategy=AndroidResourceMerger=worker
--strategy=AndroidCompiledResourceMerger=worker
--strategy=ManifestMerger=worker
--strategy=AndroidManifestMerger=worker
--strategy=Aapt2Optimize=worker
--strategy=AARGenerator=worker
--strategy=ProcessDatabinding=worker
--strategy=GenerateDataBindingBaseClasses=worker
標記:host_machine_resource_optimizations
、execution
--persistent_multiplex_android_dex_desugar
-
使用 Worker 啟用持續性多工 Android dex 和 desugar 動作。
展開後會顯示:
--persistent_android_dex_desugar
--internal_persistent_multiplex_android_dex_desugar
標記:host_machine_resource_optimizations
、execution
--persistent_multiplex_android_resource_processor
-
使用工作人員啟用持續性多工 Android 資源處理器。
展開後:
--persistent_android_resource_processor
--modify_execution_info=AaptPackage=+supports-multiplex-workers
--modify_execution_info=AndroidResourceParser=+supports-multiplex-workers
--modify_execution_info=AndroidResourceValidator=+supports-multiplex-workers
--modify_execution_info=AndroidResourceCompiler=+supports-multiplex-workers
--modify_execution_info=RClassGenerator=+supports-multiplex-workers
--modify_execution_info=AndroidResourceLink=+supports-multiplex-workers
--modify_execution_info=AndroidAapt2=+supports-multiplex-workers
--modify_execution_info=AndroidAssetMerger=+supports-multiplex-workers
--modify_execution_info=AndroidResourceMerger=+supports-multiplex-workers
--modify_execution_info=AndroidCompiledResourceMerger=+supports-multiplex-workers
--modify_execution_info=ManifestMerger=+supports-multiplex-workers
--modify_execution_info=AndroidManifestMerger=+supports-multiplex-workers
--modify_execution_info=Aapt2Optimize=+supports-multiplex-workers
--modify_execution_info=AARGenerator=+supports-multiplex-workers
標記:host_machine_resource_optimizations
、execution
--persistent_multiplex_android_tools
-
啟用持續性及多工 Android 工具 (dexing、desugaring、資源處理)。
展開後:
--internal_persistent_multiplex_busybox_tools
--persistent_multiplex_android_resource_processor
--persistent_multiplex_android_dex_desugar
標記:host_machine_resource_optimizations
、execution
--[no]use_target_platform_for_tests
預設值:「false」-
如果為 true,Bazel 會使用目標平台執行測試,而非測試執行群組。
標記:execution
- 設定用於執行動作的工具鍊選項:
--android_compiler=<a string>
預設值:請參閱說明-
Android 目標編譯器。
標籤:affects_outputs
、loading_and_analysis
、loses_incremental_state
--android_manifest_merger=<legacy, android or force_android>
預設值:「android」-
選取要用於 android_binary 規則的資訊清單合併工具。這個標記可協助從舊版合併工具轉換至 Android 資訊清單合併工具。
標籤:affects_outputs
、loading_and_analysis
、loses_incremental_state
--android_platforms=<a build target label>
預設值:「」-
設定 android_binary 目標使用的平台。如果指定多個平台,則二進位檔為笨重的 APK,其中包含每個指定目標平台的原生二進位檔。
標籤:changes_inputs
、loading_and_analysis
、loses_incremental_state
--apple_crosstool_top=<a build target label>
default: "@bazel_tools//tools/cpp:toolchain"-
要在 Apple 和 Objc 規則及其依附元件中使用的 crosstool 套件標籤。
標記:loses_incremental_state
、changes_inputs
--cc_output_directory_tag=<a string>
預設值:「」-
指定要加到設定目錄的後置字串。
標記:affects_outputs
--compiler=<a string>
預設值:請參閱說明-
用於編譯目標的 C++ 編譯器。
標記:loading_and_analysis
、execution
--coverage_output_generator=<a build target label>
default: "@bazel_tools//tools/test:lcov_merger"-
用於後續處理原始涵蓋範圍報表的二進位檔位置。目前必須是包含單一檔案 (二進位檔) 的檔案群組。預設值為「//tools/test:lcov_merger」。
標籤:changes_inputs
、affects_outputs
、loading_and_analysis
--coverage_report_generator=<a build target label>
預設值:「@bazel_tools//tools/test:coverage_report_generator」-
用於產生涵蓋範圍報表的二進位檔位置。目前必須是包含單一檔案 (二進位檔) 的檔案群組。預設值為「//tools/test:coverage_report_generator」。
標籤:changes_inputs
、affects_outputs
、loading_and_analysis
--coverage_support=<a build target label>
預設值:「@bazel_tools//tools/test:coverage_support」-
每個收集程式碼涵蓋範圍的測試動作輸入內容中,所需支援檔案的位置。預設值為「//tools/test:coverage_support」。
標籤:changes_inputs
、affects_outputs
、loading_and_analysis
--custom_malloc=<a build target label>
預設值:請參閱說明-
指定自訂 malloc 實作項目。這項設定會覆寫建構規則中的 malloc 屬性。
標記:changes_inputs
、affects_outputs
--experimental_add_exec_constraints_to_targets=<a '<RegexFilter>=<label1>[,<label2>,...]' assignment>
累積多次使用-
以逗號分隔的規則運算式清單,每個運算式可選擇性加上前置字元「-」(負運算式),並以「=」指派給以逗號分隔的限制值目標清單。如果目標與任何負運算式都不相符,但與至少一個正運算式相符,工具鍊解析就會執行,就像目標已將限制值宣告為執行限制一樣。範例://demo,-test=@platforms//cpus:x86_64 會將「x86_64」新增至 //demo 下的所有目標,但名稱包含「test」的目標除外。
標記:loading_and_analysis
--[no]experimental_include_xcode_execution_requirements
預設值:「false」-
如果已設定,請為每個 Xcode 動作新增「requires-xcode:{version}」執行需求。如果 Xcode 版本有連字號標籤,請一併新增「requires-xcode-label:{version_label}」執行需求。
標記:loses_incremental_state
、loading_and_analysis
、execution
、experimental
--[no]experimental_prefer_mutual_xcode
預設值:「true」-
如果為 true,請使用本機和遠端可用的最新 Xcode。如果為 false,或沒有可用的共同版本,請使用透過 xcode-select 選取的本機 Xcode 版本。
標記:loses_incremental_state
、experimental
--extra_execution_platforms=<comma-separated list of options>
預設值:「」-
可做為執行平台來執行動作的平台。平台可以指定為確切目標,或指定為目標模式。系統會優先考慮這些平台,再考慮 register_execution_platforms() 在 WORKSPACE 檔案中宣告的平台。這個選項只能設定一次,後續的例項會覆寫先前的標記設定。
標記:execution
--extra_toolchains=<comma-separated list of options>
累積多次使用-
工具鍊解析期間要考慮的工具鍊規則。工具鍊可指定為確切目標,或目標模式。系統會優先考量這些工具鍊,再考量由 register_toolchains() 在 WORKSPACE 檔案中宣告的工具鍊。
標記:affects_outputs
、changes_inputs
、loading_and_analysis
--grte_top=<a label>
預設值:請參閱說明-
已簽入 libc 程式庫的標籤。預設值是由 crosstool 工具鍊選取,您幾乎不需要覆寫這個值。
標記:action_command_lines
、affects_outputs
--host_compiler=<a string>
預設值:請參閱說明-
無作業旗標。將在日後推出的版本中移除。
標記:loading_and_analysis
、execution
--host_grte_top=<a label>
預設值:請參閱說明-
如果指定,這項設定會覆寫 exec 設定的 libc 頂層目錄 (--grte_top)。
標記:action_command_lines
、affects_outputs
--host_platform=<a build target label>
default: "@bazel_tools//tools:host_platform"-
平台規則的標籤,用於說明主機系統。
標籤:affects_outputs
、changes_inputs
、loading_and_analysis
--[no]incompatible_bazel_test_exec_run_under
預設值:「false」-
如果啟用,系統會在執行設定中建構「bazel test --run_under=//:runner」的「//:runner」。如果停用,系統會在目標設定中建構「//:runner」。Bazel 會在執行機器上執行測試,因此前者較為正確。這不會影響「bazel run」,因為「bazel run」一律會在目標設定中建構「`--run_under=//foo」。
標記:affects_outputs
、incompatible_change
--[no]incompatible_dont_enable_host_nonhost_crosstool_features
預設值:「true」-
如果為 true,Bazel 將不會在 C++ 工具鍊中啟用「主機」和「非主機」功能 (詳情請參閱 https://github.com/bazelbuild/bazel/issues/7407)。
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_enable_apple_toolchain_resolution
預設值:「false」-
使用工具鍊解析度,為 Apple 規則 (Starlark 和原生) 選取 Apple SDK
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_remove_legacy_whole_archive
預設值:「true」-
如果為 true,Bazel 預設不會將程式庫依附元件連結為整個封存檔 (如需遷移操作說明,請參閱 https://github.com/bazelbuild/bazel/issues/7362)。
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_strip_executable_safely
預設值:「false」-
如為 true,可執行檔的 strip 動作會使用 -x 標記,不會中斷動態符號解析。
標記:action_command_lines
、incompatible_change
-
如果工具鍊支援,請使用介面共用物件。目前所有 ELF 工具鍊都支援這項設定。
標籤:loading_and_analysis
、affects_outputs
、affects_outputs
--ios_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
指定用於建構 iOS 應用程式的 iOS SDK 版本。如未指定,則會使用「xcode_version」中的預設 iOS SDK 版本。
標記:loses_incremental_state
--macos_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
指定用於建構 macOS 應用程式的 macOS SDK 版本。如未指定,則會使用「xcode_version」中的預設 macOS SDK 版本。
標記:loses_incremental_state
--minimum_os_version=<a string>
預設值:請參閱說明-
編譯目標的最低作業系統版本。
標記:loading_and_analysis
、affects_outputs
--platform_mappings=<a main workspace-relative path>
預設值:「」-
對應檔案的位置,用於說明在未設定平台時要使用哪個平台,或是在平台已存在時要設定哪些旗標。必須相對於主要工作區根目錄。預設值為「platform_mappings」(工作區根目錄下的檔案)。
標記:affects_outputs
、changes_inputs
、loading_and_analysis
、immutable
--platforms=<a build target label>
預設值:「」-
平台規則的標籤,說明目前指令的目標平台。
標籤:affects_outputs
、changes_inputs
、loading_and_analysis
--python_path=<a string>
預設值:請參閱說明-
在目標平台上執行 Python 目標時,所叫用的 Python 解譯器絕對路徑。已淘汰;由 --incompatible_use_python_toolchains 停用。
標記:loading_and_analysis
、affects_outputs
--python_top=<a build target label>
預設值:請參閱說明-
代表 Python 解譯器的 py_runtime 標籤,用於在目標平台上執行 Python 目標。已淘汰;由 --incompatible_use_python_toolchains 停用。
標記:loading_and_analysis
、affects_outputs
--tvos_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
指定用於建構 tvOS 應用程式的 tvOS SDK 版本。如未指定,則會使用「xcode_version」中的預設 tvOS SDK 版本。
標記:loses_incremental_state
--watchos_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
指定用於建構 watchOS 應用程式的 watchOS SDK 版本。如未指定,則會使用「xcode_version」中的預設 watchOS SDK 版本。
標記:loses_incremental_state
--xcode_version=<a string>
預設值:請參閱說明-
如果指定,則會使用指定版本的 Xcode 執行相關建構動作。如未指定,則會使用 Xcode 的執行器預設版本。
標記:loses_incremental_state
--xcode_version_config=<a build target label>
default: "@bazel_tools//tools/cpp:host_xcodes"-
用於在建構設定中選取 Xcode 版本的 xcode_config 規則標籤。
標記:loses_incremental_state
、loading_and_analysis
- 控管指令輸出的選項:
--[no]apple_generate_dsym
預設值:「false」-
是否要產生偵錯符號 (.dSYM) 檔案。
標記:affects_outputs
、action_command_lines
--[no]build_runfile_links
預設值:「true」-
如果為 true,則為所有目標建構 Runfile 符號連結樹狀結構。 如果為 false,則只有在本地動作、測試或執行指令需要時,才會寫入這些檔案。
標記:affects_outputs
--[no]build_runfile_manifests
預設值:「true」-
如果是 true,則為所有目標編寫執行檔資訊清單。如果為 false,請省略這些屬性。如果為 false,本機測試將無法執行。
標記:affects_outputs
--[no]build_test_dwp
預設值:「false」-
如果啟用這項功能,系統會以靜態方式建構 C++ 測試,並使用 fission,自動建構測試二進位檔的 .dwp 檔案。
標記:loading_and_analysis
、affects_outputs
--cc_proto_library_header_suffixes=<comma-separated set of options>
預設值:「.pb.h」-
設定 cc_proto_library 建立的標頭檔案後置字元。
標記:affects_outputs
、loading_and_analysis
--cc_proto_library_source_suffixes=<comma-separated set of options>
預設值:「.pb.cc」-
設定 cc_proto_library 建立的來源檔案後置字元。
標記:affects_outputs
、loading_and_analysis
--[no]experimental_proto_descriptor_sets_include_source_info
預設值:「false」-
在 proto_library 中,針對替代的 Java API 版本執行額外動作。
標籤:affects_outputs
、loading_and_analysis
、experimental
--[no]experimental_save_feature_state
預設值:「false」-
將已啟用和要求的特徵狀態儲存為編譯輸出內容。
標記:affects_outputs
、experimental
--fission=<a set of compilation modes>
預設值:「no」-
指定哪些編譯模式會使用分裂功能進行 C++ 編譯和連結。可以是 {'fastbuild'、'dbg'、'opt'} 的任意組合,也可以是特殊值 'yes' (啟用所有模式) 和 'no' (停用所有模式)。
標籤:loading_and_analysis
、action_command_lines
、affects_outputs
--[no]incompatible_always_include_files_in_data
預設值:「true」-
如果是 true,原生規則會將資料依附元件的 <code>DefaultInfo.files</code> 新增至執行檔,這與 Starlark 規則的建議行為相符 (https://bazel.build/extending/rules#runfiles_features_to_avoid)。
標記:affects_outputs
、incompatible_change
--[no]legacy_external_runfiles
預設值:「false」-
如果為 true,請為 .runfiles/repo 底下的外部存放區建構執行檔案符號連結樹狀結構 (除了 .runfiles/repo 以外)。
標記:affects_outputs
--[no]objc_generate_linkmap
預設值:「false」-
指定是否要產生連結對應檔案。
標記:affects_outputs
--[no]save_temps
預設值:「false」-
如果設定,系統會儲存 gcc 的暫時輸出內容。包括 .s 檔案 (組語程式碼)、.i 檔案 (前置處理的 C) 和 .ii 檔案 (前置處理的 C++)。
標記:affects_outputs
- 可讓使用者設定預期輸出內容的選項,影響輸出內容的值,而非輸出內容是否存在:
--action_env=<a 'name=value' assignment with an optional value part>
累積多次使用-
指定可供具有目標設定的動作使用的環境變數集。變數可以依名稱指定 (此時值會取自叫用環境),也可以依名稱=值組合指定 (此時值會獨立於叫用環境)。這個選項可以多次使用;如果是相同變數的選項,系統會採用最新的選項,如果是不同變數的選項,則會累加。
標記:action_command_lines
--allowed_cpu_values=<comma-separated set of options>
預設值:「」-
--cpu 標記的允許值。
標記:changes_inputs
、affects_outputs
--[no]android_databinding_use_androidx
預設值:「true」-
產生與 AndroidX 相容的資料繫結檔案。這項功能僅適用於資料繫結 v2。這個旗標是無運算。
標記:affects_outputs
、loading_and_analysis
、loses_incremental_state
、experimental
--[no]android_databinding_use_v3_4_args
預設值:「true」-
使用 3.4.0 引數搭配 Android 資料繫結 v2。這個旗標是無運算。
標記:affects_outputs
、loading_and_analysis
、loses_incremental_state
、experimental
--android_dynamic_mode=<off, default or fully>
預設值:「off」-
判斷 cc_binary 未明確建立共用程式庫時,是否要動態連結 Android 規則的 C++ 依附元件。「default」表示 Bazel 會選擇是否要動態連結。「完全」表示所有程式庫都會動態連結。「off」表示所有程式庫都會以靜態模式連結。
標記:affects_outputs
、loading_and_analysis
--android_manifest_merger_order=<alphabetical, alphabetical_by_configuration or dependency>
預設值:「alphabetical」-
設定傳遞至 Android 二進位檔資訊清單合併工具的資訊清單順序。ALPHABETICAL 表示資訊清單會依據相對於 execroot 的路徑排序。ALPHABETICAL_BY_CONFIGURATION 表示資訊清單會依路徑排序,路徑是相對於輸出目錄中的設定目錄。DEPENDENCY 表示資訊清單的排序方式為:每個程式庫的資訊清單會出現在其依附元件的資訊清單之前。
標記:action_command_lines
、execution
--[no]android_resource_shrinking
預設值:「false」-
為使用 ProGuard 的 android_binary APK 啟用資源壓縮功能。
標記:affects_outputs
、loading_and_analysis
--[no]build_python_zip
預設值:「auto」-
建構 Python 可執行檔 ZIP;在 Windows 上為開啟,在其他平台上為關閉
標記:affects_outputs
--catalyst_cpus=<comma-separated list of options>
累積多次使用-
以半形逗號分隔的架構清單,用於建構 Apple Catalyst 二進位檔。
標記:loses_incremental_state
、loading_and_analysis
--[no]collect_code_coverage
預設值:「false」-
如果指定,Bazel 會檢測程式碼 (盡可能使用離線檢測),並在測試期間收集涵蓋範圍資訊。只有符合 --instrumentation_filter 的目標會受到影響。通常不應直接指定這個選項,而是應使用「bazel coverage」指令。
標記:affects_outputs
--compilation_mode=<fastbuild, dbg or opt>
[-c
] 預設值:「fastbuild」-
指定建構二進位檔的模式。值:「fastbuild」、「dbg」、「opt」。
標記:affects_outputs
、action_command_lines
--conlyopt=<a string>
累積多次使用-
編譯 C 來源檔案時,要傳遞至 gcc 的其他選項。
標記:action_command_lines
、affects_outputs
--copt=<a string>
累積多次使用-
要傳遞至 gcc 的其他選項。
標記:action_command_lines
、affects_outputs
--cpu=<a string>
預設值:「」-
目標 CPU。
標記:changes_inputs
、affects_outputs
--cs_fdo_absolute_path=<a string>
預設值:請參閱說明-
使用 CSFDO 設定檔資訊,盡可能改良編譯作業。指定包含設定檔、原始或已編列索引 LLVM 設定檔的 zip 檔絕對路徑名稱。
標記:affects_outputs
--cs_fdo_instrument=<a string>
預設值:請參閱說明-
使用情境感應 FDO 檢測功能產生二進位檔。使用 Clang/LLVM 編譯器時,系統也會接受目錄名稱,執行階段會將原始設定檔傾印至該目錄。
標記:affects_outputs
--cs_fdo_profile=<a build target label>
預設值:請參閱說明-
代表要用於最佳化的內容相關設定檔的 cs_fdo_profile。
標記:affects_outputs
--cxxopt=<a string>
累積多次使用-
編譯 C++ 來源檔案時,要傳遞至 gcc 的其他選項。
標記:action_command_lines
、affects_outputs
--define=<a 'name=value' assignment>
累積多次使用-
每個 --define 選項都會指定建構變數的指派作業。如果變數有多個值,則最後一個值會勝出。
標記:changes_inputs
、affects_outputs
--dynamic_mode=<off, default or fully>
預設值:「default」-
決定是否要動態連結 C++ 二進位檔。 「default」表示 Bazel 會選擇是否要動態連結。「完全」表示所有程式庫都會動態連結。「off」表示所有程式庫都會以靜態模式連結。
標記:loading_and_analysis
、affects_outputs
--[no]enable_propeller_optimize_absolute_paths
預設值:「true」-
如果已設定,任何使用螺旋槳最佳化絕對路徑的行為都會引發錯誤。
標記:affects_outputs
--[no]enable_remaining_fdo_absolute_paths
預設值:「true」-
如果設定,使用 FDO 的絕對路徑時會引發錯誤。
標記:affects_outputs
--[no]enable_runfiles
預設值:「auto」-
啟用 Runfiles 符號連結樹狀結構;預設為在 Windows 上關閉,在其他平台上開啟。
標記:affects_outputs
--experimental_action_listener=<a build target label>
累積多次使用-
已淘汰,請改用切面。使用 action_listener 將 extra_action 附加至現有的建構動作。
標記:execution
、experimental
--[no]experimental_android_compress_java_resources
預設值:「false」-
壓縮 APK 中的 Java 資源
標記:affects_outputs
、loading_and_analysis
、experimental
--[no]experimental_android_databinding_v2
預設值:「true」-
使用 Android 資料繫結 v2。這個旗標是無運算。
標記:affects_outputs
、loading_and_analysis
、loses_incremental_state
、experimental
--[no]experimental_android_resource_shrinking
預設值:「false」-
為使用 ProGuard 的 android_binary APK 啟用資源壓縮功能。
標籤:affects_outputs
、loading_and_analysis
、experimental
--[no]experimental_android_rewrite_dexes_with_rex
預設值:「false」-
use rex tool to rewrite dex files
標記:affects_outputs
、loading_and_analysis
、loses_incremental_state
、experimental
--[no]experimental_collect_code_coverage_for_generated_files
預設值:「false」-
如有指定,Bazel 也會為產生的檔案產生收集涵蓋範圍資訊。
標記:affects_outputs
、experimental
--experimental_objc_fastbuild_options=<comma-separated list of options>
預設值:「-O0,-DDEBUG=1」-
將這些字串做為 objc 快速建構編譯器選項。
標記:action_command_lines
--[no]experimental_omitfp
預設值:「false」-
如果設為 true,則使用 libunwind 進行堆疊解除,並使用 -fomit-frame-pointer 和 -fasynchronous-unwind-tables 進行編譯。
標籤:action_command_lines
、affects_outputs
、experimental
--experimental_output_paths=<off, content or strip>
預設值:「off」-
輸出樹狀結構規則應使用哪個模型來寫入輸出內容,特別是針對多平台 / 多設定建構作業。這項功能仍在實驗階段,詳情請參閱 https://github.com/bazelbuild/bazel/issues/6526。如要選擇加入路徑對應,請將「supports-path-mapping」鍵新增至「execution_requirements」字典。
標記:loses_incremental_state
、bazel_internal_configuration
、affects_outputs
、execution
--experimental_override_name_platform_in_output_dir=<a 'label=value' assignment>
累積多次使用-
每個項目都應採用 label=value 格式,其中 label 是指平台,value 則是要在輸出路徑中使用的所需簡短名稱。只有在 --experimental_platform_in_output_dir 為 true 時才會使用。命名優先順序最高。
標記:affects_outputs
、experimental
--[no]experimental_platform_in_output_dir
預設值:「false」-
如果為 true,輸出目錄名稱會使用目標平台的簡短名稱,而非 CPU。確切的架構是實驗性質,可能會有所變更:首先,如果 --platforms 選項沒有剛好一個值,系統會使用平台選項的雜湊。接著,如果目前平台有任何簡稱是透過 --experimental_override_name_platform_in_output_dir 登錄,系統就會使用該簡稱。然後,如果設定了 --experimental_use_platforms_in_output_dir_legacy_heuristic,請使用以目前平台標籤為準的簡短名稱。最後,平台選項的雜湊會做為最後手段。
標記:affects_outputs
、experimental
--[no]experimental_py_binaries_include_label
預設值:「false」-
即使停用蓋章功能,py_binary 目標仍會包含標籤。
標記:affects_outputs
、experimental
--[no]experimental_use_llvm_covmap
預設值:「false」-
如果指定,啟用 collect_code_coverage 時,Bazel 會產生 llvm-cov 涵蓋範圍對應資訊,而不是 gcov。
標記:changes_inputs
、affects_outputs
、loading_and_analysis
、experimental
--[no]experimental_use_platforms_in_output_dir_legacy_heuristic
預設值:「true」-
請僅在建議的遷移或測試策略中使用這個標記。請注意,這個啟發式方法有已知缺點,建議改為只依賴 --experimental_override_name_platform_in_output_dir。
標記:affects_outputs
、experimental
--fdo_instrument=<a string>
預設值:請參閱說明-
使用 FDO 檢測生成二進位檔。使用 Clang/LLVM 編譯器時,系統也會接受目錄名稱,執行階段會將原始設定檔傾印至該目錄。
標記:affects_outputs
--fdo_optimize=<a string>
預設值:請參閱說明-
使用 FDO 設定檔資訊,最佳化編譯作業。指定包含 .gcda 檔案樹狀結構、包含自動設定檔的 afdo 檔案,或 LLVM 設定檔檔案的 ZIP 檔案名稱。這個旗標也接受指定為標籤的檔案 (例如 `//foo/bar:file.afdo` - 您可能需要在對應的套件中新增 `exports_files` 指令),以及指向 `fdo_profile` 目標的標籤。這項標記會由 `fdo_profile` 規則取代。
標記:affects_outputs
--fdo_prefetch_hints=<a build target label>
預設值:請參閱說明-
使用快取預先擷取提示。
標記:affects_outputs
--fdo_profile=<a build target label>
預設值:請參閱說明-
代表用於最佳化的設定檔。
標記:affects_outputs
--features=<a string>
累積多次使用-
系統會根據目標設定,預設啟用或停用目標中建構的指定功能。指定 -<feature> 會停用該功能。負面特徵一律會覆寫正面特徵。另請參閱 --host_features
標記:changes_inputs
、affects_outputs
--[no]force_pic
預設值:「false」-
啟用後,所有 C++ 編譯作業都會產生與位置無關的程式碼 (「-fPIC」),連結會優先使用 PIC 預先建構的程式庫,而非非 PIC 程式庫,且連結會產生與位置無關的可執行檔 (「-pie」)。
標記:loading_and_analysis
、affects_outputs
--host_action_env=<a 'name=value' assignment with an optional value part>
累積多次使用-
指定可供具有執行設定的動作使用的環境變數集。變數可以依名稱指定 (此時值會取自叫用環境),也可以依名稱=值組合指定 (此時值會獨立於叫用環境)。這個選項可以多次使用;如果是相同變數的選項,系統會採用最新的選項,如果是不同變數的選項,則會累加。
標記:action_command_lines
--host_compilation_mode=<fastbuild, dbg or opt>
預設值:「opt」-
指定建構期間使用的工具建構模式。值:「fastbuild」、「dbg」、「opt」。
標記:affects_outputs
、action_command_lines
--host_conlyopt=<a string>
累積多次使用-
在 exec 設定中編譯 C (而非 C++) 來源檔案時,要傳遞至 C 編譯器的其他選項。
標記:action_command_lines
、affects_outputs
--host_copt=<a string>
累積多次使用-
要傳遞至 C 編譯器的其他選項,適用於在 exec 設定中建構的工具。
標記:action_command_lines
、affects_outputs
--host_cpu=<a string>
預設值:「」-
主機 CPU。
標記:changes_inputs
、affects_outputs
--host_cxxopt=<a string>
累積多次使用-
要傳遞至 C++ 編譯器的其他選項,適用於在 exec 設定中建構的工具。
標記:action_command_lines
、affects_outputs
--host_features=<a string>
累積多次使用-
系統會為在執行設定中建構的目標,預設啟用或停用指定功能。指定 -<feature> 會停用該功能。負面特徵一律會覆寫正面特徵。
標記:changes_inputs
、affects_outputs
--host_force_python=<PY2 or PY3>
預設值:請參閱說明-
覆寫執行設定的 Python 版本。可以是「PY2」或「PY3」。
標記:loading_and_analysis
、affects_outputs
--host_linkopt=<a string>
累積多次使用-
在執行設定中連結工具時,傳遞至連結器的其他選項。
標記:action_command_lines
、affects_outputs
--host_macos_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
主機目標的最低相容 macOS 版本。如未指定,則會使用「macos_sdk_version」。
標記:loses_incremental_state
--host_per_file_copt=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths followed by an @ and a comma separated list of options>
累積多次使用-
在執行設定中編譯特定檔案時,選擇性傳遞至 C/C++ 編譯器的其他選項。這個選項可以多次傳遞。語法:regex_filter@option_1,option_2,...,option_n。其中 regex_filter 代表包含和排除規則運算式模式的清單 (另請參閱 --instrumentation_filter)。option_1 到 option_n 代表任意指令列選項。如果選項含有半形逗號,則必須以反斜線加上引號。選項可以包含 @。系統只會使用第一個 @ 分割字串。範例:--host_per_file_copt=//foo/.*\.cc,-//foo/bar\.cc@-O0 會將 -O0 指令列選項新增至 //foo/ 中所有 cc 檔案的 gcc 指令列,但 bar.cc 除外。
標記:action_command_lines
、affects_outputs
--[no]incompatible_auto_exec_groups
預設值:「false」-
啟用後,系統會為規則使用的每個工具鍊自動建立執行群組。如要讓這項規則運作,必須在動作中指定 `toolchain` 參數。詳情請參閱 https://github.com/bazelbuild/bazel/issues/17134。
標記:affects_outputs
、incompatible_change
--[no]incompatible_merge_genfiles_directory
預設值:「true」-
如果是 true,genfiles 目錄會摺疊到 bin 目錄中。
標記:affects_outputs
、incompatible_change
--[no]instrument_test_targets
預設值:「false」-
啟用涵蓋範圍時,指定是否要考慮插樁測試規則。設定後,--instrumentation_filter 包含的測試規則會經過檢測。否則,測試規則一律會從涵蓋範圍插樁中排除。
標記:affects_outputs
--instrumentation_filter=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths>
default: "-/javatests[/:],-/test/java[/:]"-
啟用涵蓋範圍後,系統只會檢測名稱符合指定 regex 篩選器的規則。以「-」為前置字元的規則則會遭到排除。請注意,除非啟用 --instrument_test_targets,否則系統只會檢測非測試規則。
標記:affects_outputs
--ios_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
目標模擬器和裝置的最低相容 iOS 版本。如未指定,則使用「ios_sdk_version」。
標記:loses_incremental_state
--ios_multi_cpus=<comma-separated list of options>
累積多次使用-
以半形逗號分隔的架構清單,用於建構 ios_application。結果是包含所有指定架構的通用二進位檔。
標記:loses_incremental_state
、loading_and_analysis
--[no]legacy_whole_archive
預設值:「true」-
已淘汰,由 --incompatible_remove_legacy_whole_archive 取代 (詳情請參閱 https://github.com/bazelbuild/bazel/issues/7362)。開啟後,請為具有 linkshared=True,且 linkopts 中有 linkstatic=True 或「-static」的 cc_binary 規則使用 --whole-archive。這項功能僅適用於回溯相容性。更好的替代方案是在必要時使用 alwayslink=1。
標籤:action_command_lines
、affects_outputs
、deprecated
--linkopt=<a string>
累積多次使用-
連結時傳遞至 gcc 的其他選項。
標記:action_command_lines
、affects_outputs
--ltobackendopt=<a string>
累積多次使用-
傳遞至 LTO 後端步驟的其他選項 (位於 --features=thin_lto 下)。
標記:action_command_lines
、affects_outputs
--ltoindexopt=<a string>
累積多次使用-
可傳遞至 LTO 索引步驟的其他選項 (位於 --features=thin_lto 下)。
標記:action_command_lines
、affects_outputs
--macos_cpus=<comma-separated list of options>
累積多次使用-
要建構 Apple macOS 二進位檔的架構清單 (以半形逗號分隔)。
標記:loses_incremental_state
、loading_and_analysis
--macos_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
目標的最低相容 macOS 版本。如未指定,則會使用「macos_sdk_version」。
標記:loses_incremental_state
--memprof_profile=<a build target label>
預設值:請參閱說明-
使用 memprof 設定檔。
標記:affects_outputs
--[no]objc_debug_with_GLIBCXX
預設值:「false」-
如果已設定,且編譯模式設為「dbg」,請定義 GLIBCXX_DEBUG、GLIBCXX_DEBUG_PEDANTIC 和 GLIBCPP_CONCEPT_CHECKS。
標記:action_command_lines
--[no]objc_enable_binary_stripping
預設值:「false」-
是否要對連結的二進位檔執行符號和無效程式碼剝除作業。如果同時指定這個旗標和 --compilation_mode=opt,系統就會執行二進位檔剝除作業。
標記:action_command_lines
--objccopt=<a string>
累積多次使用-
編譯 Objective-C/C++ 來源檔案時,要傳遞給 gcc 的其他選項。
標記: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>
累積多次使用-
編譯特定檔案時,可選擇性傳遞至 gcc 的其他選項。這個選項可以多次傳遞。語法:regex_filter@option_1,option_2,...,option_n。其中 regex_filter 代表包含和排除規則運算式模式的清單 (另請參閱 --instrumentation_filter)。option_1 到 option_n 代表任意指令列選項。如果選項含有半形逗號,則必須以反斜線加上引號。選項可以包含 @。系統只會使用第一個 @ 分割字串。範例:--per_file_copt=//foo/.*\.cc,-//foo/bar\.cc@-O0 會將 -O0 指令列選項新增至 //foo/ 中所有 cc 檔案 (bar.cc 除外) 的 gcc 指令列。
標記: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>
累積多次使用-
編譯特定後端物件時,可選擇性傳遞至 LTO 後端的其他選項 (位於 --features=thin_lto 下)。這個選項可以多次傳遞。語法:regex_filter@option_1,option_2,...,option_n。其中 regex_filter 代表包含和排除規則運算式模式的清單,option_1 到 option_n 則代表任意指令列選項。如果選項含有半形逗號,則必須以反斜線加上引號。選項可以包含 @。系統只會使用第一個 @ 分割字串。範例:--per_file_ltobackendopt=//foo/.*\.o,-//foo/bar\.o@-O0 會將 -O0 指令列選項新增至 //foo/ 中所有 o 檔案 (bar.o 除外) 的 LTO 後端指令列。
標記:action_command_lines
、affects_outputs
--platform_suffix=<a string>
預設值:請參閱說明-
指定要加到設定目錄的後置字串。
標籤:loses_incremental_state
、affects_outputs
、loading_and_analysis
--propeller_optimize=<a build target label>
預設值:請參閱說明-
使用 Propeller 設定檔資訊,最佳化建構目標。Propeller 設定檔必須包含至少一個檔案,即 cc 設定檔和 ld 設定檔。這個標記接受建構標籤,該標籤必須參照螺旋槳設定檔輸入檔案。舉例來說,在 a/b/BUILD 中定義標籤的 BUILD 檔案:propeller_optimize( name = "propeller_profile", cc_profile = "propeller_cc_profile.txt", ld_profile = "propeller_ld_profile.txt",)可能必須將 exports_files 指令新增至對應的套件,才能讓 Bazel 看到這些檔案。這個選項必須做為下列項目使用:--propeller_optimize=//a/b:propeller_profile
標記:action_command_lines
、affects_outputs
--propeller_optimize_absolute_cc_profile=<a string>
預設值:請參閱說明-
Propeller 最佳化建構版本的 cc_profile 檔案絕對路徑名稱。
標記:affects_outputs
--propeller_optimize_absolute_ld_profile=<a string>
預設值:請參閱說明-
Propeller 最佳化建構版本的 ld_profile 檔案絕對路徑名稱。
標記:affects_outputs
--run_under=<a prefix in front of command>
預設值:請參閱說明-
要插入「test」和「run」指令可執行檔之前的字首。如果值為「foo -bar」,而執行指令列為「test_binary -baz」,則最終指令列為「foo -bar test_binary -baz」。這也可以是可執行目標的標籤。例如:'valgrind'、'strace'、'strace -c'、'valgrind --quiet --num-callers=20'、'//package:target'、'//package:target --options'。
標記:action_command_lines
-
如果為 true,不同目標之間會共用包含相同功能的原生程式庫。
標記:loading_and_analysis
、affects_outputs
--[no]stamp
預設值:「false」-
在二進位檔中蓋上日期、使用者名稱、主機名稱、工作區資訊等。
標記:affects_outputs
--strip=<always, sometimes or never>
預設值:「有時」-
指定是否要剝除二進位檔和共用程式庫 (使用「-Wl,--strip-debug」)。預設值「sometimes」表示僅在 --compilation_mode=fastbuild 時移除。
標記:affects_outputs
--stripopt=<a string>
累積多次使用-
產生 '<name>.stripped' 二進位檔時,要傳遞至 strip 的其他選項。
標記:action_command_lines
、affects_outputs
--tvos_cpus=<comma-separated list of options>
累積多次使用-
要建構 Apple tvOS 二進位檔的架構清單 (以半形逗號分隔)。
標記:loses_incremental_state
、loading_and_analysis
--tvos_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
目標模擬器和裝置的最低相容 tvOS 版本。如未指定,則會使用「tvos_sdk_version」。
標記:loses_incremental_state
--visionos_cpus=<comma-separated list of options>
累積多次使用-
要建構 Apple visionOS 二進位檔的架構清單 (以半形逗號分隔)。
標記:loses_incremental_state
、loading_and_analysis
--watchos_cpus=<comma-separated list of options>
累積多次使用-
以半形逗號分隔的架構清單,用於建構 Apple watchOS 二進位檔。
標記:loses_incremental_state
、loading_and_analysis
--watchos_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
目標模擬器和裝置的最低相容 watchOS 版本。如未指定,則會使用「watchos_sdk_version」。
標記:loses_incremental_state
--xbinary_fdo=<a build target label>
預設值:請參閱說明-
使用 XbinaryFDO 設定檔資訊,最佳化編譯作業。指定預設跨二進位檔設定檔的名稱。如果這個選項與 --fdo_instrument/--fdo_optimize/--fdo_profile 搭配使用,這些選項一律會優先採用,如同從未指定 xbinary_fdo 一樣。
標記:affects_outputs
- 影響 Bazel 嚴格程度的選項,可強制執行有效的建構輸入內容 (規則定義、旗標組合等):
--[no]check_licenses
預設值:「false」-
確認依附套件的授權限制不會與建構目標的發布模式衝突。根據預設,系統不會檢查授權。
標記:build_file_semantics
--[no]check_visibility
預設值:「true」-
如果停用,目標依附元件中的顯示設定錯誤會降級為警告。
標記:build_file_semantics
--[no]desugar_for_android
預設值:「true」-
是否要在 dexing 前脫糖 Java 8 位元碼。
標籤:affects_outputs
、loading_and_analysis
、loses_incremental_state
--[no]desugar_java8_libs
預設值:「false」-
是否要在舊版裝置的應用程式中加入支援的 Java 8 程式庫。
標記:affects_outputs
、loading_and_analysis
、loses_incremental_state
、experimental
--[no]enforce_constraints
預設值:「true」-
檢查每個目標相容的環境,並在任何目標有不支援相同環境的依附元件時回報錯誤。
標記:build_file_semantics
--[no]experimental_check_desugar_deps
預設值:「true」-
是否要在 Android 二進位層級重複檢查正確的解除糖化程序。
標籤:eagerness_to_exit
、loading_and_analysis
、experimental
--experimental_import_deps_checking=<a string>
預設值:請參閱說明-
無作業,僅為回溯相容性而保留
標記:loading_and_analysis
--experimental_one_version_enforcement=<off, warning or error>
預設值:「OFF」-
啟用後,系統會強制執行 java_binary 規則,確保類別路徑中不會包含相同類別檔案的多個版本。這項強制執行措施可能會導致建構作業中斷,或只是產生警告。
標記:loading_and_analysis
--experimental_strict_java_deps=<off, warn, error, strict or default>
預設值:「default」-
如果為 true,則檢查 Java 目標是否明確將所有直接使用的目標宣告為依附元件。
標記:build_file_semantics
、eagerness_to_exit
--[no]incompatible_check_testonly_for_output_files
預設值:「false」-
如果已啟用,請查閱產生規則的 testonly,找出輸出檔案的必要條件目標。這與可見度檢查相符。
標記:build_file_semantics
、incompatible_change
--[no]incompatible_check_visibility_for_toolchains
預設值:「false」-
如果啟用,可見度檢查也會套用至工具鍊實作項目。
標記:build_file_semantics
、incompatible_change
--[no]incompatible_disable_native_android_rules
預設值:「false」-
如果啟用,系統會停用 Android 原生規則的直接使用權。請使用 https://github.com/bazelbuild/rules_android 中的 Starlark Android 規則
標記:eagerness_to_exit
、incompatible_change
--[no]incompatible_disable_native_apple_binary_rule
預設值:「false」-
無作業。為保持回溯相容性而保留。
標記:eagerness_to_exit
、incompatible_change
--[no]incompatible_python_disable_py2
預設值:「true」-
如果為 true,使用 Python 2 設定會導致錯誤。包括 python_version=PY2、srcs_version=PY2 和 srcs_version=PY2ONLY。詳情請參閱 https://github.com/bazelbuild/bazel/issues/15684。
標記:loading_and_analysis
、incompatible_change
--[no]one_version_enforcement_on_java_tests
預設值:「true」-
啟用後,如果 experimental_one_version_enforcement 設為非 NONE 值,系統就會對 java_test 目標強制執行單一版本。您可以停用此標記,以改善增量測試效能,但可能會因此錯過潛在的單一版本違規事項。
標記:loading_and_analysis
--python_native_rules_allowlist=<a build target label>
預設值:請參閱說明-
強制執行 --incompatible_python_disallow_native_rules 時使用的許可清單 (package_group 目標)。
標記:loading_and_analysis
--[no]strict_filesets
預設值:「false」-
如果啟用這個選項,系統會將跨越套件界線的檔案集回報為錯誤。
標記:build_file_semantics
、eagerness_to_exit
--strict_proto_deps=<off, warn, error, strict or default>
預設值:「error」-
除非設為 OFF,否則會檢查 proto_library 目標是否明確將所有直接使用的目標宣告為依附元件。
標籤:build_file_semantics
、eagerness_to_exit
、incompatible_change
--strict_public_imports=<off, warn, error, strict or default>
預設值:「off」-
除非設為 OFF,否則會檢查 proto_library 目標是否明確將「import public」中使用的所有目標宣告為已匯出。
標籤:build_file_semantics
、eagerness_to_exit
、incompatible_change
--[no]strict_system_includes
預設值:「false」-
如果是 true,系統也必須宣告透過系統包含路徑 (-isystem) 找到的標頭。
標記:loading_and_analysis
、eagerness_to_exit
--target_environment=<a build target label>
累積多次使用-
宣告這個建構作業的目標環境。必須是「環境」規則的標籤參照。如果指定,所有頂層目標都必須與這個環境相容。
標記:changes_inputs
- 影響建構簽署輸出的選項:
--apk_signing_method=<v1, v2, v1_v2 or v4>
預設值:「v1_v2」-
用來簽署 APK 的實作項目
標記:action_command_lines
、affects_outputs
、loading_and_analysis
--[no]device_debug_entitlements
預設值:「true」-
如果已設定,且編譯模式不是「opt」,objc 應用程式會在簽署時加入偵錯授權。
標記:changes_inputs
--ios_signing_cert_name=<a string>
預設值:請參閱說明-
用於 iOS 簽署的憑證名稱。如未設定,系統會改用佈建設定檔。可能是憑證的鑰匙圈身分偏好設定,或憑證通用名稱的 (子字串),如 codesign 的說明頁面 (SIGNING IDENTITIES) 所示。
標記:action_command_lines
- 這個選項會影響 Starlark 語言的語意,或可供 BUILD 檔案、.bzl 檔案或 WORKSPACE 檔案存取的建構 API:
--[no]incompatible_disallow_legacy_py_provider
預設值:「true」-
No-op, will be removed soon.
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_disallow_sdk_frameworks_attributes
預設值:「false」-
如果設為 true,則 objc_library 和 objc_import 中的 sdk_frameworks 和 weak_sdk_frameworks 屬性會遭到禁止。
標記:build_file_semantics
、incompatible_change
--[no]incompatible_objc_alwayslink_by_default
預設值:「false」-
如果為 true,請將 objc_library 和 objc_import 中的 alwayslink 屬性預設值設為 true。
標記:build_file_semantics
、incompatible_change
--[no]incompatible_python_disallow_native_rules
預設值:「false」-
如果為 true,使用內建 py_* 規則時會發生錯誤,此時應改用 rule_python 規則。如需更多資訊和遷移操作說明,請參閱 https://github.com/bazelbuild/bazel/issues/17773。
標記:loading_and_analysis
、incompatible_change
- 控管測試環境或測試執行器行為的選項:
--[no]allow_analysis_failures
預設值:「false」-
如果為 true,規則目標的分析失敗會導致目標傳播包含錯誤說明的 AnalysisFailureInfo 執行個體,而不是導致建構失敗。
標記:loading_and_analysis
、experimental
--analysis_testing_deps_limit=<an integer>
預設值:「2000」-
透過具有 for_analysis_testing 設定轉換的規則屬性,設定遞移依附元件數量上限。如果超出這項限制,系統就會產生規則錯誤。
標記:loading_and_analysis
--[no]break_build_on_parallel_dex2oat_failure
預設值:「false」-
如果為 true,dex2oat 動作失敗會導致建構中斷,而不是在測試執行階段執行 dex2oat。
標記:loading_and_analysis
、experimental
--default_test_resources=<a resource name followed by equal and 1 float or 4 float, e.g. memory=10,30,60,100>
累積多次使用- 覆寫測試的預設資源量。預期格式為 <resource>=<value>。如果將單一正數指定為 <value>,系統會覆寫所有測試大小的預設資源。如果指定 4 個以半形逗號分隔的數字,系統會分別覆寫小型、中型、大型和特大型測試大小的資源量。值也可以是 HOST_RAM/HOST_CPU,後面可選擇性加上 [-|*]<float> (例如 memory=HOST_RAM*.1,HOST_RAM*.2,HOST_RAM*.3,HOST_RAM*.4)。這個旗標指定的預設測試資源,會遭到標記中明確指定的資源覆寫。
--[no]experimental_android_use_parallel_dex2oat
預設值:「false」-
使用 dex2oat 平行處理,可能可加快 android_test 的速度。
標籤:loading_and_analysis
、host_machine_resource_optimizations
、experimental
--[no]ios_memleaks
預設值:「false」-
在 ios_test 目標中啟用記憶體洩漏檢查。
標記:action_command_lines
--ios_simulator_device=<a string>
預設值:請參閱說明-
在模擬器中執行 iOS 應用程式時要模擬的裝置,例如「iPhone 6」。您可以在要執行模擬器的電腦上執行「xcrun simctl list devicetypes」,取得裝置清單。
標記:test_runner
--ios_simulator_version=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
執行或測試時,要在模擬器上執行的 iOS 版本。如果規則中指定目標裝置,系統會忽略 ios_test 規則的這項設定。
標記:test_runner
--runs_per_test=<a positive integer or test_regex@runs. This flag may be passed more than once>
累積多次使用- 指定每次測試的執行次數。如果其中任何一項嘗試因任何原因失敗,整個測試就會視為失敗。通常指定的值只會是整數。範例:--runs_per_test=3 會執行所有測試 3 次。替代語法:regex_filter@runs_per_test。其中 runs_per_test 代表整數值,regex_filter 代表包含和排除規則運算式模式的清單 (另請參閱 --instrumentation_filter)。範例:--runs_per_test=//foo/.*,-//foo/bar/.*@3 會執行 //foo/ 中的所有測試,但 foo/bar 下的測試除外,且執行次數為 3 次。這個選項可以多次傳遞。系統會優先採用最近傳遞且相符的引數。如果沒有相符的項目,測試只會執行一次。
--test_env=<a 'name=value' assignment with an optional value part>
累積多次使用-
指定要注入測試執行器環境的其他環境變數。變數可依名稱指定 (系統會從 Bazel 用戶端環境讀取變數值),或依名稱/值組合指定。這個選項可多次使用,指定多個變數。僅供「bazel test」指令使用。
標記:test_runner
--test_timeout=<a single integer or comma-separated list of 4 integers>
預設值:「-1」- 覆寫測試逾時的預設測試逾時值 (以秒為單位)。如果指定單一正整數值,系統會覆寫所有類別。如果指定 4 個以半形逗號分隔的整數,系統會依序覆寫短、中、長和永久的逾時時間。不論採用哪種形式,值為 -1 都會告知 Blaze 對該類別使用預設逾時。
--[no]zip_undeclared_test_outputs
預設值:「false」-
如果設為 true,系統會將未宣告的測試輸出內容封存至 zip 檔案。
標記:test_runner
- 可觸發建構時間最佳化的選項:
--[no]experimental_filter_library_jar_with_program_jar
預設值:「false」-
篩選 ProGuard ProgramJar,移除 LibraryJar 中也存在的任何類別。
標記:action_command_lines
、experimental
--[no]experimental_inmemory_dotd_files
預設值:「true」-
啟用後,系統會直接從遠端建構節點在記憶體中傳遞 C++ .d 檔案,而不是寫入磁碟。
標記:loading_and_analysis
、execution
、affects_outputs
、experimental
--[no]experimental_inmemory_jdeps_files
預設值:「true」-
啟用後,從 Java 編譯作業產生的依附元件 (.jdeps) 檔案會直接從遠端建構節點在記憶體中傳遞,而不是寫入磁碟。
標記:loading_and_analysis
、execution
、affects_outputs
、experimental
--[no]experimental_retain_test_configuration_across_testonly
預設值:「false」-
啟用後,--trim_test_configuration 不會修剪標示為 testonly=1 的規則測試設定。如果非測試規則依附於 cc_test 規則,這項做法可減少動作衝突問題。如果 --trim_test_configuration 為 False,則不會有任何作用。
標籤:loading_and_analysis
、loses_incremental_state
、experimental
--[no]experimental_starlark_cc_import
預設值:「false」-
如果啟用,即可使用 cc_import 的 Starlark 版本。
標記:loading_and_analysis
、experimental
--[no]experimental_unsupported_and_brittle_include_scanning
預設值:「false」-
是否要剖析輸入檔案中的 #include 行,藉此縮小 C/C++ 編譯的輸入範圍。這項做法可縮減編譯輸入樹狀結構的大小,進而提升成效和增量。不過,由於 include 掃描器並未完整實作 C 前置處理器語意,因此也可能導致建構作業中斷。特別是,它無法解讀動態 #include 指令,且會忽略前置處理器條件邏輯。您必須自行承擔使用風險。系統會關閉與此標記相關的所有問題。
標記:loading_and_analysis
、execution
、changes_inputs
、experimental
--[no]incremental_dexing
預設值:「true」-
針對每個 Jar 檔案分別執行大部分的 dexing 工作。
標籤:affects_outputs
、loading_and_analysis
、loses_incremental_state
--[no]objc_use_dotd_pruning
預設值:「true」-
如果設定這項引數,clang 發出的 .d 檔案會用於修剪傳遞至 objc 編譯的輸入集。
標記:changes_inputs
、loading_and_analysis
--[no]process_headers_in_dependencies
預設值:「false」-
建構目標 //a:a 時,處理 //a:a 所依附的所有目標中的標頭 (如果工具鍊已啟用標頭處理)。
標記:execution
--[no]trim_test_configuration
預設值:「true」-
啟用後,系統會清除建構作業頂層以下的測試相關選項。啟用這個標記後,測試無法建構為非測試規則的依附元件,但變更測試相關選項不會導致系統重新分析非測試規則。
標記:loading_and_analysis
、loses_incremental_state
- 影響記錄詳細程度、格式或位置的選項:
--toolchain_resolution_debug=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths>
預設值:「-.*」-
在工具鍊解析期間列印偵錯資訊。這個旗標會採用正規運算式,並根據工具鍊類型和特定目標進行檢查,判斷要偵錯的項目。多個規則運算式可以逗號分隔,然後系統會分別檢查每個規則運算式。注意:這個標記的輸出內容非常複雜,可能只對工具鍊解析專家有用。
標記:terminal_output
- 指定或變更 Bazel 指令一般輸入內容的選項,不屬於其他類別:
--flag_alias=<a 'name=value' flag alias>
累積多次使用-
為 Starlark 旗標設定簡短名稱。這個函式會以「<key>=<value>」形式的單一鍵/值組合做為引數。
標記:changes_inputs
--[no]incompatible_default_to_explicit_init_py
預設值:「false」-
這個標記會變更預設行為,因此系統不會再自動在 Python 目標的執行檔中建立 __init__.py 檔案。具體來說,如果 py_binary 或 py_test 目標的 legacy_create_init 設為「auto」(預設值),則只有在設定這個旗標時,系統才會將其視為 false。詳情請參閱 https://github.com/bazelbuild/bazel/issues/10076。
標記:affects_outputs
、incompatible_change
--[no]incompatible_py2_outputs_are_suffixed
預設值:「true」-
如果為 true,以 Python 2 設定建構的目標會顯示在包含「-py2」後置字串的輸出根目錄下,而為 Python 3 建構的目標則會顯示在沒有 Python 相關後置字串的根目錄中。也就是說,`bazel-bin` 便利符號連結會指向 Python 3 目標,而非 Python 2。啟用這個選項時,建議一併啟用 `--incompatible_py3_is_default`。
標記:affects_outputs
、incompatible_change
--[no]incompatible_py3_is_default
預設值:「true」-
如果為 true,未設定 `python_version` (或 `default_python_version`) 屬性的 `py_binary` 和 `py_test` 目標,預設會使用 PY3,而非 PY2。如果設定這個旗標,建議一併設定 `--incompatible_py2_outputs_are_suffixed`。
標記:loading_and_analysis
、affects_outputs
、incompatible_change
--[no]incompatible_use_python_toolchains
預設值:「true」-
如果設為 true,可執行的原生 Python 規則會使用 Python 工具鍊指定的 Python 執行階段,而不是舊版旗標 (例如 --python_top) 提供的執行階段。
標記:loading_and_analysis
、incompatible_change
--python_version=<PY2 or PY3>
預設值:請參閱說明-
Python 主要版本模式,可以是 `PY2` 或 `PY3`。請注意,這會遭到 `py_binary` 和 `py_test` 目標覆寫 (即使這些目標未明確指定版本),因此通常沒有太多理由提供這個旗標。
標記:loading_and_analysis
、affects_outputs
- 其他選項,未歸類於其他類別:
--[no]cache_test_results
[-t
] 預設值:「auto」- 如果設為「auto」,只有在下列情況下,Bazel 才會重新執行測試:(1) Bazel 偵測到測試或其依附元件有變更;(2) 測試標示為外部;(3) 使用 --runs_per_test 要求多次執行測試;或(4) 測試先前失敗。如果設為「yes」,Bazel 會快取所有測試結果,但標示為外部的測試除外。如果設為「no」,Bazel 不會快取任何測試結果。
--[no]experimental_cancel_concurrent_tests
預設值:「false」-
如果為 true,Blaze 會在第一次成功執行時,取消同時執行的測試。只有在搭配 --runs_per_test_detects_flakes 時才會有作用。
標籤:affects_outputs
、loading_and_analysis
、experimental
--[no]experimental_fetch_all_coverage_outputs
預設值:「false」-
如果為 true,Bazel 會在執行涵蓋範圍時,擷取每項測試的整個涵蓋範圍資料目錄。
標籤:affects_outputs
、loading_and_analysis
、experimental
--[no]experimental_generate_llvm_lcov
預設值:「false」-
如果為 true,clang 的涵蓋範圍會產生 LCOV 報表。
標籤:affects_outputs
、loading_and_analysis
、experimental
--[no]experimental_j2objc_header_map
預設值:「true」-
是否要與 J2ObjC 轉譯作業平行產生 J2ObjC 標頭對應檔。
標記:experimental
--[no]experimental_j2objc_shorter_header_path
預設值:「false」-
是否要使用較短的標頭路徑生成 (使用「_ios」而非「_j2objc」)。
標記:affects_outputs
、experimental
--experimental_java_classpath=<off, javabuilder or bazel>
預設值:「javabuilder」- 啟用 Java 編譯的縮減類別路徑。
--[no]experimental_limit_android_lint_to_android_constrained_java
預設值:「false」-
無作業,僅保留向後相容性
標記:affects_outputs
、experimental
--[no]experimental_run_android_lint_on_java_rules
預設值:「false」-
是否要驗證 java_* 來源。
標記:affects_outputs
、experimental
--[no]explicit_java_test_deps
預設值:「false」- 在 java_test 中明確指定 JUnit 或 Hamcrest 的依附元件,而不是從 TestRunner 的 deps 意外取得。目前僅適用於 Bazel。
--host_java_launcher=<a build target label>
預設值:請參閱說明- 建構期間執行的工具所用的 Java 啟動器。
--host_javacopt=<a string>
累積多次使用- 建構在建構期間執行的工具時,要傳遞至 javac 的其他選項。
--host_jvmopt=<a string>
累積多次使用- 建構在建構期間執行的工具時,要傳遞至 Java VM 的其他選項。這些選項會新增至每個 java_binary 目標的 VM 啟動選項。
--[no]incompatible_check_sharding_support
預設值:「true」-
如果設為 true,且測試執行器未透過觸控 TEST_SHARD_STATUS_FILE 路徑中的檔案,指出支援分片,Bazel 就會讓分片測試失敗。如果為 false,不支援分片的測試執行器會導致所有測試在每個分片中執行。
標記:incompatible_change
--[no]incompatible_exclusive_test_sandboxed
預設值:「true」-
如果是 true,系統會使用沙箱策略執行專屬測試。新增「local」標記,強制在本機執行專屬測試
Tags:incompatible_change
--[no]incompatible_strict_action_env
預設值:「false」-
如果設為 true,Bazel 會使用 PATH 的靜態值環境,且不會繼承 LD_LIBRARY_PATH。如要從用戶端繼承特定環境變數,請使用 --action_env=ENV_VARIABLE,但請注意,如果使用共用快取,這麼做可能會導致無法跨使用者快取。
標記:loading_and_analysis
、incompatible_change
--j2objc_translation_flags=<comma-separated list of options>
累積多次使用- 傳遞至 J2ObjC 工具的其他選項。
--java_debug
-
導致 Java 測試的 Java 虛擬機器等待來自符合 JDWP 規範的偵錯工具 (例如 jdb) 的連線,然後才開始測試。這表示 -test_output=streamed。
展開後會顯示:
--test_arg=--wrapper_script_flag=--debug
--test_output=streamed
--test_strategy=exclusive
--test_timeout=9999
--nocache_test_results
--[no]java_deps
預設值:「true」- 為每個 Java 目標產生依附元件資訊 (目前為編譯時間類別路徑)。
--[no]java_header_compilation
預設值:「true」- 直接從來源編譯 ijars。
--java_language_version=<a string>
預設值:「」- Java 語言版本
--java_launcher=<a build target label>
預設值:請參閱說明- 建構 Java 二進位檔時要使用的 Java 啟動器。如果將這個標記設為空字串,系統會使用 JDK 啟動器。「啟動器」屬性會覆寫這個旗標。
--java_runtime_version=<a string>
預設值:「local_jdk」- Java 執行階段版本
--javacopt=<a string>
累積多次使用- 要傳遞至 javac 的其他選項。
--jvmopt=<a string>
累積多次使用- 要傳遞至 Java VM 的其他選項。這些選項會新增至每個 java_binary 目標的 VM 啟動選項。
--legacy_main_dex_list_generator=<a build target label>
預設值:請參閱說明- 指定要使用的二進位檔,以便在編譯舊版 multidex 時,產生必須位於主要 dex 中的類別清單。
--optimizing_dexer=<a build target label>
預設值:請參閱說明- 指定用於執行 Dexing 的二進位檔,不需分片。
--plugin=<a build target label>
累積多次使用- 建構作業中要使用的外掛程式。目前適用於 java_plugin。
--proguard_top=<a build target label>
預設值:請參閱說明- 指定建構 Java 二進位檔時,要使用哪個版本的 ProGuard 移除程式碼。
--proto_compiler=<a build target label>
預設值:「@bazel_tools//tools/proto:protoc」-
proto 編譯器的標籤。
標記:affects_outputs
、loading_and_analysis
--[no]proto_profile
預設值:「true」-
是否要將 profile_path 傳遞至 proto 編譯器。
標記:affects_outputs
、loading_and_analysis
--proto_profile_path=<a build target label>
預設值:請參閱說明-
要傳遞至 proto 編譯器的設定檔,做為 profile_path。如果未設定,但 --proto_profile 為 true (預設值),則會從 --fdo_optimize 推斷路徑。
標記:affects_outputs
、loading_and_analysis
--proto_toolchain_for_cc=<a build target label>
default: "@bazel_tools//tools/proto:cc_toolchain"-
proto_lang_toolchain() 的標籤,說明如何編譯 C++ proto
標記:affects_outputs
、loading_and_analysis
--proto_toolchain_for_j2objc=<a build target label>
預設值:「@bazel_tools//tools/j2objc:j2objc_proto_toolchain」-
proto_lang_toolchain() 的標籤,說明如何編譯 j2objc proto
標記:affects_outputs
、loading_and_analysis
--proto_toolchain_for_java=<a build target label>
預設值:「@bazel_tools//tools/proto:java_toolchain」-
proto_lang_toolchain() 的標籤,說明如何編譯 Java Proto
標記:affects_outputs
、loading_and_analysis
--proto_toolchain_for_javalite=<a build target label>
預設值:「@bazel_tools//tools/proto:javalite_toolchain」-
proto_lang_toolchain() 的標籤,說明如何編譯 JavaLite proto
標記:affects_outputs
、loading_and_analysis
--protocopt=<a string>
累積多次使用-
要傳遞至 protobuf 編譯器的其他選項。
標記:affects_outputs
--[no]runs_per_test_detects_flakes
預設值:「false」- 如果為 true,只要分片中至少有一次執行/嘗試通過,且至少有一次執行/嘗試失敗,就會獲得 FLAKY 狀態。
--shell_executable=<a path>
預設值:請參閱說明-
Bazel 要使用的 Shell 可執行檔絕對路徑。如果未設定這個變數,但 BAZEL_SH 環境變數是在第一次叫用 Bazel 時設定 (這會啟動 Bazel 伺服器),Bazel 會使用該變數。如果兩者皆未設定,Bazel 會根據執行的作業系統使用硬式編碼的預設路徑 (Windows:c:/msys64/usr/bin/bash.exe、FreeBSD:/usr/local/bin/bash,其他:/bin/bash)。請注意,使用與 Bash 不相容的殼層可能會導致建構失敗,或導致產生的二進位檔發生執行階段錯誤。
標記:loading_and_analysis
--test_arg=<a string>
累積多次使用- 指定應傳遞至測試執行檔的其他選項和引數。可多次使用,指定多個引數。如果執行多項測試,每項測試都會收到相同的引數。僅供「bazel test」指令使用。
--test_filter=<a string>
預設值:請參閱說明- 指定要轉送至測試架構的篩選器。用於限制執行的測試。請注意,這不會影響建構的目標。
--test_result_expiration=<an integer>
預設值:「-1」- 這個選項已淘汰,因此不會產生任何作用。
--[no]test_runner_fail_fast
預設值:「false」- 將快速失敗選項轉送至測試執行器。測試執行器應在第一次失敗時停止執行。
--test_sharding_strategy=<explicit, disabled or forced=k where k is the number of shards to enforce>
預設值:「explicit」- 指定測試分片策略:「explicit」表示只有在存在「shard_count」BUILD 屬性時,才使用分片。「disabled」則表示永不使用測試分片。「forced=k」可強制測試使用「k」個分片,無論「shard_count」BUILD 屬性為何。
--tool_java_language_version=<a string>
預設值:「」- 用於執行建構期間所需工具的 Java 語言版本
--tool_java_runtime_version=<a string>
default: "remotejdk_11"- 建構期間執行工具時使用的 Java 執行階段版本
--[no]use_ijars
預設值:「true」- 啟用後,這項選項會讓 Java 編譯使用介面 JAR。這樣一來,增量編譯速度會更快,但錯誤訊息可能有所不同。
標準化旗標選項
繼承 build 的所有選項。
- 控管指令輸出內容的選項:
--[no]canonicalize_policy
預設值:「false」-
輸出擴展和篩選後的標準政策。為確保輸出內容乾淨整潔,如果將這個選項設為 true,系統將不會顯示標準化指令引數。請注意,--for_command 指定的指令會影響經過篩選的政策,如果未指定任何指令,預設指令為「build」。
標記:affects_outputs
、terminal_output
--[no]experimental_include_default_values
預設值:「true」-
輸出內容是否包含設為預設值的 Starlark 選項。
標記:affects_outputs
、terminal_output
- 這個選項會影響 Starlark 語言的語意,或 BUILD 檔案、.bzl 檔案或 WORKSPACE 檔案可存取的建構 API。:
--[no]incompatible_config_setting_private_default_visibility
預設值:「false」-
如果 incompatible_enforce_config_setting_visibility=false,這就是 noop。否則,如果這個旗標為 false,任何沒有明確顯示屬性的 config_setting 都是 //visibility:public。如果這個標記為 true,config_setting 會遵循與所有其他規則相同的瀏覽權限邏輯。詳情請參閱 https://github.com/bazelbuild/bazel/issues/12933。
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_enforce_config_setting_visibility
預設值:「true」-
如果為 true,則強制執行 config_setting 可見度限制。如果為 false,每個目標都會看到所有 config_setting。詳情請參閱 https://github.com/bazelbuild/bazel/issues/12932。
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_use_plus_in_repo_names
預設值:「true」-
無作業。
標記:loading_and_analysis
- 指定或變更 Bazel 指令一般輸入內容的選項,不屬於其他類別:
--for_command=<a string>
預設值:「build」-
應標準化選項的指令。
標記:affects_outputs
、terminal_output
--invocation_policy=<a string>
預設值:「」-
將叫用政策套用至要正規化的選項。
標記:affects_outputs
、terminal_output
- 其他選項,未歸類於其他類別:
--deleted_packages=<comma-separated list of package names>
累積多次使用- 以半形逗號分隔的套件名稱清單。即使這些套件顯示在套件路徑的某處,建構系統也會視為不存在。 刪除現有套件「x」的子套件「x/y」時,請使用這個選項。舉例來說,如果您在用戶端中刪除 x/y/BUILD,但另一個 package_path 項目仍提供「//x:y/z」標籤,建構系統可能會發出警告。指定 --deleted_packages x/y 即可避免這個問題。
--[no]fetch
預設值:「true」- 允許指令擷取外部依附元件。如果設為 false,指令會使用依附元件的任何快取版本,如果沒有,指令就會失敗。
--package_path=<colon-separated list of options>
預設值:「%workspace%」- 以半形冒號分隔的清單,列出要尋找套件的位置。以「%workspace%」開頭的元素與封閉工作區相關。如果省略或為空,預設值為「bazel info default-package-path」的輸出內容。
--[no]show_loading_progress
預設值:「true」- 啟用後,Bazel 會列印「正在載入套件:」訊息。
清除選項
繼承 build 的所有選項。
- 控管指令輸出內容的選項:
--[no]async
預設值:「false」-
如果為 true,輸出內容清除作業會以非同步方式執行。這個指令完成後,即使刪除作業可能仍在背景執行,您也可以在同一個用戶端執行新指令。
標記:host_machine_resource_optimizations
--[no]expunge
預設值:「false」-
如果為 true,clean 會移除這個 bazel 執行個體的整個工作樹狀結構,包括所有 bazel 建立的暫時和建構輸出檔案,並停止執行中的 bazel 伺服器。
標記:host_machine_resource_optimizations
--expunge_async
-
如果指定,清除作業會以非同步方式移除這個 Bazel 執行個體的所有工作樹狀結構,包括所有 Bazel 建立的暫時和建構輸出檔案,並停止 Bazel 伺服器 (如果正在執行)。這個指令完成後,即使刪除作業可能仍在背景執行,您也可以在同一個用戶端執行新指令。
展開後:
--expunge
--async
標記:host_machine_resource_optimizations
- 這個選項會影響 Starlark 語言的語意,或 BUILD 檔案、.bzl 檔案或 WORKSPACE 檔案可存取的建構 API。:
--[no]incompatible_use_plus_in_repo_names
預設值:「true」-
無作業。
標記:loading_and_analysis
設定選項
涵蓋範圍選項
繼承 test 的所有選項。
- 這個選項會影響 Starlark 語言的語意,或可供 BUILD 檔案、.bzl 檔案或 WORKSPACE 檔案存取的建構 API。
--[no]incompatible_use_plus_in_repo_names
預設值:「true」-
無作業。
標記:loading_and_analysis
Cquery 選項
繼承 test 的所有選項。
- 這個選項會影響 Starlark 語言的語意,或可供 BUILD 檔案、.bzl 檔案或 WORKSPACE 檔案存取的建構 API。
--[no]incompatible_use_plus_in_repo_names
預設值:「true」-
無運算。
標記:loading_and_analysis
- 與查詢輸出和語意相關的選項:
--aspect_deps=<off, conservative or precise>
預設值:「conservative」-
如果輸出格式為 {xml、proto、record},如何解決層面依附元件問題?「off」表示不會解析任何層面依附元件;「conservative」(預設值) 表示會新增所有已宣告的層面依附元件,無論這些依附元件是否具有直接依附元件的規則類別;「precise」表示只會新增可能處於啟用狀態的層面,前提是這些層面具有直接依附元件的規則類別。請注意,精確模式需要載入其他套件來評估單一目標,因此比其他模式慢。另請注意,即使是精確模式也不會完全精確:是否要計算某個層面是在分析階段決定,而分析階段不會在「bazel query」期間執行。
標記:build_file_semantics
--[no]consistent_labels
預設值:「false」-
如果啟用這項功能,每個查詢指令都會發出標籤,就像是將 Starlark <code>str</code> 函式套用至 <code>Label</code> 執行個體一樣。如果工具需要比對規則發出的不同查詢指令和/或標籤的輸出內容,這項功能就非常實用。如果未啟用,輸出格式化工具可以改為發出明顯的存放區名稱 (相對於主要存放區),讓輸出內容更易於閱讀。
標記:terminal_output
--[no]experimental_explicit_aspects
預設值:「false」-
aquery、cquery:是否要在輸出內容中加入層面產生的動作。query:無運算 (一律會追蹤層面)。
標記:terminal_output
--[no]graph:factored
預設值:「true」-
如果為 true,系統會「分解」圖表,也就是合併拓撲等效節點,並串連標籤。這個選項僅適用於 --output=graph。
標記:terminal_output
--graph:node_limit=<an integer>
預設值:「512」-
輸出內容中圖形節點的標籤字串長度上限。較長的標籤會遭到截斷;-1 表示不會截斷。這個選項僅適用於 --output=graph。
標記:terminal_output
--[no]implicit_deps
預設值:「true」-
如果啟用,查詢作業所依附的依附元件圖表會包含隱含依附元件。隱含依附元件是指未在 BUILD 檔案中明確指定,但由 Bazel 新增的依附元件。如果是 cquery,這個選項會控管已解析工具鍊的篩選作業。
標記:build_file_semantics
--[no]include_aspects
預設值:「true」-
aquery、cquery:是否要在輸出內容中加入層面產生的動作。query:無運算 (一律會追蹤層面)。
標記:terminal_output
--[no]incompatible_package_group_includes_double_slash
預設值:「true」-
如果啟用,輸出 package_group 的 `packages` 屬性時,不會省略開頭的 `//`。
標記:terminal_output
、incompatible_change
--[no]infer_universe_scope
預設值:「false」-
如果已設定,但未設定 --universe_scope,則 --universe_scope 的值會推斷為查詢運算式中的不重複目標模式清單。請注意,如果查詢運算式使用宇宙範圍函式 (例如 `allrdeps`),推斷出的 --universe_scope 值可能不是您要的值,因此只有在您瞭解自己的做法時,才應使用這個選項。如需詳細資料和範例,請參閱 https://bazel.build/reference/query#sky-query。如果已設定 --universe_scope,系統會忽略這個選項的值。注意:這個選項僅適用於 `query` (即非 `cquery`)。
標記:loading_and_analysis
--[no]line_terminator_null
預設值:「false」-
每個格式是否以 \0 結尾,而非換行符號。
標記:terminal_output
--[no]nodep_deps
預設值:「true」-
如果啟用,來自「nodep」屬性的依附元件會納入查詢運作的依附元件圖。「nodep」屬性的常見範例是「visibility」。執行並剖析 `info build-language` 的輸出內容,瞭解建構語言中的所有「nodep」屬性。
標記:build_file_semantics
--output=<a string>
預設值:「label」-
應列印 cquery 結果的格式。cquery 的允許值為:label、label_kind、textproto、transitions、proto、streamed_proto、jsonproto。如果選取「transitions」,也必須指定 --transitions=(lite|full) 選項。
標記:terminal_output
--[no]proto:default_values
預設值:「true」-
如果為 true,系統會納入 BUILD 檔案中未明確指定值的屬性;否則會省略這些屬性。這個選項適用於 --output=proto
標記:terminal_output
--[no]proto:definition_stack
預設值:「false」-
填入 definition_stack proto 欄位,記錄定義規則類別時的每個規則執行個體 Starlark 呼叫堆疊。
標記:terminal_output
--[no]proto:flatten_selects
預設值:「true」-
啟用後,系統會將 select() 建立的可設定屬性扁平化。如果是清單類型,扁平化表示法就是清單,其中每個選取對應的值只會出現一次。純量型別會扁平化為空值。
標記:build_file_semantics
--[no]proto:include_attribute_source_aspects
預設值:「false」-
使用屬性來源的來源構面,填入每個屬性的 source_aspect_name proto 欄位 (如果沒有來源構面,則填入空字串)。
標記:terminal_output
--[no]proto:include_configurations
預設值:「true」-
如果啟用,proto 輸出內容會包含設定相關資訊。停用時,cquery proto 輸出格式與查詢輸出格式類似。
標記:affects_outputs
--[no]proto:include_synthetic_attribute_hash
預設值:「false」-
是否要計算及填入 $internal_attr_hash 屬性。
標記:terminal_output
--[no]proto:instantiation_stack
預設值:「false」-
填入每項規則的例項化呼叫堆疊。請注意,這需要堆疊存在
標記:terminal_output
--[no]proto:locations
預設值:「true」-
是否要在 Proto 輸出中輸出位置資訊。
標記:terminal_output
--proto:output_rule_attrs=<comma-separated list of options>
預設值:「all」-
以半形逗號分隔的屬性清單,這些屬性會納入輸出內容。預設值為所有屬性。如要不輸出任何屬性,請設為空字串。這個選項適用於 --output=proto。
標記:terminal_output
--[no]proto:rule_classes
預設值:「false」-
填入每項規則的 rule_class_key 欄位;如果是具有特定 rule_class_key 的第一項規則,請一併填入其 rule_class_info proto 欄位。rule_class_key 欄位會專屬識別規則類別,而 rule_class_info 欄位則是 Stardoc 格式的規則類別 API 定義。
標記:terminal_output
--[no]proto:rule_inputs_and_outputs
預設值:「true」-
是否要填入 rule_input 和 rule_output 欄位。
標記:terminal_output
--query_file=<a string>
預設值:「」-
如果已設定,查詢會從這裡命名的檔案讀取查詢,而不是從指令列讀取。在此處指定檔案和指令列查詢都是錯誤的做法。
標記:changes_inputs
--[no]relative_locations
預設值:「false」-
如果為 true,xml 和 proto 輸出內容中的 BUILD 檔案位置會是相對位置。根據預設,位置輸出為絕對路徑,且在不同電腦上不會保持一致。您可以將這個選項設為 true,確保不同機器的結果一致。
標記:terminal_output
--show_config_fragments=<off, direct or transitive>
預設值:「off」-
顯示規則及其遞移依附元件所需的設定片段。這項功能有助於評估可修剪的目標圖形量。
標記:affects_outputs
--starlark:expr=<a string>
預設值:「」-
Starlark 運算式,用於在 cquery 的 --output=starlark 模式中,格式化每個已設定的目標。設定的目標會繫結至「target」。如果未指定 --starlark:expr 或 --starlark:file,這個選項會預設為「str(target.label)」。同時指定 --starlark:expr 和 --starlark:file 是錯誤的。
標記:terminal_output
--starlark:file=<a string>
預設值:「」-
定義名為「format」的 Starlark 函式 (一個引數) 的檔案名稱,該函式會套用至每個已設定的目標,並將其格式化為字串。同時指定 --starlark:expr 和 --starlark:file 是錯誤的做法。如需更多詳細資料,請參閱 --output=starlark 的說明。
標記:terminal_output
--[no]tool_deps
預設值:「true」-
查詢:如果停用,查詢作業的依附元件圖表就不會納入「執行設定」的依附元件。「執行設定」依附元件邊緣 (例如從任何「proto_library」規則到通訊協定編譯器) 通常是指在建構期間執行的工具,而不是相同「目標」程式的一部分。Cquery:如果停用,會篩除所有已設定的目標,這些目標會從發現這個已設定目標的頂層目標,跨越執行轉換。也就是說,如果頂層目標位於目標設定中,系統只會傳回目標設定中已設定的目標。如果頂層目標位於執行設定中,系統只會傳回已設定的執行目標。這個選項「不會」排除已解決的工具鍊。
標記:build_file_semantics
--transitions=<full, lite or none>
預設值:「none」-
cquery 列印轉換資訊的格式。
標記:affects_outputs
--universe_scope=<comma-separated list of options>
預設值:「」-
以逗號分隔的目標模式集 (加法和減法)。查詢可能會在指定目標的遞移閉包所定義的範圍內執行。這個選項適用於 query 和 cquery 指令。
如果是 cquery,這個選項的輸入內容是所有答案的建構目標,因此這個選項可能會影響設定和轉換。如未指定這個選項,系統會假設頂層目標是從查詢運算式剖析的目標。注意:如果是 cquery,如果從查詢運算式剖析的目標無法使用頂層選項建構,則不指定這個選項可能會導致建構作業中斷。
標記:loading_and_analysis
- 控制建構執行的選項:
--[no]experimental_inprocess_symlink_creation
預設值:「true」-
是否要直接呼叫檔案系統來建立符號連結樹狀結構,而不是委派給輔助程序。
標籤:loading_and_analysis
、execution
、experimental
--[no]experimental_persistent_aar_extractor
預設值:「false」-
使用 Worker 啟用持續性 AAR 擷取器。
標記:execution
、experimental
--[no]experimental_remotable_source_manifests
預設值:「false」-
是否要讓來源資訊清單動作可遠端執行
標記:loading_and_analysis
、execution
、experimental
--[no]experimental_split_coverage_postprocessing
預設值:「false」-
如果為 true,Bazel 會在新衍生程序中執行測試的涵蓋範圍後續處理作業。
標記:execution
、experimental
--[no]experimental_strict_fileset_output
預設值:「false」-
如果啟用這個選項,檔案集會將所有輸出構件視為一般檔案。不會遍歷目錄或對符號連結敏感。
標記:execution
、experimental
--[no]incompatible_modify_execution_info_additive
預設值:「false」-
啟用後,傳遞多個 --modify_execution_info 標記會產生加成效果。停用時,系統只會考量最後一個旗標。
標記:execution
、affects_outputs
、loading_and_analysis
、incompatible_change
--modify_execution_info=<regex=[+-]key,regex=[+-]key,...>
累積多次使用-
根據動作助記符,在動作的執行資訊中新增或移除鍵。僅適用於支援執行資訊的動作。許多常見動作都支援執行資訊,例如 Genrule、CppCompile、Javac、StarlarkAction、TestRunner。指定多個值時,順序很重要,因為許多正則運算式可能會套用至相同助記符。
語法:「regex=[+-]key,regex=[+-]key,...」。
範例:
「.*=+x,.*=-y,.*=+z」會將「x」和「z」新增至所有動作的執行資訊,並從中移除「y」。
「Genrule=+requires-x」會將「requires-x」新增至所有 Genrule 動作的執行資訊。
'(?!Genrule).*=-requires-x' 會從所有非 Genrule 動作的執行資訊中移除 'requires-x'。
標籤:execution
、affects_outputs
、loading_and_analysis
--persistent_android_dex_desugar
-
使用 Worker 啟用持續性 Android dex 和 desugar 動作。
展開後:
--internal_persistent_android_dex_desugar
--strategy=Desugar=worker
--strategy=DexBuilder=worker
標記:host_machine_resource_optimizations
、execution
--persistent_android_resource_processor
-
使用 Worker 啟用永久性 Android 資源處理器。
展開後:
--internal_persistent_busybox_tools
--strategy=AaptPackage=worker
--strategy=AndroidResourceParser=worker
--strategy=AndroidResourceValidator=worker
--strategy=AndroidResourceCompiler=worker
--strategy=RClassGenerator=worker
--strategy=AndroidResourceLink=worker
--strategy=AndroidAapt2=worker
--strategy=AndroidAssetMerger=worker
--strategy=AndroidResourceMerger=worker
--strategy=AndroidCompiledResourceMerger=worker
--strategy=ManifestMerger=worker
--strategy=AndroidManifestMerger=worker
--strategy=Aapt2Optimize=worker
--strategy=AARGenerator=worker
--strategy=ProcessDatabinding=worker
--strategy=GenerateDataBindingBaseClasses=worker
標記:host_machine_resource_optimizations
、execution
--persistent_multiplex_android_dex_desugar
-
使用 Worker 啟用持續性多工 Android dex 和 desugar 動作。
展開後會顯示:
--persistent_android_dex_desugar
--internal_persistent_multiplex_android_dex_desugar
標記:host_machine_resource_optimizations
、execution
--persistent_multiplex_android_resource_processor
-
使用工作人員啟用持續性多工 Android 資源處理器。
展開後:
--persistent_android_resource_processor
--modify_execution_info=AaptPackage=+supports-multiplex-workers
--modify_execution_info=AndroidResourceParser=+supports-multiplex-workers
--modify_execution_info=AndroidResourceValidator=+supports-multiplex-workers
--modify_execution_info=AndroidResourceCompiler=+supports-multiplex-workers
--modify_execution_info=RClassGenerator=+supports-multiplex-workers
--modify_execution_info=AndroidResourceLink=+supports-multiplex-workers
--modify_execution_info=AndroidAapt2=+supports-multiplex-workers
--modify_execution_info=AndroidAssetMerger=+supports-multiplex-workers
--modify_execution_info=AndroidResourceMerger=+supports-multiplex-workers
--modify_execution_info=AndroidCompiledResourceMerger=+supports-multiplex-workers
--modify_execution_info=ManifestMerger=+supports-multiplex-workers
--modify_execution_info=AndroidManifestMerger=+supports-multiplex-workers
--modify_execution_info=Aapt2Optimize=+supports-multiplex-workers
--modify_execution_info=AARGenerator=+supports-multiplex-workers
標記:host_machine_resource_optimizations
、execution
--persistent_multiplex_android_tools
-
啟用持續性及多工 Android 工具 (dexing、desugaring、資源處理)。
展開後:
--internal_persistent_multiplex_busybox_tools
--persistent_multiplex_android_resource_processor
--persistent_multiplex_android_dex_desugar
標記:host_machine_resource_optimizations
、execution
--[no]use_target_platform_for_tests
預設值:「false」-
如果為 true,Bazel 會使用目標平台執行測試,而非測試執行群組。
標記:execution
- 設定用於執行動作的工具鍊選項:
--android_compiler=<a string>
預設值:請參閱說明-
Android 目標編譯器。
標籤:affects_outputs
、loading_and_analysis
、loses_incremental_state
--android_manifest_merger=<legacy, android or force_android>
預設值:「android」-
選取要用於 android_binary 規則的資訊清單合併工具。這個標記可協助從舊版合併工具轉換至 Android 資訊清單合併工具。
標籤:affects_outputs
、loading_and_analysis
、loses_incremental_state
--android_platforms=<a build target label>
預設值:「」-
設定 android_binary 目標使用的平台。如果指定多個平台,則二進位檔為笨重的 APK,其中包含每個指定目標平台的原生二進位檔。
標籤:changes_inputs
、loading_and_analysis
、loses_incremental_state
--apple_crosstool_top=<a build target label>
default: "@bazel_tools//tools/cpp:toolchain"-
要在 Apple 和 Objc 規則及其依附元件中使用的 crosstool 套件標籤。
標記:loses_incremental_state
、changes_inputs
--cc_output_directory_tag=<a string>
預設值:「」-
指定要加到設定目錄的後置字串。
標記:affects_outputs
--compiler=<a string>
預設值:請參閱說明-
用於編譯目標的 C++ 編譯器。
標記:loading_and_analysis
、execution
--coverage_output_generator=<a build target label>
default: "@bazel_tools//tools/test:lcov_merger"-
用於後續處理原始涵蓋範圍報表的二進位檔位置。目前必須是包含單一檔案 (二進位檔) 的檔案群組。預設值為「//tools/test:lcov_merger」。
標籤:changes_inputs
、affects_outputs
、loading_and_analysis
--coverage_report_generator=<a build target label>
預設值:「@bazel_tools//tools/test:coverage_report_generator」-
用於產生涵蓋範圍報表的二進位檔位置。目前必須是包含單一檔案 (二進位檔) 的檔案群組。預設值為「//tools/test:coverage_report_generator」。
標籤:changes_inputs
、affects_outputs
、loading_and_analysis
--coverage_support=<a build target label>
預設值:「@bazel_tools//tools/test:coverage_support」-
每個收集程式碼涵蓋範圍的測試動作輸入內容中,所需支援檔案的位置。預設值為「//tools/test:coverage_support」。
標籤:changes_inputs
、affects_outputs
、loading_and_analysis
--custom_malloc=<a build target label>
預設值:請參閱說明-
指定自訂 malloc 實作項目。這項設定會覆寫建構規則中的 malloc 屬性。
標記:changes_inputs
、affects_outputs
--experimental_add_exec_constraints_to_targets=<a '<RegexFilter>=<label1>[,<label2>,...]' assignment>
累積多次使用-
以逗號分隔的規則運算式清單,每個運算式可選擇性加上前置字元「-」(負運算式),並以「=」指派給以逗號分隔的限制值目標清單。如果目標與任何負運算式都不相符,但與至少一個正運算式相符,工具鍊解析就會執行,就像目標已將限制值宣告為執行限制一樣。範例://demo,-test=@platforms//cpus:x86_64 會將「x86_64」新增至 //demo 下的所有目標,但名稱包含「test」的目標除外。
標記:loading_and_analysis
--[no]experimental_include_xcode_execution_requirements
預設值:「false」-
如果已設定,請為每個 Xcode 動作新增「requires-xcode:{version}」執行需求。如果 Xcode 版本有連字號標籤,請一併新增「requires-xcode-label:{version_label}」執行需求。
標記:loses_incremental_state
、loading_and_analysis
、execution
、experimental
--[no]experimental_prefer_mutual_xcode
預設值:「true」-
如果為 true,請使用本機和遠端可用的最新 Xcode。如果為 false,或沒有可用的共同版本,請使用透過 xcode-select 選取的本機 Xcode 版本。
標記:loses_incremental_state
、experimental
--extra_execution_platforms=<comma-separated list of options>
預設值:「」-
可做為執行平台來執行動作的平台。平台可以指定為確切目標,或指定為目標模式。系統會優先考慮這些平台,再考慮 register_execution_platforms() 在 WORKSPACE 檔案中宣告的平台。這個選項只能設定一次,後續的例項會覆寫先前的標記設定。
標記:execution
--extra_toolchains=<comma-separated list of options>
累積多次使用-
工具鍊解析期間要考慮的工具鍊規則。工具鍊可指定為確切目標,或目標模式。系統會優先考量這些工具鍊,再考量由 register_toolchains() 在 WORKSPACE 檔案中宣告的工具鍊。
標記:affects_outputs
、changes_inputs
、loading_and_analysis
--grte_top=<a label>
預設值:請參閱說明-
已簽入 libc 程式庫的標籤。預設值是由 crosstool 工具鍊選取,您幾乎不需要覆寫這個值。
標記:action_command_lines
、affects_outputs
--host_compiler=<a string>
預設值:請參閱說明-
無作業旗標。將在日後推出的版本中移除。
標記:loading_and_analysis
、execution
--host_grte_top=<a label>
預設值:請參閱說明-
如果指定,這項設定會覆寫 exec 設定的 libc 頂層目錄 (--grte_top)。
標記:action_command_lines
、affects_outputs
--host_platform=<a build target label>
default: "@bazel_tools//tools:host_platform"-
平台規則的標籤,用於說明主機系統。
標籤:affects_outputs
、changes_inputs
、loading_and_analysis
--[no]incompatible_bazel_test_exec_run_under
預設值:「false」-
如果啟用,系統會在執行設定中建構「bazel test --run_under=//:runner」的「//:runner」。如果停用,系統會在目標設定中建構「//:runner」。Bazel 會在執行機器上執行測試,因此前者較為正確。這不會影響「bazel run」,因為「bazel run」一律會在目標設定中建構「`--run_under=//foo」。
標記:affects_outputs
、incompatible_change
--[no]incompatible_dont_enable_host_nonhost_crosstool_features
預設值:「true」-
如果為 true,Bazel 將不會在 C++ 工具鍊中啟用「主機」和「非主機」功能 (詳情請參閱 https://github.com/bazelbuild/bazel/issues/7407)。
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_enable_apple_toolchain_resolution
預設值:「false」-
使用工具鍊解析度,為 Apple 規則 (Starlark 和原生) 選取 Apple SDK
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_remove_legacy_whole_archive
預設值:「true」-
如果為 true,Bazel 預設不會將程式庫依附元件連結為整個封存檔 (如需遷移操作說明,請參閱 https://github.com/bazelbuild/bazel/issues/7362)。
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_strip_executable_safely
預設值:「false」-
如為 true,可執行檔的 strip 動作會使用 -x 標記,不會中斷動態符號解析。
標記:action_command_lines
、incompatible_change
-
如果工具鍊支援,請使用介面共用物件。目前所有 ELF 工具鍊都支援這項設定。
標籤:loading_and_analysis
、affects_outputs
、affects_outputs
--ios_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
指定用於建構 iOS 應用程式的 iOS SDK 版本。如未指定,則會使用「xcode_version」中的預設 iOS SDK 版本。
標記:loses_incremental_state
--macos_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
指定用於建構 macOS 應用程式的 macOS SDK 版本。如未指定,則會使用「xcode_version」中的預設 macOS SDK 版本。
標記:loses_incremental_state
--minimum_os_version=<a string>
預設值:請參閱說明-
編譯目標的最低作業系統版本。
標記:loading_and_analysis
、affects_outputs
--platform_mappings=<a main workspace-relative path>
預設值:「」-
對應檔案的位置,用於說明在未設定平台時要使用哪個平台,或是在平台已存在時要設定哪些旗標。必須相對於主要工作區根目錄。預設值為「platform_mappings」(工作區根目錄下的檔案)。
標記:affects_outputs
、changes_inputs
、loading_and_analysis
、immutable
--platforms=<a build target label>
預設值:「」-
平台規則的標籤,說明目前指令的目標平台。
標籤:affects_outputs
、changes_inputs
、loading_and_analysis
--python_path=<a string>
預設值:請參閱說明-
在目標平台上執行 Python 目標時,所叫用的 Python 解譯器絕對路徑。已淘汰;由 --incompatible_use_python_toolchains 停用。
標記:loading_and_analysis
、affects_outputs
--python_top=<a build target label>
預設值:請參閱說明-
代表 Python 解譯器的 py_runtime 標籤,用於在目標平台上執行 Python 目標。已淘汰;由 --incompatible_use_python_toolchains 停用。
標記:loading_and_analysis
、affects_outputs
--tvos_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
指定用於建構 tvOS 應用程式的 tvOS SDK 版本。如未指定,則會使用「xcode_version」中的預設 tvOS SDK 版本。
標記:loses_incremental_state
--watchos_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
指定用於建構 watchOS 應用程式的 watchOS SDK 版本。如未指定,則會使用「xcode_version」中的預設 watchOS SDK 版本。
標記:loses_incremental_state
--xcode_version=<a string>
預設值:請參閱說明-
如果指定,則會使用指定版本的 Xcode 執行相關建構動作。如未指定,則會使用 Xcode 的執行器預設版本。
標記:loses_incremental_state
--xcode_version_config=<a build target label>
default: "@bazel_tools//tools/cpp:host_xcodes"-
用於在建構設定中選取 Xcode 版本的 xcode_config 規則標籤。
標記:loses_incremental_state
、loading_and_analysis
- 控管指令輸出的選項:
--[no]apple_generate_dsym
預設值:「false」-
是否要產生偵錯符號 (.dSYM) 檔案。
標記:affects_outputs
、action_command_lines
--[no]build_runfile_links
預設值:「true」-
如果為 true,則為所有目標建構 Runfile 符號連結樹狀結構。 如果為 false,則只有在本地動作、測試或執行指令需要時,才會寫入這些檔案。
標記:affects_outputs
--[no]build_runfile_manifests
預設值:「true」-
如果是 true,則為所有目標編寫執行檔資訊清單。如果為 false,請省略這些屬性。如果為 false,本機測試將無法執行。
標記:affects_outputs
--[no]build_test_dwp
預設值:「false」-
如果啟用這項功能,系統會以靜態方式建構 C++ 測試,並使用 fission,自動建構測試二進位檔的 .dwp 檔案。
標記:loading_and_analysis
、affects_outputs
--cc_proto_library_header_suffixes=<comma-separated set of options>
預設值:「.pb.h」-
設定 cc_proto_library 建立的標頭檔案後置字元。
標記:affects_outputs
、loading_and_analysis
--cc_proto_library_source_suffixes=<comma-separated set of options>
預設值:「.pb.cc」-
設定 cc_proto_library 建立的來源檔案後置字元。
標記:affects_outputs
、loading_and_analysis
--[no]experimental_proto_descriptor_sets_include_source_info
預設值:「false」-
在 proto_library 中,針對替代的 Java API 版本執行額外動作。
標籤:affects_outputs
、loading_and_analysis
、experimental
--[no]experimental_save_feature_state
預設值:「false」-
將已啟用和要求的特徵狀態儲存為編譯輸出內容。
標記:affects_outputs
、experimental
--fission=<a set of compilation modes>
預設值:「no」-
指定哪些編譯模式會使用分裂功能進行 C++ 編譯和連結。可以是 {'fastbuild'、'dbg'、'opt'} 的任意組合,也可以是特殊值 'yes' (啟用所有模式) 和 'no' (停用所有模式)。
標籤:loading_and_analysis
、action_command_lines
、affects_outputs
--[no]incompatible_always_include_files_in_data
預設值:「true」-
如果是 true,原生規則會將資料依附元件的 <code>DefaultInfo.files</code> 新增至執行檔,這與 Starlark 規則的建議行為相符 (https://bazel.build/extending/rules#runfiles_features_to_avoid)。
標記:affects_outputs
、incompatible_change
--[no]legacy_external_runfiles
預設值:「false」-
如果為 true,請為 .runfiles/repo 底下的外部存放區建構執行檔案符號連結樹狀結構 (除了 .runfiles/repo 以外)。
標記:affects_outputs
--[no]objc_generate_linkmap
預設值:「false」-
指定是否要產生連結對應檔案。
標記:affects_outputs
--[no]save_temps
預設值:「false」-
如果設定,系統會儲存 gcc 的暫時輸出內容。包括 .s 檔案 (組語程式碼)、.i 檔案 (前置處理的 C) 和 .ii 檔案 (前置處理的 C++)。
標記:affects_outputs
- 可讓使用者設定預期輸出內容的選項,影響輸出內容的值,而非輸出內容是否存在:
--action_env=<a 'name=value' assignment with an optional value part>
累積多次使用-
指定可供具有目標設定的動作使用的環境變數集。變數可以依名稱指定 (此時值會取自叫用環境),也可以依名稱=值組合指定 (此時值會獨立於叫用環境)。這個選項可以多次使用;如果是相同變數的選項,系統會採用最新的選項,如果是不同變數的選項,則會累加。
標記:action_command_lines
--allowed_cpu_values=<comma-separated set of options>
預設值:「」-
--cpu 標記的允許值。
標記:changes_inputs
、affects_outputs
--[no]android_databinding_use_androidx
預設值:「true」-
產生與 AndroidX 相容的資料繫結檔案。這項功能僅適用於資料繫結 v2。這個旗標是無運算。
標記:affects_outputs
、loading_and_analysis
、loses_incremental_state
、experimental
--[no]android_databinding_use_v3_4_args
預設值:「true」-
使用 3.4.0 引數搭配 Android 資料繫結 v2。這個旗標是無運算。
標記:affects_outputs
、loading_and_analysis
、loses_incremental_state
、experimental
--android_dynamic_mode=<off, default or fully>
預設值:「off」-
判斷 cc_binary 未明確建立共用程式庫時,是否要動態連結 Android 規則的 C++ 依附元件。「default」表示 Bazel 會選擇是否要動態連結。「完全」表示所有程式庫都會動態連結。「off」表示所有程式庫都會以靜態模式連結。
標記:affects_outputs
、loading_and_analysis
--android_manifest_merger_order=<alphabetical, alphabetical_by_configuration or dependency>
預設值:「alphabetical」-
設定傳遞至 Android 二進位檔資訊清單合併工具的資訊清單順序。ALPHABETICAL 表示資訊清單會依據相對於 execroot 的路徑排序。ALPHABETICAL_BY_CONFIGURATION 表示資訊清單會依路徑排序,路徑是相對於輸出目錄中的設定目錄。DEPENDENCY 表示資訊清單的排序方式為:每個程式庫的資訊清單會出現在其依附元件的資訊清單之前。
標記:action_command_lines
、execution
--[no]android_resource_shrinking
預設值:「false」-
為使用 ProGuard 的 android_binary APK 啟用資源壓縮功能。
標記:affects_outputs
、loading_and_analysis
--[no]build_python_zip
預設值:「auto」-
建構 Python 可執行檔 ZIP;在 Windows 上為開啟,在其他平台上為關閉
標記:affects_outputs
--catalyst_cpus=<comma-separated list of options>
累積多次使用-
以半形逗號分隔的架構清單,用於建構 Apple Catalyst 二進位檔。
標記:loses_incremental_state
、loading_and_analysis
--[no]collect_code_coverage
預設值:「false」-
如果指定,Bazel 會檢測程式碼 (盡可能使用離線檢測),並在測試期間收集涵蓋範圍資訊。只有符合 --instrumentation_filter 的目標會受到影響。通常不應直接指定這個選項,而是應使用「bazel coverage」指令。
標記:affects_outputs
--compilation_mode=<fastbuild, dbg or opt>
[-c
] 預設值:「fastbuild」-
指定建構二進位檔的模式。值:「fastbuild」、「dbg」、「opt」。
標記:affects_outputs
、action_command_lines
--conlyopt=<a string>
累積多次使用-
編譯 C 來源檔案時,要傳遞至 gcc 的其他選項。
標記:action_command_lines
、affects_outputs
--copt=<a string>
累積多次使用-
要傳遞至 gcc 的其他選項。
標記:action_command_lines
、affects_outputs
--cpu=<a string>
預設值:「」-
目標 CPU。
標記:changes_inputs
、affects_outputs
--cs_fdo_absolute_path=<a string>
預設值:請參閱說明-
使用 CSFDO 設定檔資訊,盡可能改良編譯作業。指定包含設定檔、原始或已編列索引 LLVM 設定檔的 zip 檔絕對路徑名稱。
標記:affects_outputs
--cs_fdo_instrument=<a string>
預設值:請參閱說明-
使用情境感應 FDO 檢測功能產生二進位檔。使用 Clang/LLVM 編譯器時,系統也會接受目錄名稱,執行階段會將原始設定檔傾印至該目錄。
標記:affects_outputs
--cs_fdo_profile=<a build target label>
預設值:請參閱說明-
代表要用於最佳化的內容相關設定檔的 cs_fdo_profile。
標記:affects_outputs
--cxxopt=<a string>
累積多次使用-
編譯 C++ 來源檔案時,要傳遞至 gcc 的其他選項。
標記:action_command_lines
、affects_outputs
--define=<a 'name=value' assignment>
累積多次使用-
每個 --define 選項都會指定建構變數的指派作業。如果變數有多個值,則最後一個值會勝出。
標記:changes_inputs
、affects_outputs
--dynamic_mode=<off, default or fully>
預設值:「default」-
決定是否要動態連結 C++ 二進位檔。 「default」表示 Bazel 會選擇是否要動態連結。「完全」表示所有程式庫都會動態連結。「off」表示所有程式庫都會以靜態模式連結。
標記:loading_and_analysis
、affects_outputs
--[no]enable_propeller_optimize_absolute_paths
預設值:「true」-
如果已設定,任何使用螺旋槳最佳化絕對路徑的行為都會引發錯誤。
標記:affects_outputs
--[no]enable_remaining_fdo_absolute_paths
預設值:「true」-
如果設定,使用 FDO 的絕對路徑時會引發錯誤。
標記:affects_outputs
--[no]enable_runfiles
預設值:「auto」-
啟用 Runfiles 符號連結樹狀結構;預設為在 Windows 上關閉,在其他平台上開啟。
標記:affects_outputs
--experimental_action_listener=<a build target label>
累積多次使用-
已淘汰,請改用切面。使用 action_listener 將 extra_action 附加至現有的建構動作。
標記:execution
、experimental
--[no]experimental_android_compress_java_resources
預設值:「false」-
壓縮 APK 中的 Java 資源
標記:affects_outputs
、loading_and_analysis
、experimental
--[no]experimental_android_databinding_v2
預設值:「true」-
使用 Android 資料繫結 v2。這個旗標是無運算。
標記:affects_outputs
、loading_and_analysis
、loses_incremental_state
、experimental
--[no]experimental_android_resource_shrinking
預設值:「false」-
為使用 ProGuard 的 android_binary APK 啟用資源壓縮功能。
標籤:affects_outputs
、loading_and_analysis
、experimental
--[no]experimental_android_rewrite_dexes_with_rex
預設值:「false」-
use rex tool to rewrite dex files
標記:affects_outputs
、loading_and_analysis
、loses_incremental_state
、experimental
--[no]experimental_collect_code_coverage_for_generated_files
預設值:「false」-
如有指定,Bazel 也會為產生的檔案產生收集涵蓋範圍資訊。
標記:affects_outputs
、experimental
--experimental_objc_fastbuild_options=<comma-separated list of options>
預設值:「-O0,-DDEBUG=1」-
將這些字串做為 objc 快速建構編譯器選項。
標記:action_command_lines
--[no]experimental_omitfp
預設值:「false」-
如果設為 true,則使用 libunwind 進行堆疊解除,並使用 -fomit-frame-pointer 和 -fasynchronous-unwind-tables 進行編譯。
標籤:action_command_lines
、affects_outputs
、experimental
--experimental_output_paths=<off, content or strip>
預設值:「off」-
輸出樹狀結構規則應使用哪個模型來寫入輸出內容,特別是針對多平台 / 多設定建構作業。這項功能仍在實驗階段,詳情請參閱 https://github.com/bazelbuild/bazel/issues/6526。如要選擇加入路徑對應,請將「supports-path-mapping」鍵新增至「execution_requirements」字典。
標記:loses_incremental_state
、bazel_internal_configuration
、affects_outputs
、execution
--experimental_override_name_platform_in_output_dir=<a 'label=value' assignment>
累積多次使用-
每個項目都應採用 label=value 格式,其中 label 是指平台,value 則是要在輸出路徑中使用的所需簡短名稱。只有在 --experimental_platform_in_output_dir 為 true 時才會使用。命名優先順序最高。
標記:affects_outputs
、experimental
--[no]experimental_platform_in_output_dir
預設值:「false」-
如果為 true,輸出目錄名稱會使用目標平台的簡短名稱,而非 CPU。確切的架構是實驗性質,可能會有所變更:首先,如果 --platforms 選項沒有剛好一個值,系統會使用平台選項的雜湊。接著,如果目前平台有任何簡稱是透過 --experimental_override_name_platform_in_output_dir 登錄,系統就會使用該簡稱。然後,如果設定了 --experimental_use_platforms_in_output_dir_legacy_heuristic,請使用以目前平台標籤為準的簡短名稱。最後,平台選項的雜湊會做為最後手段。
標記:affects_outputs
、experimental
--[no]experimental_py_binaries_include_label
預設值:「false」-
即使停用蓋章功能,py_binary 目標仍會包含標籤。
標記:affects_outputs
、experimental
--[no]experimental_use_llvm_covmap
預設值:「false」-
如果指定,啟用 collect_code_coverage 時,Bazel 會產生 llvm-cov 涵蓋範圍對應資訊,而不是 gcov。
標記:changes_inputs
、affects_outputs
、loading_and_analysis
、experimental
--[no]experimental_use_platforms_in_output_dir_legacy_heuristic
預設值:「true」-
請僅在建議的遷移或測試策略中使用這個標記。請注意,這個啟發式方法有已知缺點,建議改為只依賴 --experimental_override_name_platform_in_output_dir。
標記:affects_outputs
、experimental
--fdo_instrument=<a string>
預設值:請參閱說明-
使用 FDO 檢測生成二進位檔。使用 Clang/LLVM 編譯器時,系統也會接受目錄名稱,執行階段會將原始設定檔傾印至該目錄。
標記:affects_outputs
--fdo_optimize=<a string>
預設值:請參閱說明-
使用 FDO 設定檔資訊,最佳化編譯作業。指定包含 .gcda 檔案樹狀結構、包含自動設定檔的 afdo 檔案,或 LLVM 設定檔檔案的 ZIP 檔案名稱。這個旗標也接受指定為標籤的檔案 (例如 `//foo/bar:file.afdo` - 您可能需要在對應的套件中新增 `exports_files` 指令),以及指向 `fdo_profile` 目標的標籤。這項標記會由 `fdo_profile` 規則取代。
標記:affects_outputs
--fdo_prefetch_hints=<a build target label>
預設值:請參閱說明-
使用快取預先擷取提示。
標記:affects_outputs
--fdo_profile=<a build target label>
預設值:請參閱說明-
代表用於最佳化的設定檔。
標記:affects_outputs
--features=<a string>
累積多次使用-
系統會根據目標設定,預設啟用或停用目標中建構的指定功能。指定 -<feature> 會停用該功能。負面特徵一律會覆寫正面特徵。另請參閱 --host_features
標記:changes_inputs
、affects_outputs
--[no]force_pic
預設值:「false」-
啟用後,所有 C++ 編譯作業都會產生與位置無關的程式碼 (「-fPIC」),連結會優先使用 PIC 預先建構的程式庫,而非非 PIC 程式庫,且連結會產生與位置無關的可執行檔 (「-pie」)。
標記:loading_and_analysis
、affects_outputs
--host_action_env=<a 'name=value' assignment with an optional value part>
累積多次使用-
指定可供具有執行設定的動作使用的環境變數集。變數可以依名稱指定 (此時值會取自叫用環境),也可以依名稱=值組合指定 (此時值會獨立於叫用環境)。這個選項可以多次使用;如果是相同變數的選項,系統會採用最新的選項,如果是不同變數的選項,則會累加。
標記:action_command_lines
--host_compilation_mode=<fastbuild, dbg or opt>
預設值:「opt」-
指定建構期間使用的工具建構模式。值:「fastbuild」、「dbg」、「opt」。
標記:affects_outputs
、action_command_lines
--host_conlyopt=<a string>
累積多次使用-
在 exec 設定中編譯 C (而非 C++) 來源檔案時,要傳遞至 C 編譯器的其他選項。
標記:action_command_lines
、affects_outputs
--host_copt=<a string>
累積多次使用-
要傳遞至 C 編譯器的其他選項,適用於在 exec 設定中建構的工具。
標記:action_command_lines
、affects_outputs
--host_cpu=<a string>
預設值:「」-
主機 CPU。
標記:changes_inputs
、affects_outputs
--host_cxxopt=<a string>
累積多次使用-
要傳遞至 C++ 編譯器的其他選項,適用於在 exec 設定中建構的工具。
標記:action_command_lines
、affects_outputs
--host_features=<a string>
累積多次使用-
系統會為在執行設定中建構的目標,預設啟用或停用指定功能。指定 -<feature> 會停用該功能。負面特徵一律會覆寫正面特徵。
標記:changes_inputs
、affects_outputs
--host_force_python=<PY2 or PY3>
預設值:請參閱說明-
覆寫執行設定的 Python 版本。可以是「PY2」或「PY3」。
標記:loading_and_analysis
、affects_outputs
--host_linkopt=<a string>
累積多次使用-
在執行設定中連結工具時,傳遞至連結器的其他選項。
標記:action_command_lines
、affects_outputs
--host_macos_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
主機目標的最低相容 macOS 版本。如未指定,則會使用「macos_sdk_version」。
標記:loses_incremental_state
--host_per_file_copt=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths followed by an @ and a comma separated list of options>
累積多次使用-
在執行設定中編譯特定檔案時,選擇性傳遞至 C/C++ 編譯器的其他選項。這個選項可以多次傳遞。語法:regex_filter@option_1,option_2,...,option_n。其中 regex_filter 代表包含和排除規則運算式模式的清單 (另請參閱 --instrumentation_filter)。option_1 到 option_n 代表任意指令列選項。如果選項含有半形逗號,則必須以反斜線加上引號。選項可以包含 @。系統只會使用第一個 @ 分割字串。範例:--host_per_file_copt=//foo/.*\.cc,-//foo/bar\.cc@-O0 會將 -O0 指令列選項新增至 //foo/ 中所有 cc 檔案的 gcc 指令列,但 bar.cc 除外。
標記:action_command_lines
、affects_outputs
--[no]incompatible_auto_exec_groups
預設值:「false」-
啟用後,系統會為規則使用的每個工具鍊自動建立執行群組。如要讓這項規則運作,必須在動作中指定 `toolchain` 參數。詳情請參閱 https://github.com/bazelbuild/bazel/issues/17134。
標記:affects_outputs
、incompatible_change
--[no]incompatible_merge_genfiles_directory
預設值:「true」-
如果是 true,genfiles 目錄會摺疊到 bin 目錄中。
標記:affects_outputs
、incompatible_change
--[no]instrument_test_targets
預設值:「false」-
啟用涵蓋範圍時,指定是否要考慮插樁測試規則。設定後,--instrumentation_filter 包含的測試規則會經過檢測。否則,測試規則一律會從涵蓋範圍插樁中排除。
標記:affects_outputs
--instrumentation_filter=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths>
default: "-/javatests[/:],-/test/java[/:]"-
啟用涵蓋範圍後,系統只會檢測名稱符合指定 regex 篩選器的規則。以「-」為前置字元的規則則會遭到排除。請注意,除非啟用 --instrument_test_targets,否則系統只會檢測非測試規則。
標記:affects_outputs
--ios_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
目標模擬器和裝置的最低相容 iOS 版本。如未指定,則使用「ios_sdk_version」。
標記:loses_incremental_state
--ios_multi_cpus=<comma-separated list of options>
累積多次使用-
以半形逗號分隔的架構清單,用於建構 ios_application。結果是包含所有指定架構的通用二進位檔。
標記:loses_incremental_state
、loading_and_analysis
--[no]legacy_whole_archive
預設值:「true」-
已淘汰,由 --incompatible_remove_legacy_whole_archive 取代 (詳情請參閱 https://github.com/bazelbuild/bazel/issues/7362)。開啟後,請為具有 linkshared=True,且 linkopts 中有 linkstatic=True 或「-static」的 cc_binary 規則使用 --whole-archive。這項功能僅適用於回溯相容性。更好的替代方案是在必要時使用 alwayslink=1。
標籤:action_command_lines
、affects_outputs
、deprecated
--linkopt=<a string>
累積多次使用-
連結時傳遞至 gcc 的其他選項。
標記:action_command_lines
、affects_outputs
--ltobackendopt=<a string>
累積多次使用-
傳遞至 LTO 後端步驟的其他選項 (位於 --features=thin_lto 下)。
標記:action_command_lines
、affects_outputs
--ltoindexopt=<a string>
累積多次使用-
可傳遞至 LTO 索引步驟的其他選項 (位於 --features=thin_lto 下)。
標記:action_command_lines
、affects_outputs
--macos_cpus=<comma-separated list of options>
累積多次使用-
要建構 Apple macOS 二進位檔的架構清單 (以半形逗號分隔)。
標記:loses_incremental_state
、loading_and_analysis
--macos_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
目標的最低相容 macOS 版本。如未指定,則會使用「macos_sdk_version」。
標記:loses_incremental_state
--memprof_profile=<a build target label>
預設值:請參閱說明-
使用 memprof 設定檔。
標記:affects_outputs
--[no]objc_debug_with_GLIBCXX
預設值:「false」-
如果已設定,且編譯模式設為「dbg」,請定義 GLIBCXX_DEBUG、GLIBCXX_DEBUG_PEDANTIC 和 GLIBCPP_CONCEPT_CHECKS。
標記:action_command_lines
--[no]objc_enable_binary_stripping
預設值:「false」-
是否要對連結的二進位檔執行符號和無效程式碼剝除作業。如果同時指定這個旗標和 --compilation_mode=opt,系統就會執行二進位檔剝除作業。
標記:action_command_lines
--objccopt=<a string>
累積多次使用-
編譯 Objective-C/C++ 來源檔案時,要傳遞給 gcc 的其他選項。
標記: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>
累積多次使用-
編譯特定檔案時,可選擇性傳遞至 gcc 的其他選項。這個選項可以多次傳遞。語法:regex_filter@option_1,option_2,...,option_n。其中 regex_filter 代表包含和排除規則運算式模式的清單 (另請參閱 --instrumentation_filter)。option_1 到 option_n 代表任意指令列選項。如果選項含有半形逗號,則必須以反斜線加上引號。選項可以包含 @。系統只會使用第一個 @ 分割字串。範例:--per_file_copt=//foo/.*\.cc,-//foo/bar\.cc@-O0 會將 -O0 指令列選項新增至 //foo/ 中所有 cc 檔案 (bar.cc 除外) 的 gcc 指令列。
標記: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>
累積多次使用-
編譯特定後端物件時,可選擇性傳遞至 LTO 後端的其他選項 (位於 --features=thin_lto 下)。這個選項可以多次傳遞。語法:regex_filter@option_1,option_2,...,option_n。其中 regex_filter 代表包含和排除規則運算式模式的清單,option_1 到 option_n 則代表任意指令列選項。如果選項含有半形逗號,則必須以反斜線加上引號。選項可以包含 @。系統只會使用第一個 @ 分割字串。範例:--per_file_ltobackendopt=//foo/.*\.o,-//foo/bar\.o@-O0 會將 -O0 指令列選項新增至 //foo/ 中所有 o 檔案 (bar.o 除外) 的 LTO 後端指令列。
標記:action_command_lines
、affects_outputs
--platform_suffix=<a string>
預設值:請參閱說明-
指定要加到設定目錄的後置字串。
標籤:loses_incremental_state
、affects_outputs
、loading_and_analysis
--propeller_optimize=<a build target label>
預設值:請參閱說明-
使用 Propeller 設定檔資訊,最佳化建構目標。Propeller 設定檔必須包含至少一個檔案,即 cc 設定檔和 ld 設定檔。這個標記接受建構標籤,該標籤必須參照螺旋槳設定檔輸入檔案。舉例來說,在 a/b/BUILD 中定義標籤的 BUILD 檔案:propeller_optimize( name = "propeller_profile", cc_profile = "propeller_cc_profile.txt", ld_profile = "propeller_ld_profile.txt",)可能必須將 exports_files 指令新增至對應的套件,才能讓 Bazel 看到這些檔案。這個選項必須做為下列項目使用:--propeller_optimize=//a/b:propeller_profile
標記:action_command_lines
、affects_outputs
--propeller_optimize_absolute_cc_profile=<a string>
預設值:請參閱說明-
Propeller 最佳化建構版本的 cc_profile 檔案絕對路徑名稱。
標記:affects_outputs
--propeller_optimize_absolute_ld_profile=<a string>
預設值:請參閱說明-
Propeller 最佳化建構版本的 ld_profile 檔案絕對路徑名稱。
標記:affects_outputs
--run_under=<a prefix in front of command>
預設值:請參閱說明-
要插入「test」和「run」指令可執行檔之前的字首。如果值為「foo -bar」,而執行指令列為「test_binary -baz」,則最終指令列為「foo -bar test_binary -baz」。這也可以是可執行目標的標籤。例如:'valgrind'、'strace'、'strace -c'、'valgrind --quiet --num-callers=20'、'//package:target'、'//package:target --options'。
標記:action_command_lines
-
如果為 true,不同目標之間會共用包含相同功能的原生程式庫。
標記:loading_and_analysis
、affects_outputs
--[no]stamp
預設值:「false」-
在二進位檔中蓋上日期、使用者名稱、主機名稱、工作區資訊等。
標記:affects_outputs
--strip=<always, sometimes or never>
預設值:「有時」-
指定是否要剝除二進位檔和共用程式庫 (使用「-Wl,--strip-debug」)。預設值「sometimes」表示僅在 --compilation_mode=fastbuild 時移除。
標記:affects_outputs
--stripopt=<a string>
累積多次使用-
產生 '<name>.stripped' 二進位檔時,要傳遞至 strip 的其他選項。
標記:action_command_lines
、affects_outputs
--tvos_cpus=<comma-separated list of options>
累積多次使用-
要建構 Apple tvOS 二進位檔的架構清單 (以半形逗號分隔)。
標記:loses_incremental_state
、loading_and_analysis
--tvos_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
目標模擬器和裝置的最低相容 tvOS 版本。如未指定,則會使用「tvos_sdk_version」。
標記:loses_incremental_state
--visionos_cpus=<comma-separated list of options>
累積多次使用-
要建構 Apple visionOS 二進位檔的架構清單 (以半形逗號分隔)。
標記:loses_incremental_state
、loading_and_analysis
--watchos_cpus=<comma-separated list of options>
累積多次使用-
以半形逗號分隔的架構清單,用於建構 Apple watchOS 二進位檔。
標記:loses_incremental_state
、loading_and_analysis
--watchos_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
目標模擬器和裝置的最低相容 watchOS 版本。如未指定,則會使用「watchos_sdk_version」。
標記:loses_incremental_state
--xbinary_fdo=<a build target label>
預設值:請參閱說明-
使用 XbinaryFDO 設定檔資訊,最佳化編譯作業。指定預設跨二進位檔設定檔的名稱。如果這個選項與 --fdo_instrument/--fdo_optimize/--fdo_profile 搭配使用,這些選項一律會優先採用,如同從未指定 xbinary_fdo 一樣。
標記:affects_outputs
- 影響 Bazel 嚴格程度的選項,可強制執行有效的建構輸入內容 (規則定義、旗標組合等):
--[no]check_licenses
預設值:「false」-
確認依附套件的授權限制不會與建構目標的發布模式衝突。根據預設,系統不會檢查授權。
標記:build_file_semantics
--[no]check_visibility
預設值:「true」-
如果停用,目標依附元件中的顯示設定錯誤會降級為警告。
標記:build_file_semantics
--[no]desugar_for_android
預設值:「true」-
是否要在 dexing 前脫糖 Java 8 位元碼。
標籤:affects_outputs
、loading_and_analysis
、loses_incremental_state
--[no]desugar_java8_libs
預設值:「false」-
是否要在舊版裝置的應用程式中加入支援的 Java 8 程式庫。
標記:affects_outputs
、loading_and_analysis
、loses_incremental_state
、experimental
--[no]enforce_constraints
預設值:「true」-
檢查每個目標相容的環境,並在任何目標有不支援相同環境的依附元件時回報錯誤。
標記:build_file_semantics
--[no]experimental_check_desugar_deps
預設值:「true」-
是否要在 Android 二進位層級重複檢查正確的解除糖化程序。
標籤:eagerness_to_exit
、loading_and_analysis
、experimental
--experimental_import_deps_checking=<a string>
預設值:請參閱說明-
無作業,僅為回溯相容性而保留
標記:loading_and_analysis
--experimental_one_version_enforcement=<off, warning or error>
預設值:「OFF」-
啟用後,系統會強制執行 java_binary 規則,確保類別路徑中不會包含相同類別檔案的多個版本。這項強制執行措施可能會導致建構作業中斷,或只是產生警告。
標記:loading_and_analysis
--experimental_strict_java_deps=<off, warn, error, strict or default>
預設值:「default」-
如果為 true,則檢查 Java 目標是否明確將所有直接使用的目標宣告為依附元件。
標記:build_file_semantics
、eagerness_to_exit
--[no]incompatible_check_testonly_for_output_files
預設值:「false」-
如果已啟用,請查閱產生規則的 testonly,找出輸出檔案的必要條件目標。這與可見度檢查相符。
標記:build_file_semantics
、incompatible_change
--[no]incompatible_check_visibility_for_toolchains
預設值:「false」-
如果啟用,可見度檢查也會套用至工具鍊實作項目。
標記:build_file_semantics
、incompatible_change
--[no]incompatible_disable_native_android_rules
預設值:「false」-
如果啟用,系統會停用 Android 原生規則的直接使用權。請使用 https://github.com/bazelbuild/rules_android 中的 Starlark Android 規則
標記:eagerness_to_exit
、incompatible_change
--[no]incompatible_disable_native_apple_binary_rule
預設值:「false」-
無作業。為保持回溯相容性而保留。
標記:eagerness_to_exit
、incompatible_change
--[no]incompatible_python_disable_py2
預設值:「true」-
如果為 true,使用 Python 2 設定會導致錯誤。包括 python_version=PY2、srcs_version=PY2 和 srcs_version=PY2ONLY。詳情請參閱 https://github.com/bazelbuild/bazel/issues/15684。
標記:loading_and_analysis
、incompatible_change
--[no]one_version_enforcement_on_java_tests
預設值:「true」-
啟用後,如果 experimental_one_version_enforcement 設為非 NONE 值,系統就會對 java_test 目標強制執行單一版本。您可以停用此標記,以改善增量測試效能,但可能會因此錯過潛在的單一版本違規事項。
標記:loading_and_analysis
--python_native_rules_allowlist=<a build target label>
預設值:請參閱說明-
強制執行 --incompatible_python_disallow_native_rules 時使用的許可清單 (package_group 目標)。
標記:loading_and_analysis
--[no]strict_filesets
預設值:「false」-
如果啟用這個選項,系統會將跨越套件界線的檔案集回報為錯誤。
標記:build_file_semantics
、eagerness_to_exit
--strict_proto_deps=<off, warn, error, strict or default>
預設值:「error」-
除非設為 OFF,否則會檢查 proto_library 目標是否明確將所有直接使用的目標宣告為依附元件。
標籤:build_file_semantics
、eagerness_to_exit
、incompatible_change
--strict_public_imports=<off, warn, error, strict or default>
預設值:「off」-
除非設為 OFF,否則會檢查 proto_library 目標是否明確將「import public」中使用的所有目標宣告為已匯出。
標籤:build_file_semantics
、eagerness_to_exit
、incompatible_change
--[no]strict_system_includes
預設值:「false」-
如果是 true,系統也必須宣告透過系統包含路徑 (-isystem) 找到的標頭。
標記:loading_and_analysis
、eagerness_to_exit
--target_environment=<a build target label>
累積多次使用-
宣告這個建構作業的目標環境。必須是「環境」規則的標籤參照。如果指定,所有頂層目標都必須與這個環境相容。
標記:changes_inputs
- 影響建構簽署輸出的選項:
--apk_signing_method=<v1, v2, v1_v2 or v4>
預設值:「v1_v2」-
用來簽署 APK 的實作項目
標記:action_command_lines
、affects_outputs
、loading_and_analysis
--[no]device_debug_entitlements
預設值:「true」-
如果已設定,且編譯模式不是「opt」,objc 應用程式會在簽署時加入偵錯授權。
標記:changes_inputs
--ios_signing_cert_name=<a string>
預設值:請參閱說明-
用於 iOS 簽署的憑證名稱。如未設定,系統會改用佈建設定檔。可能是憑證的鑰匙圈身分偏好設定,或憑證通用名稱的 (子字串),如 codesign 的說明頁面 (SIGNING IDENTITIES) 所示。
標記:action_command_lines
- 這個選項會影響 Starlark 語言的語意,或可供 BUILD 檔案、.bzl 檔案或 WORKSPACE 檔案存取的建構 API:
--[no]incompatible_disallow_legacy_py_provider
預設值:「true」-
No-op, will be removed soon.
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_disallow_sdk_frameworks_attributes
預設值:「false」-
如果設為 true,則 objc_library 和 objc_import 中的 sdk_frameworks 和 weak_sdk_frameworks 屬性會遭到禁止。
標記:build_file_semantics
、incompatible_change
--[no]incompatible_objc_alwayslink_by_default
預設值:「false」-
如果為 true,請將 objc_library 和 objc_import 中的 alwayslink 屬性預設值設為 true。
標記:build_file_semantics
、incompatible_change
--[no]incompatible_python_disallow_native_rules
預設值:「false」-
如果為 true,使用內建 py_* 規則時會發生錯誤,此時應改用 rule_python 規則。如需更多資訊和遷移操作說明,請參閱 https://github.com/bazelbuild/bazel/issues/17773。
標記:loading_and_analysis
、incompatible_change
- 控管測試環境或測試執行器行為的選項:
--[no]allow_analysis_failures
預設值:「false」-
如果為 true,規則目標的分析失敗會導致目標傳播包含錯誤說明的 AnalysisFailureInfo 執行個體,而不是導致建構失敗。
標記:loading_and_analysis
、experimental
--analysis_testing_deps_limit=<an integer>
預設值:「2000」-
透過具有 for_analysis_testing 設定轉換的規則屬性,設定遞移依附元件數量上限。如果超出這項限制,系統就會產生規則錯誤。
標記:loading_and_analysis
--[no]break_build_on_parallel_dex2oat_failure
預設值:「false」-
如果為 true,dex2oat 動作失敗會導致建構中斷,而不是在測試執行階段執行 dex2oat。
標記:loading_and_analysis
、experimental
--default_test_resources=<a resource name followed by equal and 1 float or 4 float, e.g. memory=10,30,60,100>
累積多次使用- 覆寫測試的預設資源量。預期格式為 <resource>=<value>。如果將單一正數指定為 <value>,系統會覆寫所有測試大小的預設資源。如果指定 4 個以半形逗號分隔的數字,系統會分別覆寫小型、中型、大型和特大型測試大小的資源量。值也可以是 HOST_RAM/HOST_CPU,後面可選擇性加上 [-|*]<float> (例如 memory=HOST_RAM*.1,HOST_RAM*.2,HOST_RAM*.3,HOST_RAM*.4)。這個旗標指定的預設測試資源,會遭到標記中明確指定的資源覆寫。
--[no]experimental_android_use_parallel_dex2oat
預設值:「false」-
使用 dex2oat 平行處理,可能可加快 android_test 的速度。
標籤:loading_and_analysis
、host_machine_resource_optimizations
、experimental
--[no]ios_memleaks
預設值:「false」-
在 ios_test 目標中啟用記憶體洩漏檢查。
標記:action_command_lines
--ios_simulator_device=<a string>
預設值:請參閱說明-
在模擬器中執行 iOS 應用程式時要模擬的裝置,例如「iPhone 6」。您可以在要執行模擬器的電腦上執行「xcrun simctl list devicetypes」,取得裝置清單。
標記:test_runner
--ios_simulator_version=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
執行或測試時,要在模擬器上執行的 iOS 版本。如果規則中指定目標裝置,系統會忽略 ios_test 規則的這項設定。
標記:test_runner
--runs_per_test=<a positive integer or test_regex@runs. This flag may be passed more than once>
累積多次使用- 指定每次測試的執行次數。如果其中任何一項嘗試因任何原因失敗,整個測試就會視為失敗。通常指定的值只會是整數。範例:--runs_per_test=3 會執行所有測試 3 次。替代語法:regex_filter@runs_per_test。其中 runs_per_test 代表整數值,regex_filter 代表包含和排除規則運算式模式的清單 (另請參閱 --instrumentation_filter)。範例:--runs_per_test=//foo/.*,-//foo/bar/.*@3 會執行 //foo/ 中的所有測試,但 foo/bar 下的測試除外,且執行次數為 3 次。這個選項可以多次傳遞。系統會優先採用最近傳遞且相符的引數。如果沒有相符的項目,測試只會執行一次。
--test_env=<a 'name=value' assignment with an optional value part>
累積多次使用-
指定要注入測試執行器環境的其他環境變數。變數可依名稱指定 (系統會從 Bazel 用戶端環境讀取變數值),或依名稱/值組合指定。這個選項可多次使用,指定多個變數。僅供「bazel test」指令使用。
標記:test_runner
--test_timeout=<a single integer or comma-separated list of 4 integers>
預設值:「-1」- 覆寫測試逾時的預設測試逾時值 (以秒為單位)。如果指定單一正整數值,系統會覆寫所有類別。如果指定 4 個以半形逗號分隔的整數,系統會依序覆寫短、中、長和永久的逾時時間。不論採用哪種形式,值為 -1 都會告知 Blaze 對該類別使用預設逾時。
--[no]zip_undeclared_test_outputs
預設值:「false」-
如果設為 true,系統會將未宣告的測試輸出內容封存至 zip 檔案。
標記:test_runner
- 可觸發建構時間最佳化的選項:
--[no]experimental_filter_library_jar_with_program_jar
預設值:「false」-
篩選 ProGuard ProgramJar,移除 LibraryJar 中也存在的任何類別。
標記:action_command_lines
、experimental
--[no]experimental_inmemory_dotd_files
預設值:「true」-
啟用後,系統會直接從遠端建構節點在記憶體中傳遞 C++ .d 檔案,而不是寫入磁碟。
標記:loading_and_analysis
、execution
、affects_outputs
、experimental
--[no]experimental_inmemory_jdeps_files
預設值:「true」-
啟用後,從 Java 編譯作業產生的依附元件 (.jdeps) 檔案會直接從遠端建構節點在記憶體中傳遞,而不是寫入磁碟。
標記:loading_and_analysis
、execution
、affects_outputs
、experimental
--[no]experimental_retain_test_configuration_across_testonly
預設值:「false」-
啟用後,--trim_test_configuration 不會修剪標示為 testonly=1 的規則測試設定。如果非測試規則依附於 cc_test 規則,這項做法可減少動作衝突問題。如果 --trim_test_configuration 為 False,則不會有任何作用。
標籤:loading_and_analysis
、loses_incremental_state
、experimental
--[no]experimental_starlark_cc_import
預設值:「false」-
如果啟用,即可使用 cc_import 的 Starlark 版本。
標記:loading_and_analysis
、experimental
--[no]experimental_unsupported_and_brittle_include_scanning
預設值:「false」-
是否要剖析輸入檔案中的 #include 行,藉此縮小 C/C++ 編譯的輸入範圍。這項做法可縮減編譯輸入樹狀結構的大小,進而提升成效和增量。不過,由於 include 掃描器並未完整實作 C 前置處理器語意,因此也可能導致建構作業中斷。特別是,它無法解讀動態 #include 指令,且會忽略前置處理器條件邏輯。您必須自行承擔使用風險。系統會關閉與此標記相關的所有問題。
標記:loading_and_analysis
、execution
、changes_inputs
、experimental
--[no]incremental_dexing
預設值:「true」-
針對每個 Jar 檔案分別執行大部分的 dexing 工作。
標籤:affects_outputs
、loading_and_analysis
、loses_incremental_state
--[no]objc_use_dotd_pruning
預設值:「true」-
如果設定這項引數,clang 發出的 .d 檔案會用於修剪傳遞至 objc 編譯的輸入集。
標記:changes_inputs
、loading_and_analysis
--[no]process_headers_in_dependencies
預設值:「false」-
建構目標 //a:a 時,處理 //a:a 所依附的所有目標中的標頭 (如果工具鍊已啟用標頭處理)。
標記:execution
--[no]trim_test_configuration
預設值:「true」-
啟用後,系統會清除建構作業頂層以下的測試相關選項。啟用這個標記後,測試無法建構為非測試規則的依附元件,但變更測試相關選項不會導致系統重新分析非測試規則。
標記:loading_and_analysis
、loses_incremental_state
- 影響記錄詳細程度、格式或位置的選項:
--toolchain_resolution_debug=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths>
預設值:「-.*」-
在工具鍊解析期間列印偵錯資訊。這個旗標會採用正規運算式,並根據工具鍊類型和特定目標進行檢查,判斷要偵錯的項目。多個規則運算式可以逗號分隔,然後系統會分別檢查每個規則運算式。注意:這個標記的輸出內容非常複雜,可能只對工具鍊解析專家有用。
標記:terminal_output
- 指定或變更 Bazel 指令一般輸入內容的選項,不屬於其他類別:
--flag_alias=<a 'name=value' flag alias>
累積多次使用-
為 Starlark 旗標設定簡短名稱。這個函式會以「<key>=<value>」形式的單一鍵/值組合做為引數。
標記:changes_inputs
--[no]incompatible_default_to_explicit_init_py
預設值:「false」-
這個標記會變更預設行為,因此系統不會再自動在 Python 目標的執行檔中建立 __init__.py 檔案。具體來說,如果 py_binary 或 py_test 目標的 legacy_create_init 設為「auto」(預設值),則只有在設定這個旗標時,系統才會將其視為 false。詳情請參閱 https://github.com/bazelbuild/bazel/issues/10076。
標記:affects_outputs
、incompatible_change
--[no]incompatible_py2_outputs_are_suffixed
預設值:「true」-
如果為 true,以 Python 2 設定建構的目標會顯示在包含「-py2」後置字串的輸出根目錄下,而為 Python 3 建構的目標則會顯示在沒有 Python 相關後置字串的根目錄中。也就是說,`bazel-bin` 便利符號連結會指向 Python 3 目標,而非 Python 2。啟用這個選項時,建議一併啟用 `--incompatible_py3_is_default`。
標記:affects_outputs
、incompatible_change
--[no]incompatible_py3_is_default
預設值:「true」-
如果為 true,未設定 `python_version` (或 `default_python_version`) 屬性的 `py_binary` 和 `py_test` 目標,預設會使用 PY3,而非 PY2。如果設定這個旗標,建議一併設定 `--incompatible_py2_outputs_are_suffixed`。
標記:loading_and_analysis
、affects_outputs
、incompatible_change
--[no]incompatible_use_python_toolchains
預設值:「true」-
如果設為 true,可執行的原生 Python 規則會使用 Python 工具鍊指定的 Python 執行階段,而不是舊版旗標 (例如 --python_top) 提供的執行階段。
標記:loading_and_analysis
、incompatible_change
--python_version=<PY2 or PY3>
預設值:請參閱說明-
Python 主要版本模式,可以是 `PY2` 或 `PY3`。請注意,這會遭到 `py_binary` 和 `py_test` 目標覆寫 (即使這些目標未明確指定版本),因此通常沒有太多理由提供這個旗標。
標記:loading_and_analysis
、affects_outputs
- 其他選項,未歸類於其他類別:
--[no]cache_test_results
[-t
] 預設值:「auto」- 如果設為「auto」,只有在下列情況下,Bazel 才會重新執行測試:(1) Bazel 偵測到測試或其依附元件有變更;(2) 測試標示為外部;(3) 使用 --runs_per_test 要求多次執行測試;或(4) 測試先前失敗。如果設為「yes」,Bazel 會快取所有測試結果,但標示為外部的測試除外。如果設為「no」,Bazel 不會快取任何測試結果。
--[no]experimental_cancel_concurrent_tests
預設值:「false」-
如果為 true,Blaze 會在第一次成功執行時,取消同時執行的測試。只有在搭配 --runs_per_test_detects_flakes 時才會有作用。
標籤:affects_outputs
、loading_and_analysis
、experimental
--[no]experimental_fetch_all_coverage_outputs
預設值:「false」-
如果為 true,Bazel 會在執行涵蓋範圍時,擷取每項測試的整個涵蓋範圍資料目錄。
標籤:affects_outputs
、loading_and_analysis
、experimental
--[no]experimental_generate_llvm_lcov
預設值:「false」-
如果為 true,clang 的涵蓋範圍會產生 LCOV 報表。
標籤:affects_outputs
、loading_and_analysis
、experimental
--[no]experimental_j2objc_header_map
預設值:「true」-
是否要與 J2ObjC 轉譯作業平行產生 J2ObjC 標頭對應檔。
標記:experimental
--[no]experimental_j2objc_shorter_header_path
預設值:「false」-
是否要使用較短的標頭路徑生成 (使用「_ios」而非「_j2objc」)。
標記:affects_outputs
、experimental
--experimental_java_classpath=<off, javabuilder or bazel>
預設值:「javabuilder」- 啟用 Java 編譯的縮減類別路徑。
--[no]experimental_limit_android_lint_to_android_constrained_java
預設值:「false」-
無作業,僅保留向後相容性
標記:affects_outputs
、experimental
--[no]experimental_run_android_lint_on_java_rules
預設值:「false」-
是否要驗證 java_* 來源。
標記:affects_outputs
、experimental
--[no]explicit_java_test_deps
預設值:「false」- 在 java_test 中明確指定 JUnit 或 Hamcrest 的依附元件,而不是從 TestRunner 的 deps 意外取得。目前僅適用於 Bazel。
--host_java_launcher=<a build target label>
預設值:請參閱說明- 建構期間執行的工具所用的 Java 啟動器。
--host_javacopt=<a string>
累積多次使用- 建構在建構期間執行的工具時,要傳遞至 javac 的其他選項。
--host_jvmopt=<a string>
累積多次使用- 建構在建構期間執行的工具時,要傳遞至 Java VM 的其他選項。這些選項會新增至每個 java_binary 目標的 VM 啟動選項。
--[no]incompatible_check_sharding_support
預設值:「true」-
如果設為 true,且測試執行器未透過觸控 TEST_SHARD_STATUS_FILE 路徑中的檔案,指出支援分片,Bazel 就會讓分片測試失敗。如果為 false,不支援分片的測試執行器會導致所有測試在每個分片中執行。
標記:incompatible_change
--[no]incompatible_exclusive_test_sandboxed
預設值:「true」-
如果是 true,系統會使用沙箱策略執行專屬測試。新增「local」標記,強制在本機執行專屬測試
Tags:incompatible_change
--[no]incompatible_strict_action_env
預設值:「false」-
如果設為 true,Bazel 會使用 PATH 的靜態值環境,且不會繼承 LD_LIBRARY_PATH。如要從用戶端繼承特定環境變數,請使用 --action_env=ENV_VARIABLE,但請注意,如果使用共用快取,這麼做可能會導致無法跨使用者快取。
標記:loading_and_analysis
、incompatible_change
--j2objc_translation_flags=<comma-separated list of options>
累積多次使用- 傳遞至 J2ObjC 工具的其他選項。
--java_debug
-
導致 Java 測試的 Java 虛擬機器等待來自符合 JDWP 規範的偵錯工具 (例如 jdb) 的連線,然後才開始測試。這表示 -test_output=streamed。
展開後會顯示:
--test_arg=--wrapper_script_flag=--debug
--test_output=streamed
--test_strategy=exclusive
--test_timeout=9999
--nocache_test_results
--[no]java_deps
預設值:「true」- 為每個 Java 目標產生依附元件資訊 (目前為編譯時間類別路徑)。
--[no]java_header_compilation
預設值:「true」- 直接從來源編譯 ijars。
--java_language_version=<a string>
預設值:「」- Java 語言版本
--java_launcher=<a build target label>
預設值:請參閱說明- 建構 Java 二進位檔時要使用的 Java 啟動器。如果將這個標記設為空字串,系統會使用 JDK 啟動器。「啟動器」屬性會覆寫這個旗標。
--java_runtime_version=<a string>
預設值:「local_jdk」- Java 執行階段版本
--javacopt=<a string>
累積多次使用- 要傳遞至 javac 的其他選項。
--jvmopt=<a string>
累積多次使用- 要傳遞至 Java VM 的其他選項。這些選項會新增至每個 java_binary 目標的 VM 啟動選項。
--legacy_main_dex_list_generator=<a build target label>
預設值:請參閱說明- 指定要使用的二進位檔,以便在編譯舊版 multidex 時,產生必須位於主要 dex 中的類別清單。
--optimizing_dexer=<a build target label>
預設值:請參閱說明- 指定用於執行 Dexing 的二進位檔,不需分片。
--plugin=<a build target label>
累積多次使用- 建構作業中要使用的外掛程式。目前適用於 java_plugin。
--proguard_top=<a build target label>
預設值:請參閱說明- 指定建構 Java 二進位檔時,要使用哪個版本的 ProGuard 移除程式碼。
--proto_compiler=<a build target label>
預設值:「@bazel_tools//tools/proto:protoc」-
proto 編譯器的標籤。
標記:affects_outputs
、loading_and_analysis
--[no]proto_profile
預設值:「true」-
是否要將 profile_path 傳遞至 proto 編譯器。
標記:affects_outputs
、loading_and_analysis
--proto_profile_path=<a build target label>
預設值:請參閱說明-
要傳遞至 proto 編譯器的設定檔,做為 profile_path。如果未設定,但 --proto_profile 為 true (預設值),則會從 --fdo_optimize 推斷路徑。
標記:affects_outputs
、loading_and_analysis
--proto_toolchain_for_cc=<a build target label>
default: "@bazel_tools//tools/proto:cc_toolchain"-
proto_lang_toolchain() 的標籤,說明如何編譯 C++ proto
標記:affects_outputs
、loading_and_analysis
--proto_toolchain_for_j2objc=<a build target label>
預設值:「@bazel_tools//tools/j2objc:j2objc_proto_toolchain」-
proto_lang_toolchain() 的標籤,說明如何編譯 j2objc proto
標記:affects_outputs
、loading_and_analysis
--proto_toolchain_for_java=<a build target label>
預設值:「@bazel_tools//tools/proto:java_toolchain」-
proto_lang_toolchain() 的標籤,說明如何編譯 Java Proto
標記:affects_outputs
、loading_and_analysis
--proto_toolchain_for_javalite=<a build target label>
預設值:「@bazel_tools//tools/proto:javalite_toolchain」-
proto_lang_toolchain() 的標籤,說明如何編譯 JavaLite proto
標記:affects_outputs
、loading_and_analysis
--protocopt=<a string>
累積多次使用-
要傳遞至 protobuf 編譯器的其他選項。
標記:affects_outputs
--[no]runs_per_test_detects_flakes
預設值:「false」- 如果為 true,只要分片中至少有一次執行/嘗試通過,且至少有一次執行/嘗試失敗,就會獲得 FLAKY 狀態。
--shell_executable=<a path>
預設值:請參閱說明-
Bazel 要使用的 Shell 可執行檔絕對路徑。如果未設定這個變數,但 BAZEL_SH 環境變數是在第一次叫用 Bazel 時設定 (這會啟動 Bazel 伺服器),Bazel 會使用該變數。如果兩者皆未設定,Bazel 會根據執行的作業系統使用硬式編碼的預設路徑 (Windows:c:/msys64/usr/bin/bash.exe、FreeBSD:/usr/local/bin/bash,其他:/bin/bash)。請注意,使用與 Bash 不相容的殼層可能會導致建構失敗,或導致產生的二進位檔發生執行階段錯誤。
標記:loading_and_analysis
--test_arg=<a string>
累積多次使用- 指定應傳遞至測試執行檔的其他選項和引數。可多次使用,指定多個引數。如果執行多項測試,每項測試都會收到相同的引數。僅供「bazel test」指令使用。
--test_filter=<a string>
預設值:請參閱說明- 指定要轉送至測試架構的篩選器。用於限制執行的測試。請注意,這不會影響建構的目標。
--test_result_expiration=<an integer>
預設值:「-1」- 這個選項已淘汰,因此不會產生任何作用。
--[no]test_runner_fail_fast
預設值:「false」- 將快速失敗選項轉送至測試執行器。測試執行器應在第一次失敗時停止執行。
--test_sharding_strategy=<explicit, disabled or forced=k where k is the number of shards to enforce>
預設值:「explicit」- 指定測試分片策略:「explicit」表示只有在存在「shard_count」BUILD 屬性時,才使用分片。「disabled」則表示永不使用測試分片。「forced=k」可強制測試使用「k」個分片,無論「shard_count」BUILD 屬性為何。
--tool_java_language_version=<a string>
預設值:「」- 用於執行建構期間所需工具的 Java 語言版本
--tool_java_runtime_version=<a string>
default: "remotejdk_11"- 建構期間執行工具時使用的 Java 執行階段版本
--[no]use_ijars
預設值:「true」- 啟用後,這項選項會讓 Java 編譯使用介面 JAR。這樣一來,增量編譯速度會更快,但錯誤訊息可能有所不同。
傾印選項
- 控管指令輸出內容的選項:
--[no]action_cache
預設值:「false」-
傾印動作快取內容。
標記:bazel_monitoring
--memory=<memory mode>
預設值:請參閱說明-
傾印指定 Skyframe 節點的記憶體用量。
標記:bazel_monitoring
--[no]packages
預設值:「false」-
傾印封裝快取內容。
標記:bazel_monitoring
--[no]rule_classes
預設值:「false」-
傾印規則類別。
標記:bazel_monitoring
--[no]rules
預設值:「false」-
傾印規則,包括計數和記憶體用量 (如果追蹤記憶體)。
標記:bazel_monitoring
--skyframe=<off, summary, count, value, deps, rdeps, function_graph, working_set or working_set_frontier_deps>
預設值:「off」-
傾印 Skyframe 圖表。
標記:bazel_monitoring
--skykey_filter=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths>
預設值:「.*」-
要輸出的 SkyKey 名稱的規則運算式篩選器。僅適用於 --skyframe=deps、rdeps、function_graph。
標記:bazel_monitoring
--skylark_memory=<a string>
預設值:請參閱說明-
將與 pprof 相容的記憶體設定檔傾印至指定路徑。詳情請參閱 https://github.com/google/pprof。
標記:bazel_monitoring
- 這個選項會影響 Starlark 語言的語意,或可供 BUILD 檔案、.bzl 檔案或 WORKSPACE 檔案存取的建構 API:
--[no]incompatible_use_plus_in_repo_names
預設值:「true」-
無作業。
標記:loading_and_analysis
擷取選項
繼承 test 的所有選項。
- 控制建構執行的選項:
--[no]all
預設值:「false」-
擷取建構任何目標或存放區所需的所有外部存放區。如果未提供其他旗標和引數,則此為預設值。只有在啟用 --enable_bzlmod 時才有效。
標記:changes_inputs
--[no]keep_going
[-k
] 預設值:「false」-
盡可能在發生錯誤後繼續作業。雖然系統無法分析失敗的目標和依附於該目標的目標,但可以分析這些目標的其他必要條件。
標記: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">
預設值:「auto」-
用於載入/分析階段的平行執行緒數量。可使用整數或關鍵字 (「auto」、「HOST_CPUS」、「HOST_RAM」),後面可選擇性加上運算符號 ([-|*]<float>),例如 「auto」、「HOST_CPUS*.5」。「auto」會根據主機資源設定合理的預設值。不得小於 1。
標記:bazel_internal_configuration
- 這個選項會影響 Starlark 語言的語意,或可供 BUILD 檔案、.bzl 檔案或 WORKSPACE 檔案存取的建構 API:
--[no]incompatible_config_setting_private_default_visibility
預設值:「false」-
如果 incompatible_enforce_config_setting_visibility=false,這就是 noop。否則,如果這個旗標為 false,任何沒有明確顯示屬性的 config_setting 都是 //visibility:public。如果這個標記為 true,config_setting 會遵循與所有其他規則相同的瀏覽權限邏輯。詳情請參閱 https://github.com/bazelbuild/bazel/issues/12933。
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_enforce_config_setting_visibility
預設值:「true」-
如果為 true,則強制執行 config_setting 可見度限制。如果為 false,每個目標都會看到所有 config_setting。詳情請參閱 https://github.com/bazelbuild/bazel/issues/12932。
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_use_plus_in_repo_names
預設值:「true」-
無作業。
標記:loading_and_analysis
- 與 Bzlmod 輸出和語意相關的選項:
--[no]configure
預設值:「false」-
系統只會擷取標示為「設定」的存放區,用於系統設定。只有在啟用 --enable_bzlmod 時才有效。
標記:changes_inputs
--[no]force
預設值:「false」-
忽略現有存放區 (如有),並強制再次擷取存放區。只有在啟用 --enable_bzlmod 時才有效。
標記:changes_inputs
--repo=<a string>
累積多次使用-
只會擷取指定的存放區,可以是 {@apparent_repo_name} 或 {@@canonical_repo_name}。只有在啟用 --enable_bzlmod 時才有效。
標記:changes_inputs
- 影響記錄詳細程度、格式或位置的選項:
--experimental_repository_resolved_file=<a string>
預設值:「」-
如果不是空白,請寫入 Starlark 值,其中包含所有已執行的 Starlark 存放區規則的已解析資訊。
標記:affects_outputs
- 其他選項,未歸類於其他類別:
--deleted_packages=<comma-separated list of package names>
累積多次使用- 以半形逗號分隔的套件名稱清單。即使這些套件顯示在套件路徑的某處,建構系統也會視為不存在。 刪除現有套件「x」的子套件「x/y」時,請使用這個選項。舉例來說,如果您在用戶端中刪除 x/y/BUILD,但另一個 package_path 項目仍提供「//x:y/z」標籤,建構系統可能會發出警告。指定 --deleted_packages x/y 即可避免這個問題。
--[no]fetch
預設值:「true」- 允許指令擷取外部依附元件。如果設為 false,指令會使用依附元件的任何快取版本,如果沒有,指令就會失敗。
--package_path=<colon-separated list of options>
預設值:「%workspace%」- 以半形冒號分隔的清單,列出要尋找套件的位置。以「%workspace%」開頭的元素與封閉工作區相關。如果省略或為空,預設值為「bazel info default-package-path」的輸出內容。
--[no]show_loading_progress
預設值:「true」- 啟用後,Bazel 會列印「正在載入套件:」訊息。
- 控管建構作業執行的選項:
--[no]experimental_inprocess_symlink_creation
預設值:「true」-
是否要直接呼叫檔案系統來建立符號連結樹狀結構,而不是委派給輔助程序。
標籤:loading_and_analysis
、execution
、experimental
--[no]experimental_persistent_aar_extractor
預設值:「false」-
使用 Worker 啟用持續性 AAR 擷取器。
標記:execution
、experimental
--[no]experimental_remotable_source_manifests
預設值:「false」-
是否要讓來源資訊清單動作可遠端執行
標記:loading_and_analysis
、execution
、experimental
--[no]experimental_split_coverage_postprocessing
預設值:「false」-
如果為 true,Bazel 會在新衍生程序中執行測試的涵蓋範圍後續處理作業。
標記:execution
、experimental
--[no]experimental_strict_fileset_output
預設值:「false」-
如果啟用這個選項,檔案集會將所有輸出構件視為一般檔案。不會遍歷目錄或對符號連結敏感。
標記:execution
、experimental
--[no]incompatible_modify_execution_info_additive
預設值:「false」-
啟用後,傳遞多個 --modify_execution_info 標記會產生加成效果。停用時,系統只會考量最後一個旗標。
標記:execution
、affects_outputs
、loading_and_analysis
、incompatible_change
--modify_execution_info=<regex=[+-]key,regex=[+-]key,...>
累積多次使用-
根據動作助記符,在動作的執行資訊中新增或移除鍵。僅適用於支援執行資訊的動作。許多常見動作都支援執行資訊,例如 Genrule、CppCompile、Javac、StarlarkAction、TestRunner。指定多個值時,順序很重要,因為許多正則運算式可能會套用至相同助記符。
語法:「regex=[+-]key,regex=[+-]key,...」。
範例:
「.*=+x,.*=-y,.*=+z」會將「x」和「z」新增至所有動作的執行資訊,並從中移除「y」。
「Genrule=+requires-x」會將「requires-x」新增至所有 Genrule 動作的執行資訊。
'(?!Genrule).*=-requires-x' 會從所有非 Genrule 動作的執行資訊中移除 'requires-x'。
標籤:execution
、affects_outputs
、loading_and_analysis
--persistent_android_dex_desugar
-
使用 Worker 啟用持續性 Android dex 和 desugar 動作。
展開後:
--internal_persistent_android_dex_desugar
--strategy=Desugar=worker
--strategy=DexBuilder=worker
標記:host_machine_resource_optimizations
、execution
--persistent_android_resource_processor
-
使用 Worker 啟用永久性 Android 資源處理器。
展開後:
--internal_persistent_busybox_tools
--strategy=AaptPackage=worker
--strategy=AndroidResourceParser=worker
--strategy=AndroidResourceValidator=worker
--strategy=AndroidResourceCompiler=worker
--strategy=RClassGenerator=worker
--strategy=AndroidResourceLink=worker
--strategy=AndroidAapt2=worker
--strategy=AndroidAssetMerger=worker
--strategy=AndroidResourceMerger=worker
--strategy=AndroidCompiledResourceMerger=worker
--strategy=ManifestMerger=worker
--strategy=AndroidManifestMerger=worker
--strategy=Aapt2Optimize=worker
--strategy=AARGenerator=worker
--strategy=ProcessDatabinding=worker
--strategy=GenerateDataBindingBaseClasses=worker
標記:host_machine_resource_optimizations
、execution
--persistent_multiplex_android_dex_desugar
-
使用 Worker 啟用持續性多工 Android dex 和 desugar 動作。
展開後會顯示:
--persistent_android_dex_desugar
--internal_persistent_multiplex_android_dex_desugar
標記:host_machine_resource_optimizations
、execution
--persistent_multiplex_android_resource_processor
-
使用工作人員啟用持續性多工 Android 資源處理器。
展開後:
--persistent_android_resource_processor
--modify_execution_info=AaptPackage=+supports-multiplex-workers
--modify_execution_info=AndroidResourceParser=+supports-multiplex-workers
--modify_execution_info=AndroidResourceValidator=+supports-multiplex-workers
--modify_execution_info=AndroidResourceCompiler=+supports-multiplex-workers
--modify_execution_info=RClassGenerator=+supports-multiplex-workers
--modify_execution_info=AndroidResourceLink=+supports-multiplex-workers
--modify_execution_info=AndroidAapt2=+supports-multiplex-workers
--modify_execution_info=AndroidAssetMerger=+supports-multiplex-workers
--modify_execution_info=AndroidResourceMerger=+supports-multiplex-workers
--modify_execution_info=AndroidCompiledResourceMerger=+supports-multiplex-workers
--modify_execution_info=ManifestMerger=+supports-multiplex-workers
--modify_execution_info=AndroidManifestMerger=+supports-multiplex-workers
--modify_execution_info=Aapt2Optimize=+supports-multiplex-workers
--modify_execution_info=AARGenerator=+supports-multiplex-workers
標記:host_machine_resource_optimizations
、execution
--persistent_multiplex_android_tools
-
啟用持續性及多工 Android 工具 (dexing、desugaring、資源處理)。
展開後:
--internal_persistent_multiplex_busybox_tools
--persistent_multiplex_android_resource_processor
--persistent_multiplex_android_dex_desugar
標記:host_machine_resource_optimizations
、execution
--[no]use_target_platform_for_tests
預設值:「false」-
如果為 true,Bazel 會使用目標平台執行測試,而非測試執行群組。
標記:execution
- 設定用於執行動作的工具鍊選項:
--android_compiler=<a string>
預設值:請參閱說明-
Android 目標編譯器。
標籤:affects_outputs
、loading_and_analysis
、loses_incremental_state
--android_manifest_merger=<legacy, android or force_android>
預設值:「android」-
選取要用於 android_binary 規則的資訊清單合併工具。這個標記可協助從舊版合併工具轉換至 Android 資訊清單合併工具。
標籤:affects_outputs
、loading_and_analysis
、loses_incremental_state
--android_platforms=<a build target label>
預設值:「」-
設定 android_binary 目標使用的平台。如果指定多個平台,則二進位檔為笨重的 APK,其中包含每個指定目標平台的原生二進位檔。
標籤:changes_inputs
、loading_and_analysis
、loses_incremental_state
--apple_crosstool_top=<a build target label>
default: "@bazel_tools//tools/cpp:toolchain"-
要在 Apple 和 Objc 規則及其依附元件中使用的 crosstool 套件標籤。
標記:loses_incremental_state
、changes_inputs
--cc_output_directory_tag=<a string>
預設值:「」-
指定要加到設定目錄的後置字串。
標記:affects_outputs
--compiler=<a string>
預設值:請參閱說明-
用於編譯目標的 C++ 編譯器。
標記:loading_and_analysis
、execution
--coverage_output_generator=<a build target label>
default: "@bazel_tools//tools/test:lcov_merger"-
用於後續處理原始涵蓋範圍報表的二進位檔位置。目前必須是包含單一檔案 (二進位檔) 的檔案群組。預設值為「//tools/test:lcov_merger」。
標籤:changes_inputs
、affects_outputs
、loading_and_analysis
--coverage_report_generator=<a build target label>
預設值:「@bazel_tools//tools/test:coverage_report_generator」-
用於產生涵蓋範圍報表的二進位檔位置。目前必須是包含單一檔案 (二進位檔) 的檔案群組。預設值為「//tools/test:coverage_report_generator」。
標籤:changes_inputs
、affects_outputs
、loading_and_analysis
--coverage_support=<a build target label>
預設值:「@bazel_tools//tools/test:coverage_support」-
每個收集程式碼涵蓋範圍的測試動作輸入內容中,所需支援檔案的位置。預設值為「//tools/test:coverage_support」。
標籤:changes_inputs
、affects_outputs
、loading_and_analysis
--custom_malloc=<a build target label>
預設值:請參閱說明-
指定自訂 malloc 實作項目。這項設定會覆寫建構規則中的 malloc 屬性。
標記:changes_inputs
、affects_outputs
--experimental_add_exec_constraints_to_targets=<a '<RegexFilter>=<label1>[,<label2>,...]' assignment>
累積多次使用-
以逗號分隔的規則運算式清單,每個運算式可選擇性加上前置字元「-」(負運算式),並以「=」指派給以逗號分隔的限制值目標清單。如果目標與任何負運算式都不相符,但與至少一個正運算式相符,工具鍊解析就會執行,就像目標已將限制值宣告為執行限制一樣。範例://demo,-test=@platforms//cpus:x86_64 會將「x86_64」新增至 //demo 下的所有目標,但名稱包含「test」的目標除外。
標記:loading_and_analysis
--[no]experimental_include_xcode_execution_requirements
預設值:「false」-
如果已設定,請為每個 Xcode 動作新增「requires-xcode:{version}」執行需求。如果 Xcode 版本有連字號標籤,請一併新增「requires-xcode-label:{version_label}」執行需求。
標記:loses_incremental_state
、loading_and_analysis
、execution
、experimental
--[no]experimental_prefer_mutual_xcode
預設值:「true」-
如果為 true,請使用本機和遠端可用的最新 Xcode。如果為 false,或沒有可用的共同版本,請使用透過 xcode-select 選取的本機 Xcode 版本。
標記:loses_incremental_state
、experimental
--extra_execution_platforms=<comma-separated list of options>
預設值:「」-
可做為執行平台來執行動作的平台。平台可以指定為確切目標,或指定為目標模式。系統會優先考慮這些平台,再考慮 register_execution_platforms() 在 WORKSPACE 檔案中宣告的平台。這個選項只能設定一次,後續的例項會覆寫先前的標記設定。
標記:execution
--extra_toolchains=<comma-separated list of options>
累積多次使用-
工具鍊解析期間要考慮的工具鍊規則。工具鍊可指定為確切目標,或目標模式。系統會優先考量這些工具鍊,再考量由 register_toolchains() 在 WORKSPACE 檔案中宣告的工具鍊。
標記:affects_outputs
、changes_inputs
、loading_and_analysis
--grte_top=<a label>
預設值:請參閱說明-
已簽入 libc 程式庫的標籤。預設值是由 crosstool 工具鍊選取,您幾乎不需要覆寫這個值。
標記:action_command_lines
、affects_outputs
--host_compiler=<a string>
預設值:請參閱說明-
無作業旗標。將在日後推出的版本中移除。
標記:loading_and_analysis
、execution
--host_grte_top=<a label>
預設值:請參閱說明-
如果指定,這項設定會覆寫 exec 設定的 libc 頂層目錄 (--grte_top)。
標記:action_command_lines
、affects_outputs
--host_platform=<a build target label>
default: "@bazel_tools//tools:host_platform"-
平台規則的標籤,用於說明主機系統。
標籤:affects_outputs
、changes_inputs
、loading_and_analysis
--[no]incompatible_bazel_test_exec_run_under
預設值:「false」-
如果啟用,系統會在執行設定中建構「bazel test --run_under=//:runner」的「//:runner」。如果停用,系統會在目標設定中建構「//:runner」。Bazel 會在執行機器上執行測試,因此前者較為正確。這不會影響「bazel run」,因為「bazel run」一律會在目標設定中建構「`--run_under=//foo」。
標記:affects_outputs
、incompatible_change
--[no]incompatible_dont_enable_host_nonhost_crosstool_features
預設值:「true」-
如果為 true,Bazel 將不會在 C++ 工具鍊中啟用「主機」和「非主機」功能 (詳情請參閱 https://github.com/bazelbuild/bazel/issues/7407)。
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_enable_apple_toolchain_resolution
預設值:「false」-
使用工具鍊解析度,為 Apple 規則 (Starlark 和原生) 選取 Apple SDK
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_remove_legacy_whole_archive
預設值:「true」-
如果為 true,Bazel 預設不會將程式庫依附元件連結為整個封存檔 (如需遷移操作說明,請參閱 https://github.com/bazelbuild/bazel/issues/7362)。
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_strip_executable_safely
預設值:「false」-
如為 true,可執行檔的 strip 動作會使用 -x 標記,不會中斷動態符號解析。
標記:action_command_lines
、incompatible_change
-
如果工具鍊支援,請使用介面共用物件。目前所有 ELF 工具鍊都支援這項設定。
標籤:loading_and_analysis
、affects_outputs
、affects_outputs
--ios_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
指定用於建構 iOS 應用程式的 iOS SDK 版本。如未指定,則會使用「xcode_version」中的預設 iOS SDK 版本。
標記:loses_incremental_state
--macos_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
指定用於建構 macOS 應用程式的 macOS SDK 版本。如未指定,則會使用「xcode_version」中的預設 macOS SDK 版本。
標記:loses_incremental_state
--minimum_os_version=<a string>
預設值:請參閱說明-
編譯目標的最低作業系統版本。
標記:loading_and_analysis
、affects_outputs
--platform_mappings=<a main workspace-relative path>
預設值:「」-
對應檔案的位置,用於說明在未設定平台時要使用哪個平台,或是在平台已存在時要設定哪些旗標。必須相對於主要工作區根目錄。預設值為「platform_mappings」(工作區根目錄下的檔案)。
標記:affects_outputs
、changes_inputs
、loading_and_analysis
、immutable
--platforms=<a build target label>
預設值:「」-
平台規則的標籤,說明目前指令的目標平台。
標籤:affects_outputs
、changes_inputs
、loading_and_analysis
--python_path=<a string>
預設值:請參閱說明-
在目標平台上執行 Python 目標時,所叫用的 Python 解譯器絕對路徑。已淘汰;由 --incompatible_use_python_toolchains 停用。
標記:loading_and_analysis
、affects_outputs
--python_top=<a build target label>
預設值:請參閱說明-
代表 Python 解譯器的 py_runtime 標籤,用於在目標平台上執行 Python 目標。已淘汰;由 --incompatible_use_python_toolchains 停用。
標記:loading_and_analysis
、affects_outputs
--tvos_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
指定用於建構 tvOS 應用程式的 tvOS SDK 版本。如未指定,則會使用「xcode_version」中的預設 tvOS SDK 版本。
標記:loses_incremental_state
--watchos_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
指定用於建構 watchOS 應用程式的 watchOS SDK 版本。如未指定,則會使用「xcode_version」中的預設 watchOS SDK 版本。
標記:loses_incremental_state
--xcode_version=<a string>
預設值:請參閱說明-
如果指定,則會使用指定版本的 Xcode 執行相關建構動作。如未指定,則會使用 Xcode 的執行器預設版本。
標記:loses_incremental_state
--xcode_version_config=<a build target label>
default: "@bazel_tools//tools/cpp:host_xcodes"-
用於在建構設定中選取 Xcode 版本的 xcode_config 規則標籤。
標記:loses_incremental_state
、loading_and_analysis
- 控管指令輸出的選項:
--[no]apple_generate_dsym
預設值:「false」-
是否要產生偵錯符號 (.dSYM) 檔案。
標記:affects_outputs
、action_command_lines
--[no]build_runfile_links
預設值:「true」-
如果為 true,則為所有目標建構 Runfile 符號連結樹狀結構。 如果為 false,則只有在本地動作、測試或執行指令需要時,才會寫入這些檔案。
標記:affects_outputs
--[no]build_runfile_manifests
預設值:「true」-
如果是 true,則為所有目標編寫執行檔資訊清單。如果為 false,請省略這些屬性。如果為 false,本機測試將無法執行。
標記:affects_outputs
--[no]build_test_dwp
預設值:「false」-
如果啟用這項功能,系統會以靜態方式建構 C++ 測試,並使用 fission,自動建構測試二進位檔的 .dwp 檔案。
標記:loading_and_analysis
、affects_outputs
--cc_proto_library_header_suffixes=<comma-separated set of options>
預設值:「.pb.h」-
設定 cc_proto_library 建立的標頭檔案後置字元。
標記:affects_outputs
、loading_and_analysis
--cc_proto_library_source_suffixes=<comma-separated set of options>
預設值:「.pb.cc」-
設定 cc_proto_library 建立的來源檔案後置字元。
標記:affects_outputs
、loading_and_analysis
--[no]experimental_proto_descriptor_sets_include_source_info
預設值:「false」-
在 proto_library 中,針對替代的 Java API 版本執行額外動作。
標籤:affects_outputs
、loading_and_analysis
、experimental
--[no]experimental_save_feature_state
預設值:「false」-
將已啟用和要求的特徵狀態儲存為編譯輸出內容。
標記:affects_outputs
、experimental
--fission=<a set of compilation modes>
預設值:「no」-
指定哪些編譯模式會使用分裂功能進行 C++ 編譯和連結。可以是 {'fastbuild'、'dbg'、'opt'} 的任意組合,也可以是特殊值 'yes' (啟用所有模式) 和 'no' (停用所有模式)。
標籤:loading_and_analysis
、action_command_lines
、affects_outputs
--[no]incompatible_always_include_files_in_data
預設值:「true」-
如果是 true,原生規則會將資料依附元件的 <code>DefaultInfo.files</code> 新增至執行檔,這與 Starlark 規則的建議行為相符 (https://bazel.build/extending/rules#runfiles_features_to_avoid)。
標記:affects_outputs
、incompatible_change
--[no]legacy_external_runfiles
預設值:「false」-
如果為 true,請為 .runfiles/repo 底下的外部存放區建構執行檔案符號連結樹狀結構 (除了 .runfiles/repo 以外)。
標記:affects_outputs
--[no]objc_generate_linkmap
預設值:「false」-
指定是否要產生連結對應檔案。
標記:affects_outputs
--[no]save_temps
預設值:「false」-
如果設定,系統會儲存 gcc 的暫時輸出內容。包括 .s 檔案 (組語程式碼)、.i 檔案 (前置處理的 C) 和 .ii 檔案 (前置處理的 C++)。
標記:affects_outputs
- 可讓使用者設定預期輸出內容的選項,影響輸出內容的值,而非輸出內容是否存在:
--action_env=<a 'name=value' assignment with an optional value part>
累積多次使用-
指定可供具有目標設定的動作使用的環境變數集。變數可以依名稱指定 (此時值會取自叫用環境),也可以依名稱=值組合指定 (此時值會獨立於叫用環境)。這個選項可以多次使用;如果是相同變數的選項,系統會採用最新的選項,如果是不同變數的選項,則會累加。
標記:action_command_lines
--allowed_cpu_values=<comma-separated set of options>
預設值:「」-
--cpu 標記的允許值。
標記:changes_inputs
、affects_outputs
--[no]android_databinding_use_androidx
預設值:「true」-
產生與 AndroidX 相容的資料繫結檔案。這項功能僅適用於資料繫結 v2。這個旗標是無運算。
標記:affects_outputs
、loading_and_analysis
、loses_incremental_state
、experimental
--[no]android_databinding_use_v3_4_args
預設值:「true」-
使用 3.4.0 引數搭配 Android 資料繫結 v2。這個旗標是無運算。
標記:affects_outputs
、loading_and_analysis
、loses_incremental_state
、experimental
--android_dynamic_mode=<off, default or fully>
預設值:「off」-
判斷 cc_binary 未明確建立共用程式庫時,是否要動態連結 Android 規則的 C++ 依附元件。「default」表示 Bazel 會選擇是否要動態連結。「完全」表示所有程式庫都會動態連結。「off」表示所有程式庫都會以靜態模式連結。
標記:affects_outputs
、loading_and_analysis
--android_manifest_merger_order=<alphabetical, alphabetical_by_configuration or dependency>
預設值:「alphabetical」-
設定傳遞至 Android 二進位檔資訊清單合併工具的資訊清單順序。ALPHABETICAL 表示資訊清單會依據相對於 execroot 的路徑排序。ALPHABETICAL_BY_CONFIGURATION 表示資訊清單會依路徑排序,路徑是相對於輸出目錄中的設定目錄。DEPENDENCY 表示資訊清單的排序方式為:每個程式庫的資訊清單會出現在其依附元件的資訊清單之前。
標記:action_command_lines
、execution
--[no]android_resource_shrinking
預設值:「false」-
為使用 ProGuard 的 android_binary APK 啟用資源壓縮功能。
標記:affects_outputs
、loading_and_analysis
--[no]build_python_zip
預設值:「auto」-
建構 Python 可執行檔 ZIP;在 Windows 上為開啟,在其他平台上為關閉
標記:affects_outputs
--catalyst_cpus=<comma-separated list of options>
累積多次使用-
以半形逗號分隔的架構清單,用於建構 Apple Catalyst 二進位檔。
標記:loses_incremental_state
、loading_and_analysis
--[no]collect_code_coverage
預設值:「false」-
如果指定,Bazel 會檢測程式碼 (盡可能使用離線檢測),並在測試期間收集涵蓋範圍資訊。只有符合 --instrumentation_filter 的目標會受到影響。通常不應直接指定這個選項,而是應使用「bazel coverage」指令。
標記:affects_outputs
--compilation_mode=<fastbuild, dbg or opt>
[-c
] 預設值:「fastbuild」-
指定建構二進位檔的模式。值:「fastbuild」、「dbg」、「opt」。
標記:affects_outputs
、action_command_lines
--conlyopt=<a string>
累積多次使用-
編譯 C 來源檔案時,要傳遞至 gcc 的其他選項。
標記:action_command_lines
、affects_outputs
--copt=<a string>
累積多次使用-
要傳遞至 gcc 的其他選項。
標記:action_command_lines
、affects_outputs
--cpu=<a string>
預設值:「」-
目標 CPU。
標記:changes_inputs
、affects_outputs
--cs_fdo_absolute_path=<a string>
預設值:請參閱說明-
使用 CSFDO 設定檔資訊,盡可能改良編譯作業。指定包含設定檔、原始或已編列索引 LLVM 設定檔的 zip 檔絕對路徑名稱。
標記:affects_outputs
--cs_fdo_instrument=<a string>
預設值:請參閱說明-
使用情境感應 FDO 檢測功能產生二進位檔。使用 Clang/LLVM 編譯器時,系統也會接受目錄名稱,執行階段會將原始設定檔傾印至該目錄。
標記:affects_outputs
--cs_fdo_profile=<a build target label>
預設值:請參閱說明-
代表要用於最佳化的內容相關設定檔的 cs_fdo_profile。
標記:affects_outputs
--cxxopt=<a string>
累積多次使用-
編譯 C++ 來源檔案時,要傳遞至 gcc 的其他選項。
標記:action_command_lines
、affects_outputs
--define=<a 'name=value' assignment>
累積多次使用-
每個 --define 選項都會指定建構變數的指派作業。如果變數有多個值,則最後一個值會勝出。
標記:changes_inputs
、affects_outputs
--dynamic_mode=<off, default or fully>
預設值:「default」-
決定是否要動態連結 C++ 二進位檔。 「default」表示 Bazel 會選擇是否要動態連結。「完全」表示所有程式庫都會動態連結。「off」表示所有程式庫都會以靜態模式連結。
標記:loading_and_analysis
、affects_outputs
--[no]enable_propeller_optimize_absolute_paths
預設值:「true」-
如果已設定,任何使用螺旋槳最佳化絕對路徑的行為都會引發錯誤。
標記:affects_outputs
--[no]enable_remaining_fdo_absolute_paths
預設值:「true」-
如果設定,使用 FDO 的絕對路徑時會引發錯誤。
標記:affects_outputs
--[no]enable_runfiles
預設值:「auto」-
啟用 Runfiles 符號連結樹狀結構;預設為在 Windows 上關閉,在其他平台上開啟。
標記:affects_outputs
--experimental_action_listener=<a build target label>
累積多次使用-
已淘汰,請改用切面。使用 action_listener 將 extra_action 附加至現有的建構動作。
標記:execution
、experimental
--[no]experimental_android_compress_java_resources
預設值:「false」-
壓縮 APK 中的 Java 資源
標記:affects_outputs
、loading_and_analysis
、experimental
--[no]experimental_android_databinding_v2
預設值:「true」-
使用 Android 資料繫結 v2。這個旗標是無運算。
標記:affects_outputs
、loading_and_analysis
、loses_incremental_state
、experimental
--[no]experimental_android_resource_shrinking
預設值:「false」-
為使用 ProGuard 的 android_binary APK 啟用資源壓縮功能。
標籤:affects_outputs
、loading_and_analysis
、experimental
--[no]experimental_android_rewrite_dexes_with_rex
預設值:「false」-
use rex tool to rewrite dex files
標記:affects_outputs
、loading_and_analysis
、loses_incremental_state
、experimental
--[no]experimental_collect_code_coverage_for_generated_files
預設值:「false」-
如有指定,Bazel 也會為產生的檔案產生收集涵蓋範圍資訊。
標記:affects_outputs
、experimental
--experimental_objc_fastbuild_options=<comma-separated list of options>
預設值:「-O0,-DDEBUG=1」-
將這些字串做為 objc 快速建構編譯器選項。
標記:action_command_lines
--[no]experimental_omitfp
預設值:「false」-
如果設為 true,則使用 libunwind 進行堆疊解除,並使用 -fomit-frame-pointer 和 -fasynchronous-unwind-tables 進行編譯。
標籤:action_command_lines
、affects_outputs
、experimental
--experimental_output_paths=<off, content or strip>
預設值:「off」-
輸出樹狀結構規則應使用哪個模型來寫入輸出內容,特別是針對多平台 / 多設定建構作業。這項功能仍在實驗階段,詳情請參閱 https://github.com/bazelbuild/bazel/issues/6526。如要選擇加入路徑對應,請將「supports-path-mapping」鍵新增至「execution_requirements」字典。
標記:loses_incremental_state
、bazel_internal_configuration
、affects_outputs
、execution
--experimental_override_name_platform_in_output_dir=<a 'label=value' assignment>
累積多次使用-
每個項目都應採用 label=value 格式,其中 label 是指平台,value 則是要在輸出路徑中使用的所需簡短名稱。只有在 --experimental_platform_in_output_dir 為 true 時才會使用。命名優先順序最高。
標記:affects_outputs
、experimental
--[no]experimental_platform_in_output_dir
預設值:「false」-
如果為 true,輸出目錄名稱會使用目標平台的簡短名稱,而非 CPU。確切的架構是實驗性質,可能會有所變更:首先,如果 --platforms 選項沒有剛好一個值,系統會使用平台選項的雜湊。接著,如果目前平台有任何簡稱是透過 --experimental_override_name_platform_in_output_dir 登錄,系統就會使用該簡稱。然後,如果設定了 --experimental_use_platforms_in_output_dir_legacy_heuristic,請使用以目前平台標籤為準的簡短名稱。最後,平台選項的雜湊會做為最後手段。
標記:affects_outputs
、experimental
--[no]experimental_py_binaries_include_label
預設值:「false」-
即使停用蓋章功能,py_binary 目標仍會包含標籤。
標記:affects_outputs
、experimental
--[no]experimental_use_llvm_covmap
預設值:「false」-
如果指定,啟用 collect_code_coverage 時,Bazel 會產生 llvm-cov 涵蓋範圍對應資訊,而不是 gcov。
標記:changes_inputs
、affects_outputs
、loading_and_analysis
、experimental
--[no]experimental_use_platforms_in_output_dir_legacy_heuristic
預設值:「true」-
請僅在建議的遷移或測試策略中使用這個標記。請注意,這個啟發式方法有已知缺點,建議改為只依賴 --experimental_override_name_platform_in_output_dir。
標記:affects_outputs
、experimental
--fdo_instrument=<a string>
預設值:請參閱說明-
使用 FDO 檢測生成二進位檔。使用 Clang/LLVM 編譯器時,系統也會接受目錄名稱,執行階段會將原始設定檔傾印至該目錄。
標記:affects_outputs
--fdo_optimize=<a string>
預設值:請參閱說明-
使用 FDO 設定檔資訊,最佳化編譯作業。指定包含 .gcda 檔案樹狀結構、包含自動設定檔的 afdo 檔案,或 LLVM 設定檔檔案的 ZIP 檔案名稱。這個旗標也接受指定為標籤的檔案 (例如 `//foo/bar:file.afdo` - 您可能需要在對應的套件中新增 `exports_files` 指令),以及指向 `fdo_profile` 目標的標籤。這項標記會由 `fdo_profile` 規則取代。
標記:affects_outputs
--fdo_prefetch_hints=<a build target label>
預設值:請參閱說明-
使用快取預先擷取提示。
標記:affects_outputs
--fdo_profile=<a build target label>
預設值:請參閱說明-
代表用於最佳化的設定檔。
標記:affects_outputs
--features=<a string>
累積多次使用-
系統會根據目標設定,預設啟用或停用目標中建構的指定功能。指定 -<feature> 會停用該功能。負面特徵一律會覆寫正面特徵。另請參閱 --host_features
標記:changes_inputs
、affects_outputs
--[no]force_pic
預設值:「false」-
啟用後,所有 C++ 編譯作業都會產生與位置無關的程式碼 (「-fPIC」),連結會優先使用 PIC 預先建構的程式庫,而非非 PIC 程式庫,且連結會產生與位置無關的可執行檔 (「-pie」)。
標記:loading_and_analysis
、affects_outputs
--host_action_env=<a 'name=value' assignment with an optional value part>
累積多次使用-
指定可供具有執行設定的動作使用的環境變數集。變數可以依名稱指定 (此時值會取自叫用環境),也可以依名稱=值組合指定 (此時值會獨立於叫用環境)。這個選項可以多次使用;如果是相同變數的選項,系統會採用最新的選項,如果是不同變數的選項,則會累加。
標記:action_command_lines
--host_compilation_mode=<fastbuild, dbg or opt>
預設值:「opt」-
指定建構期間使用的工具建構模式。值:「fastbuild」、「dbg」、「opt」。
標記:affects_outputs
、action_command_lines
--host_conlyopt=<a string>
累積多次使用-
在 exec 設定中編譯 C (而非 C++) 來源檔案時,要傳遞至 C 編譯器的其他選項。
標記:action_command_lines
、affects_outputs
--host_copt=<a string>
累積多次使用-
要傳遞至 C 編譯器的其他選項,適用於在 exec 設定中建構的工具。
標記:action_command_lines
、affects_outputs
--host_cpu=<a string>
預設值:「」-
主機 CPU。
標記:changes_inputs
、affects_outputs
--host_cxxopt=<a string>
累積多次使用-
要傳遞至 C++ 編譯器的其他選項,適用於在 exec 設定中建構的工具。
標記:action_command_lines
、affects_outputs
--host_features=<a string>
累積多次使用-
系統會為在執行設定中建構的目標,預設啟用或停用指定功能。指定 -<feature> 會停用該功能。負面特徵一律會覆寫正面特徵。
標記:changes_inputs
、affects_outputs
--host_force_python=<PY2 or PY3>
預設值:請參閱說明-
覆寫執行設定的 Python 版本。可以是「PY2」或「PY3」。
標記:loading_and_analysis
、affects_outputs
--host_linkopt=<a string>
累積多次使用-
在執行設定中連結工具時,傳遞至連結器的其他選項。
標記:action_command_lines
、affects_outputs
--host_macos_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
主機目標的最低相容 macOS 版本。如未指定,則會使用「macos_sdk_version」。
標記:loses_incremental_state
--host_per_file_copt=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths followed by an @ and a comma separated list of options>
累積多次使用-
在執行設定中編譯特定檔案時,選擇性傳遞至 C/C++ 編譯器的其他選項。這個選項可以多次傳遞。語法:regex_filter@option_1,option_2,...,option_n。其中 regex_filter 代表包含和排除規則運算式模式的清單 (另請參閱 --instrumentation_filter)。option_1 到 option_n 代表任意指令列選項。如果選項含有半形逗號,則必須以反斜線加上引號。選項可以包含 @。系統只會使用第一個 @ 分割字串。範例:--host_per_file_copt=//foo/.*\.cc,-//foo/bar\.cc@-O0 會將 -O0 指令列選項新增至 //foo/ 中所有 cc 檔案的 gcc 指令列,但 bar.cc 除外。
標記:action_command_lines
、affects_outputs
--[no]incompatible_auto_exec_groups
預設值:「false」-
啟用後,系統會為規則使用的每個工具鍊自動建立執行群組。如要讓這項規則運作,必須在動作中指定 `toolchain` 參數。詳情請參閱 https://github.com/bazelbuild/bazel/issues/17134。
標記:affects_outputs
、incompatible_change
--[no]incompatible_merge_genfiles_directory
預設值:「true」-
如果是 true,genfiles 目錄會摺疊到 bin 目錄中。
標記:affects_outputs
、incompatible_change
--[no]instrument_test_targets
預設值:「false」-
啟用涵蓋範圍時,指定是否要考慮插樁測試規則。設定後,--instrumentation_filter 包含的測試規則會經過檢測。否則,測試規則一律會從涵蓋範圍插樁中排除。
標記:affects_outputs
--instrumentation_filter=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths>
default: "-/javatests[/:],-/test/java[/:]"-
啟用涵蓋範圍後,系統只會檢測名稱符合指定 regex 篩選器的規則。以「-」為前置字元的規則則會遭到排除。請注意,除非啟用 --instrument_test_targets,否則系統只會檢測非測試規則。
標記:affects_outputs
--ios_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
目標模擬器和裝置的最低相容 iOS 版本。如未指定,則使用「ios_sdk_version」。
標記:loses_incremental_state
--ios_multi_cpus=<comma-separated list of options>
累積多次使用-
以半形逗號分隔的架構清單,用於建構 ios_application。結果是包含所有指定架構的通用二進位檔。
標記:loses_incremental_state
、loading_and_analysis
--[no]legacy_whole_archive
預設值:「true」-
已淘汰,由 --incompatible_remove_legacy_whole_archive 取代 (詳情請參閱 https://github.com/bazelbuild/bazel/issues/7362)。開啟後,請為具有 linkshared=True,且 linkopts 中有 linkstatic=True 或「-static」的 cc_binary 規則使用 --whole-archive。這項功能僅適用於回溯相容性。更好的替代方案是在必要時使用 alwayslink=1。
標籤:action_command_lines
、affects_outputs
、deprecated
--linkopt=<a string>
累積多次使用-
連結時傳遞至 gcc 的其他選項。
標記:action_command_lines
、affects_outputs
--ltobackendopt=<a string>
累積多次使用-
傳遞至 LTO 後端步驟的其他選項 (位於 --features=thin_lto 下)。
標記:action_command_lines
、affects_outputs
--ltoindexopt=<a string>
累積多次使用-
可傳遞至 LTO 索引步驟的其他選項 (位於 --features=thin_lto 下)。
標記:action_command_lines
、affects_outputs
--macos_cpus=<comma-separated list of options>
累積多次使用-
要建構 Apple macOS 二進位檔的架構清單 (以半形逗號分隔)。
標記:loses_incremental_state
、loading_and_analysis
--macos_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
目標的最低相容 macOS 版本。如未指定,則會使用「macos_sdk_version」。
標記:loses_incremental_state
--memprof_profile=<a build target label>
預設值:請參閱說明-
使用 memprof 設定檔。
標記:affects_outputs
--[no]objc_debug_with_GLIBCXX
預設值:「false」-
如果已設定,且編譯模式設為「dbg」,請定義 GLIBCXX_DEBUG、GLIBCXX_DEBUG_PEDANTIC 和 GLIBCPP_CONCEPT_CHECKS。
標記:action_command_lines
--[no]objc_enable_binary_stripping
預設值:「false」-
是否要對連結的二進位檔執行符號和無效程式碼剝除作業。如果同時指定這個旗標和 --compilation_mode=opt,系統就會執行二進位檔剝除作業。
標記:action_command_lines
--objccopt=<a string>
累積多次使用-
編譯 Objective-C/C++ 來源檔案時,要傳遞給 gcc 的其他選項。
標記: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>
累積多次使用-
編譯特定檔案時,可選擇性傳遞至 gcc 的其他選項。這個選項可以多次傳遞。語法:regex_filter@option_1,option_2,...,option_n。其中 regex_filter 代表包含和排除規則運算式模式的清單 (另請參閱 --instrumentation_filter)。option_1 到 option_n 代表任意指令列選項。如果選項含有半形逗號,則必須以反斜線加上引號。選項可以包含 @。系統只會使用第一個 @ 分割字串。範例:--per_file_copt=//foo/.*\.cc,-//foo/bar\.cc@-O0 會將 -O0 指令列選項新增至 //foo/ 中所有 cc 檔案 (bar.cc 除外) 的 gcc 指令列。
標記: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>
累積多次使用-
編譯特定後端物件時,可選擇性傳遞至 LTO 後端的其他選項 (位於 --features=thin_lto 下)。這個選項可以多次傳遞。語法:regex_filter@option_1,option_2,...,option_n。其中 regex_filter 代表包含和排除規則運算式模式的清單,option_1 到 option_n 則代表任意指令列選項。如果選項含有半形逗號,則必須以反斜線加上引號。選項可以包含 @。系統只會使用第一個 @ 分割字串。範例:--per_file_ltobackendopt=//foo/.*\.o,-//foo/bar\.o@-O0 會將 -O0 指令列選項新增至 //foo/ 中所有 o 檔案 (bar.o 除外) 的 LTO 後端指令列。
標記:action_command_lines
、affects_outputs
--platform_suffix=<a string>
預設值:請參閱說明-
指定要加到設定目錄的後置字串。
標籤:loses_incremental_state
、affects_outputs
、loading_and_analysis
--propeller_optimize=<a build target label>
預設值:請參閱說明-
使用 Propeller 設定檔資訊,最佳化建構目標。Propeller 設定檔必須包含至少一個檔案,即 cc 設定檔和 ld 設定檔。這個標記接受建構標籤,該標籤必須參照螺旋槳設定檔輸入檔案。舉例來說,在 a/b/BUILD 中定義標籤的 BUILD 檔案:propeller_optimize( name = "propeller_profile", cc_profile = "propeller_cc_profile.txt", ld_profile = "propeller_ld_profile.txt",)可能必須將 exports_files 指令新增至對應的套件,才能讓 Bazel 看到這些檔案。這個選項必須做為下列項目使用:--propeller_optimize=//a/b:propeller_profile
標記:action_command_lines
、affects_outputs
--propeller_optimize_absolute_cc_profile=<a string>
預設值:請參閱說明-
Propeller 最佳化建構版本的 cc_profile 檔案絕對路徑名稱。
標記:affects_outputs
--propeller_optimize_absolute_ld_profile=<a string>
預設值:請參閱說明-
Propeller 最佳化建構版本的 ld_profile 檔案絕對路徑名稱。
標記:affects_outputs
--run_under=<a prefix in front of command>
預設值:請參閱說明-
要插入「test」和「run」指令可執行檔之前的字首。如果值為「foo -bar」,而執行指令列為「test_binary -baz」,則最終指令列為「foo -bar test_binary -baz」。這也可以是可執行目標的標籤。例如:'valgrind'、'strace'、'strace -c'、'valgrind --quiet --num-callers=20'、'//package:target'、'//package:target --options'。
標記:action_command_lines
-
如果為 true,不同目標之間會共用包含相同功能的原生程式庫。
標記:loading_and_analysis
、affects_outputs
--[no]stamp
預設值:「false」-
在二進位檔中蓋上日期、使用者名稱、主機名稱、工作區資訊等。
標記:affects_outputs
--strip=<always, sometimes or never>
預設值:「有時」-
指定是否要剝除二進位檔和共用程式庫 (使用「-Wl,--strip-debug」)。預設值「sometimes」表示僅在 --compilation_mode=fastbuild 時移除。
標記:affects_outputs
--stripopt=<a string>
累積多次使用-
產生 '<name>.stripped' 二進位檔時,要傳遞至 strip 的其他選項。
標記:action_command_lines
、affects_outputs
--tvos_cpus=<comma-separated list of options>
累積多次使用-
要建構 Apple tvOS 二進位檔的架構清單 (以半形逗號分隔)。
標記:loses_incremental_state
、loading_and_analysis
--tvos_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
目標模擬器和裝置的最低相容 tvOS 版本。如未指定,則會使用「tvos_sdk_version」。
標記:loses_incremental_state
--visionos_cpus=<comma-separated list of options>
累積多次使用-
要建構 Apple visionOS 二進位檔的架構清單 (以半形逗號分隔)。
標記:loses_incremental_state
、loading_and_analysis
--watchos_cpus=<comma-separated list of options>
累積多次使用-
以半形逗號分隔的架構清單,用於建構 Apple watchOS 二進位檔。
標記:loses_incremental_state
、loading_and_analysis
--watchos_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
目標模擬器和裝置的最低相容 watchOS 版本。如未指定,則會使用「watchos_sdk_version」。
標記:loses_incremental_state
--xbinary_fdo=<a build target label>
預設值:請參閱說明-
使用 XbinaryFDO 設定檔資訊,最佳化編譯作業。指定預設跨二進位檔設定檔的名稱。如果這個選項與 --fdo_instrument/--fdo_optimize/--fdo_profile 搭配使用,這些選項一律會優先採用,如同從未指定 xbinary_fdo 一樣。
標記:affects_outputs
- 影響 Bazel 嚴格程度的選項,可強制執行有效的建構輸入內容 (規則定義、旗標組合等):
--[no]check_licenses
預設值:「false」-
確認依附套件的授權限制不會與建構目標的發布模式衝突。根據預設,系統不會檢查授權。
標記:build_file_semantics
--[no]check_visibility
預設值:「true」-
如果停用,目標依附元件中的顯示設定錯誤會降級為警告。
標記:build_file_semantics
--[no]desugar_for_android
預設值:「true」-
是否要在 dexing 前脫糖 Java 8 位元碼。
標籤:affects_outputs
、loading_and_analysis
、loses_incremental_state
--[no]desugar_java8_libs
預設值:「false」-
是否要在舊版裝置的應用程式中加入支援的 Java 8 程式庫。
標記:affects_outputs
、loading_and_analysis
、loses_incremental_state
、experimental
--[no]enforce_constraints
預設值:「true」-
檢查每個目標相容的環境,並在任何目標有不支援相同環境的依附元件時回報錯誤。
標記:build_file_semantics
--[no]experimental_check_desugar_deps
預設值:「true」-
是否要在 Android 二進位層級重複檢查正確的解除糖化程序。
標籤:eagerness_to_exit
、loading_and_analysis
、experimental
--experimental_import_deps_checking=<a string>
預設值:請參閱說明-
無作業,僅為回溯相容性而保留
標記:loading_and_analysis
--experimental_one_version_enforcement=<off, warning or error>
預設值:「OFF」-
啟用後,系統會強制執行 java_binary 規則,確保類別路徑中不會包含相同類別檔案的多個版本。這項強制執行措施可能會導致建構作業中斷,或只是產生警告。
標記:loading_and_analysis
--experimental_strict_java_deps=<off, warn, error, strict or default>
預設值:「default」-
如果為 true,則檢查 Java 目標是否明確將所有直接使用的目標宣告為依附元件。
標記:build_file_semantics
、eagerness_to_exit
--[no]incompatible_check_testonly_for_output_files
預設值:「false」-
如果已啟用,請查閱產生規則的 testonly,找出輸出檔案的必要條件目標。這與可見度檢查相符。
標記:build_file_semantics
、incompatible_change
--[no]incompatible_check_visibility_for_toolchains
預設值:「false」-
如果啟用,可見度檢查也會套用至工具鍊實作項目。
標記:build_file_semantics
、incompatible_change
--[no]incompatible_disable_native_android_rules
預設值:「false」-
如果啟用,系統會停用 Android 原生規則的直接使用權。請使用 https://github.com/bazelbuild/rules_android 中的 Starlark Android 規則
標記:eagerness_to_exit
、incompatible_change
--[no]incompatible_disable_native_apple_binary_rule
預設值:「false」-
無作業。為保持回溯相容性而保留。
標記:eagerness_to_exit
、incompatible_change
--[no]incompatible_python_disable_py2
預設值:「true」-
如果為 true,使用 Python 2 設定會導致錯誤。包括 python_version=PY2、srcs_version=PY2 和 srcs_version=PY2ONLY。詳情請參閱 https://github.com/bazelbuild/bazel/issues/15684。
標記:loading_and_analysis
、incompatible_change
--[no]one_version_enforcement_on_java_tests
預設值:「true」-
啟用後,如果 experimental_one_version_enforcement 設為非 NONE 值,系統就會對 java_test 目標強制執行單一版本。您可以停用此標記,以改善增量測試效能,但可能會因此錯過潛在的單一版本違規事項。
標記:loading_and_analysis
--python_native_rules_allowlist=<a build target label>
預設值:請參閱說明-
強制執行 --incompatible_python_disallow_native_rules 時使用的許可清單 (package_group 目標)。
標記:loading_and_analysis
--[no]strict_filesets
預設值:「false」-
如果啟用這個選項,系統會將跨越套件界線的檔案集回報為錯誤。
標記:build_file_semantics
、eagerness_to_exit
--strict_proto_deps=<off, warn, error, strict or default>
預設值:「error」-
除非設為 OFF,否則會檢查 proto_library 目標是否明確將所有直接使用的目標宣告為依附元件。
標籤:build_file_semantics
、eagerness_to_exit
、incompatible_change
--strict_public_imports=<off, warn, error, strict or default>
預設值:「off」-
除非設為 OFF,否則會檢查 proto_library 目標是否明確將「import public」中使用的所有目標宣告為已匯出。
標籤:build_file_semantics
、eagerness_to_exit
、incompatible_change
--[no]strict_system_includes
預設值:「false」-
如果是 true,系統也必須宣告透過系統包含路徑 (-isystem) 找到的標頭。
標記:loading_and_analysis
、eagerness_to_exit
--target_environment=<a build target label>
累積多次使用-
宣告這個建構作業的目標環境。必須是「環境」規則的標籤參照。如果指定,所有頂層目標都必須與這個環境相容。
標記:changes_inputs
- 影響建構簽署輸出的選項:
--apk_signing_method=<v1, v2, v1_v2 or v4>
預設值:「v1_v2」-
用來簽署 APK 的實作項目
標記:action_command_lines
、affects_outputs
、loading_and_analysis
--[no]device_debug_entitlements
預設值:「true」-
如果已設定,且編譯模式不是「opt」,objc 應用程式會在簽署時加入偵錯授權。
標記:changes_inputs
--ios_signing_cert_name=<a string>
預設值:請參閱說明-
用於 iOS 簽署的憑證名稱。如未設定,系統會改用佈建設定檔。可能是憑證的鑰匙圈身分偏好設定,或憑證通用名稱的 (子字串),如 codesign 的說明頁面 (SIGNING IDENTITIES) 所示。
標記:action_command_lines
- 這個選項會影響 Starlark 語言的語意,或可供 BUILD 檔案、.bzl 檔案或 WORKSPACE 檔案存取的建構 API:
--[no]incompatible_disallow_legacy_py_provider
預設值:「true」-
No-op, will be removed soon.
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_disallow_sdk_frameworks_attributes
預設值:「false」-
如果設為 true,則 objc_library 和 objc_import 中的 sdk_frameworks 和 weak_sdk_frameworks 屬性會遭到禁止。
標記:build_file_semantics
、incompatible_change
--[no]incompatible_objc_alwayslink_by_default
預設值:「false」-
如果為 true,請將 objc_library 和 objc_import 中的 alwayslink 屬性預設值設為 true。
標記:build_file_semantics
、incompatible_change
--[no]incompatible_python_disallow_native_rules
預設值:「false」-
如果為 true,使用內建 py_* 規則時會發生錯誤,此時應改用 rule_python 規則。如需更多資訊和遷移操作說明,請參閱 https://github.com/bazelbuild/bazel/issues/17773。
標記:loading_and_analysis
、incompatible_change
- 控管測試環境或測試執行器行為的選項:
--[no]allow_analysis_failures
預設值:「false」-
如果為 true,規則目標的分析失敗會導致目標傳播包含錯誤說明的 AnalysisFailureInfo 執行個體,而不是導致建構失敗。
標記:loading_and_analysis
、experimental
--analysis_testing_deps_limit=<an integer>
預設值:「2000」-
透過具有 for_analysis_testing 設定轉換的規則屬性,設定遞移依附元件數量上限。如果超出這項限制,系統就會產生規則錯誤。
標記:loading_and_analysis
--[no]break_build_on_parallel_dex2oat_failure
預設值:「false」-
如果為 true,dex2oat 動作失敗會導致建構中斷,而不是在測試執行階段執行 dex2oat。
標記:loading_and_analysis
、experimental
--default_test_resources=<a resource name followed by equal and 1 float or 4 float, e.g. memory=10,30,60,100>
累積多次使用- 覆寫測試的預設資源量。預期格式為 <resource>=<value>。如果將單一正數指定為 <value>,系統會覆寫所有測試大小的預設資源。如果指定 4 個以半形逗號分隔的數字,系統會分別覆寫小型、中型、大型和特大型測試大小的資源量。值也可以是 HOST_RAM/HOST_CPU,後面可選擇性加上 [-|*]<float> (例如 memory=HOST_RAM*.1,HOST_RAM*.2,HOST_RAM*.3,HOST_RAM*.4)。這個旗標指定的預設測試資源,會遭到標記中明確指定的資源覆寫。
--[no]experimental_android_use_parallel_dex2oat
預設值:「false」-
使用 dex2oat 平行處理,可能可加快 android_test 的速度。
標籤:loading_and_analysis
、host_machine_resource_optimizations
、experimental
--[no]ios_memleaks
預設值:「false」-
在 ios_test 目標中啟用記憶體洩漏檢查。
標記:action_command_lines
--ios_simulator_device=<a string>
預設值:請參閱說明-
在模擬器中執行 iOS 應用程式時要模擬的裝置,例如「iPhone 6」。您可以在要執行模擬器的電腦上執行「xcrun simctl list devicetypes」,取得裝置清單。
標記:test_runner
--ios_simulator_version=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
執行或測試時,要在模擬器上執行的 iOS 版本。如果規則中指定目標裝置,系統會忽略 ios_test 規則的這項設定。
標記:test_runner
--runs_per_test=<a positive integer or test_regex@runs. This flag may be passed more than once>
累積多次使用- 指定每次測試的執行次數。如果其中任何一項嘗試因任何原因失敗,整個測試就會視為失敗。通常指定的值只會是整數。範例:--runs_per_test=3 會執行所有測試 3 次。替代語法:regex_filter@runs_per_test。其中 runs_per_test 代表整數值,regex_filter 代表包含和排除規則運算式模式的清單 (另請參閱 --instrumentation_filter)。範例:--runs_per_test=//foo/.*,-//foo/bar/.*@3 會執行 //foo/ 中的所有測試,但 foo/bar 下的測試除外,且執行次數為 3 次。這個選項可以多次傳遞。系統會優先採用最近傳遞且相符的引數。如果沒有相符的項目,測試只會執行一次。
--test_env=<a 'name=value' assignment with an optional value part>
累積多次使用-
指定要注入測試執行器環境的其他環境變數。變數可依名稱指定 (系統會從 Bazel 用戶端環境讀取變數值),或依名稱/值組合指定。這個選項可多次使用,指定多個變數。僅供「bazel test」指令使用。
標記:test_runner
--test_timeout=<a single integer or comma-separated list of 4 integers>
預設值:「-1」- 覆寫測試逾時的預設測試逾時值 (以秒為單位)。如果指定單一正整數值,系統會覆寫所有類別。如果指定 4 個以半形逗號分隔的整數,系統會依序覆寫短、中、長和永久的逾時時間。不論採用哪種形式,值為 -1 都會告知 Blaze 對該類別使用預設逾時。
--[no]zip_undeclared_test_outputs
預設值:「false」-
如果設為 true,系統會將未宣告的測試輸出內容封存至 zip 檔案。
標記:test_runner
- 可觸發建構時間最佳化的選項:
--[no]experimental_filter_library_jar_with_program_jar
預設值:「false」-
篩選 ProGuard ProgramJar,移除 LibraryJar 中也存在的任何類別。
標記:action_command_lines
、experimental
--[no]experimental_inmemory_dotd_files
預設值:「true」-
啟用後,系統會直接從遠端建構節點在記憶體中傳遞 C++ .d 檔案,而不是寫入磁碟。
標記:loading_and_analysis
、execution
、affects_outputs
、experimental
--[no]experimental_inmemory_jdeps_files
預設值:「true」-
啟用後,從 Java 編譯作業產生的依附元件 (.jdeps) 檔案會直接從遠端建構節點在記憶體中傳遞,而不是寫入磁碟。
標記:loading_and_analysis
、execution
、affects_outputs
、experimental
--[no]experimental_retain_test_configuration_across_testonly
預設值:「false」-
啟用後,--trim_test_configuration 不會修剪標示為 testonly=1 的規則測試設定。如果非測試規則依附於 cc_test 規則,這項做法可減少動作衝突問題。如果 --trim_test_configuration 為 False,則不會有任何作用。
標籤:loading_and_analysis
、loses_incremental_state
、experimental
--[no]experimental_starlark_cc_import
預設值:「false」-
如果啟用,即可使用 cc_import 的 Starlark 版本。
標記:loading_and_analysis
、experimental
--[no]experimental_unsupported_and_brittle_include_scanning
預設值:「false」-
是否要剖析輸入檔案中的 #include 行,藉此縮小 C/C++ 編譯的輸入範圍。這項做法可縮減編譯輸入樹狀結構的大小,進而提升成效和增量。不過,由於 include 掃描器並未完整實作 C 前置處理器語意,因此也可能導致建構作業中斷。特別是,它無法解讀動態 #include 指令,且會忽略前置處理器條件邏輯。您必須自行承擔使用風險。系統會關閉與此標記相關的所有問題。
標記:loading_and_analysis
、execution
、changes_inputs
、experimental
--[no]incremental_dexing
預設值:「true」-
針對每個 Jar 檔案分別執行大部分的 dexing 工作。
標籤:affects_outputs
、loading_and_analysis
、loses_incremental_state
--[no]objc_use_dotd_pruning
預設值:「true」-
如果設定這項引數,clang 發出的 .d 檔案會用於修剪傳遞至 objc 編譯的輸入集。
標記:changes_inputs
、loading_and_analysis
--[no]process_headers_in_dependencies
預設值:「false」-
建構目標 //a:a 時,處理 //a:a 所依附的所有目標中的標頭 (如果工具鍊已啟用標頭處理)。
標記:execution
--[no]trim_test_configuration
預設值:「true」-
啟用後,系統會清除建構作業頂層以下的測試相關選項。啟用這個標記後,測試無法建構為非測試規則的依附元件,但變更測試相關選項不會導致系統重新分析非測試規則。
標記:loading_and_analysis
、loses_incremental_state
- 影響記錄詳細程度、格式或位置的選項:
--toolchain_resolution_debug=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths>
預設值:「-.*」-
在工具鍊解析期間列印偵錯資訊。這個旗標會採用正規運算式,並根據工具鍊類型和特定目標進行檢查,判斷要偵錯的項目。多個規則運算式可以逗號分隔,然後系統會分別檢查每個規則運算式。注意:這個標記的輸出內容非常複雜,可能只對工具鍊解析專家有用。
標記:terminal_output
- 指定或變更 Bazel 指令一般輸入內容的選項,不屬於其他類別:
--flag_alias=<a 'name=value' flag alias>
累積多次使用-
為 Starlark 旗標設定簡短名稱。這個函式會以「<key>=<value>」形式的單一鍵/值組合做為引數。
標記:changes_inputs
--[no]incompatible_default_to_explicit_init_py
預設值:「false」-
這個標記會變更預設行為,因此系統不會再自動在 Python 目標的執行檔中建立 __init__.py 檔案。具體來說,如果 py_binary 或 py_test 目標的 legacy_create_init 設為「auto」(預設值),則只有在設定這個旗標時,系統才會將其視為 false。詳情請參閱 https://github.com/bazelbuild/bazel/issues/10076。
標記:affects_outputs
、incompatible_change
--[no]incompatible_py2_outputs_are_suffixed
預設值:「true」-
如果為 true,以 Python 2 設定建構的目標會顯示在包含「-py2」後置字串的輸出根目錄下,而為 Python 3 建構的目標則會顯示在沒有 Python 相關後置字串的根目錄中。也就是說,`bazel-bin` 便利符號連結會指向 Python 3 目標,而非 Python 2。啟用這個選項時,建議一併啟用 `--incompatible_py3_is_default`。
標記:affects_outputs
、incompatible_change
--[no]incompatible_py3_is_default
預設值:「true」-
如果為 true,未設定 `python_version` (或 `default_python_version`) 屬性的 `py_binary` 和 `py_test` 目標,預設會使用 PY3,而非 PY2。如果設定這個旗標,建議一併設定 `--incompatible_py2_outputs_are_suffixed`。
標記:loading_and_analysis
、affects_outputs
、incompatible_change
--[no]incompatible_use_python_toolchains
預設值:「true」-
如果設為 true,可執行的原生 Python 規則會使用 Python 工具鍊指定的 Python 執行階段,而不是舊版旗標 (例如 --python_top) 提供的執行階段。
標記:loading_and_analysis
、incompatible_change
--python_version=<PY2 or PY3>
預設值:請參閱說明-
Python 主要版本模式,可以是 `PY2` 或 `PY3`。請注意,這會遭到 `py_binary` 和 `py_test` 目標覆寫 (即使這些目標未明確指定版本),因此通常沒有太多理由提供這個旗標。
標記:loading_and_analysis
、affects_outputs
- 其他選項,未歸類於其他類別:
--[no]cache_test_results
[-t
] 預設值:「auto」- 如果設為「auto」,只有在下列情況下,Bazel 才會重新執行測試:(1) Bazel 偵測到測試或其依附元件有變更;(2) 測試標示為外部;(3) 使用 --runs_per_test 要求多次執行測試;或(4) 測試先前失敗。如果設為「yes」,Bazel 會快取所有測試結果,但標示為外部的測試除外。如果設為「no」,Bazel 不會快取任何測試結果。
--[no]experimental_cancel_concurrent_tests
預設值:「false」-
如果為 true,Blaze 會在第一次成功執行時,取消同時執行的測試。只有在搭配 --runs_per_test_detects_flakes 時才會有作用。
標籤:affects_outputs
、loading_and_analysis
、experimental
--[no]experimental_fetch_all_coverage_outputs
預設值:「false」-
如果為 true,Bazel 會在執行涵蓋範圍時,擷取每項測試的整個涵蓋範圍資料目錄。
標籤:affects_outputs
、loading_and_analysis
、experimental
--[no]experimental_generate_llvm_lcov
預設值:「false」-
如果為 true,clang 的涵蓋範圍會產生 LCOV 報表。
標籤:affects_outputs
、loading_and_analysis
、experimental
--[no]experimental_j2objc_header_map
預設值:「true」-
是否要與 J2ObjC 轉譯作業平行產生 J2ObjC 標頭對應檔。
標記:experimental
--[no]experimental_j2objc_shorter_header_path
預設值:「false」-
是否要使用較短的標頭路徑生成 (使用「_ios」而非「_j2objc」)。
標記:affects_outputs
、experimental
--experimental_java_classpath=<off, javabuilder or bazel>
預設值:「javabuilder」- 啟用 Java 編譯的縮減類別路徑。
--[no]experimental_limit_android_lint_to_android_constrained_java
預設值:「false」-
無作業,僅保留向後相容性
標記:affects_outputs
、experimental
--[no]experimental_run_android_lint_on_java_rules
預設值:「false」-
是否要驗證 java_* 來源。
標記:affects_outputs
、experimental
--[no]explicit_java_test_deps
預設值:「false」- 在 java_test 中明確指定 JUnit 或 Hamcrest 的依附元件,而不是從 TestRunner 的 deps 意外取得。目前僅適用於 Bazel。
--host_java_launcher=<a build target label>
預設值:請參閱說明- 建構期間執行的工具所用的 Java 啟動器。
--host_javacopt=<a string>
累積多次使用- 建構在建構期間執行的工具時,要傳遞至 javac 的其他選項。
--host_jvmopt=<a string>
累積多次使用- 建構在建構期間執行的工具時,要傳遞至 Java VM 的其他選項。這些選項會新增至每個 java_binary 目標的 VM 啟動選項。
--[no]incompatible_check_sharding_support
預設值:「true」-
如果設為 true,且測試執行器未透過觸控 TEST_SHARD_STATUS_FILE 路徑中的檔案,指出支援分片,Bazel 就會讓分片測試失敗。如果為 false,不支援分片的測試執行器會導致所有測試在每個分片中執行。
標記:incompatible_change
--[no]incompatible_exclusive_test_sandboxed
預設值:「true」-
如果是 true,系統會使用沙箱策略執行專屬測試。新增「local」標記,強制在本機執行專屬測試
Tags:incompatible_change
--[no]incompatible_strict_action_env
預設值:「false」-
如果設為 true,Bazel 會使用 PATH 的靜態值環境,且不會繼承 LD_LIBRARY_PATH。如要從用戶端繼承特定環境變數,請使用 --action_env=ENV_VARIABLE,但請注意,如果使用共用快取,這麼做可能會導致無法跨使用者快取。
標記:loading_and_analysis
、incompatible_change
--j2objc_translation_flags=<comma-separated list of options>
累積多次使用- 傳遞至 J2ObjC 工具的其他選項。
--java_debug
-
導致 Java 測試的 Java 虛擬機器等待來自符合 JDWP 規範的偵錯工具 (例如 jdb) 的連線,然後才開始測試。這表示 -test_output=streamed。
展開後會顯示:
--test_arg=--wrapper_script_flag=--debug
--test_output=streamed
--test_strategy=exclusive
--test_timeout=9999
--nocache_test_results
--[no]java_deps
預設值:「true」- 為每個 Java 目標產生依附元件資訊 (目前為編譯時間類別路徑)。
--[no]java_header_compilation
預設值:「true」- 直接從來源編譯 ijars。
--java_language_version=<a string>
預設值:「」- Java 語言版本
--java_launcher=<a build target label>
預設值:請參閱說明- 建構 Java 二進位檔時要使用的 Java 啟動器。如果將這個標記設為空字串,系統會使用 JDK 啟動器。「啟動器」屬性會覆寫這個旗標。
--java_runtime_version=<a string>
預設值:「local_jdk」- Java 執行階段版本
--javacopt=<a string>
累積多次使用- 要傳遞至 javac 的其他選項。
--jvmopt=<a string>
累積多次使用- 要傳遞至 Java VM 的其他選項。這些選項會新增至每個 java_binary 目標的 VM 啟動選項。
--legacy_main_dex_list_generator=<a build target label>
預設值:請參閱說明- 指定要使用的二進位檔,以便在編譯舊版 multidex 時,產生必須位於主要 dex 中的類別清單。
--optimizing_dexer=<a build target label>
預設值:請參閱說明- 指定用於執行 Dexing 的二進位檔,不需分片。
--plugin=<a build target label>
累積多次使用- 建構作業中要使用的外掛程式。目前適用於 java_plugin。
--proguard_top=<a build target label>
預設值:請參閱說明- 指定建構 Java 二進位檔時,要使用哪個版本的 ProGuard 移除程式碼。
--proto_compiler=<a build target label>
預設值:「@bazel_tools//tools/proto:protoc」-
proto 編譯器的標籤。
標記:affects_outputs
、loading_and_analysis
--[no]proto_profile
預設值:「true」-
是否要將 profile_path 傳遞至 proto 編譯器。
標記:affects_outputs
、loading_and_analysis
--proto_profile_path=<a build target label>
預設值:請參閱說明-
要傳遞至 proto 編譯器的設定檔,做為 profile_path。如果未設定,但 --proto_profile 為 true (預設值),則會從 --fdo_optimize 推斷路徑。
標記:affects_outputs
、loading_and_analysis
--proto_toolchain_for_cc=<a build target label>
default: "@bazel_tools//tools/proto:cc_toolchain"-
proto_lang_toolchain() 的標籤,說明如何編譯 C++ proto
標記:affects_outputs
、loading_and_analysis
--proto_toolchain_for_j2objc=<a build target label>
預設值:「@bazel_tools//tools/j2objc:j2objc_proto_toolchain」-
proto_lang_toolchain() 的標籤,說明如何編譯 j2objc proto
標記:affects_outputs
、loading_and_analysis
--proto_toolchain_for_java=<a build target label>
預設值:「@bazel_tools//tools/proto:java_toolchain」-
proto_lang_toolchain() 的標籤,說明如何編譯 Java Proto
標記:affects_outputs
、loading_and_analysis
--proto_toolchain_for_javalite=<a build target label>
預設值:「@bazel_tools//tools/proto:javalite_toolchain」-
proto_lang_toolchain() 的標籤,說明如何編譯 JavaLite proto
標記:affects_outputs
、loading_and_analysis
--protocopt=<a string>
累積多次使用-
要傳遞至 protobuf 編譯器的其他選項。
標記:affects_outputs
--[no]runs_per_test_detects_flakes
預設值:「false」- 如果為 true,只要分片中至少有一次執行/嘗試通過,且至少有一次執行/嘗試失敗,就會獲得 FLAKY 狀態。
--shell_executable=<a path>
預設值:請參閱說明-
Bazel 要使用的 Shell 可執行檔絕對路徑。如果未設定這個變數,但 BAZEL_SH 環境變數是在第一次叫用 Bazel 時設定 (這會啟動 Bazel 伺服器),Bazel 會使用該變數。如果兩者皆未設定,Bazel 會根據執行的作業系統使用硬式編碼的預設路徑 (Windows:c:/msys64/usr/bin/bash.exe、FreeBSD:/usr/local/bin/bash,其他:/bin/bash)。請注意,使用與 Bash 不相容的殼層可能會導致建構失敗,或導致產生的二進位檔發生執行階段錯誤。
標記:loading_and_analysis
--test_arg=<a string>
累積多次使用- 指定應傳遞至測試執行檔的其他選項和引數。可多次使用,指定多個引數。如果執行多項測試,每項測試都會收到相同的引數。僅供「bazel test」指令使用。
--test_filter=<a string>
預設值:請參閱說明- 指定要轉送至測試架構的篩選器。用於限制執行的測試。請注意,這不會影響建構的目標。
--test_result_expiration=<an integer>
預設值:「-1」- 這個選項已淘汰,因此不會產生任何作用。
--[no]test_runner_fail_fast
預設值:「false」- 將快速失敗選項轉送至測試執行器。測試執行器應在第一次失敗時停止執行。
--test_sharding_strategy=<explicit, disabled or forced=k where k is the number of shards to enforce>
預設值:「explicit」- 指定測試分片策略:「explicit」表示只有在存在「shard_count」BUILD 屬性時,才使用分片。「disabled」則表示永不使用測試分片。「forced=k」可強制測試使用「k」個分片,無論「shard_count」BUILD 屬性為何。
--tool_java_language_version=<a string>
預設值:「」- 用於執行建構期間所需工具的 Java 語言版本
--tool_java_runtime_version=<a string>
default: "remotejdk_11"- 建構期間執行工具時使用的 Java 執行階段版本
--[no]use_ijars
預設值:「true」- 啟用後,這項選項會讓 Java 編譯使用介面 JAR。這樣一來,增量編譯速度會更快,但錯誤訊息可能有所不同。
說明選項
- 這個選項會影響 Starlark 語言的語意,或可供 BUILD 檔案、.bzl 檔案或 WORKSPACE 檔案存取的建構 API。
--[no]incompatible_use_plus_in_repo_names
預設值:「true」-
No-op。
標記:loading_and_analysis
- 影響記錄詳細程度、格式或位置的選項:
--help_verbosity=<long, medium or short>
預設值:「medium」-
選取說明指令的詳細程度。
標記:terminal_output
--long
[-l
]-
顯示每個選項的完整說明,而不只是名稱。
展開後:
--help_verbosity=long
標記:terminal_output
--short
-
只顯示選項名稱,不顯示類型或意義。
展開後:
--help_verbosity=short
標記:terminal_output
資訊選項
繼承 build 的所有選項。
- 這個選項會影響 Starlark 語言的語意,或可供 BUILD 檔案、.bzl 檔案或 WORKSPACE 檔案存取的建構 API。
--[no]incompatible_use_plus_in_repo_names
預設值:「true」-
No-op。
標記:loading_and_analysis
- 影響記錄詳細程度、格式或位置的選項:
--[no]show_make_env
預設值:「false」-
在輸出內容中加入「Make」環境。
標記:affects_outputs
、terminal_output
授權選項
- 這個選項會影響 Starlark 語言的語意,或可供 BUILD 檔案、.bzl 檔案或 WORKSPACE 檔案存取的建構 API。
--[no]incompatible_use_plus_in_repo_names
預設值:「true」-
無作業。
標記:loading_and_analysis
行動應用程式安裝選項
繼承 build 的所有選項。
- 控制建構執行的選項:
--mode=<classic, classic_internal_test_do_not_use or skylark>
預設值:「skylark」-
已淘汰的無效旗標。系統僅支援 skylark 模式。
標記:loading_and_analysis
、execution
、incompatible_change
- 設定用於執行動作的工具鍊的選項:
--adb=<a string>
預設值:「」-
用於「mobile-install」指令的 adb 二進位檔。如未指定,系統會使用 --android_sdk_channel 指令列選項指定的 Android SDK (或預設 SDK,如果未指定 --android_sdk_channel)。
標記:changes_inputs
- 可控管指令輸出的選項:
--[no]incremental
預設值:「false」-
是否要執行漸進式安裝。如為 true,請讀取要安裝程式碼的裝置狀態,並使用該資訊避免不必要的工作,盡量減少額外工作。如果為 false (預設值),一律執行完整安裝。
標記:loading_and_analysis
--[no]split_apks
預設值:「false」-
是否使用分割 APK 在裝置上安裝及更新應用程式。僅適用於搭載 Marshmallow 以上版本的裝置
標記:loading_and_analysis
、affects_outputs
- 可讓使用者設定預期輸出內容的選項,會影響輸出內容的值,而非輸出內容是否存在:
--adb_arg=<a string>
累積多次使用-
要傳遞至 adb 的額外引數。通常用於指定要安裝的裝置。
標記:action_command_lines
--debug_app
-
是否要等待偵錯工具,再啟動應用程式。
展開後會顯示:
--start=DEBUG
標記:execution
--device=<a string>
預設值:「」-
adb 裝置序號。如未指定,系統會使用第一個裝置。
標記:action_command_lines
--start=<no, cold, warm or debug>
預設值:「NO」-
安裝應用程式後,應如何啟動應用程式。設為 WARM,即可在增量安裝時保留及還原應用程式狀態。
標記:execution
--start_app
-
是否要在安裝後啟動應用程式。
展開後:
--start=COLD
標記:execution
- 這個選項會影響 Starlark 語言的語意,或是 BUILD 檔案、.bzl 檔案或 WORKSPACE 檔案可存取的建構 API。:
--[no]incompatible_use_plus_in_repo_names
預設值:「true」-
No-op。
標記:loading_and_analysis
- 影響記錄詳細程度、格式或位置的選項:
--incremental_install_verbosity=<a string>
預設值:「」-
漸進式安裝的詳細程度。設為 1 可啟用偵錯記錄。
標記:bazel_monitoring
模組選項
- 控制建構執行的選項:
--loading_phase_threads=<an integer, or a keyword ("auto", "HOST_CPUS", "HOST_RAM"), optionally followed by an operation ([-|*]<float>) eg. "auto", "HOST_CPUS*.5">
預設值:「auto」-
用於載入/分析階段的平行執行緒數量。可使用整數或關鍵字 (「auto」、「HOST_CPUS」、「HOST_RAM」),後面可選擇性加上運算符號 ([-|*]<float>),例如 「auto」、「HOST_CPUS*.5」。「auto」會根據主機資源設定合理的預設值。不得小於 1。
標記:bazel_internal_configuration
- 這個選項會影響 Starlark 語言的語意,或可供 BUILD 檔案、.bzl 檔案或 WORKSPACE 檔案存取的建構 API:
--[no]incompatible_config_setting_private_default_visibility
預設值:「false」-
如果 incompatible_enforce_config_setting_visibility=false,這就是 noop。否則,如果這個旗標為 false,任何沒有明確顯示屬性的 config_setting 都是 //visibility:public。如果這個標記為 true,config_setting 會遵循與所有其他規則相同的瀏覽權限邏輯。詳情請參閱 https://github.com/bazelbuild/bazel/issues/12933。
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_enforce_config_setting_visibility
預設值:「true」-
如果為 true,則強制執行 config_setting 可見度限制。如果為 false,每個目標都會看到所有 config_setting。詳情請參閱 https://github.com/bazelbuild/bazel/issues/12932。
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_use_plus_in_repo_names
預設值:「true」-
無作業。
標記:loading_and_analysis
- 與 `mod` 子指令的輸出和語意相關的選項:
--base_module=<"<root>" for the root module; <module>@<version> for a specific version of a module; <module> for all versions of a module; @<name> for a repo with the given apparent name; or @@<name> for a repo with the given canonical name>
預設值:「<root>」-
指定要解譯指定目標存放區的相關模組。
標記:terminal_output
--charset=<utf8 or ascii>
預設值:「utf8」-
選擇要用於樹狀結構的字元集。只會影響文字輸出內容。有效值為「utf8」或「ascii」。預設值為「utf8」
標記:terminal_output
--[no]cycles
預設值:「false」-
指出顯示樹狀結構內的依附元件週期,這些週期通常預設會遭到忽略。
標記:terminal_output
--depth=<an integer>
預設值:「-1」-
依附元件樹狀結構的顯示深度上限。舉例來說,深度為 1 會顯示直接依附元件。如果是樹狀結構、路徑和 all_paths,預設值為 Integer.MAX_VALUE;如果是 deps 和 explain,預設值為 1 (除了目標葉節點及其父項之外,只會顯示根節點的直接依附元件)。
標記:terminal_output
--extension_filter=<a comma-separated list of <extension>s>
預設值:請參閱說明-
只有在設定對應的旗標時,才會顯示這些模組擴充功能的用法,以及由這些擴充功能產生的存放區。如果設定此選項,結果圖表只會包含使用指定擴充功能的模組路徑。空白清單會停用篩選器,有效指定所有可能的擴充功能。
標記:terminal_output
--extension_info=<hidden, usages, repos or all>
預設值:「hidden」-
指定要在查詢結果中納入多少擴充功能使用情況的詳細資料。「Usages」只會顯示擴充功能名稱,「repos」也會包含以 use_repo 匯入的存放區,「all」則會顯示擴充功能產生的其他存放區。
標記:terminal_output
--extension_usages=<a comma-separated list of <module>s>
預設值:「」-
指定要在 show_extension 查詢中顯示擴充功能用法的模組。
標記:terminal_output
--from=<a comma-separated list of <module>s>
預設值:「<root>」-
系統會從這個模組開始顯示依附元件圖表查詢。請查看每個查詢的說明,瞭解確切的語意。預設值為 <root>。
標記:terminal_output
--[no]include_builtin
預設值:「false」-
在依附元件圖表中加入內建模組。這項功能預設為停用,因為相當吵雜。
標記:terminal_output
--[no]include_unused
預設值:「false」-
查詢也會考量並顯示未使用的模組,這些模組在選取後不會出現在模組解析圖中 (因為 Minimal-Version Selection 或覆寫規則)。這對各類查詢類型可能會產生不同影響,例如在 all_paths 指令中加入新路徑,或在 explain 指令中加入額外的依附元件。
標記:terminal_output
--output=<text, json or graph>
預設值:「text」-
查詢結果的列印格式。查詢可用的值包括:text、json、graph
標記:terminal_output
--[no]verbose
預設值:「false」-
查詢也會顯示模組解析為目前版本的原因 (如有變更)。預設值為 true,但僅適用於說明查詢。
標記:terminal_output
- 其他選項,未歸類於其他類別:
--deleted_packages=<comma-separated list of package names>
累積多次使用- 以半形逗號分隔的套件名稱清單。即使這些套件顯示在套件路徑的某處,建構系統也會視為不存在。 刪除現有套件「x」的子套件「x/y」時,請使用這個選項。舉例來說,如果您在用戶端中刪除 x/y/BUILD,但另一個 package_path 項目仍提供「//x:y/z」標籤,建構系統可能會發出警告。指定 --deleted_packages x/y 即可避免這個問題。
--[no]fetch
預設值:「true」- 允許指令擷取外部依附元件。如果設為 false,指令會使用依附元件的任何快取版本,如果沒有,指令就會失敗。
--package_path=<colon-separated list of options>
預設值:「%workspace%」- 以半形冒號分隔的清單,列出要尋找套件的位置。以「%workspace%」開頭的元素與封閉工作區相關。如果省略或為空,預設值為「bazel info default-package-path」的輸出內容。
--[no]show_loading_progress
預設值:「true」- 啟用後,Bazel 會列印「正在載入套件:」訊息。
Print_action 選項
繼承 build 的所有選項。
- 這個選項會影響 Starlark 語言的語意,或可供 BUILD 檔案、.bzl 檔案或 WORKSPACE 檔案存取的建構 API。
--[no]incompatible_use_plus_in_repo_names
預設值:「true」-
無作業。
標記:loading_and_analysis
- 其他選項,未歸類於其他類別:
--print_action_mnemonics=<a string>
累積多次使用- 列出要用來篩選 print_action 資料的助記符,如果留空,系統就不會進行篩選。
查詢選項
- 控制建構執行的選項:
--[no]keep_going
[-k
] 預設值:「false」-
盡可能在發生錯誤後繼續作業。雖然系統無法分析失敗的目標和依附於該目標的目標,但可以分析這些目標的其他必要條件。
標記: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">
預設值:「auto」-
用於載入/分析階段的平行執行緒數量。可使用整數或關鍵字 (「auto」、「HOST_CPUS」、「HOST_RAM」),後面可選擇性加上運算符號 ([-|*]<float>),例如 「auto」、「HOST_CPUS*.5」。「auto」會根據主機資源設定合理的預設值。不得小於 1。
標記:bazel_internal_configuration
- 這個選項會影響 Starlark 語言的語意,或可供 BUILD 檔案、.bzl 檔案或 WORKSPACE 檔案存取的建構 API:
--[no]incompatible_config_setting_private_default_visibility
預設值:「false」-
如果 incompatible_enforce_config_setting_visibility=false,這就是 noop。否則,如果這個旗標為 false,任何沒有明確顯示屬性的 config_setting 都是 //visibility:public。如果這個標記為 true,config_setting 會遵循與所有其他規則相同的瀏覽權限邏輯。詳情請參閱 https://github.com/bazelbuild/bazel/issues/12933。
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_enforce_config_setting_visibility
預設值:「true」-
如果為 true,則強制執行 config_setting 可見度限制。如果為 false,每個目標都會看到所有 config_setting。詳情請參閱 https://github.com/bazelbuild/bazel/issues/12932。
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_use_plus_in_repo_names
預設值:「true」-
無運算。
標記:loading_and_analysis
- 與查詢輸出和語意相關的選項:
--aspect_deps=<off, conservative or precise>
預設值:「conservative」-
如果輸出格式為 {xml、proto、record},如何解決層面依附元件問題?「off」表示不會解析任何層面依附元件;「conservative」(預設值) 表示會新增所有已宣告的層面依附元件,無論這些依附元件是否具有直接依附元件的規則類別;「precise」表示只會新增可能處於啟用狀態的層面,前提是這些層面具有直接依附元件的規則類別。請注意,精確模式需要載入其他套件來評估單一目標,因此比其他模式慢。另請注意,即使是精確模式也不會完全精確:是否要計算某個層面是在分析階段決定,而分析階段不會在「bazel query」期間執行。
標記:build_file_semantics
--[no]consistent_labels
預設值:「false」-
如果啟用這項功能,每個查詢指令都會發出標籤,就像是將 Starlark <code>str</code> 函式套用至 <code>Label</code> 執行個體一樣。如果工具需要比對規則發出的不同查詢指令和/或標籤的輸出內容,這項功能就非常實用。如果未啟用,輸出格式化工具可以改為發出明顯的存放區名稱 (相對於主要存放區),讓輸出內容更易於閱讀。
標記:terminal_output
--[no]experimental_explicit_aspects
預設值:「false」-
aquery、cquery:是否要在輸出內容中加入層面產生的動作。query:無運算 (一律會追蹤層面)。
標記:terminal_output
--[no]experimental_graphless_query
預設值:「auto」-
如為 true,則使用不會複製圖表的 Query 實作方式。新實作方式僅支援 --order_output=no,以及部分輸出格式化工具。
標記:build_file_semantics
、eagerness_to_exit
--graph:conditional_edges_limit=<an integer>
預設值:「4」-
要顯示的條件標籤數量上限。-1 表示不截斷,0 表示不註解。這個選項僅適用於 --output=graph。
標記:terminal_output
--[no]graph:factored
預設值:「true」-
如果為 true,系統會「分解」圖表,也就是合併拓撲等效節點,並串連標籤。這個選項僅適用於 --output=graph。
標記:terminal_output
--graph:node_limit=<an integer>
預設值:「512」-
輸出內容中圖形節點的標籤字串長度上限。較長的標籤會遭到截斷;-1 表示不會截斷。這個選項僅適用於 --output=graph。
標記:terminal_output
--[no]implicit_deps
預設值:「true」-
如果啟用,查詢作業所依附的依附元件圖表會包含隱含依附元件。隱含依附元件是指未在 BUILD 檔案中明確指定,但由 Bazel 新增的依附元件。如果是 cquery,這個選項會控管已解析工具鍊的篩選作業。
標記:build_file_semantics
--[no]include_aspects
預設值:「true」-
aquery、cquery:是否要在輸出內容中加入層面產生的動作。query:無運算 (一律會追蹤層面)。
標記:terminal_output
--[no]incompatible_lexicographical_output
預設值:「true」-
如果設定這個選項,系統會依字典順序排序 --order_output=auto 輸出內容。
標記:terminal_output
、incompatible_change
--[no]incompatible_package_group_includes_double_slash
預設值:「true」-
如果啟用,輸出 package_group 的 `packages` 屬性時,不會省略開頭的 `//`。
標記:terminal_output
、incompatible_change
--[no]infer_universe_scope
預設值:「false」-
如果已設定,但未設定 --universe_scope,則 --universe_scope 的值會推斷為查詢運算式中的不重複目標模式清單。請注意,如果查詢運算式使用宇宙範圍函式 (例如 `allrdeps`),推斷出的 --universe_scope 值可能不是您要的值,因此只有在您瞭解自己的做法時,才應使用這個選項。如需詳細資料和範例,請參閱 https://bazel.build/reference/query#sky-query。如果已設定 --universe_scope,系統會忽略這個選項的值。注意:這個選項僅適用於 `query` (即非 `cquery`)。
標記:loading_and_analysis
--[no]line_terminator_null
預設值:「false」-
每個格式是否以 \0 結尾,而非換行符號。
標記:terminal_output
--[no]nodep_deps
預設值:「true」-
如果啟用,來自「nodep」屬性的依附元件會納入查詢運作的依附元件圖。「nodep」屬性的常見範例是「visibility」。執行並剖析 `info build-language` 的輸出內容,瞭解建構語言中的所有「nodep」屬性。
標記:build_file_semantics
--noorder_results
-
以依附元件排序 (預設) 或未排序的方式輸出結果。無序輸出速度較快,但僅在 --output 不是 minrank、maxrank 或 graph 時支援。
展開後:
--order_output=no
標記:terminal_output
--null
-
每個格式是否以 \0 結尾,而非換行符號。
展開後:
--line_terminator_null=true
標記:terminal_output
--order_output=<no, deps, auto or full>
預設值:「auto」-
輸出結果時不排序 (no)、依附屬元件排序 (deps) 或完全排序 (full)。預設值為「auto」,也就是說,系統會根據輸出格式器,以依附元件排序或完整排序的方式輸出結果 (proto、minrank、maxrank 和 graph 會依附元件排序,其他則會完整排序)。輸出內容完全排序後,節點會以完全確定的 (總) 順序列印。首先,所有節點會依字母順序排序。接著,清單中的每個節點都會做為後序深度優先搜尋的起點,其中會依後續節點的字母順序,遍歷未造訪節點的外向邊緣。最後,節點會以造訪順序的反向順序列印。
標記:terminal_output
--order_results
-
以依附元件排序 (預設) 或未排序的方式輸出結果。無序輸出速度較快,但僅在 --output 不是 minrank、maxrank 或 graph 時支援。
展開後:
--order_output=auto
標記:terminal_output
--output=<a string>
預設值:「label」-
查詢結果的列印格式。查詢可用的值包括:build、graph、streamed_jsonproto、label、label_kind、location、maxrank、minrank、package、proto、streamed_proto、xml。
標記:terminal_output
--[no]proto:default_values
預設值:「true」-
如果為 true,系統會納入 BUILD 檔案中未明確指定值的屬性;否則會省略這些屬性。這個選項適用於 --output=proto
標記:terminal_output
--[no]proto:definition_stack
預設值:「false」-
填入 definition_stack proto 欄位,記錄定義規則類別時的每個規則執行個體 Starlark 呼叫堆疊。
標記:terminal_output
--[no]proto:flatten_selects
預設值:「true」-
啟用後,系統會將 select() 建立的可設定屬性扁平化。如果是清單類型,扁平化表示法就是清單,其中每個選取對應的值只會出現一次。純量型別會扁平化為空值。
標記:build_file_semantics
--[no]proto:include_attribute_source_aspects
預設值:「false」-
使用屬性來源的來源構面,填入每個屬性的 source_aspect_name proto 欄位 (如果沒有來源構面,則填入空字串)。
標記:terminal_output
--[no]proto:include_synthetic_attribute_hash
預設值:「false」-
是否要計算及填入 $internal_attr_hash 屬性。
標記:terminal_output
--[no]proto:instantiation_stack
預設值:「false」-
填入每項規則的例項化呼叫堆疊。請注意,這需要堆疊存在
標記:terminal_output
--[no]proto:locations
預設值:「true」-
是否要在 Proto 輸出中輸出位置資訊。
標記:terminal_output
--proto:output_rule_attrs=<comma-separated list of options>
預設值:「all」-
以半形逗號分隔的屬性清單,這些屬性會納入輸出內容。預設值為所有屬性。如要不輸出任何屬性,請設為空字串。這個選項適用於 --output=proto。
標記:terminal_output
--[no]proto:rule_classes
預設值:「false」-
填入每項規則的 rule_class_key 欄位;如果是具有特定 rule_class_key 的第一項規則,請一併填入其 rule_class_info proto 欄位。rule_class_key 欄位會專屬識別規則類別,而 rule_class_info 欄位則是 Stardoc 格式的規則類別 API 定義。
標記:terminal_output
--[no]proto:rule_inputs_and_outputs
預設值:「true」-
是否要填入 rule_input 和 rule_output 欄位。
標記:terminal_output
--query_file=<a string>
預設值:「」-
如果已設定,查詢會從這裡命名的檔案讀取查詢,而不是從指令列讀取。在此處指定檔案和指令列查詢都是錯誤的做法。
標記:changes_inputs
--[no]relative_locations
預設值:「false」-
如果為 true,xml 和 proto 輸出內容中的 BUILD 檔案位置會是相對位置。根據預設,位置輸出為絕對路徑,且在不同電腦上不會保持一致。您可以將這個選項設為 true,確保不同機器的結果一致。
標記:terminal_output
--[no]strict_test_suite
預設值:「false」-
如果為 true,tests() 運算式遇到含有非測試目標的 test_suite 時,就會產生錯誤。
標記:build_file_semantics
、eagerness_to_exit
--[no]tool_deps
預設值:「true」-
查詢:如果停用,查詢作業的依附元件圖表就不會納入「執行設定」的依附元件。「執行設定」依附元件邊緣 (例如從任何「proto_library」規則到通訊協定編譯器) 通常是指在建構期間執行的工具,而不是相同「目標」程式的一部分。Cquery:如果停用,會篩除所有已設定的目標,這些目標會從發現這個已設定目標的頂層目標,跨越執行轉換。也就是說,如果頂層目標位於目標設定中,系統只會傳回目標設定中已設定的目標。如果頂層目標位於執行設定中,系統只會傳回已設定的執行目標。這個選項「不會」排除已解決的工具鍊。
標記:build_file_semantics
--universe_scope=<comma-separated list of options>
預設值:「」-
以逗號分隔的目標模式集 (加法和減法)。查詢可能會在指定目標的遞移閉包所定義的範圍內執行。這個選項適用於 query 和 cquery 指令。
如果是 cquery,這個選項的輸入內容是所有答案的建構目標,因此這個選項可能會影響設定和轉換。如未指定這個選項,系統會假設頂層目標是從查詢運算式剖析的目標。注意:如果是 cquery,如果從查詢運算式剖析的目標無法使用頂層選項建構,則不指定這個選項可能會導致建構作業中斷。
標記:loading_and_analysis
--[no]xml:default_values
預設值:「false」-
如果是 true,系統會列印 BUILD 檔案中未明確指定值的規則屬性;否則會省略這些屬性。
標記:terminal_output
--[no]xml:line_numbers
預設值:「true」-
如果是 true,XML 輸出內容會包含行號。停用這個選項可讓差異更容易閱讀。這個選項僅適用於 --output=xml。
標記:terminal_output
- 影響記錄詳細程度、格式或位置的選項:
--experimental_repository_resolved_file=<a string>
預設值:「」-
如果不是空白,請寫入 Starlark 值,其中包含所有已執行的 Starlark 存放區規則的已解析資訊。
標記:affects_outputs
- 其他選項,未歸類於其他類別:
--deleted_packages=<comma-separated list of package names>
累積多次使用- 以半形逗號分隔的套件名稱清單。即使這些套件顯示在套件路徑的某處,建構系統也會視為不存在。 刪除現有套件「x」的子套件「x/y」時,請使用這個選項。舉例來說,如果您在用戶端中刪除 x/y/BUILD,但另一個 package_path 項目仍提供「//x:y/z」標籤,建構系統可能會發出警告。指定 --deleted_packages x/y 即可避免這個問題。
--[no]fetch
預設值:「true」- 允許指令擷取外部依附元件。如果設為 false,指令會使用依附元件的任何快取版本,如果沒有,指令就會失敗。
--package_path=<colon-separated list of options>
預設值:「%workspace%」- 以半形冒號分隔的清單,列出要尋找套件的位置。以「%workspace%」開頭的元素與封閉工作區相關。如果省略或為空,預設值為「bazel info default-package-path」的輸出內容。
--[no]show_loading_progress
預設值:「true」- 啟用後,Bazel 會列印「正在載入套件:」訊息。
執行選項
繼承 build 的所有選項。
- 顯示在指令之前並由用戶端剖析的選項:
--[no]portable_paths
預設值:「false」-
如果為 true,則會在 ExecRequest 中加入要替換的路徑,使產生的路徑可攜。
標記:affects_outputs
--[no]run
預設值:「true」-
如果為 false,請略過為建構目標建構的指令列。請注意,所有 --script_path 建構作業都會忽略這個標記。
標記:affects_outputs
--run_env=<a 'name=value' assignment with an optional value part>
累積多次使用-
指定可供具有目標設定的動作使用的環境變數集。變數可以依名稱指定 (此時值會取自叫用環境),也可以依名稱=值組合指定 (此時值會獨立於叫用環境)。這個選項可以多次使用;如果是相同變數的選項,系統會採用最新的選項,如果是不同變數的選項,則會累加。
標記:affects_outputs
- 可讓使用者設定預期輸出內容的選項,會影響輸出內容的值,而非存在與否:
--script_path=<a path>
預設值:請參閱說明-
如果設定此選項,請將叫用目標的殼層指令碼寫入指定檔案。如果設定這個選項,目標就不會從 Bazel 執行。使用「bazel run --script_path=foo //foo && ./foo」叫用目標「//foo」。這與「bazel run //foo」不同,因為 Bazel 鎖定會釋出,且可執行檔會連線至終端的 stdin。
標記:affects_outputs
、execution
- 這個選項會影響 Starlark 語言的語意,或 BUILD 檔案、.bzl 檔案或 WORKSPACE 檔案可存取的建構 API。:
--[no]incompatible_use_plus_in_repo_names
預設值:「true」-
無作業。
標記:loading_and_analysis
關機選項
- 控管指令輸出內容的選項:
--iff_heap_size_greater_than=<an integer>
預設值:「0」-
如果不是零,只有在 JVM 耗用的總記憶體 (以 MB 為單位) 超過這個值時,關機才會關閉伺服器。
標記:loses_incremental_state
、eagerness_to_exit
- 這個選項會影響 Starlark 語言的語意,或 BUILD 檔案、.bzl 檔案或 WORKSPACE 檔案可存取的建構 API。:
--[no]incompatible_use_plus_in_repo_names
預設值:「true」-
無作業。
標記:loading_and_analysis
同步選項
- 控制建構執行的選項:
--[no]configure
預設值:「False」-
系統只會同步處理標示為「設定」的存放區,以進行系統設定。
標記:changes_inputs
--[no]keep_going
[-k
] 預設值:「false」-
盡可能在發生錯誤後繼續作業。雖然系統無法分析失敗的目標和依附於該目標的目標,但可以分析這些目標的其他必要條件。
標記: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">
預設值:「auto」-
用於載入/分析階段的平行執行緒數量。可使用整數或關鍵字 (「auto」、「HOST_CPUS」、「HOST_RAM」),後面可選擇性加上運算符號 ([-|*]<float>),例如 「auto」、「HOST_CPUS*.5」。「auto」會根據主機資源設定合理的預設值。不得小於 1。
標記:bazel_internal_configuration
--only=<a string>
累積多次使用-
如果提供這個選項,請只同步處理以這個選項指定的存放區。仍然將所有 (或所有類似設定的,如果提供 --configure) 視為過時。
標記:changes_inputs
- 這個選項會影響 Starlark 語言的語意,或可供 BUILD 檔案、.bzl 檔案或 WORKSPACE 檔案存取的建構 API:
--[no]incompatible_config_setting_private_default_visibility
預設值:「false」-
如果 incompatible_enforce_config_setting_visibility=false,這就是 noop。否則,如果這個旗標為 false,任何沒有明確顯示屬性的 config_setting 都是 //visibility:public。如果這個標記為 true,config_setting 會遵循與所有其他規則相同的瀏覽權限邏輯。詳情請參閱 https://github.com/bazelbuild/bazel/issues/12933。
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_enforce_config_setting_visibility
預設值:「true」-
如果為 true,則強制執行 config_setting 可見度限制。如果為 false,每個目標都會看到所有 config_setting。詳情請參閱 https://github.com/bazelbuild/bazel/issues/12932。
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_use_plus_in_repo_names
預設值:「true」-
No-op。
標記:loading_and_analysis
- 影響記錄詳細程度、格式或位置的選項:
--experimental_repository_resolved_file=<a string>
預設值:「」-
如果不是空白,請寫入 Starlark 值,其中包含所有已執行的 Starlark 存放區規則的已解析資訊。
標記:affects_outputs
- 其他選項,未歸類於其他類別:
--deleted_packages=<comma-separated list of package names>
累積多次使用- 以半形逗號分隔的套件名稱清單。即使這些套件顯示在套件路徑的某處,建構系統也會視為不存在。 刪除現有套件「x」的子套件「x/y」時,請使用這個選項。舉例來說,如果您在用戶端中刪除 x/y/BUILD,但另一個 package_path 項目仍提供「//x:y/z」標籤,建構系統可能會發出警告。指定 --deleted_packages x/y 即可避免這個問題。
--[no]fetch
預設值:「true」- 允許指令擷取外部依附元件。如果設為 false,指令會使用依附元件的任何快取版本,如果沒有,指令就會失敗。
--package_path=<colon-separated list of options>
預設值:「%workspace%」- 以半形冒號分隔的清單,列出要尋找套件的位置。以「%workspace%」開頭的元素與封閉工作區相關。如果省略或為空,預設值為「bazel info default-package-path」的輸出內容。
--[no]show_loading_progress
預設值:「true」- 啟用後,Bazel 會列印「正在載入套件:」訊息。
測試選項
繼承 build 的所有選項。
- 這個選項會影響 Starlark 語言的語意,或可供 BUILD 檔案、.bzl 檔案或 WORKSPACE 檔案存取的建構 API。
--[no]incompatible_use_plus_in_repo_names
預設值:「true」-
No-op。
標記:loading_and_analysis
- 影響記錄詳細程度、格式或位置的選項:
--[no]print_relative_test_log_paths
預設值:「false」-
如果為 true,在將路徑列印至測試記錄時,請使用會用到「testlogs」便利符號連結的相對路徑。注意:後續使用不同設定叫用「build」/「test」/等項目時,可能會導致這個符號連結的目標變更,先前列印的路徑將不再有用。
標記:affects_outputs
--[no]test_verbose_timeout_warnings
預設值:「false」-
如為 true,當實際測試執行時間與測試定義的逾時時間 (隱含或明確) 不符時,請列印額外警告。
標記:affects_outputs
--[no]verbose_test_summary
預設值:「true」-
如為 true,請在測試摘要中列印額外資訊 (時間、失敗的執行次數等)。
標記:affects_outputs
供應商選項
繼承 test 的所有選項。
- 控制建構執行的選項:
--[no]keep_going
[-k
] 預設值:「false」-
盡可能在發生錯誤後繼續作業。雖然系統無法分析失敗的目標和依附於該目標的目標,但可以分析這些目標的其他必要條件。
標記: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">
預設值:「auto」-
用於載入/分析階段的平行執行緒數量。可使用整數或關鍵字 (「auto」、「HOST_CPUS」、「HOST_RAM」),後面可選擇性加上運算符號 ([-|*]<float>),例如 「auto」、「HOST_CPUS*.5」。「auto」會根據主機資源設定合理的預設值。不得小於 1。
標記:bazel_internal_configuration
- 這個選項會影響 Starlark 語言的語意,或可供 BUILD 檔案、.bzl 檔案或 WORKSPACE 檔案存取的建構 API:
--[no]incompatible_config_setting_private_default_visibility
預設值:「false」-
如果 incompatible_enforce_config_setting_visibility=false,這就是 noop。否則,如果這個旗標為 false,任何沒有明確顯示屬性的 config_setting 都是 //visibility:public。如果這個標記為 true,config_setting 會遵循與所有其他規則相同的瀏覽權限邏輯。詳情請參閱 https://github.com/bazelbuild/bazel/issues/12933。
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_enforce_config_setting_visibility
預設值:「true」-
如果為 true,則強制執行 config_setting 可見度限制。如果為 false,每個目標都會看到所有 config_setting。詳情請參閱 https://github.com/bazelbuild/bazel/issues/12932。
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_use_plus_in_repo_names
預設值:「true」-
無作業。
標記:loading_and_analysis
- 與 Bzlmod 輸出和語意相關的選項:
--repo=<a string>
累積多次使用-
只有指定存放區的供應商,可以是 `@apparent_repo_name` 或 `@@canonical_repo_name`。這個選項可以設定多次
標記:changes_inputs
- 其他選項,未分類:
--deleted_packages=<comma-separated list of package names>
累積多次使用- 以半形逗號分隔的套件名稱清單。即使這些套件顯示在套件路徑的某處,建構系統也會視為不存在。 刪除現有套件「x」的子套件「x/y」時,請使用這個選項。舉例來說,如果您在用戶端中刪除 x/y/BUILD,但另一個 package_path 項目仍提供「//x:y/z」標籤,建構系統可能會發出警告。指定 --deleted_packages x/y 即可避免這個問題。
--[no]fetch
預設值:「true」- 允許指令擷取外部依附元件。如果設為 false,指令會使用依附元件的任何快取版本,如果沒有,指令就會失敗。
--package_path=<colon-separated list of options>
預設值:「%workspace%」- 以半形冒號分隔的清單,列出要尋找套件的位置。以「%workspace%」開頭的元素與封閉工作區相關。如果省略或為空,預設值為「bazel info default-package-path」的輸出內容。
--[no]show_loading_progress
預設值:「true」- 啟用後,Bazel 會列印「正在載入套件:」訊息。
- 控管建構作業執行的選項:
--[no]experimental_inprocess_symlink_creation
預設值:「true」-
是否要直接呼叫檔案系統來建立符號連結樹狀結構,而不是委派給輔助程序。
標籤:loading_and_analysis
、execution
、experimental
--[no]experimental_persistent_aar_extractor
預設值:「false」-
使用 Worker 啟用持續性 AAR 擷取器。
標記:execution
、experimental
--[no]experimental_remotable_source_manifests
預設值:「false」-
是否要讓來源資訊清單動作可遠端執行
標記:loading_and_analysis
、execution
、experimental
--[no]experimental_split_coverage_postprocessing
預設值:「false」-
如果為 true,Bazel 會在新衍生程序中執行測試的涵蓋範圍後續處理作業。
標記:execution
、experimental
--[no]experimental_strict_fileset_output
預設值:「false」-
如果啟用這個選項,檔案集會將所有輸出構件視為一般檔案。不會遍歷目錄或對符號連結敏感。
標記:execution
、experimental
--[no]incompatible_modify_execution_info_additive
預設值:「false」-
啟用後,傳遞多個 --modify_execution_info 標記會產生加成效果。停用時,系統只會考量最後一個旗標。
標記:execution
、affects_outputs
、loading_and_analysis
、incompatible_change
--modify_execution_info=<regex=[+-]key,regex=[+-]key,...>
累積多次使用-
根據動作助記符,在動作的執行資訊中新增或移除鍵。僅適用於支援執行資訊的動作。許多常見動作都支援執行資訊,例如 Genrule、CppCompile、Javac、StarlarkAction、TestRunner。指定多個值時,順序很重要,因為許多正則運算式可能會套用至相同助記符。
語法:「regex=[+-]key,regex=[+-]key,...」。
範例:
「.*=+x,.*=-y,.*=+z」會將「x」和「z」新增至所有動作的執行資訊,並從中移除「y」。
「Genrule=+requires-x」會將「requires-x」新增至所有 Genrule 動作的執行資訊。
'(?!Genrule).*=-requires-x' 會從所有非 Genrule 動作的執行資訊中移除 'requires-x'。
標籤:execution
、affects_outputs
、loading_and_analysis
--persistent_android_dex_desugar
-
使用 Worker 啟用持續性 Android dex 和 desugar 動作。
展開後:
--internal_persistent_android_dex_desugar
--strategy=Desugar=worker
--strategy=DexBuilder=worker
標記:host_machine_resource_optimizations
、execution
--persistent_android_resource_processor
-
使用 Worker 啟用永久性 Android 資源處理器。
展開後:
--internal_persistent_busybox_tools
--strategy=AaptPackage=worker
--strategy=AndroidResourceParser=worker
--strategy=AndroidResourceValidator=worker
--strategy=AndroidResourceCompiler=worker
--strategy=RClassGenerator=worker
--strategy=AndroidResourceLink=worker
--strategy=AndroidAapt2=worker
--strategy=AndroidAssetMerger=worker
--strategy=AndroidResourceMerger=worker
--strategy=AndroidCompiledResourceMerger=worker
--strategy=ManifestMerger=worker
--strategy=AndroidManifestMerger=worker
--strategy=Aapt2Optimize=worker
--strategy=AARGenerator=worker
--strategy=ProcessDatabinding=worker
--strategy=GenerateDataBindingBaseClasses=worker
標記:host_machine_resource_optimizations
、execution
--persistent_multiplex_android_dex_desugar
-
使用 Worker 啟用持續性多工 Android dex 和 desugar 動作。
展開後會顯示:
--persistent_android_dex_desugar
--internal_persistent_multiplex_android_dex_desugar
標記:host_machine_resource_optimizations
、execution
--persistent_multiplex_android_resource_processor
-
使用工作人員啟用持續性多工 Android 資源處理器。
展開後:
--persistent_android_resource_processor
--modify_execution_info=AaptPackage=+supports-multiplex-workers
--modify_execution_info=AndroidResourceParser=+supports-multiplex-workers
--modify_execution_info=AndroidResourceValidator=+supports-multiplex-workers
--modify_execution_info=AndroidResourceCompiler=+supports-multiplex-workers
--modify_execution_info=RClassGenerator=+supports-multiplex-workers
--modify_execution_info=AndroidResourceLink=+supports-multiplex-workers
--modify_execution_info=AndroidAapt2=+supports-multiplex-workers
--modify_execution_info=AndroidAssetMerger=+supports-multiplex-workers
--modify_execution_info=AndroidResourceMerger=+supports-multiplex-workers
--modify_execution_info=AndroidCompiledResourceMerger=+supports-multiplex-workers
--modify_execution_info=ManifestMerger=+supports-multiplex-workers
--modify_execution_info=AndroidManifestMerger=+supports-multiplex-workers
--modify_execution_info=Aapt2Optimize=+supports-multiplex-workers
--modify_execution_info=AARGenerator=+supports-multiplex-workers
標記:host_machine_resource_optimizations
、execution
--persistent_multiplex_android_tools
-
啟用持續性及多工 Android 工具 (dexing、desugaring、資源處理)。
展開後:
--internal_persistent_multiplex_busybox_tools
--persistent_multiplex_android_resource_processor
--persistent_multiplex_android_dex_desugar
標記:host_machine_resource_optimizations
、execution
--[no]use_target_platform_for_tests
預設值:「false」-
如果為 true,Bazel 會使用目標平台執行測試,而非測試執行群組。
標記:execution
- 設定用於執行動作的工具鍊選項:
--android_compiler=<a string>
預設值:請參閱說明-
Android 目標編譯器。
標籤:affects_outputs
、loading_and_analysis
、loses_incremental_state
--android_manifest_merger=<legacy, android or force_android>
預設值:「android」-
選取要用於 android_binary 規則的資訊清單合併工具。這個標記可協助從舊版合併工具轉換至 Android 資訊清單合併工具。
標籤:affects_outputs
、loading_and_analysis
、loses_incremental_state
--android_platforms=<a build target label>
預設值:「」-
設定 android_binary 目標使用的平台。如果指定多個平台,則二進位檔為笨重的 APK,其中包含每個指定目標平台的原生二進位檔。
標籤:changes_inputs
、loading_and_analysis
、loses_incremental_state
--apple_crosstool_top=<a build target label>
default: "@bazel_tools//tools/cpp:toolchain"-
要在 Apple 和 Objc 規則及其依附元件中使用的 crosstool 套件標籤。
標記:loses_incremental_state
、changes_inputs
--cc_output_directory_tag=<a string>
預設值:「」-
指定要加到設定目錄的後置字串。
標記:affects_outputs
--compiler=<a string>
預設值:請參閱說明-
用於編譯目標的 C++ 編譯器。
標記:loading_and_analysis
、execution
--coverage_output_generator=<a build target label>
default: "@bazel_tools//tools/test:lcov_merger"-
用於後續處理原始涵蓋範圍報表的二進位檔位置。目前必須是包含單一檔案 (二進位檔) 的檔案群組。預設值為「//tools/test:lcov_merger」。
標籤:changes_inputs
、affects_outputs
、loading_and_analysis
--coverage_report_generator=<a build target label>
預設值:「@bazel_tools//tools/test:coverage_report_generator」-
用於產生涵蓋範圍報表的二進位檔位置。目前必須是包含單一檔案 (二進位檔) 的檔案群組。預設值為「//tools/test:coverage_report_generator」。
標籤:changes_inputs
、affects_outputs
、loading_and_analysis
--coverage_support=<a build target label>
預設值:「@bazel_tools//tools/test:coverage_support」-
每個收集程式碼涵蓋範圍的測試動作輸入內容中,所需支援檔案的位置。預設值為「//tools/test:coverage_support」。
標籤:changes_inputs
、affects_outputs
、loading_and_analysis
--custom_malloc=<a build target label>
預設值:請參閱說明-
指定自訂 malloc 實作項目。這項設定會覆寫建構規則中的 malloc 屬性。
標記:changes_inputs
、affects_outputs
--experimental_add_exec_constraints_to_targets=<a '<RegexFilter>=<label1>[,<label2>,...]' assignment>
累積多次使用-
以逗號分隔的規則運算式清單,每個運算式可選擇性加上前置字元「-」(負運算式),並以「=」指派給以逗號分隔的限制值目標清單。如果目標與任何負運算式都不相符,但與至少一個正運算式相符,工具鍊解析就會執行,就像目標已將限制值宣告為執行限制一樣。範例://demo,-test=@platforms//cpus:x86_64 會將「x86_64」新增至 //demo 下的所有目標,但名稱包含「test」的目標除外。
標記:loading_and_analysis
--[no]experimental_include_xcode_execution_requirements
預設值:「false」-
如果已設定,請為每個 Xcode 動作新增「requires-xcode:{version}」執行需求。如果 Xcode 版本有連字號標籤,請一併新增「requires-xcode-label:{version_label}」執行需求。
標記:loses_incremental_state
、loading_and_analysis
、execution
、experimental
--[no]experimental_prefer_mutual_xcode
預設值:「true」-
如果為 true,請使用本機和遠端可用的最新 Xcode。如果為 false,或沒有可用的共同版本,請使用透過 xcode-select 選取的本機 Xcode 版本。
標記:loses_incremental_state
、experimental
--extra_execution_platforms=<comma-separated list of options>
預設值:「」-
可做為執行平台來執行動作的平台。平台可以指定為確切目標,或指定為目標模式。系統會優先考慮這些平台,再考慮 register_execution_platforms() 在 WORKSPACE 檔案中宣告的平台。這個選項只能設定一次,後續的例項會覆寫先前的標記設定。
標記:execution
--extra_toolchains=<comma-separated list of options>
累積多次使用-
工具鍊解析期間要考慮的工具鍊規則。工具鍊可指定為確切目標,或目標模式。系統會優先考量這些工具鍊,再考量由 register_toolchains() 在 WORKSPACE 檔案中宣告的工具鍊。
標記:affects_outputs
、changes_inputs
、loading_and_analysis
--grte_top=<a label>
預設值:請參閱說明-
已簽入 libc 程式庫的標籤。預設值是由 crosstool 工具鍊選取,您幾乎不需要覆寫這個值。
標記:action_command_lines
、affects_outputs
--host_compiler=<a string>
預設值:請參閱說明-
無作業旗標。將在日後推出的版本中移除。
標記:loading_and_analysis
、execution
--host_grte_top=<a label>
預設值:請參閱說明-
如果指定,這項設定會覆寫 exec 設定的 libc 頂層目錄 (--grte_top)。
標記:action_command_lines
、affects_outputs
--host_platform=<a build target label>
default: "@bazel_tools//tools:host_platform"-
平台規則的標籤,用於說明主機系統。
標籤:affects_outputs
、changes_inputs
、loading_and_analysis
--[no]incompatible_bazel_test_exec_run_under
預設值:「false」-
如果啟用,系統會在執行設定中建構「bazel test --run_under=//:runner」的「//:runner」。如果停用,系統會在目標設定中建構「//:runner」。Bazel 會在執行機器上執行測試,因此前者較為正確。這不會影響「bazel run」,因為「bazel run」一律會在目標設定中建構「`--run_under=//foo」。
標記:affects_outputs
、incompatible_change
--[no]incompatible_dont_enable_host_nonhost_crosstool_features
預設值:「true」-
如果為 true,Bazel 將不會在 C++ 工具鍊中啟用「主機」和「非主機」功能 (詳情請參閱 https://github.com/bazelbuild/bazel/issues/7407)。
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_enable_apple_toolchain_resolution
預設值:「false」-
使用工具鍊解析度,為 Apple 規則 (Starlark 和原生) 選取 Apple SDK
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_remove_legacy_whole_archive
預設值:「true」-
如果為 true,Bazel 預設不會將程式庫依附元件連結為整個封存檔 (如需遷移操作說明,請參閱 https://github.com/bazelbuild/bazel/issues/7362)。
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_strip_executable_safely
預設值:「false」-
如為 true,可執行檔的 strip 動作會使用 -x 標記,不會中斷動態符號解析。
標記:action_command_lines
、incompatible_change
-
如果工具鍊支援,請使用介面共用物件。目前所有 ELF 工具鍊都支援這項設定。
標籤:loading_and_analysis
、affects_outputs
、affects_outputs
--ios_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
指定用於建構 iOS 應用程式的 iOS SDK 版本。如未指定,則會使用「xcode_version」中的預設 iOS SDK 版本。
標記:loses_incremental_state
--macos_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
指定用於建構 macOS 應用程式的 macOS SDK 版本。如未指定,則會使用「xcode_version」中的預設 macOS SDK 版本。
標記:loses_incremental_state
--minimum_os_version=<a string>
預設值:請參閱說明-
編譯目標的最低作業系統版本。
標記:loading_and_analysis
、affects_outputs
--platform_mappings=<a main workspace-relative path>
預設值:「」-
對應檔案的位置,用於說明在未設定平台時要使用哪個平台,或是在平台已存在時要設定哪些旗標。必須相對於主要工作區根目錄。預設值為「platform_mappings」(工作區根目錄下的檔案)。
標記:affects_outputs
、changes_inputs
、loading_and_analysis
、immutable
--platforms=<a build target label>
預設值:「」-
平台規則的標籤,說明目前指令的目標平台。
標籤:affects_outputs
、changes_inputs
、loading_and_analysis
--python_path=<a string>
預設值:請參閱說明-
在目標平台上執行 Python 目標時,所叫用的 Python 解譯器絕對路徑。已淘汰;由 --incompatible_use_python_toolchains 停用。
標記:loading_and_analysis
、affects_outputs
--python_top=<a build target label>
預設值:請參閱說明-
代表 Python 解譯器的 py_runtime 標籤,用於在目標平台上執行 Python 目標。已淘汰;由 --incompatible_use_python_toolchains 停用。
標記:loading_and_analysis
、affects_outputs
--tvos_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
指定用於建構 tvOS 應用程式的 tvOS SDK 版本。如未指定,則會使用「xcode_version」中的預設 tvOS SDK 版本。
標記:loses_incremental_state
--watchos_sdk_version=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
指定用於建構 watchOS 應用程式的 watchOS SDK 版本。如未指定,則會使用「xcode_version」中的預設 watchOS SDK 版本。
標記:loses_incremental_state
--xcode_version=<a string>
預設值:請參閱說明-
如果指定,則會使用指定版本的 Xcode 執行相關建構動作。如未指定,則會使用 Xcode 的執行器預設版本。
標記:loses_incremental_state
--xcode_version_config=<a build target label>
default: "@bazel_tools//tools/cpp:host_xcodes"-
用於在建構設定中選取 Xcode 版本的 xcode_config 規則標籤。
標記:loses_incremental_state
、loading_and_analysis
- 控管指令輸出的選項:
--[no]apple_generate_dsym
預設值:「false」-
是否要產生偵錯符號 (.dSYM) 檔案。
標記:affects_outputs
、action_command_lines
--[no]build_runfile_links
預設值:「true」-
如果為 true,則為所有目標建構 Runfile 符號連結樹狀結構。 如果為 false,則只有在本地動作、測試或執行指令需要時,才會寫入這些檔案。
標記:affects_outputs
--[no]build_runfile_manifests
預設值:「true」-
如果是 true,則為所有目標編寫執行檔資訊清單。如果為 false,請省略這些屬性。如果為 false,本機測試將無法執行。
標記:affects_outputs
--[no]build_test_dwp
預設值:「false」-
如果啟用這項功能,系統會以靜態方式建構 C++ 測試,並使用 fission,自動建構測試二進位檔的 .dwp 檔案。
標記:loading_and_analysis
、affects_outputs
--cc_proto_library_header_suffixes=<comma-separated set of options>
預設值:「.pb.h」-
設定 cc_proto_library 建立的標頭檔案後置字元。
標記:affects_outputs
、loading_and_analysis
--cc_proto_library_source_suffixes=<comma-separated set of options>
預設值:「.pb.cc」-
設定 cc_proto_library 建立的來源檔案後置字元。
標記:affects_outputs
、loading_and_analysis
--[no]experimental_proto_descriptor_sets_include_source_info
預設值:「false」-
在 proto_library 中,針對替代的 Java API 版本執行額外動作。
標籤:affects_outputs
、loading_and_analysis
、experimental
--[no]experimental_save_feature_state
預設值:「false」-
將已啟用和要求的特徵狀態儲存為編譯輸出內容。
標記:affects_outputs
、experimental
--fission=<a set of compilation modes>
預設值:「no」-
指定哪些編譯模式會使用分裂功能進行 C++ 編譯和連結。可以是 {'fastbuild'、'dbg'、'opt'} 的任意組合,也可以是特殊值 'yes' (啟用所有模式) 和 'no' (停用所有模式)。
標籤:loading_and_analysis
、action_command_lines
、affects_outputs
--[no]incompatible_always_include_files_in_data
預設值:「true」-
如果是 true,原生規則會將資料依附元件的 <code>DefaultInfo.files</code> 新增至執行檔,這與 Starlark 規則的建議行為相符 (https://bazel.build/extending/rules#runfiles_features_to_avoid)。
標記:affects_outputs
、incompatible_change
--[no]legacy_external_runfiles
預設值:「false」-
如果為 true,請為 .runfiles/repo 底下的外部存放區建構執行檔案符號連結樹狀結構 (除了 .runfiles/repo 以外)。
標記:affects_outputs
--[no]objc_generate_linkmap
預設值:「false」-
指定是否要產生連結對應檔案。
標記:affects_outputs
--[no]save_temps
預設值:「false」-
如果設定,系統會儲存 gcc 的暫時輸出內容。包括 .s 檔案 (組語程式碼)、.i 檔案 (前置處理的 C) 和 .ii 檔案 (前置處理的 C++)。
標記:affects_outputs
- 可讓使用者設定預期輸出內容的選項,影響輸出內容的值,而非輸出內容是否存在:
--action_env=<a 'name=value' assignment with an optional value part>
累積多次使用-
指定可供具有目標設定的動作使用的環境變數集。變數可以依名稱指定 (此時值會取自叫用環境),也可以依名稱=值組合指定 (此時值會獨立於叫用環境)。這個選項可以多次使用;如果是相同變數的選項,系統會採用最新的選項,如果是不同變數的選項,則會累加。
標記:action_command_lines
--allowed_cpu_values=<comma-separated set of options>
預設值:「」-
--cpu 標記的允許值。
標記:changes_inputs
、affects_outputs
--[no]android_databinding_use_androidx
預設值:「true」-
產生與 AndroidX 相容的資料繫結檔案。這項功能僅適用於資料繫結 v2。這個旗標是無運算。
標記:affects_outputs
、loading_and_analysis
、loses_incremental_state
、experimental
--[no]android_databinding_use_v3_4_args
預設值:「true」-
使用 3.4.0 引數搭配 Android 資料繫結 v2。這個旗標是無運算。
標記:affects_outputs
、loading_and_analysis
、loses_incremental_state
、experimental
--android_dynamic_mode=<off, default or fully>
預設值:「off」-
判斷 cc_binary 未明確建立共用程式庫時,是否要動態連結 Android 規則的 C++ 依附元件。「default」表示 Bazel 會選擇是否要動態連結。「完全」表示所有程式庫都會動態連結。「off」表示所有程式庫都會以靜態模式連結。
標記:affects_outputs
、loading_and_analysis
--android_manifest_merger_order=<alphabetical, alphabetical_by_configuration or dependency>
預設值:「alphabetical」-
設定傳遞至 Android 二進位檔資訊清單合併工具的資訊清單順序。ALPHABETICAL 表示資訊清單會依據相對於 execroot 的路徑排序。ALPHABETICAL_BY_CONFIGURATION 表示資訊清單會依路徑排序,路徑是相對於輸出目錄中的設定目錄。DEPENDENCY 表示資訊清單的排序方式為:每個程式庫的資訊清單會出現在其依附元件的資訊清單之前。
標記:action_command_lines
、execution
--[no]android_resource_shrinking
預設值:「false」-
為使用 ProGuard 的 android_binary APK 啟用資源壓縮功能。
標記:affects_outputs
、loading_and_analysis
--[no]build_python_zip
預設值:「auto」-
建構 Python 可執行檔 ZIP;在 Windows 上為開啟,在其他平台上為關閉
標記:affects_outputs
--catalyst_cpus=<comma-separated list of options>
累積多次使用-
以半形逗號分隔的架構清單,用於建構 Apple Catalyst 二進位檔。
標記:loses_incremental_state
、loading_and_analysis
--[no]collect_code_coverage
預設值:「false」-
如果指定,Bazel 會檢測程式碼 (盡可能使用離線檢測),並在測試期間收集涵蓋範圍資訊。只有符合 --instrumentation_filter 的目標會受到影響。通常不應直接指定這個選項,而是應使用「bazel coverage」指令。
標記:affects_outputs
--compilation_mode=<fastbuild, dbg or opt>
[-c
] 預設值:「fastbuild」-
指定建構二進位檔的模式。值:「fastbuild」、「dbg」、「opt」。
標記:affects_outputs
、action_command_lines
--conlyopt=<a string>
累積多次使用-
編譯 C 來源檔案時,要傳遞至 gcc 的其他選項。
標記:action_command_lines
、affects_outputs
--copt=<a string>
累積多次使用-
要傳遞至 gcc 的其他選項。
標記:action_command_lines
、affects_outputs
--cpu=<a string>
預設值:「」-
目標 CPU。
標記:changes_inputs
、affects_outputs
--cs_fdo_absolute_path=<a string>
預設值:請參閱說明-
使用 CSFDO 設定檔資訊,盡可能改良編譯作業。指定包含設定檔、原始或已編列索引 LLVM 設定檔的 zip 檔絕對路徑名稱。
標記:affects_outputs
--cs_fdo_instrument=<a string>
預設值:請參閱說明-
使用情境感應 FDO 檢測功能產生二進位檔。使用 Clang/LLVM 編譯器時,系統也會接受目錄名稱,執行階段會將原始設定檔傾印至該目錄。
標記:affects_outputs
--cs_fdo_profile=<a build target label>
預設值:請參閱說明-
代表要用於最佳化的內容相關設定檔的 cs_fdo_profile。
標記:affects_outputs
--cxxopt=<a string>
累積多次使用-
編譯 C++ 來源檔案時,要傳遞至 gcc 的其他選項。
標記:action_command_lines
、affects_outputs
--define=<a 'name=value' assignment>
累積多次使用-
每個 --define 選項都會指定建構變數的指派作業。如果變數有多個值,則最後一個值會勝出。
標記:changes_inputs
、affects_outputs
--dynamic_mode=<off, default or fully>
預設值:「default」-
決定是否要動態連結 C++ 二進位檔。 「default」表示 Bazel 會選擇是否要動態連結。「完全」表示所有程式庫都會動態連結。「off」表示所有程式庫都會以靜態模式連結。
標記:loading_and_analysis
、affects_outputs
--[no]enable_propeller_optimize_absolute_paths
預設值:「true」-
如果已設定,任何使用螺旋槳最佳化絕對路徑的行為都會引發錯誤。
標記:affects_outputs
--[no]enable_remaining_fdo_absolute_paths
預設值:「true」-
如果設定,使用 FDO 的絕對路徑時會引發錯誤。
標記:affects_outputs
--[no]enable_runfiles
預設值:「auto」-
啟用 Runfiles 符號連結樹狀結構;預設為在 Windows 上關閉,在其他平台上開啟。
標記:affects_outputs
--experimental_action_listener=<a build target label>
累積多次使用-
已淘汰,請改用切面。使用 action_listener 將 extra_action 附加至現有的建構動作。
標記:execution
、experimental
--[no]experimental_android_compress_java_resources
預設值:「false」-
壓縮 APK 中的 Java 資源
標記:affects_outputs
、loading_and_analysis
、experimental
--[no]experimental_android_databinding_v2
預設值:「true」-
使用 Android 資料繫結 v2。這個旗標是無運算。
標記:affects_outputs
、loading_and_analysis
、loses_incremental_state
、experimental
--[no]experimental_android_resource_shrinking
預設值:「false」-
為使用 ProGuard 的 android_binary APK 啟用資源壓縮功能。
標籤:affects_outputs
、loading_and_analysis
、experimental
--[no]experimental_android_rewrite_dexes_with_rex
預設值:「false」-
use rex tool to rewrite dex files
標記:affects_outputs
、loading_and_analysis
、loses_incremental_state
、experimental
--[no]experimental_collect_code_coverage_for_generated_files
預設值:「false」-
如有指定,Bazel 也會為產生的檔案產生收集涵蓋範圍資訊。
標記:affects_outputs
、experimental
--experimental_objc_fastbuild_options=<comma-separated list of options>
預設值:「-O0,-DDEBUG=1」-
將這些字串做為 objc 快速建構編譯器選項。
標記:action_command_lines
--[no]experimental_omitfp
預設值:「false」-
如果設為 true,則使用 libunwind 進行堆疊解除,並使用 -fomit-frame-pointer 和 -fasynchronous-unwind-tables 進行編譯。
標籤:action_command_lines
、affects_outputs
、experimental
--experimental_output_paths=<off, content or strip>
預設值:「off」-
輸出樹狀結構規則應使用哪個模型來寫入輸出內容,特別是針對多平台 / 多設定建構作業。這項功能仍在實驗階段,詳情請參閱 https://github.com/bazelbuild/bazel/issues/6526。如要選擇加入路徑對應,請將「supports-path-mapping」鍵新增至「execution_requirements」字典。
標記:loses_incremental_state
、bazel_internal_configuration
、affects_outputs
、execution
--experimental_override_name_platform_in_output_dir=<a 'label=value' assignment>
累積多次使用-
每個項目都應採用 label=value 格式,其中 label 是指平台,value 則是要在輸出路徑中使用的所需簡短名稱。只有在 --experimental_platform_in_output_dir 為 true 時才會使用。命名優先順序最高。
標記:affects_outputs
、experimental
--[no]experimental_platform_in_output_dir
預設值:「false」-
如果為 true,輸出目錄名稱會使用目標平台的簡短名稱,而非 CPU。確切的架構是實驗性質,可能會有所變更:首先,如果 --platforms 選項沒有剛好一個值,系統會使用平台選項的雜湊。接著,如果目前平台有任何簡稱是透過 --experimental_override_name_platform_in_output_dir 登錄,系統就會使用該簡稱。然後,如果設定了 --experimental_use_platforms_in_output_dir_legacy_heuristic,請使用以目前平台標籤為準的簡短名稱。最後,平台選項的雜湊會做為最後手段。
標記:affects_outputs
、experimental
--[no]experimental_py_binaries_include_label
預設值:「false」-
即使停用蓋章功能,py_binary 目標仍會包含標籤。
標記:affects_outputs
、experimental
--[no]experimental_use_llvm_covmap
預設值:「false」-
如果指定,啟用 collect_code_coverage 時,Bazel 會產生 llvm-cov 涵蓋範圍對應資訊,而不是 gcov。
標記:changes_inputs
、affects_outputs
、loading_and_analysis
、experimental
--[no]experimental_use_platforms_in_output_dir_legacy_heuristic
預設值:「true」-
請僅在建議的遷移或測試策略中使用這個標記。請注意,這個啟發式方法有已知缺點,建議改為只依賴 --experimental_override_name_platform_in_output_dir。
標記:affects_outputs
、experimental
--fdo_instrument=<a string>
預設值:請參閱說明-
使用 FDO 檢測生成二進位檔。使用 Clang/LLVM 編譯器時,系統也會接受目錄名稱,執行階段會將原始設定檔傾印至該目錄。
標記:affects_outputs
--fdo_optimize=<a string>
預設值:請參閱說明-
使用 FDO 設定檔資訊,最佳化編譯作業。指定包含 .gcda 檔案樹狀結構、包含自動設定檔的 afdo 檔案,或 LLVM 設定檔檔案的 ZIP 檔案名稱。這個旗標也接受指定為標籤的檔案 (例如 `//foo/bar:file.afdo` - 您可能需要在對應的套件中新增 `exports_files` 指令),以及指向 `fdo_profile` 目標的標籤。這項標記會由 `fdo_profile` 規則取代。
標記:affects_outputs
--fdo_prefetch_hints=<a build target label>
預設值:請參閱說明-
使用快取預先擷取提示。
標記:affects_outputs
--fdo_profile=<a build target label>
預設值:請參閱說明-
代表用於最佳化的設定檔。
標記:affects_outputs
--features=<a string>
累積多次使用-
系統會根據目標設定,預設啟用或停用目標中建構的指定功能。指定 -<feature> 會停用該功能。負面特徵一律會覆寫正面特徵。另請參閱 --host_features
標記:changes_inputs
、affects_outputs
--[no]force_pic
預設值:「false」-
啟用後,所有 C++ 編譯作業都會產生與位置無關的程式碼 (「-fPIC」),連結會優先使用 PIC 預先建構的程式庫,而非非 PIC 程式庫,且連結會產生與位置無關的可執行檔 (「-pie」)。
標記:loading_and_analysis
、affects_outputs
--host_action_env=<a 'name=value' assignment with an optional value part>
累積多次使用-
指定可供具有執行設定的動作使用的環境變數集。變數可以依名稱指定 (此時值會取自叫用環境),也可以依名稱=值組合指定 (此時值會獨立於叫用環境)。這個選項可以多次使用;如果是相同變數的選項,系統會採用最新的選項,如果是不同變數的選項,則會累加。
標記:action_command_lines
--host_compilation_mode=<fastbuild, dbg or opt>
預設值:「opt」-
指定建構期間使用的工具建構模式。值:「fastbuild」、「dbg」、「opt」。
標記:affects_outputs
、action_command_lines
--host_conlyopt=<a string>
累積多次使用-
在 exec 設定中編譯 C (而非 C++) 來源檔案時,要傳遞至 C 編譯器的其他選項。
標記:action_command_lines
、affects_outputs
--host_copt=<a string>
累積多次使用-
要傳遞至 C 編譯器的其他選項,適用於在 exec 設定中建構的工具。
標記:action_command_lines
、affects_outputs
--host_cpu=<a string>
預設值:「」-
主機 CPU。
標記:changes_inputs
、affects_outputs
--host_cxxopt=<a string>
累積多次使用-
要傳遞至 C++ 編譯器的其他選項,適用於在 exec 設定中建構的工具。
標記:action_command_lines
、affects_outputs
--host_features=<a string>
累積多次使用-
系統會為在執行設定中建構的目標,預設啟用或停用指定功能。指定 -<feature> 會停用該功能。負面特徵一律會覆寫正面特徵。
標記:changes_inputs
、affects_outputs
--host_force_python=<PY2 or PY3>
預設值:請參閱說明-
覆寫執行設定的 Python 版本。可以是「PY2」或「PY3」。
標記:loading_and_analysis
、affects_outputs
--host_linkopt=<a string>
累積多次使用-
在執行設定中連結工具時,傳遞至連結器的其他選項。
標記:action_command_lines
、affects_outputs
--host_macos_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
主機目標的最低相容 macOS 版本。如未指定,則會使用「macos_sdk_version」。
標記:loses_incremental_state
--host_per_file_copt=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths followed by an @ and a comma separated list of options>
累積多次使用-
在執行設定中編譯特定檔案時,選擇性傳遞至 C/C++ 編譯器的其他選項。這個選項可以多次傳遞。語法:regex_filter@option_1,option_2,...,option_n。其中 regex_filter 代表包含和排除規則運算式模式的清單 (另請參閱 --instrumentation_filter)。option_1 到 option_n 代表任意指令列選項。如果選項含有半形逗號,則必須以反斜線加上引號。選項可以包含 @。系統只會使用第一個 @ 分割字串。範例:--host_per_file_copt=//foo/.*\.cc,-//foo/bar\.cc@-O0 會將 -O0 指令列選項新增至 //foo/ 中所有 cc 檔案的 gcc 指令列,但 bar.cc 除外。
標記:action_command_lines
、affects_outputs
--[no]incompatible_auto_exec_groups
預設值:「false」-
啟用後,系統會為規則使用的每個工具鍊自動建立執行群組。如要讓這項規則運作,必須在動作中指定 `toolchain` 參數。詳情請參閱 https://github.com/bazelbuild/bazel/issues/17134。
標記:affects_outputs
、incompatible_change
--[no]incompatible_merge_genfiles_directory
預設值:「true」-
如果是 true,genfiles 目錄會摺疊到 bin 目錄中。
標記:affects_outputs
、incompatible_change
--[no]instrument_test_targets
預設值:「false」-
啟用涵蓋範圍時,指定是否要考慮插樁測試規則。設定後,--instrumentation_filter 包含的測試規則會經過檢測。否則,測試規則一律會從涵蓋範圍插樁中排除。
標記:affects_outputs
--instrumentation_filter=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths>
default: "-/javatests[/:],-/test/java[/:]"-
啟用涵蓋範圍後,系統只會檢測名稱符合指定 regex 篩選器的規則。以「-」為前置字元的規則則會遭到排除。請注意,除非啟用 --instrument_test_targets,否則系統只會檢測非測試規則。
標記:affects_outputs
--ios_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
目標模擬器和裝置的最低相容 iOS 版本。如未指定,則使用「ios_sdk_version」。
標記:loses_incremental_state
--ios_multi_cpus=<comma-separated list of options>
累積多次使用-
以半形逗號分隔的架構清單,用於建構 ios_application。結果是包含所有指定架構的通用二進位檔。
標記:loses_incremental_state
、loading_and_analysis
--[no]legacy_whole_archive
預設值:「true」-
已淘汰,由 --incompatible_remove_legacy_whole_archive 取代 (詳情請參閱 https://github.com/bazelbuild/bazel/issues/7362)。開啟後,請為具有 linkshared=True,且 linkopts 中有 linkstatic=True 或「-static」的 cc_binary 規則使用 --whole-archive。這項功能僅適用於回溯相容性。更好的替代方案是在必要時使用 alwayslink=1。
標籤:action_command_lines
、affects_outputs
、deprecated
--linkopt=<a string>
累積多次使用-
連結時傳遞至 gcc 的其他選項。
標記:action_command_lines
、affects_outputs
--ltobackendopt=<a string>
累積多次使用-
傳遞至 LTO 後端步驟的其他選項 (位於 --features=thin_lto 下)。
標記:action_command_lines
、affects_outputs
--ltoindexopt=<a string>
累積多次使用-
可傳遞至 LTO 索引步驟的其他選項 (位於 --features=thin_lto 下)。
標記:action_command_lines
、affects_outputs
--macos_cpus=<comma-separated list of options>
累積多次使用-
要建構 Apple macOS 二進位檔的架構清單 (以半形逗號分隔)。
標記:loses_incremental_state
、loading_and_analysis
--macos_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
目標的最低相容 macOS 版本。如未指定,則會使用「macos_sdk_version」。
標記:loses_incremental_state
--memprof_profile=<a build target label>
預設值:請參閱說明-
使用 memprof 設定檔。
標記:affects_outputs
--[no]objc_debug_with_GLIBCXX
預設值:「false」-
如果已設定,且編譯模式設為「dbg」,請定義 GLIBCXX_DEBUG、GLIBCXX_DEBUG_PEDANTIC 和 GLIBCPP_CONCEPT_CHECKS。
標記:action_command_lines
--[no]objc_enable_binary_stripping
預設值:「false」-
是否要對連結的二進位檔執行符號和無效程式碼剝除作業。如果同時指定這個旗標和 --compilation_mode=opt,系統就會執行二進位檔剝除作業。
標記:action_command_lines
--objccopt=<a string>
累積多次使用-
編譯 Objective-C/C++ 來源檔案時,要傳遞給 gcc 的其他選項。
標記: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>
累積多次使用-
編譯特定檔案時,可選擇性傳遞至 gcc 的其他選項。這個選項可以多次傳遞。語法:regex_filter@option_1,option_2,...,option_n。其中 regex_filter 代表包含和排除規則運算式模式的清單 (另請參閱 --instrumentation_filter)。option_1 到 option_n 代表任意指令列選項。如果選項含有半形逗號,則必須以反斜線加上引號。選項可以包含 @。系統只會使用第一個 @ 分割字串。範例:--per_file_copt=//foo/.*\.cc,-//foo/bar\.cc@-O0 會將 -O0 指令列選項新增至 //foo/ 中所有 cc 檔案 (bar.cc 除外) 的 gcc 指令列。
標記: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>
累積多次使用-
編譯特定後端物件時,可選擇性傳遞至 LTO 後端的其他選項 (位於 --features=thin_lto 下)。這個選項可以多次傳遞。語法:regex_filter@option_1,option_2,...,option_n。其中 regex_filter 代表包含和排除規則運算式模式的清單,option_1 到 option_n 則代表任意指令列選項。如果選項含有半形逗號,則必須以反斜線加上引號。選項可以包含 @。系統只會使用第一個 @ 分割字串。範例:--per_file_ltobackendopt=//foo/.*\.o,-//foo/bar\.o@-O0 會將 -O0 指令列選項新增至 //foo/ 中所有 o 檔案 (bar.o 除外) 的 LTO 後端指令列。
標記:action_command_lines
、affects_outputs
--platform_suffix=<a string>
預設值:請參閱說明-
指定要加到設定目錄的後置字串。
標籤:loses_incremental_state
、affects_outputs
、loading_and_analysis
--propeller_optimize=<a build target label>
預設值:請參閱說明-
使用 Propeller 設定檔資訊,最佳化建構目標。Propeller 設定檔必須包含至少一個檔案,即 cc 設定檔和 ld 設定檔。這個標記接受建構標籤,該標籤必須參照螺旋槳設定檔輸入檔案。舉例來說,在 a/b/BUILD 中定義標籤的 BUILD 檔案:propeller_optimize( name = "propeller_profile", cc_profile = "propeller_cc_profile.txt", ld_profile = "propeller_ld_profile.txt",)可能必須將 exports_files 指令新增至對應的套件,才能讓 Bazel 看到這些檔案。這個選項必須做為下列項目使用:--propeller_optimize=//a/b:propeller_profile
標記:action_command_lines
、affects_outputs
--propeller_optimize_absolute_cc_profile=<a string>
預設值:請參閱說明-
Propeller 最佳化建構版本的 cc_profile 檔案絕對路徑名稱。
標記:affects_outputs
--propeller_optimize_absolute_ld_profile=<a string>
預設值:請參閱說明-
Propeller 最佳化建構版本的 ld_profile 檔案絕對路徑名稱。
標記:affects_outputs
--run_under=<a prefix in front of command>
預設值:請參閱說明-
要插入「test」和「run」指令可執行檔之前的字首。如果值為「foo -bar」,而執行指令列為「test_binary -baz」,則最終指令列為「foo -bar test_binary -baz」。這也可以是可執行目標的標籤。例如:'valgrind'、'strace'、'strace -c'、'valgrind --quiet --num-callers=20'、'//package:target'、'//package:target --options'。
標記:action_command_lines
-
如果為 true,不同目標之間會共用包含相同功能的原生程式庫。
標記:loading_and_analysis
、affects_outputs
--[no]stamp
預設值:「false」-
在二進位檔中蓋上日期、使用者名稱、主機名稱、工作區資訊等。
標記:affects_outputs
--strip=<always, sometimes or never>
預設值:「有時」-
指定是否要剝除二進位檔和共用程式庫 (使用「-Wl,--strip-debug」)。預設值「sometimes」表示僅在 --compilation_mode=fastbuild 時移除。
標記:affects_outputs
--stripopt=<a string>
累積多次使用-
產生 '<name>.stripped' 二進位檔時,要傳遞至 strip 的其他選項。
標記:action_command_lines
、affects_outputs
--tvos_cpus=<comma-separated list of options>
累積多次使用-
要建構 Apple tvOS 二進位檔的架構清單 (以半形逗號分隔)。
標記:loses_incremental_state
、loading_and_analysis
--tvos_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
目標模擬器和裝置的最低相容 tvOS 版本。如未指定,則會使用「tvos_sdk_version」。
標記:loses_incremental_state
--visionos_cpus=<comma-separated list of options>
累積多次使用-
要建構 Apple visionOS 二進位檔的架構清單 (以半形逗號分隔)。
標記:loses_incremental_state
、loading_and_analysis
--watchos_cpus=<comma-separated list of options>
累積多次使用-
以半形逗號分隔的架構清單,用於建構 Apple watchOS 二進位檔。
標記:loses_incremental_state
、loading_and_analysis
--watchos_minimum_os=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
目標模擬器和裝置的最低相容 watchOS 版本。如未指定,則會使用「watchos_sdk_version」。
標記:loses_incremental_state
--xbinary_fdo=<a build target label>
預設值:請參閱說明-
使用 XbinaryFDO 設定檔資訊,最佳化編譯作業。指定預設跨二進位檔設定檔的名稱。如果這個選項與 --fdo_instrument/--fdo_optimize/--fdo_profile 搭配使用,這些選項一律會優先採用,如同從未指定 xbinary_fdo 一樣。
標記:affects_outputs
- 影響 Bazel 嚴格程度的選項,可強制執行有效的建構輸入內容 (規則定義、旗標組合等):
--[no]check_licenses
預設值:「false」-
確認依附套件的授權限制不會與建構目標的發布模式衝突。根據預設,系統不會檢查授權。
標記:build_file_semantics
--[no]check_visibility
預設值:「true」-
如果停用,目標依附元件中的顯示設定錯誤會降級為警告。
標記:build_file_semantics
--[no]desugar_for_android
預設值:「true」-
是否要在 dexing 前脫糖 Java 8 位元碼。
標籤:affects_outputs
、loading_and_analysis
、loses_incremental_state
--[no]desugar_java8_libs
預設值:「false」-
是否要在舊版裝置的應用程式中加入支援的 Java 8 程式庫。
標記:affects_outputs
、loading_and_analysis
、loses_incremental_state
、experimental
--[no]enforce_constraints
預設值:「true」-
檢查每個目標相容的環境,並在任何目標有不支援相同環境的依附元件時回報錯誤。
標記:build_file_semantics
--[no]experimental_check_desugar_deps
預設值:「true」-
是否要在 Android 二進位層級重複檢查正確的解除糖化程序。
標籤:eagerness_to_exit
、loading_and_analysis
、experimental
--experimental_import_deps_checking=<a string>
預設值:請參閱說明-
無作業,僅為回溯相容性而保留
標記:loading_and_analysis
--experimental_one_version_enforcement=<off, warning or error>
預設值:「OFF」-
啟用後,系統會強制執行 java_binary 規則,確保類別路徑中不會包含相同類別檔案的多個版本。這項強制執行措施可能會導致建構作業中斷,或只是產生警告。
標記:loading_and_analysis
--experimental_strict_java_deps=<off, warn, error, strict or default>
預設值:「default」-
如果為 true,則檢查 Java 目標是否明確將所有直接使用的目標宣告為依附元件。
標記:build_file_semantics
、eagerness_to_exit
--[no]incompatible_check_testonly_for_output_files
預設值:「false」-
如果已啟用,請查閱產生規則的 testonly,找出輸出檔案的必要條件目標。這與可見度檢查相符。
標記:build_file_semantics
、incompatible_change
--[no]incompatible_check_visibility_for_toolchains
預設值:「false」-
如果啟用,可見度檢查也會套用至工具鍊實作項目。
標記:build_file_semantics
、incompatible_change
--[no]incompatible_disable_native_android_rules
預設值:「false」-
如果啟用,系統會停用 Android 原生規則的直接使用權。請使用 https://github.com/bazelbuild/rules_android 中的 Starlark Android 規則
標記:eagerness_to_exit
、incompatible_change
--[no]incompatible_disable_native_apple_binary_rule
預設值:「false」-
無作業。為保持回溯相容性而保留。
標記:eagerness_to_exit
、incompatible_change
--[no]incompatible_python_disable_py2
預設值:「true」-
如果為 true,使用 Python 2 設定會導致錯誤。包括 python_version=PY2、srcs_version=PY2 和 srcs_version=PY2ONLY。詳情請參閱 https://github.com/bazelbuild/bazel/issues/15684。
標記:loading_and_analysis
、incompatible_change
--[no]one_version_enforcement_on_java_tests
預設值:「true」-
啟用後,如果 experimental_one_version_enforcement 設為非 NONE 值,系統就會對 java_test 目標強制執行單一版本。您可以停用此標記,以改善增量測試效能,但可能會因此錯過潛在的單一版本違規事項。
標記:loading_and_analysis
--python_native_rules_allowlist=<a build target label>
預設值:請參閱說明-
強制執行 --incompatible_python_disallow_native_rules 時使用的許可清單 (package_group 目標)。
標記:loading_and_analysis
--[no]strict_filesets
預設值:「false」-
如果啟用這個選項,系統會將跨越套件界線的檔案集回報為錯誤。
標記:build_file_semantics
、eagerness_to_exit
--strict_proto_deps=<off, warn, error, strict or default>
預設值:「error」-
除非設為 OFF,否則會檢查 proto_library 目標是否明確將所有直接使用的目標宣告為依附元件。
標籤:build_file_semantics
、eagerness_to_exit
、incompatible_change
--strict_public_imports=<off, warn, error, strict or default>
預設值:「off」-
除非設為 OFF,否則會檢查 proto_library 目標是否明確將「import public」中使用的所有目標宣告為已匯出。
標籤:build_file_semantics
、eagerness_to_exit
、incompatible_change
--[no]strict_system_includes
預設值:「false」-
如果是 true,系統也必須宣告透過系統包含路徑 (-isystem) 找到的標頭。
標記:loading_and_analysis
、eagerness_to_exit
--target_environment=<a build target label>
累積多次使用-
宣告這個建構作業的目標環境。必須是「環境」規則的標籤參照。如果指定,所有頂層目標都必須與這個環境相容。
標記:changes_inputs
- 影響建構簽署輸出的選項:
--apk_signing_method=<v1, v2, v1_v2 or v4>
預設值:「v1_v2」-
用來簽署 APK 的實作項目
標記:action_command_lines
、affects_outputs
、loading_and_analysis
--[no]device_debug_entitlements
預設值:「true」-
如果已設定,且編譯模式不是「opt」,objc 應用程式會在簽署時加入偵錯授權。
標記:changes_inputs
--ios_signing_cert_name=<a string>
預設值:請參閱說明-
用於 iOS 簽署的憑證名稱。如未設定,系統會改用佈建設定檔。可能是憑證的鑰匙圈身分偏好設定,或憑證通用名稱的 (子字串),如 codesign 的說明頁面 (SIGNING IDENTITIES) 所示。
標記:action_command_lines
- 這個選項會影響 Starlark 語言的語意,或可供 BUILD 檔案、.bzl 檔案或 WORKSPACE 檔案存取的建構 API:
--[no]incompatible_disallow_legacy_py_provider
預設值:「true」-
No-op, will be removed soon.
標記:loading_and_analysis
、incompatible_change
--[no]incompatible_disallow_sdk_frameworks_attributes
預設值:「false」-
如果設為 true,則 objc_library 和 objc_import 中的 sdk_frameworks 和 weak_sdk_frameworks 屬性會遭到禁止。
標記:build_file_semantics
、incompatible_change
--[no]incompatible_objc_alwayslink_by_default
預設值:「false」-
如果為 true,請將 objc_library 和 objc_import 中的 alwayslink 屬性預設值設為 true。
標記:build_file_semantics
、incompatible_change
--[no]incompatible_python_disallow_native_rules
預設值:「false」-
如果為 true,使用內建 py_* 規則時會發生錯誤,此時應改用 rule_python 規則。如需更多資訊和遷移操作說明,請參閱 https://github.com/bazelbuild/bazel/issues/17773。
標記:loading_and_analysis
、incompatible_change
- 控管測試環境或測試執行器行為的選項:
--[no]allow_analysis_failures
預設值:「false」-
如果為 true,規則目標的分析失敗會導致目標傳播包含錯誤說明的 AnalysisFailureInfo 執行個體,而不是導致建構失敗。
標記:loading_and_analysis
、experimental
--analysis_testing_deps_limit=<an integer>
預設值:「2000」-
透過具有 for_analysis_testing 設定轉換的規則屬性,設定遞移依附元件數量上限。如果超出這項限制,系統就會產生規則錯誤。
標記:loading_and_analysis
--[no]break_build_on_parallel_dex2oat_failure
預設值:「false」-
如果為 true,dex2oat 動作失敗會導致建構中斷,而不是在測試執行階段執行 dex2oat。
標記:loading_and_analysis
、experimental
--default_test_resources=<a resource name followed by equal and 1 float or 4 float, e.g. memory=10,30,60,100>
累積多次使用- 覆寫測試的預設資源量。預期格式為 <resource>=<value>。如果將單一正數指定為 <value>,系統會覆寫所有測試大小的預設資源。如果指定 4 個以半形逗號分隔的數字,系統會分別覆寫小型、中型、大型和特大型測試大小的資源量。值也可以是 HOST_RAM/HOST_CPU,後面可選擇性加上 [-|*]<float> (例如 memory=HOST_RAM*.1,HOST_RAM*.2,HOST_RAM*.3,HOST_RAM*.4)。這個旗標指定的預設測試資源,會遭到標記中明確指定的資源覆寫。
--[no]experimental_android_use_parallel_dex2oat
預設值:「false」-
使用 dex2oat 平行處理,可能可加快 android_test 的速度。
標籤:loading_and_analysis
、host_machine_resource_optimizations
、experimental
--[no]ios_memleaks
預設值:「false」-
在 ios_test 目標中啟用記憶體洩漏檢查。
標記:action_command_lines
--ios_simulator_device=<a string>
預設值:請參閱說明-
在模擬器中執行 iOS 應用程式時要模擬的裝置,例如「iPhone 6」。您可以在要執行模擬器的電腦上執行「xcrun simctl list devicetypes」,取得裝置清單。
標記:test_runner
--ios_simulator_version=<a dotted version (for example '2.3' or '3.3alpha2.4')>
預設值:請參閱說明-
執行或測試時,要在模擬器上執行的 iOS 版本。如果規則中指定目標裝置,系統會忽略 ios_test 規則的這項設定。
標記:test_runner
--runs_per_test=<a positive integer or test_regex@runs. This flag may be passed more than once>
累積多次使用- 指定每次測試的執行次數。如果其中任何一項嘗試因任何原因失敗,整個測試就會視為失敗。通常指定的值只會是整數。範例:--runs_per_test=3 會執行所有測試 3 次。替代語法:regex_filter@runs_per_test。其中 runs_per_test 代表整數值,regex_filter 代表包含和排除規則運算式模式的清單 (另請參閱 --instrumentation_filter)。範例:--runs_per_test=//foo/.*,-//foo/bar/.*@3 會執行 //foo/ 中的所有測試,但 foo/bar 下的測試除外,且執行次數為 3 次。這個選項可以多次傳遞。系統會優先採用最近傳遞且相符的引數。如果沒有相符的項目,測試只會執行一次。
--test_env=<a 'name=value' assignment with an optional value part>
累積多次使用-
指定要注入測試執行器環境的其他環境變數。變數可依名稱指定 (系統會從 Bazel 用戶端環境讀取變數值),或依名稱/值組合指定。這個選項可多次使用,指定多個變數。僅供「bazel test」指令使用。
標記:test_runner
--test_timeout=<a single integer or comma-separated list of 4 integers>
預設值:「-1」- 覆寫測試逾時的預設測試逾時值 (以秒為單位)。如果指定單一正整數值,系統會覆寫所有類別。如果指定 4 個以半形逗號分隔的整數,系統會依序覆寫短、中、長和永久的逾時時間。不論採用哪種形式,值為 -1 都會告知 Blaze 對該類別使用預設逾時。
--[no]zip_undeclared_test_outputs
預設值:「false」-
如果設為 true,系統會將未宣告的測試輸出內容封存至 zip 檔案。
標記:test_runner
- 可觸發建構時間最佳化的選項:
--[no]experimental_filter_library_jar_with_program_jar
預設值:「false」-
篩選 ProGuard ProgramJar,移除 LibraryJar 中也存在的任何類別。
標記:action_command_lines
、experimental
--[no]experimental_inmemory_dotd_files
預設值:「true」-
啟用後,系統會直接從遠端建構節點在記憶體中傳遞 C++ .d 檔案,而不是寫入磁碟。
標記:loading_and_analysis
、execution
、affects_outputs
、experimental
--[no]experimental_inmemory_jdeps_files
預設值:「true」-
啟用後,從 Java 編譯作業產生的依附元件 (.jdeps) 檔案會直接從遠端建構節點在記憶體中傳遞,而不是寫入磁碟。
標記:loading_and_analysis
、execution
、affects_outputs
、experimental
--[no]experimental_retain_test_configuration_across_testonly
預設值:「false」-
啟用後,--trim_test_configuration 不會修剪標示為 testonly=1 的規則測試設定。如果非測試規則依附於 cc_test 規則,這項做法可減少動作衝突問題。如果 --trim_test_configuration 為 False,則不會有任何作用。
標籤:loading_and_analysis
、loses_incremental_state
、experimental
--[no]experimental_starlark_cc_import
預設值:「false」-
如果啟用,即可使用 cc_import 的 Starlark 版本。
標記:loading_and_analysis
、experimental
--[no]experimental_unsupported_and_brittle_include_scanning
預設值:「false」-
是否要剖析輸入檔案中的 #include 行,藉此縮小 C/C++ 編譯的輸入範圍。這項做法可縮減編譯輸入樹狀結構的大小,進而提升成效和增量。不過,由於 include 掃描器並未完整實作 C 前置處理器語意,因此也可能導致建構作業中斷。特別是,它無法解讀動態 #include 指令,且會忽略前置處理器條件邏輯。您必須自行承擔使用風險。系統會關閉與此標記相關的所有問題。
標記:loading_and_analysis
、execution
、changes_inputs
、experimental
--[no]incremental_dexing
預設值:「true」-
針對每個 Jar 檔案分別執行大部分的 dexing 工作。
標籤:affects_outputs
、loading_and_analysis
、loses_incremental_state
--[no]objc_use_dotd_pruning
預設值:「true」-
如果設定這項引數,clang 發出的 .d 檔案會用於修剪傳遞至 objc 編譯的輸入集。
標記:changes_inputs
、loading_and_analysis
--[no]process_headers_in_dependencies
預設值:「false」-
建構目標 //a:a 時,處理 //a:a 所依附的所有目標中的標頭 (如果工具鍊已啟用標頭處理)。
標記:execution
--[no]trim_test_configuration
預設值:「true」-
啟用後,系統會清除建構作業頂層以下的測試相關選項。啟用這個標記後,測試無法建構為非測試規則的依附元件,但變更測試相關選項不會導致系統重新分析非測試規則。
標記:loading_and_analysis
、loses_incremental_state
- 影響記錄詳細程度、格式或位置的選項:
--toolchain_resolution_debug=<a comma-separated list of regex expressions with prefix '-' specifying excluded paths>
預設值:「-.*」-
在工具鍊解析期間列印偵錯資訊。這個旗標會採用正規運算式,並根據工具鍊類型和特定目標進行檢查,判斷要偵錯的項目。多個規則運算式可以逗號分隔,然後系統會分別檢查每個規則運算式。注意:這個標記的輸出內容非常複雜,可能只對工具鍊解析專家有用。
標記:terminal_output
- 指定或變更 Bazel 指令一般輸入內容的選項,不屬於其他類別:
--flag_alias=<a 'name=value' flag alias>
累積多次使用-
為 Starlark 旗標設定簡短名稱。這個函式會以「<key>=<value>」形式的單一鍵/值組合做為引數。
標記:changes_inputs
--[no]incompatible_default_to_explicit_init_py
預設值:「false」-
這個標記會變更預設行為,因此系統不會再自動在 Python 目標的執行檔中建立 __init__.py 檔案。具體來說,如果 py_binary 或 py_test 目標的 legacy_create_init 設為「auto」(預設值),則只有在設定這個旗標時,系統才會將其視為 false。詳情請參閱 https://github.com/bazelbuild/bazel/issues/10076。
標記:affects_outputs
、incompatible_change
--[no]incompatible_py2_outputs_are_suffixed
預設值:「true」-
如果為 true,以 Python 2 設定建構的目標會顯示在包含「-py2」後置字串的輸出根目錄下,而為 Python 3 建構的目標則會顯示在沒有 Python 相關後置字串的根目錄中。也就是說,`bazel-bin` 便利符號連結會指向 Python 3 目標,而非 Python 2。啟用這個選項時,建議一併啟用 `--incompatible_py3_is_default`。
標記:affects_outputs
、incompatible_change
--[no]incompatible_py3_is_default
預設值:「true」-
如果為 true,未設定 `python_version` (或 `default_python_version`) 屬性的 `py_binary` 和 `py_test` 目標,預設會使用 PY3,而非 PY2。如果設定這個旗標,建議一併設定 `--incompatible_py2_outputs_are_suffixed`。
標記:loading_and_analysis
、affects_outputs
、incompatible_change
--[no]incompatible_use_python_toolchains
預設值:「true」-
如果設為 true,可執行的原生 Python 規則會使用 Python 工具鍊指定的 Python 執行階段,而不是舊版旗標 (例如 --python_top) 提供的執行階段。
標記:loading_and_analysis
、incompatible_change
--python_version=<PY2 or PY3>
預設值:請參閱說明-
Python 主要版本模式,可以是 `PY2` 或 `PY3`。請注意,這會遭到 `py_binary` 和 `py_test` 目標覆寫 (即使這些目標未明確指定版本),因此通常沒有太多理由提供這個旗標。
標記:loading_and_analysis
、affects_outputs
- 其他選項,未歸類於其他類別:
--[no]cache_test_results
[-t
] 預設值:「auto」- 如果設為「auto」,只有在下列情況下,Bazel 才會重新執行測試:(1) Bazel 偵測到測試或其依附元件有變更;(2) 測試標示為外部;(3) 使用 --runs_per_test 要求多次執行測試;或(4) 測試先前失敗。如果設為「yes」,Bazel 會快取所有測試結果,但標示為外部的測試除外。如果設為「no」,Bazel 不會快取任何測試結果。
--[no]experimental_cancel_concurrent_tests
預設值:「false」-
如果為 true,Blaze 會在第一次成功執行時,取消同時執行的測試。只有在搭配 --runs_per_test_detects_flakes 時才會有作用。
標籤:affects_outputs
、loading_and_analysis
、experimental
--[no]experimental_fetch_all_coverage_outputs
預設值:「false」-
如果為 true,Bazel 會在執行涵蓋範圍時,擷取每項測試的整個涵蓋範圍資料目錄。
標籤:affects_outputs
、loading_and_analysis
、experimental
--[no]experimental_generate_llvm_lcov
預設值:「false」-
如果為 true,clang 的涵蓋範圍會產生 LCOV 報表。
標籤:affects_outputs
、loading_and_analysis
、experimental
--[no]experimental_j2objc_header_map
預設值:「true」-
是否要與 J2ObjC 轉譯作業平行產生 J2ObjC 標頭對應檔。
標記:experimental
--[no]experimental_j2objc_shorter_header_path
預設值:「false」-
是否要使用較短的標頭路徑生成 (使用「_ios」而非「_j2objc」)。
標記:affects_outputs
、experimental
--experimental_java_classpath=<off, javabuilder or bazel>
預設值:「javabuilder」- 啟用 Java 編譯的縮減類別路徑。
--[no]experimental_limit_android_lint_to_android_constrained_java
預設值:「false」-
無作業,僅保留向後相容性
標記:affects_outputs
、experimental
--[no]experimental_run_android_lint_on_java_rules
預設值:「false」-
是否要驗證 java_* 來源。
標記:affects_outputs
、experimental
--[no]explicit_java_test_deps
預設值:「false」- 在 java_test 中明確指定 JUnit 或 Hamcrest 的依附元件,而不是從 TestRunner 的 deps 意外取得。目前僅適用於 Bazel。
--host_java_launcher=<a build target label>
預設值:請參閱說明- 建構期間執行的工具所用的 Java 啟動器。
--host_javacopt=<a string>
累積多次使用- 建構在建構期間執行的工具時,要傳遞至 javac 的其他選項。
--host_jvmopt=<a string>
累積多次使用- 建構在建構期間執行的工具時,要傳遞至 Java VM 的其他選項。這些選項會新增至每個 java_binary 目標的 VM 啟動選項。
--[no]incompatible_check_sharding_support
預設值:「true」-
如果設為 true,且測試執行器未透過觸控 TEST_SHARD_STATUS_FILE 路徑中的檔案,指出支援分片,Bazel 就會讓分片測試失敗。如果為 false,不支援分片的測試執行器會導致所有測試在每個分片中執行。
標記:incompatible_change
--[no]incompatible_exclusive_test_sandboxed
預設值:「true」-
如果是 true,系統會使用沙箱策略執行專屬測試。新增「local」標記,強制在本機執行專屬測試
Tags:incompatible_change
--[no]incompatible_strict_action_env
預設值:「false」-
如果設為 true,Bazel 會使用 PATH 的靜態值環境,且不會繼承 LD_LIBRARY_PATH。如要從用戶端繼承特定環境變數,請使用 --action_env=ENV_VARIABLE,但請注意,如果使用共用快取,這麼做可能會導致無法跨使用者快取。
標記:loading_and_analysis
、incompatible_change
--j2objc_translation_flags=<comma-separated list of options>
累積多次使用- 傳遞至 J2ObjC 工具的其他選項。
--java_debug
-
導致 Java 測試的 Java 虛擬機器等待來自符合 JDWP 規範的偵錯工具 (例如 jdb) 的連線,然後才開始測試。這表示 -test_output=streamed。
展開後會顯示:
--test_arg=--wrapper_script_flag=--debug
--test_output=streamed
--test_strategy=exclusive
--test_timeout=9999
--nocache_test_results
--[no]java_deps
預設值:「true」- 為每個 Java 目標產生依附元件資訊 (目前為編譯時間類別路徑)。
--[no]java_header_compilation
預設值:「true」- 直接從來源編譯 ijars。
--java_language_version=<a string>
預設值:「」- Java 語言版本
--java_launcher=<a build target label>
預設值:請參閱說明- 建構 Java 二進位檔時要使用的 Java 啟動器。如果將這個標記設為空字串,系統會使用 JDK 啟動器。「啟動器」屬性會覆寫這個旗標。
--java_runtime_version=<a string>
預設值:「local_jdk」- Java 執行階段版本
--javacopt=<a string>
累積多次使用- 要傳遞至 javac 的其他選項。
--jvmopt=<a string>
累積多次使用- 要傳遞至 Java VM 的其他選項。這些選項會新增至每個 java_binary 目標的 VM 啟動選項。
--legacy_main_dex_list_generator=<a build target label>
預設值:請參閱說明- 指定要使用的二進位檔,以便在編譯舊版 multidex 時,產生必須位於主要 dex 中的類別清單。
--optimizing_dexer=<a build target label>
預設值:請參閱說明- 指定用於執行 Dexing 的二進位檔,不需分片。
--plugin=<a build target label>
累積多次使用- 建構作業中要使用的外掛程式。目前適用於 java_plugin。
--proguard_top=<a build target label>
預設值:請參閱說明- 指定建構 Java 二進位檔時,要使用哪個版本的 ProGuard 移除程式碼。
--proto_compiler=<a build target label>
預設值:「@bazel_tools//tools/proto:protoc」-
proto 編譯器的標籤。
標記:affects_outputs
、loading_and_analysis
--[no]proto_profile
預設值:「true」-
是否要將 profile_path 傳遞至 proto 編譯器。
標記:affects_outputs
、loading_and_analysis
--proto_profile_path=<a build target label>
預設值:請參閱說明-
要傳遞至 proto 編譯器的設定檔,做為 profile_path。如果未設定,但 --proto_profile 為 true (預設值),則會從 --fdo_optimize 推斷路徑。
標記:affects_outputs
、loading_and_analysis
--proto_toolchain_for_cc=<a build target label>
default: "@bazel_tools//tools/proto:cc_toolchain"-
proto_lang_toolchain() 的標籤,說明如何編譯 C++ proto
標記:affects_outputs
、loading_and_analysis
--proto_toolchain_for_j2objc=<a build target label>
預設值:「@bazel_tools//tools/j2objc:j2objc_proto_toolchain」-
proto_lang_toolchain() 的標籤,說明如何編譯 j2objc proto
標記:affects_outputs
、loading_and_analysis
--proto_toolchain_for_java=<a build target label>
預設值:「@bazel_tools//tools/proto:java_toolchain」-
proto_lang_toolchain() 的標籤,說明如何編譯 Java Proto
標記:affects_outputs
、loading_and_analysis
--proto_toolchain_for_javalite=<a build target label>
預設值:「@bazel_tools//tools/proto:javalite_toolchain」-
proto_lang_toolchain() 的標籤,說明如何編譯 JavaLite proto
標記:affects_outputs
、loading_and_analysis
--protocopt=<a string>
累積多次使用-
要傳遞至 protobuf 編譯器的其他選項。
標記:affects_outputs
--[no]runs_per_test_detects_flakes
預設值:「false」- 如果為 true,只要分片中至少有一次執行/嘗試通過,且至少有一次執行/嘗試失敗,就會獲得 FLAKY 狀態。
--shell_executable=<a path>
預設值:請參閱說明-
Bazel 要使用的 Shell 可執行檔絕對路徑。如果未設定這個變數,但 BAZEL_SH 環境變數是在第一次叫用 Bazel 時設定 (這會啟動 Bazel 伺服器),Bazel 會使用該變數。如果兩者皆未設定,Bazel 會根據執行的作業系統使用硬式編碼的預設路徑 (Windows:c:/msys64/usr/bin/bash.exe、FreeBSD:/usr/local/bin/bash,其他:/bin/bash)。請注意,使用與 Bash 不相容的殼層可能會導致建構失敗,或導致產生的二進位檔發生執行階段錯誤。
標記:loading_and_analysis
--test_arg=<a string>
累積多次使用- 指定應傳遞至測試執行檔的其他選項和引數。可多次使用,指定多個引數。如果執行多項測試,每項測試都會收到相同的引數。僅供「bazel test」指令使用。
--test_filter=<a string>
預設值:請參閱說明- 指定要轉送至測試架構的篩選器。用於限制執行的測試。請注意,這不會影響建構的目標。
--test_result_expiration=<an integer>
預設值:「-1」- 這個選項已淘汰,因此不會產生任何作用。
--[no]test_runner_fail_fast
預設值:「false」- 將快速失敗選項轉送至測試執行器。測試執行器應在第一次失敗時停止執行。
--test_sharding_strategy=<explicit, disabled or forced=k where k is the number of shards to enforce>
預設值:「explicit」- 指定測試分片策略:「explicit」表示只有在存在「shard_count」BUILD 屬性時,才使用分片。「disabled」則表示永不使用測試分片。「forced=k」可強制測試使用「k」個分片,無論「shard_count」BUILD 屬性為何。
--tool_java_language_version=<a string>
預設值:「」- 用於執行建構期間所需工具的 Java 語言版本
--tool_java_runtime_version=<a string>
default: "remotejdk_11"- 建構期間執行工具時使用的 Java 執行階段版本
--[no]use_ijars
預設值:「true」- 啟用後,這項選項會讓 Java 編譯使用介面 JAR。這樣一來,增量編譯速度會更快,但錯誤訊息可能有所不同。
版本選項
- 可讓使用者設定預期輸出內容的選項,影響輸出內容的值,而非存在與否:
--[no]gnu_format
預設值:「false」-
如果已設定,請使用 GNU 標準中說明的慣例,將版本寫入 stdout。
標記:affects_outputs
、execution
- 這個選項會影響 Starlark 語言的語意,或 BUILD 檔案、.bzl 檔案或 WORKSPACE 檔案可存取的建構 API。:
--[no]incompatible_use_plus_in_repo_names
預設值:「true」-
無作業。
標記:loading_and_analysis
選項效果標記
unknown |
這個選項的效果不明或未記錄。 |
no_op |
這個選項實際上不會有任何效果。 |
loses_incremental_state |
變更這個選項的值可能會導致增量狀態大幅遺失,進而減緩建構速度。伺服器重新啟動或大部分依附元件圖失效時,狀態可能會遺失。 |
changes_inputs |
這個選項會主動變更 Bazel 考量建構作業的輸入內容,例如檔案系統限制、存放區版本或其他選項。 |
affects_outputs |
這個選項會影響 bazel 的輸出內容。這個標記刻意涵蓋廣泛,可能包含遞移效應,且未指定受影響的輸出類型。 |
build_file_semantics |
這個選項會影響 BUILD 或 .bzl 檔案的語意。 |
bazel_internal_configuration |
這個選項會影響 bazel 內部機制的設定。單獨出現這個標記並不代表建構構件受到影響。 |
loading_and_analysis |
這個選項會影響依附元件的載入和分析,以及依附元件圖表的建構。 |
execution |
這個選項會影響執行階段,例如沙箱或遠端執行相關選項。 |
host_machine_resource_optimizations |
這個選項會觸發最佳化作業,但最佳化結果可能只適用於特定機器,不保證能在所有機器上運作。最佳化作業可能需要犧牲其他方面的效能,例如記憶體或 CPU 成本。 |
eagerness_to_exit |
這個選項會變更 Bazel 在發生失敗時的結束方式,您可以選擇繼續執行或結束叫用。 |
bazel_monitoring |
這個選項可用於監控 Bazel 的行為和效能。 |
terminal_output |
這個選項會影響 bazel 的終端機輸出內容。 |
action_command_lines |
這個選項會變更一或多個建構動作的指令列引數。 |
test_runner |
這個選項會變更建構版本的測試執行器環境。 |
選項中繼資料標記
experimental |
這個選項會觸發實驗功能,但無法保證功能正常運作。 |
incompatible_change |
這個選項會觸發破壞性變更。使用這個選項測試遷移準備情況,或搶先體驗新功能 |
deprecated |
這個選項已淘汰,可能是因為受影響的功能已淘汰,或是我們偏好使用其他方式提供資訊。 |
immutable |
轉換期間無法變更這個選項。 |