-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
version/bazel: fix git SHA1 embedding story. (#843)
This is an alternative to #841, using the technique described in https://groups.google.com/forum/m/#!topic/bazel-discuss/9kqLmOq_m_U. See also bazelbuild/bazel#2893.
- Loading branch information
1 parent
392b122
commit 3ea5d3b
Showing
16 changed files
with
84 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +0,0 @@ | ||
load( | ||
"//bazel:envoy_build_system.bzl", | ||
"envoy_package", | ||
) | ||
|
||
envoy_package() | ||
|
||
genrule( | ||
name = "envoy_version", | ||
srcs = glob([".git/**"]), | ||
outs = ["version_generated.cc"], | ||
cmd = "touch $@ && $(location //tools:gen_git_sha.sh) " + | ||
"$$(dirname $(location //tools:gen_git_sha.sh)) $@", | ||
local = 1, | ||
tools = ["//tools:gen_git_sha.sh"], | ||
) | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# This file was imported from https://github.com/bazelbuild/bazel at d6fec93. | ||
|
||
#!/bin/bash | ||
|
||
# This script will be run bazel when building process starts to | ||
# generate key-value information that represents the status of the | ||
# workspace. The output should be like | ||
# | ||
# KEY1 VALUE1 | ||
# KEY2 VALUE2 | ||
# | ||
# If the script exits with non-zero code, it's considered as a failure | ||
# and the output will be discarded. | ||
|
||
# The code below presents an implementation that works for git repository | ||
git_rev=$(git rev-parse HEAD) | ||
if [[ $? != 0 ]]; | ||
then | ||
exit 1 | ||
fi | ||
echo "BUILD_SCM_REVISION ${git_rev}" | ||
|
||
# Check whether there are any uncommited changes | ||
git diff-index --quiet HEAD -- | ||
if [[ $? == 0 ]]; | ||
then | ||
tree_status="Clean" | ||
else | ||
tree_status="Modified" | ||
fi | ||
echo "BUILD_SCM_STATUS ${tree_status}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
extern const char build_scm_revision[]; | ||
extern const char build_scm_status[]; | ||
|
||
const char build_scm_revision[] = BUILD_SCM_REVISION; | ||
const char build_scm_status[] = BUILD_SCM_STATUS; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters