From 5cb542647bcbe1f962bb38cebf6f0598861cd4ce Mon Sep 17 00:00:00 2001 From: rsteube Date: Sun, 6 Oct 2024 20:29:24 +0200 Subject: [PATCH] added bazel --- .../bazel_completer/cmd/analyzeProfile.go | 31 ++++++ .../cmd/common/buildExecution.go | 14 +++ .../cmd/common/buildTimeOptimization.go | 22 ++++ .../bazel_completer/cmd/common/bzlmod.go | 17 +++ .../cmd/common/inputAltering.go | 14 +++ .../cmd/common/inputValidation.go | 8 ++ .../bazel_completer/cmd/common/logging.go | 98 +++++++++++++++++ .../cmd/common/miscellaneous.go | 48 +++++++++ .../bazel_completer/cmd/common/output.go | 14 +++ .../cmd/common/remoteCaching.go | 80 ++++++++++++++ .../cmd/common/starlarkSemantic.go | 100 ++++++++++++++++++ .../bazel_completer/cmd/common/toolchain.go | 10 ++ completers/bazel_completer/cmd/root.go | 68 ++++++++++++ completers/bazel_completer/main.go | 7 ++ 14 files changed, 531 insertions(+) create mode 100644 completers/bazel_completer/cmd/analyzeProfile.go create mode 100644 completers/bazel_completer/cmd/common/buildExecution.go create mode 100644 completers/bazel_completer/cmd/common/buildTimeOptimization.go create mode 100644 completers/bazel_completer/cmd/common/bzlmod.go create mode 100644 completers/bazel_completer/cmd/common/inputAltering.go create mode 100644 completers/bazel_completer/cmd/common/inputValidation.go create mode 100644 completers/bazel_completer/cmd/common/logging.go create mode 100644 completers/bazel_completer/cmd/common/miscellaneous.go create mode 100644 completers/bazel_completer/cmd/common/output.go create mode 100644 completers/bazel_completer/cmd/common/remoteCaching.go create mode 100644 completers/bazel_completer/cmd/common/starlarkSemantic.go create mode 100644 completers/bazel_completer/cmd/common/toolchain.go create mode 100644 completers/bazel_completer/cmd/root.go create mode 100644 completers/bazel_completer/main.go diff --git a/completers/bazel_completer/cmd/analyzeProfile.go b/completers/bazel_completer/cmd/analyzeProfile.go new file mode 100644 index 0000000000..9682f608aa --- /dev/null +++ b/completers/bazel_completer/cmd/analyzeProfile.go @@ -0,0 +1,31 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/carapace-sh/carapace-bin/completers/bazel_completer/cmd/common" + "github.com/spf13/cobra" +) + +var analyzeProfileCmd = &cobra.Command{ + Use: "analyze-profile", + Short: "Analyzes build profile data for the given profile data files", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(analyzeProfileCmd).Standalone() + common.AddRemoteCachingFlags(analyzeProfileCmd) + common.AddBuildExecutionFlags(analyzeProfileCmd) + common.AddToolchainFlags(analyzeProfileCmd) + common.AddBuildTimeOptimizationFlags(analyzeProfileCmd) + common.AddStarlarkSemanticFlags(analyzeProfileCmd) + common.AddBzlmodFlags(analyzeProfileCmd) + common.AddInputAlteringFlags(analyzeProfileCmd) + common.AddInputValidationFlags(analyzeProfileCmd) + common.AddLoggingFlags(analyzeProfileCmd) + common.AddOutputFlags(analyzeProfileCmd) + common.AddMiscellaneousFlags(analyzeProfileCmd) + + rootCmd.AddCommand(analyzeProfileCmd) + +} diff --git a/completers/bazel_completer/cmd/common/buildExecution.go b/completers/bazel_completer/cmd/common/buildExecution.go new file mode 100644 index 0000000000..5fc1a71b36 --- /dev/null +++ b/completers/bazel_completer/cmd/common/buildExecution.go @@ -0,0 +1,14 @@ +package common + +import ( + "github.com/spf13/cobra" +) + +func AddBuildExecutionFlags(cmd *cobra.Command) { + cmd.Flags().String("experimental_ui_max_stdouterr_bytes", "", "The maximum size of the stdout / stderr files that will be printed to the console") + cmd.Flags().String("gc_thrashing_threshold", "", "The percent of tenured space occupied (0-100) above which GcThrashingDetector considers memory pressure events against its limits (-- gc_thrashing_limits)") + cmd.Flags().Bool("incompatible_remote_dangling_symlinks", false, "If set to true, symlinks uploaded to a remote or disk cache are allowed to dangle") + cmd.Flags().Bool("incompatible_remote_symlinks", false, "If set to true, Bazel will always upload symlinks as such to a remote or disk cache") + cmd.Flags().Bool("no-incompatible_remote_dangling_symlinks", false, "If set to true, symlinks uploaded to a remote or disk cache are allowed to dangle") + cmd.Flags().Bool("no-incompatible_remote_symlinks", false, "If set to true, Bazel will always upload symlinks as such to a remote or disk cache") +} diff --git a/completers/bazel_completer/cmd/common/buildTimeOptimization.go b/completers/bazel_completer/cmd/common/buildTimeOptimization.go new file mode 100644 index 0000000000..1fc40881d4 --- /dev/null +++ b/completers/bazel_completer/cmd/common/buildTimeOptimization.go @@ -0,0 +1,22 @@ +package common + +import ( + "github.com/spf13/cobra" +) + +func AddBuildTimeOptimizationFlags(cmd *cobra.Command) { + cmd.Flags().String("gc_thrashing_limits", "", "Limits which, if reached, cause GcThrashingDetector to crash Bazel with an OOM") + cmd.Flags().Bool("heuristically_drop_nodes", false, "If true, Blaze will remove FileState and DirectoryListingState nodes after related File and DirectoryListing node is done to save memory") + cmd.Flags().Bool("incompatible_do_not_split_linking_cmdline", false, "When true, Bazel no longer modifies command line flags used for linking, and also doesn't selectively decide which flags go to the param file and which don't") + cmd.Flags().Bool("keep_state_after_build", false, "If false, Blaze will discard the inmemory state from this build when the build finishes") + cmd.Flags().Bool("no-heuristically_drop_nodes", false, "If true, Blaze will remove FileState and DirectoryListingState nodes after related File and DirectoryListing node is done to save memory") + cmd.Flags().Bool("no-incompatible_do_not_split_linking_cmdline", false, "When true, Bazel no longer modifies command line flags used for linking, and also doesn't selectively decide which flags go to the param file and which don't") + cmd.Flags().Bool("no-keep_state_after_build", false, "If false, Blaze will discard the inmemory state from this build when the build finishes") + cmd.Flags().Bool("no-track_incremental_state", false, "If false, Blaze will not persist data that allows for invalidation and re- evaluation on incremental builds in order to save memory on this build") + cmd.Flags().String("skyframe_high_water_mark_full_gc_drops_per_invocation", "", "Flag for advanced configuration of Bazel's internal Skyframe engine") + cmd.Flags().String("skyframe_high_water_mark_minor_gc_drops_per_invocation", "", "Flag for advanced configuration of Bazel's internal Skyframe engine") + cmd.Flags().String("skyframe_high_water_mark_threshold", "", "Flag for advanced configuration of Bazel's internal Skyframe engine") + cmd.Flags().Bool("track_incremental_state", false, "If false, Blaze will not persist data that allows for invalidation and re- evaluation on incremental builds in order to save memory on this build") + + // TODO add flag completion +} diff --git a/completers/bazel_completer/cmd/common/bzlmod.go b/completers/bazel_completer/cmd/common/bzlmod.go new file mode 100644 index 0000000000..ee10f26d9a --- /dev/null +++ b/completers/bazel_completer/cmd/common/bzlmod.go @@ -0,0 +1,17 @@ +package common + +import "github.com/spf13/cobra" + +func AddBzlmodFlags(cmd *cobra.Command) { + cmd.Flags().StringSlice("allow_yanked_versions", []string{}, "Specified the module versions in the form of `@, @` that will be allowed in the resolved dependency graph even if they are declared yanked in the registry where they come from (if they are not coming from a NonRegistryOverride)") + cmd.Flags().String("check_bazel_compatibility", "", "Check bazel version compatibility of Bazel modules") + cmd.Flags().String("check_direct_dependencies", "", "Check if the direct `bazel_dep` dependencies declared in the root module are the same versions you get in the resolved dependency graph") + cmd.Flags().Bool("ignore_dev_dependency", false, "If true, Bazel ignores `bazel_dep` and `use_extension` declared as `dev_dependency` in the MODULE.bazel of the root module") + cmd.Flags().String("lockfile_mode", "", "Specifies how and whether or not to use the lockfile") + cmd.Flags().Bool("no-ignore_dev_dependency", false, "If true, Bazel ignores `bazel_dep` and `use_extension` declared as `dev_dependency` in the MODULE.bazel of the root module") + cmd.Flags().StringSlice("override_module", []string{}, "Override a module with a local path in the form of =") + cmd.Flags().StringSlice("registry", []string{}, "Specifies the registries to use to locate Bazel module dependencies") + cmd.Flags().String("vendor_dir", "", "Specifies the directory that should hold the external repositories in vendor mode, whether for the purpose of fetching them into it or using them while building") + + // TODO add flag completion +} diff --git a/completers/bazel_completer/cmd/common/inputAltering.go b/completers/bazel_completer/cmd/common/inputAltering.go new file mode 100644 index 0000000000..c5633ea793 --- /dev/null +++ b/completers/bazel_completer/cmd/common/inputAltering.go @@ -0,0 +1,14 @@ +package common + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +func AddInputAlteringFlags(cmd *cobra.Command) { + cmd.Flags().String("experimental_resolved_file_instead_of_workspace", "", "If non-empty read the specified resolved file instead of the WORKSPACE file Tags: changes_inputs") + + carapace.Gen(cmd).FlagCompletion(carapace.ActionMap{ + "experimental_resolved_file_instead_of_workspace": carapace.ActionFiles(), + }) +} diff --git a/completers/bazel_completer/cmd/common/inputValidation.go b/completers/bazel_completer/cmd/common/inputValidation.go new file mode 100644 index 0000000000..51187688a4 --- /dev/null +++ b/completers/bazel_completer/cmd/common/inputValidation.go @@ -0,0 +1,8 @@ +package common + +import "github.com/spf13/cobra" + +func AddInputValidationFlags(cmd *cobra.Command) { + cmd.Flags().Bool("check_bzl_visibility", false, "If disabled, .bzl load visibility errors are demoted to warnings") + cmd.Flags().Bool("no-check_bzl_visibility", false, "If disabled, .bzl load visibility errors are demoted to warnings") +} diff --git a/completers/bazel_completer/cmd/common/logging.go b/completers/bazel_completer/cmd/common/logging.go new file mode 100644 index 0000000000..25ab4a47e6 --- /dev/null +++ b/completers/bazel_completer/cmd/common/logging.go @@ -0,0 +1,98 @@ +package common + +import ( + "github.com/spf13/cobra" +) + +func AddLoggingFlags(cmd *cobra.Command) { + cmd.Flags().Bool("announce_rc", false, "Whether to announce rc options") + cmd.Flags().Bool("attempt_to_print_relative_paths", false, "When printing the location part of messages, attempt to use a path relative to the workspace directory or one of the directories specified by -- package_path") + cmd.Flags().String("bes_backend", "", "Specifies the build event service (BES) backend endpoint in the form [SCHEME://]HOST[:PORT]") + cmd.Flags().Bool("bes_check_preceding_lifecycle_events", false, "Sets the field check_preceding_lifecycle_events_present on PublishBuildToolEventStreamRequest which tells BES to check whether it previously received InvocationAttemptStarted and BuildEnqueued events matching the current tool event") + cmd.Flags().StringSlice("bes_header", []string{}, "Specify a header in NAME=VALUE form that will be included in BES requests") + cmd.Flags().String("bes_instance_name", "", "Specifies the instance name under which the BES will persist uploaded BEP") + cmd.Flags().StringSlice("bes_keywords", []string{}, "Specifies a list of notification keywords to be added the default set of keywords published to BES (\"command_name= \", \"protocol_name=BEP\")") + cmd.Flags().Bool("bes_lifecycle_events", false, "Specifies whether to publish BES lifecycle events") + cmd.Flags().String("bes_oom_finish_upload_timeout", "", "Specifies how long bazel should wait for the BES/BEP upload to complete while OOMing") + cmd.Flags().String("bes_outerr_buffer_size", "", "Specifies the maximal size of stdout or stderr to be buffered in BEP, before it is reported as a progress event") + cmd.Flags().String("bes_outerr_chunk_size", "", "Specifies the maximal size of stdout or stderr to be sent to BEP in a single message") + cmd.Flags().String("bes_proxy", "", "Connect to the Build Event Service through a proxy") + cmd.Flags().String("bes_results_url", "", "Specifies the base URL where a user can view the information streamed to the BES backend") + cmd.Flags().StringSlice("bes_system_keywords", []string{}, "Specifies a list of notification keywords to be included directly, without the \"user_keyword=\" prefix included for keywords supplied via -- bes_keywords") + cmd.Flags().String("bes_timeout", "", "Specifies how long bazel should wait for the BES/BEP upload to complete after the build and tests have finished") + cmd.Flags().String("bes_upload_mode", "", "Specifies whether the Build Event Service upload should block the build completion or should end the invocation immediately and finish the upload in the background") + cmd.Flags().String("build_event_binary_file", "", "If non-empty, write a varint delimited binary representation of representation of the build event protocol to that file") + cmd.Flags().Bool("build_event_binary_file_path_conversion", false, "Convert paths in the binary file representation of the build event protocol to more globally valid URIs whenever possible; if disabled, the file:// uri scheme will always be used Tags: affects_outputs") + cmd.Flags().String("build_event_binary_file_upload_mode", "", "Specifies whether the Build Event Service upload for -- build_event_binary_file should block the build completion or should end the invocation immediately and finish the upload in the background") + cmd.Flags().String("build_event_json_file", "", "If non-empty, write a JSON serialisation of the build event protocol to that file") + cmd.Flags().Bool("build_event_json_file_path_conversion", false, "Convert paths in the json file representation of the build event protocol to more globally valid URIs whenever possible; if disabled, the file:// uri scheme will always be used Tags: affects_outputs") + cmd.Flags().String("build_event_json_file_upload_mode", "", "Specifies whether the Build Event Service upload for -- build_event_json_file should block the build completion or should end the invocation immediately and finish the upload in the background") + cmd.Flags().String("build_event_max_named_set_of_file_entries", "", "The maximum number of entries for a single named_set_of_files event; values smaller than 2 are ignored and no event splitting is performed") + cmd.Flags().Bool("build_event_publish_all_actions", false, "Whether all actions should be published") + cmd.Flags().String("build_event_text_file", "", "If non-empty, write a textual representation of the build event protocol to that file Tags: affects_outputs") + cmd.Flags().Bool("build_event_text_file_path_conversion", false, "Convert paths in the text file representation of the build event protocol to more globally valid URIs whenever possible; if disabled, the file:// uri scheme will always be used Tags: affects_outputs") + cmd.Flags().String("build_event_text_file_upload_mode", "", "Specifies whether the Build Event Service upload for -- build_event_text_file should block the build completion or should end the invocation immediately and finish the upload in the background") + cmd.Flags().StringP("dump", "d", "", "output full profile data dump either in human-readable 'text' format or script-friendly 'raw' format") + cmd.Flags().Bool("experimental_announce_profile_path", false, "If enabled, adds the JSON profile path to the log") + cmd.Flags().Bool("experimental_bep_target_summary", false, "Whether to publish TargetSummary events") + cmd.Flags().Bool("experimental_build_event_expand_filesets", false, "If true, expand Filesets in the BEP when presenting output files") + cmd.Flags().Bool("experimental_build_event_fully_resolve_fileset_symlinks", false, "If true, fully resolve relative Fileset symlinks in the BEP when presenting output files") + cmd.Flags().String("experimental_build_event_upload_max_retries", "", "The maximum number of times Bazel should retry uploading a build event") + cmd.Flags().String("experimental_build_event_upload_retry_minimum_delay", "", "Initial, minimum delay for exponential backoff retries when BEP upload fails") + cmd.Flags().String("experimental_build_event_upload_strategy", "", "Selects how to upload artifacts referenced in the build event protocol") + cmd.Flags().Bool("experimental_collect_load_average_in_profiler", false, "If enabled, the profiler collects the system's overall load average") + cmd.Flags().Bool("experimental_collect_pressure_stall_indicators", false, "If enabled, the profiler collects the Linux PSI data") + cmd.Flags().Bool("experimental_collect_resource_estimation", false, "If enabled, the profiler collects CPU and memory usage estimation for local actions") + cmd.Flags().Bool("experimental_collect_system_network_usage", false, "If enabled, the profiler collects the system's network usage") + cmd.Flags().Bool("experimental_collect_worker_data_in_profiler", false, "If enabled, the profiler collects worker's aggregated resource data") + cmd.Flags().String("experimental_command_profile", "", "Records a Java Flight Recorder profile for the duration of the command") + cmd.Flags().StringSlice("experimental_profile_additional_tasks", []string{}, "Specifies additional profile tasks to be included in the profile") + cmd.Flags().Bool("experimental_profile_include_primary_output", false, "Includes the extra \"out\" attribute in action events that contains the exec path to the action's primary output") + cmd.Flags().Bool("experimental_profile_include_target_label", false, "Includes target label in action events' JSON profile data") + cmd.Flags().Bool("experimental_record_metrics_for_all_mnemonics", false, "By default the number of action types is limited to the 20 mnemonics with the largest number of executed actions") + cmd.Flags().Bool("experimental_run_bep_event_include_residue", false, "Whether to include the command-line residue in run build events which could contain the residue") + cmd.Flags().Bool("experimental_stream_log_file_uploads", false, "Stream log file uploads directly to the remote storage rather than writing them to disk") + cmd.Flags().String("experimental_workspace_rules_log_file", "", "Log certain Workspace Rules events into this file as delimited WorkspaceEvent protos") + cmd.Flags().String("generate_json_trace_profile", "", "If enabled, Bazel profiles the build and writes a JSON-format profile into a file in the output base") + cmd.Flags().Bool("heap_dump_on_oom", false, "Whether to manually output a heap dump if an OOM is thrown (including manual OOMs due to reaching --gc_thrashing_limits)") + cmd.Flags().Bool("legacy_important_outputs", false, "Use this to suppress generation of the legacy important_outputs field in the TargetComplete event") + cmd.Flags().String("logging", "", "The logging level") + cmd.Flags().String("memory_profile", "", "If set, write memory usage data to the specified file at phase ends and stable heap to master log at end of build") + cmd.Flags().String("memory_profile_stable_heap_parameters", "", "Tune memory profile's computation of stable heap at end of build") + cmd.Flags().Bool("no-announce_rc", false, "Whether to announce rc options") + cmd.Flags().Bool("no-attempt_to_print_relative_paths", false, "When printing the location part of messages, attempt to use a path relative to the workspace directory or one of the directories specified by -- package_path") + cmd.Flags().Bool("no-bes_check_preceding_lifecycle_events", false, "Sets the field check_preceding_lifecycle_events_present on PublishBuildToolEventStreamRequest which tells BES to check whether it previously received InvocationAttemptStarted and BuildEnqueued events matching the current tool event") + cmd.Flags().Bool("no-bes_lifecycle_events", false, "Specifies whether to publish BES lifecycle events") + cmd.Flags().Bool("no-build_event_binary_file_path_conversion", false, "Convert paths in the binary file representation of the build event protocol to more globally valid URIs whenever possible; if disabled, the file:// uri scheme will always be used Tags: affects_outputs") + cmd.Flags().Bool("no-build_event_json_file_path_conversion", false, "Convert paths in the json file representation of the build event protocol to more globally valid URIs whenever possible; if disabled, the file:// uri scheme will always be used Tags: affects_outputs") + cmd.Flags().Bool("no-build_event_publish_all_actions", false, "Whether all actions should be published") + cmd.Flags().Bool("no-build_event_text_file_path_conversion", false, "Convert paths in the text file representation of the build event protocol to more globally valid URIs whenever possible; if disabled, the file:// uri scheme will always be used Tags: affects_outputs") + cmd.Flags().Bool("no-experimental_announce_profile_path", false, "If enabled, adds the JSON profile path to the log") + cmd.Flags().Bool("no-experimental_bep_target_summary", false, "Whether to publish TargetSummary events") + cmd.Flags().Bool("no-experimental_build_event_expand_filesets", false, "If true, expand Filesets in the BEP when presenting output files") + cmd.Flags().Bool("no-experimental_build_event_fully_resolve_fileset_symlinks", false, "If true, fully resolve relative Fileset symlinks in the BEP when presenting output files") + cmd.Flags().Bool("no-experimental_collect_load_average_in_profiler", false, "If enabled, the profiler collects the system's overall load average") + cmd.Flags().Bool("no-experimental_collect_pressure_stall_indicators", false, "If enabled, the profiler collects the Linux PSI data") + cmd.Flags().Bool("no-experimental_collect_resource_estimation", false, "If enabled, the profiler collects CPU and memory usage estimation for local actions") + cmd.Flags().Bool("no-experimental_collect_system_network_usage", false, "If enabled, the profiler collects the system's network usage") + cmd.Flags().Bool("no-experimental_collect_worker_data_in_profiler", false, "If enabled, the profiler collects worker's aggregated resource data") + cmd.Flags().Bool("no-experimental_profile_include_primary_output", false, "Includes the extra \"out\" attribute in action events that contains the exec path to the action's primary output") + cmd.Flags().Bool("no-experimental_profile_include_target_label", false, "Includes target label in action events' JSON profile data") + cmd.Flags().Bool("no-experimental_record_metrics_for_all_mnemonics", false, "By default the number of action types is limited to the 20 mnemonics with the largest number of executed actions") + cmd.Flags().Bool("no-experimental_run_bep_event_include_residue", false, "Whether to include the command-line residue in run build events which could contain the residue") + cmd.Flags().Bool("no-experimental_stream_log_file_uploads", false, "Stream log file uploads directly to the remote storage rather than writing them to disk") + cmd.Flags().String("no-generate_json_trace_profile", "", "If enabled, Bazel profiles the build and writes a JSON-format profile into a file in the output base") + cmd.Flags().Bool("no-heap_dump_on_oom", false, "Whether to manually output a heap dump if an OOM is thrown (including manual OOMs due to reaching --gc_thrashing_limits)") + cmd.Flags().Bool("no-legacy_important_outputs", false, "Use this to suppress generation of the legacy important_outputs field in the TargetComplete event") + cmd.Flags().Bool("no-record_full_profiler_data", false, "By default, Bazel profiler will record only aggregated data for fast but numerous events (such as statting the file)") + cmd.Flags().Bool("no-slim_profile", false, "Slims down the size of the JSON profile by merging events if the profile gets too large") + cmd.Flags().String("profile", "", "If set, profile Bazel and write data to the specified file") + cmd.Flags().Bool("record_full_profiler_data", false, "By default, Bazel profiler will record only aggregated data for fast but numerous events (such as statting the file)") + cmd.Flags().String("remote_print_execution_messages", "", "Choose when to print remote execution messages") + cmd.Flags().Bool("slim_profile", false, "Slims down the size of the JSON profile by merging events if the profile gets too large") + cmd.Flags().String("starlark_cpu_profile", "", "Writes into the specified file a pprof profile of CPU usage by all Starlark threads") + cmd.Flags().String("tool_tag", "", "A tool name to attribute this Bazel invocation to") + cmd.Flags().StringSlice("ui_event_filters", []string{}, "Specifies which events to show in the UI") + + // TODO add flag completion +} diff --git a/completers/bazel_completer/cmd/common/miscellaneous.go b/completers/bazel_completer/cmd/common/miscellaneous.go new file mode 100644 index 0000000000..e56d1b1fbf --- /dev/null +++ b/completers/bazel_completer/cmd/common/miscellaneous.go @@ -0,0 +1,48 @@ +package common + +import ( + "github.com/spf13/cobra" +) + +func AddMiscellaneousFlags(cmd *cobra.Command) { + cmd.Flags().StringSlice("build_metadata", []string{}, "Custom key-value string pairs to supply in a build event") + cmd.Flags().String("color", "", "Use terminal controls to colorize output") + cmd.Flags().StringSlice("config", []string{}, "Selects additional config sections from the rc files; for every , it also pulls in the options from : if such a section exists; if this section doesn't exist in any .rc file, Blaze fails with an error") + cmd.Flags().StringSlice("credential_helper", []string{}, "Configures a credential helper conforming to the =") + cmd.Flags().Bool("progress_in_terminal_title", false, "Show the command progress in the terminal title") + cmd.Flags().Bool("show_progress", false, "Display progress messages during a build") + cmd.Flags().String("show_progress_rate_limit", "", "Minimum number of seconds between progress messages in the output") + cmd.Flags().Bool("show_timestamps", false, "Include timestamps in messages") + cmd.Flags().String("tls_certificate", "", "Specify a path to a TLS certificate that is trusted to sign server certificates") + cmd.Flags().String("tls_client_certificate", "", "Specify the TLS client certificate to use; you also need to provide a client key to enable client authentication") + cmd.Flags().String("tls_client_key", "", "Specify the TLS client key to use; you also need to provide a client certificate to enable client authentication") + cmd.Flags().String("ui_actions_shown", "", "Number of concurrent actions shown in the detailed progress bar; each action is shown on a separate line") + cmd.Flags().Bool("watchfs", false, "On Linux/macOS: If true, bazel tries to use the operating system's file watch service for local changes instead of scanning every file for a change") + + // TODO add flag completion +} diff --git a/completers/bazel_completer/cmd/common/output.go b/completers/bazel_completer/cmd/common/output.go new file mode 100644 index 0000000000..3a3ef1776f --- /dev/null +++ b/completers/bazel_completer/cmd/common/output.go @@ -0,0 +1,14 @@ +package common + +import ( + "github.com/spf13/cobra" +) + +func AddOutputFlags(cmd *cobra.Command) { + cmd.Flags().String("bep_maximum_open_remote_upload_files", "", "Maximum number of open files allowed during BEP artifact upload") + cmd.Flags().String("remote_download_outputs", "", "If set to 'minimal' doesn't download any remote build outputs to the local machine, except the ones required by local actions") + cmd.Flags().String("remote_download_symlink_template", "", "Instead of downloading remote build outputs to the local machine, create symbolic links") + cmd.Flags().StringSlice("repo_env", []string{}, "Specifies additional environment variables to be available only for repository rules") + + // TODO add flag completion +} diff --git a/completers/bazel_completer/cmd/common/remoteCaching.go b/completers/bazel_completer/cmd/common/remoteCaching.go new file mode 100644 index 0000000000..e740f702c5 --- /dev/null +++ b/completers/bazel_completer/cmd/common/remoteCaching.go @@ -0,0 +1,80 @@ +package common + +import ( + "github.com/spf13/cobra" +) + +func AddRemoteCachingFlags(cmd *cobra.Command) { + cmd.Flags().String("experimental_circuit_breaker_strategy", "", "Specifies the strategy for the circuit breaker to use") + cmd.Flags().String("experimental_downloader_config", "", "Specify a file to configure the remote downloader with") + cmd.Flags().Bool("experimental_guard_against_concurrent_changes", false, "Turn this off to disable checking the ctime of input files of an action before uploading it to a remote cache") + cmd.Flags().Bool("experimental_remote_cache_async", false, "If true, remote cache I/O will happen in the background instead of taking place as the part of a spawn") + cmd.Flags().String("experimental_remote_cache_compression_threshold", "", "The minimum blob size required to compress/decompress with zstd") + cmd.Flags().Bool("experimental_remote_cache_lease_extension", false, "If set to true, Bazel will extend the lease for outputs of remote actions during the build by sending `FindMissingBlobs` calls periodically to remote cache") + cmd.Flags().String("experimental_remote_cache_ttl", "", "The guaranteed minimal TTL of blobs in the remote cache after their digests are recently referenced e.g. by an ActionResult or FindMissingBlobs") + cmd.Flags().String("experimental_remote_capture_corrupted_outputs", "", "A path to a directory where the corrupted outputs will be captured to") + cmd.Flags().Bool("experimental_remote_discard_merkle_trees", false, "If set to true, discard in-memory copies of the input root's Merkle tree and associated input mappings during calls to GetActionResult() and Execute()") + cmd.Flags().String("experimental_remote_downloader", "", "A Remote Asset API endpoint URI, to be used as a remote download proxy") + cmd.Flags().Bool("experimental_remote_downloader_local_fallback", false, "Whether to fall back to the local downloader if remote downloader fails") + cmd.Flags().Bool("experimental_remote_execution_keepalive", false, "Whether to use keepalive for remote execution calls") + cmd.Flags().String("experimental_remote_failure_rate_threshold", "", "Sets the allowed number of failure rate in percentage for a specific time window after which it stops calling to the remote cache/executor") + cmd.Flags().String("experimental_remote_failure_window_interval", "", "The interval in which the failure rate of the remote requests are computed") + cmd.Flags().Bool("experimental_remote_mark_tool_inputs", false, "If set to true, Bazel will mark inputs as tool inputs for the remote executor") + cmd.Flags().Bool("experimental_remote_merkle_tree_cache", false, "If set to true, Merkle tree calculations will be memoized to improve the remote cache hit checking speed") + cmd.Flags().String("experimental_remote_merkle_tree_cache_size", "", "The number of Merkle trees to memoize to improve the remote cache hit checking speed") + cmd.Flags().String("experimental_remote_output_service", "", "HOST or HOST:PORT of a remote output service endpoint") + cmd.Flags().String("experimental_remote_output_service_output_path_prefix", "", "The path under which the contents of output directories managed by the -- experimental_remote_output_service are placed") + cmd.Flags().Bool("experimental_remote_require_cached", false, "If set to true, enforce that all actions that can run remotely are cached, or else fail the build") + cmd.Flags().String("experimental_remote_scrubbing_config", "", "Enables remote cache key scrubbing with the supplied configuration file, which must be a protocol buffer in text format (see src/main/protobuf/remote_scrubbing.proto)") + cmd.Flags().String("experimental_worker_for_repo_fetching", "", "The threading mode to use for repo fetching") + cmd.Flags().Bool("incompatible_remote_build_event_upload_respect_no_cache", false, "Deprecated") + cmd.Flags().Bool("incompatible_remote_downloader_send_all_headers", false, "Whether to send all values of a multi-valued header to the remote downloader instead of just the first") + cmd.Flags().Bool("incompatible_remote_output_paths_relative_to_input_root", false, "If set to true, output paths are relative to input root instead of working directory") + cmd.Flags().Bool("incompatible_remote_results_ignore_disk", false, "No-op Tags: incompatible_change") + cmd.Flags().Bool("no-experimental_guard_against_concurrent_changes", false, "Turn this off to disable checking the ctime of input files of an action before uploading it to a remote cache") + cmd.Flags().Bool("no-experimental_remote_cache_async", false, "If true, remote cache I/O will happen in the background instead of taking place as the part of a spawn") + cmd.Flags().Bool("no-experimental_remote_cache_lease_extension", false, "If set to true, Bazel will extend the lease for outputs of remote actions during the build by sending `FindMissingBlobs` calls periodically to remote cache") + cmd.Flags().Bool("no-experimental_remote_discard_merkle_trees", false, "If set to true, discard in-memory copies of the input root's Merkle tree and associated input mappings during calls to GetActionResult() and Execute()") + cmd.Flags().Bool("no-experimental_remote_downloader_local_fallback", false, "Whether to fall back to the local downloader if remote downloader fails") + cmd.Flags().Bool("no-experimental_remote_execution_keepalive", false, "Whether to use keepalive for remote execution calls") + cmd.Flags().Bool("no-experimental_remote_mark_tool_inputs", false, "If set to true, Bazel will mark inputs as tool inputs for the remote executor") + cmd.Flags().Bool("no-experimental_remote_merkle_tree_cache", false, "If set to true, Merkle tree calculations will be memoized to improve the remote cache hit checking speed") + cmd.Flags().Bool("no-experimental_remote_require_cached", false, "If set to true, enforce that all actions that can run remotely are cached, or else fail the build") + cmd.Flags().Bool("no-incompatible_remote_build_event_upload_respect_no_cache", false, "Deprecated") + cmd.Flags().Bool("no-incompatible_remote_downloader_send_all_headers", false, "Whether to send all values of a multi-valued header to the remote downloader instead of just the first") + cmd.Flags().Bool("no-incompatible_remote_output_paths_relative_to_input_root", false, "If set to true, output paths are relative to input root instead of working directory") + cmd.Flags().Bool("no-incompatible_remote_results_ignore_disk", false, "No-op Tags: incompatible_change") + cmd.Flags().Bool("no-remote_accept_cached", false, "Whether to accept remotely cached action results") + cmd.Flags().Bool("no-remote_cache_compression", false, "If enabled, compress/decompress cache blobs with zstd when their size is at least --experimental_remote_cache_compression_threshold") + cmd.Flags().Bool("no-remote_local_fallback", false, "Whether to fall back to standalone local execution strategy if remote execution fails") + cmd.Flags().Bool("no-remote_upload_local_results", false, "Whether to upload locally executed action results to the remote cache if the remote cache supports it and the user is authorized to do so") + cmd.Flags().Bool("no-remote_verify_downloads", false, "If set to true, Bazel will compute the hash sum of all remote downloads and discard the remotely cached values if they don't match the expected value") + cmd.Flags().Bool("remote_accept_cached", false, "Whether to accept remotely cached action results") + cmd.Flags().String("remote_build_event_upload", "", "If set to 'all', all local outputs referenced by BEP are uploaded to remote cache") + cmd.Flags().String("remote_bytestream_uri_prefix", "", "The hostname and instance name to be used in bytestream:// URIs that are written into build event streams") + cmd.Flags().String("remote_cache", "", "A URI of a caching endpoint") + cmd.Flags().Bool("remote_cache_compression", false, "If enabled, compress/decompress cache blobs with zstd when their size is at least --experimental_remote_cache_compression_threshold") + cmd.Flags().StringSlice("remote_cache_header", []string{}, "Specify a header that will be included in cache requests: -- remote_cache_header=Name=Value") + cmd.Flags().StringSlice("remote_default_exec_properties", []string{}, "Set the default exec properties to be used as the remote execution platform if an execution platform does not already set exec_properties") + cmd.Flags().String("remote_default_platform_properties", "", "Set the default platform properties to be set for the remote execution API, if the execution platform does not already set remote_execution_properties") + cmd.Flags().StringSlice("remote_download_regex", []string{}, "Force remote build outputs whose path matches this pattern to be downloaded, irrespective of --remote_download_outputs") + cmd.Flags().StringSlice("remote_downloader_header", []string{}, "Specify a header that will be included in remote downloader requests: -- remote_downloader_header=Name=Value") + cmd.Flags().StringSlice("remote_exec_header", []string{}, "Specify a header that will be included in execution requests: -- remote_exec_header=Name=Value") + cmd.Flags().String("remote_execution_priority", "", "The relative priority of actions to be executed remotely") + cmd.Flags().String("remote_executor", "", "HOST or HOST:PORT of a remote execution endpoint") + cmd.Flags().String("remote_grpc_log", "", "If specified, a path to a file to log gRPC call related details") + cmd.Flags().StringSlice("remote_header", []string{}, "Specify a header that will be included in requests: -- remote_header=Name=Value") + cmd.Flags().String("remote_instance_name", "", "Value to pass as instance_name in the remote execution API") + cmd.Flags().Bool("remote_local_fallback", false, "Whether to fall back to standalone local execution strategy if remote execution fails") + cmd.Flags().String("remote_local_fallback_strategy", "", "No-op, deprecated") + cmd.Flags().String("remote_max_connections", "", "Limit the max number of concurrent connections to remote cache/executor") + cmd.Flags().String("remote_proxy", "", "Connect to the remote cache through a proxy") + cmd.Flags().String("remote_result_cache_priority", "", "The relative priority of remote actions to be stored in remote cache") + cmd.Flags().String("remote_retries", "", "The maximum number of attempts to retry a transient error") + cmd.Flags().String("remote_retry_max_delay", "", "The maximum backoff delay between remote retry attempts") + cmd.Flags().String("remote_timeout", "", "The maximum amount of time to wait for remote execution and cache calls") + cmd.Flags().Bool("remote_upload_local_results", false, "Whether to upload locally executed action results to the remote cache if the remote cache supports it and the user is authorized to do so") + cmd.Flags().Bool("remote_verify_downloads", false, "If set to true, Bazel will compute the hash sum of all remote downloads and discard the remotely cached values if they don't match the expected value") + + // TODO add flag completion +} diff --git a/completers/bazel_completer/cmd/common/starlarkSemantic.go b/completers/bazel_completer/cmd/common/starlarkSemantic.go new file mode 100644 index 0000000000..9df30ef84e --- /dev/null +++ b/completers/bazel_completer/cmd/common/starlarkSemantic.go @@ -0,0 +1,100 @@ +package common + +import ( + "github.com/spf13/cobra" +) + +func AddStarlarkSemanticFlags(cmd *cobra.Command) { + cmd.Flags().Bool("enable_bzlmod", false, "If true, enables the Bzlmod dependency management system, taking precedence over WORKSPACE") + cmd.Flags().Bool("enable_workspace", false, "If true, enables the legacy WORKSPACE system for external dependencies") + cmd.Flags().Bool("experimental_action_resource_set", false, "If set to true, ctx.actions.run() and ctx.actions.run_shell() accept a resource_set parameter for local execution") + cmd.Flags().Bool("experimental_bzl_visibility", false, "If enabled, adds a `visibility()` function that .bzl files may call during top-level evaluation to set their visibility for the purpose of load() statements") + cmd.Flags().Bool("experimental_cc_shared_library", false, "If set to true, rule attributes and Starlark API methods needed for the rule cc_shared_library will be available Tags: build_file_semantics, loading_and_analysis, experimental") + cmd.Flags().Bool("experimental_disable_external_package", false, "If set to true, the auto-generated //external package will not be available anymore") + cmd.Flags().Bool("experimental_enable_android_migration_apis", false, "If set to true, enables the APIs required to support the Android Starlark migration") + cmd.Flags().Bool("experimental_enable_scl_dialect", false, "If set to true, .scl files may be used in load() statements") + cmd.Flags().Bool("experimental_google_legacy_api", false, "If set to true, exposes a number of experimental pieces of Starlark build API pertaining to Google legacy code") + cmd.Flags().Bool("experimental_isolated_extension_usages", false, "If true, enables the isolate parameter in the use_extension function") + cmd.Flags().Bool("experimental_java_library_export", false, "If enabled, experimental_java_library_export_do_not_use module is available") + cmd.Flags().Bool("experimental_platforms_api", false, "If set to true, enables a number of platform-related Starlark APIs useful for debugging") + cmd.Flags().Bool("experimental_repo_remote_exec", false, "If set to true, repository_rule gains some remote execution capabilities") + cmd.Flags().Bool("experimental_sibling_repository_layout", false, "If set to true, non-main repositories are planted as symlinks to the main repository in the execution root") + cmd.Flags().Bool("incompatible_allow_tags_propagation", false, "If set to true, tags will be propagated from a target to the actions' execution requirements; otherwise tags are not propagated") + cmd.Flags().Bool("incompatible_always_check_depset_elements", false, "Check the validity of elements added to depsets, in all constructors") + cmd.Flags().Bool("incompatible_depset_for_java_output_source_jars", false, "When true, Bazel no longer returns a list from java_info.java_output[0]") + cmd.Flags().Bool("incompatible_depset_for_libraries_to_link_getter", false, "When true, Bazel no longer returns a list from linking_context") + cmd.Flags().Bool("incompatible_disable_objc_library_transition", false, "Disable objc_library's custom transition and inherit from the top level target instead Tags: build_file_semantics, incompatible_change") + cmd.Flags().Bool("incompatible_disable_starlark_host_transitions", false, "If set to true, rule attributes cannot set 'cfg = \"host\"'") + cmd.Flags().Bool("incompatible_disable_target_provider_fields", false, "If set to true, disable the ability to access providers on 'target' objects via field syntax") + cmd.Flags().Bool("incompatible_disallow_empty_glob", false, "If set to true, the default value of the `allow_empty` argument of glob() is False") + cmd.Flags().Bool("incompatible_disallow_struct_provider_syntax", false, "If set to true, rule implementation functions may not return a struct") + cmd.Flags().Bool("incompatible_enable_deprecated_label_apis", false, "If enabled, certain deprecated APIs (native.repository_name, Label") + cmd.Flags().Bool("incompatible_existing_rules_immutable_view", false, "If set to true, native.existing_rule and native.existing_rules return lightweight immutable view objects instead of mutable dicts") + cmd.Flags().Bool("incompatible_fail_on_unknown_attributes", false, "If enabled, targets that have unknown attributes set to None fail") + cmd.Flags().Bool("incompatible_fix_package_group_reporoot_syntax", false, "In package_group's `packages` attribute, changes the meaning of the value \"//...\" to refer to all packages in the current repository instead of all packages in any repository") + cmd.Flags().Bool("incompatible_java_common_parameters", false, "If set to true, the output_jar, and host_javabase parameters in pack_sources and host_javabase in compile will all be removed") + cmd.Flags().Bool("incompatible_merge_fixed_and_default_shell_env", false, "If enabled, actions registered with ctx.actions.run and ctx.actions. run_shell with both 'env' and 'use_default_shell_env = True' specified will use an environment obtained from the default shell environment by overriding with the values passed in to 'env'") + cmd.Flags().Bool("incompatible_new_actions_api", false, "If set to true, the API to create actions is only available on `ctx") + cmd.Flags().Bool("incompatible_no_attr_license", false, "If set to true, disables the function `attr.license`") + cmd.Flags().Bool("incompatible_no_implicit_file_export", false, "If set, (used) source files are are package private unless exported explicitly") + cmd.Flags().Bool("incompatible_no_rule_outputs_param", false, "If set to true, disables the `outputs` parameter of the `rule()` Starlark function") + cmd.Flags().Bool("incompatible_objc_provider_remove_linking_info", false, "If set to true, the ObjcProvider's APIs for linking info will be removed") + cmd.Flags().Bool("incompatible_package_group_has_public_syntax", false, "In package_group's `packages` attribute, allows writing \"public\" or \"private\" to refer to all packages or no packages respectively") + cmd.Flags().Bool("incompatible_require_linker_input_cc_api", false, "If set to true, rule create_linking_context will require linker_inputs instead of libraries_to_link") + cmd.Flags().Bool("incompatible_run_shell_command_string", false, "If set to true, the command parameter of actions.run_shell will only accept string Tags: build_file_semantics, incompatible_change") + cmd.Flags().Bool("incompatible_stop_exporting_language_modules", false, "If enabled, certain language-specific modules (such as `cc_common`) are unavailable in user .bzl files and may only be called from their respective rules repositories") + cmd.Flags().Bool("incompatible_struct_has_no_methods", false, "Disables the to_json and to_proto methods of struct, which pollute the struct field namespace") + cmd.Flags().Bool("incompatible_top_level_aspects_require_providers", false, "If set to true, the top level aspect will honor its required providers and only run on top level targets whose rules' advertised providers satisfy the required providers of the aspect") + cmd.Flags().Bool("incompatible_unambiguous_label_stringification", false, "When true, Bazel will stringify the label @//foo:bar to @//foo:bar, instead of //foo:bar") + cmd.Flags().Bool("incompatible_use_cc_configure_from_rules_cc", false, "When true, Bazel will no longer allow using cc_configure from @bazel_tools") + cmd.Flags().Bool("incompatible_use_plus_in_repo_names", false, "If true, uses the plus sign (+) as the separator in canonical repo names, instead of the tilde (~)") + cmd.Flags().Bool("incompatible_visibility_private_attributes_at_definition", false, "If set to true, the visibility of private rule attributes is checked with respect to the rule definition, falling back to rule usage if not visible") + cmd.Flags().String("max_computation_steps", "", "The maximum number of Starlark computation steps that may be executed by a BUILD file (zero means no limit)") + cmd.Flags().String("nested_set_depth_limit", "", "The maximum depth of the graph internal to a depset (also known as NestedSet), above which the depset() constructor will fail") + cmd.Flags().Bool("no-enable_bzlmod", false, "If true, enables the Bzlmod dependency management system, taking precedence over WORKSPACE") + cmd.Flags().Bool("no-enable_workspace", false, "If true, enables the legacy WORKSPACE system for external dependencies") + cmd.Flags().Bool("no-experimental_action_resource_set", false, "If set to true, ctx.actions.run() and ctx.actions.run_shell() accept a resource_set parameter for local execution") + cmd.Flags().Bool("no-experimental_bzl_visibility", false, "If enabled, adds a `visibility()` function that .bzl files may call during top-level evaluation to set their visibility for the purpose of load() statements") + cmd.Flags().Bool("no-experimental_cc_shared_library", false, "If set to true, rule attributes and Starlark API methods needed for the rule cc_shared_library will be available Tags: build_file_semantics, loading_and_analysis, experimental") + cmd.Flags().Bool("no-experimental_disable_external_package", false, "If set to true, the auto-generated //external package will not be available anymore") + cmd.Flags().Bool("no-experimental_enable_android_migration_apis", false, "If set to true, enables the APIs required to support the Android Starlark migration") + cmd.Flags().Bool("no-experimental_enable_scl_dialect", false, "If set to true, .scl files may be used in load() statements") + cmd.Flags().Bool("no-experimental_google_legacy_api", false, "If set to true, exposes a number of experimental pieces of Starlark build API pertaining to Google legacy code") + cmd.Flags().Bool("no-experimental_isolated_extension_usages", false, "If true, enables the isolate parameter in the use_extension function") + cmd.Flags().Bool("no-experimental_java_library_export", false, "If enabled, experimental_java_library_export_do_not_use module is available") + cmd.Flags().Bool("no-experimental_platforms_api", false, "If set to true, enables a number of platform-related Starlark APIs useful for debugging") + cmd.Flags().Bool("no-experimental_repo_remote_exec", false, "If set to true, repository_rule gains some remote execution capabilities") + cmd.Flags().Bool("no-experimental_sibling_repository_layout", false, "If set to true, non-main repositories are planted as symlinks to the main repository in the execution root") + cmd.Flags().Bool("no-incompatible_allow_tags_propagation", false, "If set to true, tags will be propagated from a target to the actions' execution requirements; otherwise tags are not propagated") + cmd.Flags().Bool("no-incompatible_always_check_depset_elements", false, "Check the validity of elements added to depsets, in all constructors") + cmd.Flags().Bool("no-incompatible_depset_for_java_output_source_jars", false, "When true, Bazel no longer returns a list from java_info.java_output[0]") + cmd.Flags().Bool("no-incompatible_depset_for_libraries_to_link_getter", false, "When true, Bazel no longer returns a list from linking_context") + cmd.Flags().Bool("no-incompatible_disable_objc_library_transition", false, "Disable objc_library's custom transition and inherit from the top level target instead Tags: build_file_semantics, incompatible_change") + cmd.Flags().Bool("no-incompatible_disable_starlark_host_transitions", false, "If set to true, rule attributes cannot set 'cfg = \"host\"'") + cmd.Flags().Bool("no-incompatible_disable_target_provider_fields", false, "If set to true, disable the ability to access providers on 'target' objects via field syntax") + cmd.Flags().Bool("no-incompatible_disallow_empty_glob", false, "If set to true, the default value of the `allow_empty` argument of glob() is False") + cmd.Flags().Bool("no-incompatible_disallow_struct_provider_syntax", false, "If set to true, rule implementation functions may not return a struct") + cmd.Flags().Bool("no-incompatible_enable_deprecated_label_apis", false, "If enabled, certain deprecated APIs (native.repository_name, Label") + cmd.Flags().Bool("no-incompatible_existing_rules_immutable_view", false, "If set to true, native.existing_rule and native.existing_rules return lightweight immutable view objects instead of mutable dicts") + cmd.Flags().Bool("no-incompatible_fail_on_unknown_attributes", false, "If enabled, targets that have unknown attributes set to None fail") + cmd.Flags().Bool("no-incompatible_fix_package_group_reporoot_syntax", false, "In package_group's `packages` attribute, changes the meaning of the value \"//...\" to refer to all packages in the current repository instead of all packages in any repository") + cmd.Flags().Bool("no-incompatible_java_common_parameters", false, "If set to true, the output_jar, and host_javabase parameters in pack_sources and host_javabase in compile will all be removed") + cmd.Flags().Bool("no-incompatible_merge_fixed_and_default_shell_env", false, "If enabled, actions registered with ctx.actions.run and ctx.actions. run_shell with both 'env' and 'use_default_shell_env = True' specified will use an environment obtained from the default shell environment by overriding with the values passed in to 'env'") + cmd.Flags().Bool("no-incompatible_new_actions_api", false, "If set to true, the API to create actions is only available on `ctx") + cmd.Flags().Bool("no-incompatible_no_attr_license", false, "If set to true, disables the function `attr.license`") + cmd.Flags().Bool("no-incompatible_no_implicit_file_export", false, "If set, (used) source files are are package private unless exported explicitly") + cmd.Flags().Bool("no-incompatible_no_rule_outputs_param", false, "If set to true, disables the `outputs` parameter of the `rule()` Starlark function") + cmd.Flags().Bool("no-incompatible_objc_provider_remove_linking_info", false, "If set to true, the ObjcProvider's APIs for linking info will be removed") + cmd.Flags().Bool("no-incompatible_package_group_has_public_syntax", false, "In package_group's `packages` attribute, allows writing \"public\" or \"private\" to refer to all packages or no packages respectively") + cmd.Flags().Bool("no-incompatible_require_linker_input_cc_api", false, "If set to true, rule create_linking_context will require linker_inputs instead of libraries_to_link") + cmd.Flags().Bool("no-incompatible_run_shell_command_string", false, "If set to true, the command parameter of actions.run_shell will only accept string Tags: build_file_semantics, incompatible_change") + cmd.Flags().Bool("no-incompatible_stop_exporting_language_modules", false, "If enabled, certain language-specific modules (such as `cc_common`) are unavailable in user .bzl files and may only be called from their respective rules repositories") + cmd.Flags().Bool("no-incompatible_struct_has_no_methods", false, "Disables the to_json and to_proto methods of struct, which pollute the struct field namespace") + cmd.Flags().Bool("no-incompatible_top_level_aspects_require_providers", false, "If set to true, the top level aspect will honor its required providers and only run on top level targets whose rules' advertised providers satisfy the required providers of the aspect") + cmd.Flags().Bool("no-incompatible_unambiguous_label_stringification", false, "When true, Bazel will stringify the label @//foo:bar to @//foo:bar, instead of //foo:bar") + cmd.Flags().Bool("no-incompatible_use_cc_configure_from_rules_cc", false, "When true, Bazel will no longer allow using cc_configure from @bazel_tools") + cmd.Flags().Bool("no-incompatible_use_plus_in_repo_names", false, "If true, uses the plus sign (+) as the separator in canonical repo names, instead of the tilde (~)") + cmd.Flags().Bool("no-incompatible_visibility_private_attributes_at_definition", false, "If set to true, the visibility of private rule attributes is checked with respect to the rule definition, falling back to rule usage if not visible") + + // TODO add flag completion +} diff --git a/completers/bazel_completer/cmd/common/toolchain.go b/completers/bazel_completer/cmd/common/toolchain.go new file mode 100644 index 0000000000..9ed0756745 --- /dev/null +++ b/completers/bazel_completer/cmd/common/toolchain.go @@ -0,0 +1,10 @@ +package common + +import ( + "github.com/spf13/cobra" +) + +func AddToolchainFlags(cmd *cobra.Command) { + cmd.Flags().Bool("incompatible_enable_proto_toolchain_resolution", false, "If true, proto lang rules define toolchains from rules_proto, rules_java, rules_cc repositories") + cmd.Flags().Bool("no-incompatible_enable_proto_toolchain_resolution", false, "If true, proto lang rules define toolchains from rules_proto, rules_java, rules_cc repositories") +} diff --git a/completers/bazel_completer/cmd/root.go b/completers/bazel_completer/cmd/root.go new file mode 100644 index 0000000000..39c17063ba --- /dev/null +++ b/completers/bazel_completer/cmd/root.go @@ -0,0 +1,68 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var rootCmd = &cobra.Command{ + Use: "bazel", + Short: "a fast, scalable, multi-language and extensible build system", + Long: "https://bazel.build/", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func Execute() error { + return rootCmd.Execute() +} + +func init() { + carapace.Gen(rootCmd).Standalone() + + rootCmd.Flags().Bool("autodetect_server_javabase", false, "When --noautodetect_server_javabase is passed, Bazel does not fall back to the local JDK for running the bazel server and instead exits") + rootCmd.Flags().Bool("batch", false, "If set, Bazel will be run as just a client process without a server, instead of in the standard client/server mode") + rootCmd.Flags().Bool("batch_cpu_scheduling", false, "Only on Linux; use 'batch' CPU scheduling for Blaze") + rootCmd.Flags().String("bazelrc", "", "The location of the user .bazelrc file containing default values of Bazel options") + rootCmd.Flags().Bool("block_for_lock", false, "When --noblock_for_lock is passed, Bazel does not wait for a running command to complete, but instead exits immediately") + rootCmd.Flags().Bool("client_debug", false, "If true, log debug information from the client to stderr") + rootCmd.Flags().String("connect_timeout_secs", "", "The amount of time the client waits for each attempt to connect to the server Tags: bazel_internal_configuration") + rootCmd.Flags().String("digest_function", "", "The hash function to use when computing file digests") + rootCmd.Flags().Bool("expand_configs_in_place", false, "Changed the expansion of --config flags to be done in-place, as opposed to in a fixed point expansion between normal rc options and command-line specified options") + rootCmd.Flags().String("failure_detail_out", "", "If set, specifies a location to write a failure_detail protobuf message if the server experiences a failure and cannot report it via gRPC, as normal") + rootCmd.Flags().Bool("home_rc", false, "Whether or not to look for the home bazelrc file at $HOME/.bazelrc Tags: changes_inputs") + rootCmd.Flags().StringSlice("host_jvm_args", []string{}, "Flags to pass to the JVM executing Blaze") + rootCmd.Flags().String("host_jvm_profile", "", "Convenience option to add some profiler/debugger-specific JVM startup flags") + rootCmd.Flags().Bool("idle_server_tasks", false, "Run System.gc() when the server is idle Tags: loses_incremental_state, host_machine_resource_optimizations") + rootCmd.Flags().Bool("ignore_all_rc_files", false, "Disables all rc files, regardless of the values of other rc-modifying flags, even if these flags come later in the list of startup options") + rootCmd.Flags().String("io_nice_level", "", "Only on Linux; set a level from 0-7 for best-effort IO scheduling using the sys_ioprio_set system call") + rootCmd.Flags().String("local_startup_timeout_secs", "", "The maximum amount of time the client waits to connect to the server Tags: bazel_internal_configuration") + rootCmd.Flags().String("macos_qos_class", "", "Sets the QoS service class of the bazel server when running on macOS") + rootCmd.Flags().String("max_idle_secs", "", "The number of seconds the build server will wait idling before shutting down") + rootCmd.Flags().Bool("no-autodetect_server_javabase", false, "When --noautodetect_server_javabase is passed, Bazel does not fall back to the local JDK for running the bazel server and instead exits") + rootCmd.Flags().Bool("no-batch", false, "If set, Bazel will be run as just a client process without a server, instead of in the standard client/server mode") + rootCmd.Flags().Bool("no-batch_cpu_scheduling", false, "Only on Linux; use 'batch' CPU scheduling for Blaze") + rootCmd.Flags().Bool("no-block_for_lock", false, "When --noblock_for_lock is passed, Bazel does not wait for a running command to complete, but instead exits immediately") + rootCmd.Flags().Bool("no-client_debug", false, "If true, log debug information from the client to stderr") + rootCmd.Flags().Bool("no-expand_configs_in_place", false, "Changed the expansion of --config flags to be done in-place, as opposed to in a fixed point expansion between normal rc options and command-line specified options") + rootCmd.Flags().Bool("no-home_rc", false, "Whether or not to look for the home bazelrc file at $HOME/.bazelrc Tags: changes_inputs") + rootCmd.Flags().Bool("no-idle_server_tasks", false, "Run System.gc() when the server is idle Tags: loses_incremental_state, host_machine_resource_optimizations") + rootCmd.Flags().Bool("no-ignore_all_rc_files", false, "Disables all rc files, regardless of the values of other rc-modifying flags, even if these flags come later in the list of startup options") + rootCmd.Flags().Bool("no-preemptible", false, "If true, the command can be preempted if another command is started") + rootCmd.Flags().Bool("no-shutdown_on_low_sys_mem", false, "If max_idle_secs is set and the build server has been idle for a while, shut down the server when the system is low on free RAM") + rootCmd.Flags().Bool("no-system_rc", false, "Whether or not to look for the system-wide bazelrc") + rootCmd.Flags().Bool("no-unlimit_coredumps", false, "Raises the soft coredump limit to the hard limit to make coredumps of the server (including the JVM) and the client possible under common conditions") + rootCmd.Flags().Bool("no-watchfs", false, "If true, bazel tries to use the operating system's file watch service for local changes instead of scanning every file for a change") + rootCmd.Flags().Bool("no-windows_enable_symlinks", false, "If true, real symbolic links will be created on Windows instead of file copying") + rootCmd.Flags().Bool("no-workspace_rc", false, "Whether or not to look for the workspace bazelrc file at $workspace/.bazelrc Tags: changes_inputs") + rootCmd.Flags().String("output_base", "", "If set, specifies the output location to which all build output will be written") + rootCmd.Flags().String("output_user_root", "", "The user-specific directory beneath which all build outputs are written; by default, this is a function of $USER, but by specifying a constant, build outputs can be shared between collaborating users") + rootCmd.Flags().Bool("preemptible", false, "If true, the command can be preempted if another command is started") + rootCmd.Flags().String("server_javabase", "", "Path to the JVM used to execute Bazel itself") + rootCmd.Flags().String("server_jvm_out", "", "The location to write the server's JVM's output") + rootCmd.Flags().Bool("shutdown_on_low_sys_mem", false, "If max_idle_secs is set and the build server has been idle for a while, shut down the server when the system is low on free RAM") + rootCmd.Flags().Bool("system_rc", false, "Whether or not to look for the system-wide bazelrc") + rootCmd.Flags().Bool("unlimit_coredumps", false, "Raises the soft coredump limit to the hard limit to make coredumps of the server (including the JVM) and the client possible under common conditions") + rootCmd.Flags().Bool("watchfs", false, "If true, bazel tries to use the operating system's file watch service for local changes instead of scanning every file for a change") + rootCmd.Flags().Bool("windows_enable_symlinks", false, "If true, real symbolic links will be created on Windows instead of file copying") + rootCmd.Flags().Bool("workspace_rc", false, "Whether or not to look for the workspace bazelrc file at $workspace/.bazelrc Tags: changes_inputs") +} diff --git a/completers/bazel_completer/main.go b/completers/bazel_completer/main.go new file mode 100644 index 0000000000..bb14677ce9 --- /dev/null +++ b/completers/bazel_completer/main.go @@ -0,0 +1,7 @@ +package main + +import "github.com/carapace-sh/carapace-bin/completers/bazel_completer/cmd" + +func main() { + cmd.Execute() +}