Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added bazel #2546

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions completers/bazel_completer/cmd/analyzeProfile.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
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",
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)

// TODO positional completion
}
14 changes: 14 additions & 0 deletions completers/bazel_completer/cmd/common/buildExecution.go
Original file line number Diff line number Diff line change
@@ -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")
}
22 changes: 22 additions & 0 deletions completers/bazel_completer/cmd/common/buildTimeOptimization.go
Original file line number Diff line number Diff line change
@@ -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
}
17 changes: 17 additions & 0 deletions completers/bazel_completer/cmd/common/bzlmod.go
Original file line number Diff line number Diff line change
@@ -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 `<module1>@<version1>, <module2>@<version2>` that will be allowed in the resolved dependency graph even if they are declared yanked in the registry where they come from (if they are not coming from a NonRegistryOverride)")
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 <module name>=<path>")
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
}
14 changes: 14 additions & 0 deletions completers/bazel_completer/cmd/common/inputAltering.go
Original file line number Diff line number Diff line change
@@ -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(),
})
}
8 changes: 8 additions & 0 deletions completers/bazel_completer/cmd/common/inputValidation.go
Original file line number Diff line number Diff line change
@@ -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")
}
Loading