Skip to content
This repository has been archived by the owner on Nov 11, 2022. It is now read-only.

Commit

Permalink
Inject bb info into version command.
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerwilliams committed Dec 8, 2020
1 parent f6614e0 commit 321a605
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 2 additions & 0 deletions cmd/buildbuddy/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ go_library(
importpath = "github.com/buildbuddy-io/buildbuddy-cli/cmd/buildbuddy",
visibility = ["//visibility:private"],
deps = [
"//:go_default_library",
"//commandline:go_default_library",
"//logging:go_default_library",
"//parser:go_default_library",
"//sidecar:go_default_library",
"@com_github_bazelbuild_bazelisk//core:go_default_library",
"@com_github_bazelbuild_bazelisk//repositories:go_default_library",
"@com_github_buildbuddy_io_buildbuddy//server/version:go_default_library",
],
)

Expand Down
13 changes: 10 additions & 3 deletions cmd/buildbuddy/buildbuddy.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import (
"github.com/buildbuddy-io/buildbuddy-cli/commandline"
"github.com/buildbuddy-io/buildbuddy-cli/parser"
"github.com/buildbuddy-io/buildbuddy-cli/sidecar"
"github.com/buildbuddy-io/buildbuddy-cli/static_data"
"github.com/buildbuddy-io/buildbuddy/server/version"

bblog "github.com/buildbuddy-io/buildbuddy-cli/logging"
)
Expand Down Expand Up @@ -100,6 +102,11 @@ func main() {
remoteCacheFlag := parser.GetRCFlagValue(opts, subcommand, bazelFlags.Config, "--remote_cache")
remoteExecFlag := parser.GetRCFlagValue(opts, subcommand, bazelFlags.Config, "--remote_executor")

if subcommand == "version" {
if b, ok := static_data.Data["VERSION"]; ok {
fmt.Printf("bb %s\n", version.AppVersion(b))
}
}
if besBackendFlag == "" && remoteCacheFlag == "" {
runBazelAndDie(filteredOSArgs)
}
Expand All @@ -124,9 +131,9 @@ func main() {
}
if remoteCacheFlag != "" && remoteExecFlag == "" {
sidecarArgs = append(sidecarArgs, remoteCacheFlag)
// Also specify as disk cache directory.
diskCacheDir := filepath.Join(bbHome, "filecache")
sidecarArgs = append(sidecarArgs, fmt.Sprintf("--cache_directory=%s", diskCacheDir))
// Also specify as disk cache directory.
diskCacheDir := filepath.Join(bbHome, "filecache")
sidecarArgs = append(sidecarArgs, fmt.Sprintf("--cache_directory=%s", diskCacheDir))
}

if len(sidecarArgs) > 0 {
Expand Down

0 comments on commit 321a605

Please sign in to comment.