Revert "bazel: generate the workspace version from the volatile status."

Bazel 0.3.2 introduced regression: [1] workspace_status_command seems to
be ignored. That broke Bazel build. Revert this change and re-consider to
re-apply it, when the problem is fixed upstream.

* [1] https://github.com/bazelbuild/bazel/issues/1976

This reverts commit 214171ddda.

Change-Id: I729ffaf6ae1bff5fb858d78de2a6915058c9e651
This commit is contained in:
David Ostrovsky
2016-10-23 20:44:37 +02:00
committed by David Pursehouse
parent fae18ed4a0
commit 47deed6a86
4 changed files with 9 additions and 23 deletions

View File

@@ -1 +1 @@
build --workspace_status_command=./tools/workspace-status.sh --strategy=Javac=worker
build --strategy=Javac=worker

11
BUILD
View File

@@ -1,10 +1,11 @@
load('//tools/bzl:genrule2.bzl', 'genrule2')
load('//tools/bzl:pkg_war.bzl', 'pkg_war')
genrule(
name = 'gen_version',
stamp = 1,
cmd = "grep STABLE_BUILD_GERRIT_LABEL < bazel-out/volatile-status.txt | cut -d ' ' -f 2 > $@",
outs = ['version.txt'],
genrule2(
name = 'version',
srcs = ['VERSION'],
cmd = "grep GERRIT_VERSION $< | cut -d \"'\" -f 2 >$@",
out = 'version.txt',
visibility = ['//visibility:public'],
)

View File

@@ -63,9 +63,9 @@ genrule2(
cmd = ' && '.join([
'cd $$TMP',
'mkdir -p com/google/gerrit/common',
'cat $$ROOT/$(location //:version.txt) >com/google/gerrit/common/Version',
'cat $$ROOT/$(location //:version) >com/google/gerrit/common/Version',
'zip -9Dqr $$ROOT/$@ .',
]),
tools = ['//:version.txt'],
tools = ['//:version'],
out = 'gen_version.jar',
)

View File

@@ -1,15 +0,0 @@
#!/bin/sh
# This script will be run by bazel when the build 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.
git_rev=$(git describe --always --match "v[0-9].*" --dirty)
echo "STABLE_BUILD_GERRIT_LABEL ${git_rev}"