File tree Expand file tree Collapse file tree 5 files changed +44
-0
lines changed Expand file tree Collapse file tree 5 files changed +44
-0
lines changed Original file line number Diff line number Diff line change 1
1
# Enable Bzlmod for every Bazel command
2
2
common --enable_bzlmod
3
+
4
+ # build, test, and run commands
5
+ build --stamp --workspace_status_command=./scripts/bazel-status.sh
6
+ test --stamp --workspace_status_command=./scripts/bazel-status.sh
7
+ run --stamp --workspace_status_command=./scripts/bazel-status.sh
Original file line number Diff line number Diff line change @@ -38,6 +38,13 @@ go_binary(
38
38
name = "yutu" ,
39
39
embed = [":yutu_lib" ],
40
40
visibility = ["//visibility:public" ],
41
+ x_defs = {
42
+ "Version" : "{STABLE_VERSION}" ,
43
+ "Commit" : "{STABLE_GIT_SHORT_SHA}" ,
44
+ "CommitDate" : "{STABLE_GIT_COMMIT_DATE}" ,
45
+ "Os" : "{STABLE_OS}" ,
46
+ "Arch" : "{STABLE_ARCH}" ,
47
+ },
41
48
)
42
49
43
50
go_cross_binary (
Original file line number Diff line number Diff line change @@ -8,6 +8,14 @@ go_sdk.from_file(go_mod = "//:go.mod")
8
8
9
9
go_deps = use_extension ("@gazelle//:extensions.bzl" , "go_deps" )
10
10
go_deps .from_file (go_mod = "//:go.mod" )
11
+
12
+ go_deps .config (
13
+ go_env = {
14
+ "CGO_ENABLED" : "0" ,
15
+ "GO111MODULE" : "on" ,
16
+ },
17
+ )
18
+
11
19
use_repo (
12
20
go_deps ,
13
21
"com_github_savioxavier_termlink" ,
Original file line number Diff line number Diff line change @@ -9,6 +9,13 @@ go_library(
9
9
],
10
10
importpath = "github.com/eat-pray-ai/yutu/cmd" ,
11
11
visibility = ["//visibility:public" ],
12
+ x_defs = {
13
+ "Version" : "{STABLE_VERSION}" ,
14
+ "Commit" : "{STABLE_GIT_SHORT_SHA}" ,
15
+ "CommitDate" : "{STABLE_GIT_COMMIT_DATE}" ,
16
+ "Os" : "{STABLE_OS}" ,
17
+ "Arch" : "{STABLE_ARCH}" ,
18
+ },
12
19
deps = [
13
20
"//pkg/auth" ,
14
21
"@com_github_savioxavier_termlink//:termlink" ,
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ GIT_SHORT_SHA=$( git rev-parse --short HEAD)
4
+ echo STABLE_GIT_SHORT_SHA " $GIT_SHORT_SHA "
5
+ echo STABLE_GIT_COMMIT_DATE " $( git log -1 --format=%cd --date=iso) "
6
+
7
+ GIT_TAG=$( git describe --tags --abbrev=0)
8
+ GIT_TAG_DIRTY=$( git describe --tags --dirty --abbrev=0)
9
+ # if the tag is dirty, we need to append the short SHA
10
+ if [[ " $GIT_TAG_DIRTY " != " $GIT_TAG " ]]; then
11
+ echo STABLE_VERSION " $GIT_TAG_DIRTY -$GIT_SHORT_SHA "
12
+ else
13
+ echo STABLE_VERSION " $GIT_TAG "
14
+ fi
15
+
16
+ echo STABLE_OS " $( uname -s | tr ' [:upper:]' ' [:lower:]' ) "
17
+ echo STABLE_ARCH " $( uname -m | sed ' s/x86_64/amd64/' | tr ' [:upper:]' ' [:lower:]' ) "
You can’t perform that action at this time.
0 commit comments