Make sure wrong plugin manifest file is not collected from cache

Building two versions of a gerrit plugin using the same buck would make
buck use the cached manifest file from the previous build.
With this change the result of git_describe() is used to determine
archetype version, so the manifest file will be rebuilt.

Change-Id: If5e7be8d7f11b965e973172f77fe7bfc93019f3a
This commit is contained in:
Sven Selberg 2015-04-13 15:34:38 +02:00 committed by Shawn Pearce
parent b6b6ee280a
commit aab703f6ca
2 changed files with 7 additions and 3 deletions

View File

@ -18,6 +18,7 @@ include_defs('//lib/auto/auto_value.defs')
include_defs('//tools/gwt-constants.defs')
include_defs('//tools/java_doc.defs')
include_defs('//tools/java_sources.defs')
include_defs('//tools/git.defs')
import copy
# Set defaults on java rules:
@ -130,7 +131,7 @@ def gerrit_plugin(
type = 'plugin',
visibility = ['PUBLIC']):
from multiprocessing import cpu_count
mf_cmd = 'v=\$(git describe HEAD);'
mf_cmd = 'v=%s;' % git_describe(name)
if manifest_file:
mf_src = [manifest_file]
mf_cmd += 'sed "s:@VERSION@:$v:g" $SRCS >$OUT'

View File

@ -12,10 +12,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
def git_describe():
def git_describe(plugin = None):
import subprocess
cmd = ['git', 'describe', '--match', 'v[0-9].*', '--dirty']
p = subprocess.Popen(cmd, stdout = subprocess.PIPE)
if not plugin:
p = subprocess.Popen(cmd, stdout = subprocess.PIPE)
else:
p = subprocess.Popen(cmd, stdout = subprocess.PIPE, cwd = 'plugins/%s' % plugin)
v = p.communicate()[0].strip()
r = p.returncode
if r != 0: