diff --git a/.bazelrc b/.bazelrc index d92f9cfa2..be5c8d920 100644 --- a/.bazelrc +++ b/.bazelrc @@ -20,6 +20,8 @@ # widely accepted by compilers. This may lead to strange behavior or compiler # errors in earlier compilers. build --cxxopt="-std=c++1z" +build --sandbox_debug --verbose_failures --cxxopt="-DNDEBUG" +build --workspace_status_command "tools/workspace_status.sh" # By default, we don't suppress any warnings, to get clang-specific warning # suppression you can invoke with --config=clang build:clang --cxxopt=-Wno-deprecated-declarations diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 6c3bed3eb..99c0d6578 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -11,6 +11,7 @@ jobs: uses: actions/checkout@v2 with: ref: ${{ github.ref }} + fetch-depth: 0 - name: Cache uses: pat-s/always-upload-cache@v2.1.5 with: @@ -43,6 +44,7 @@ jobs: uses: actions/checkout@v2 with: ref: ${{ github.ref }} + fetch-depth: 0 - name: Cache uses: pat-s/always-upload-cache@v2.1.5 with: diff --git a/README.md b/README.md index bb205cb34..56192cff1 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ ## ZetaSQL Formatter -[](https://github.com/Matts966/zetasql-formatter/actions?query=event%3Acreate+workflow%3Arelease+) -[](https://github.com/Matts966/zetasql-formatter/actions?query=branch%main+workflow%3Atest+) +[](https://github.com/Matts966/zetasql-formatter/actions?query=branch%main+workflow%3ABuild+)
diff --git a/WORKSPACE b/WORKSPACE
index e44134e8d..e849df075 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -92,3 +92,9 @@ load("@com_google_zetasql//bazel:zetasql_deps_step_4.bzl", "zetasql_deps_step_4"
zetasql_deps_step_4()
+load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
+git_repository(
+ name = "com_github_gflags_gflags",
+ remote = "https://github.com/gflags/gflags.git",
+ tag = "v2.2.2"
+)
diff --git a/docs/changes.png b/docs/changes.png
new file mode 100644
index 000000000..d20b1fd52
Binary files /dev/null and b/docs/changes.png differ
diff --git a/tools/BUILD b/tools/BUILD
index dd0fd8e3d..9a890b328 100644
--- a/tools/BUILD
+++ b/tools/BUILD
@@ -24,6 +24,7 @@ package(
exports_files([
"pom-template.xml",
+ "workspace_status.sh",
])
bzl_library(
diff --git a/tools/workspace_status.sh b/tools/workspace_status.sh
new file mode 100755
index 000000000..e68fe3b64
--- /dev/null
+++ b/tools/workspace_status.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+echo "STABLE_BUILD_GIT_DESCRIBE $(git describe --tags)"
diff --git a/zetasql/tools/zetasql-formatter/BUILD b/zetasql/tools/zetasql-formatter/BUILD
index e5ca0f042..3d2525bb6 100644
--- a/zetasql/tools/zetasql-formatter/BUILD
+++ b/zetasql/tools/zetasql-formatter/BUILD
@@ -2,14 +2,31 @@ package(
default_visibility = ["//zetasql/base:zetasql_implementation"],
)
+genrule(
+ name = "gen_version",
+ outs = ["version.h"],
+ cmd = """
+TAG=$$(sed -n 's/STABLE_BUILD_GIT_DESCRIBE //p' bazel-out/stable-status.txt)
+cat > $@ <