diff --git a/gerrit-common/BUCK b/gerrit-common/BUCK index 73a9a60398..a79930b66e 100644 --- a/gerrit-common/BUCK +++ b/gerrit-common/BUCK @@ -31,35 +31,6 @@ java_library( visibility = ['PUBLIC'], ) -prebuilt_jar( - name = 'version', - binary_jar = genfile('version.jar'), - deps = [':gen_version'], - visibility = ['PUBLIC'], -) - -# TODO(sop): Move git describe into an uncacheable genrule() -def git_describe(): - import subprocess - cmd = ['git', 'describe', '--match', 'v[0-9].*', '--dirty'] - p = subprocess.Popen(cmd, stdout = subprocess.PIPE) - v = p.communicate()[0].strip() - r = p.returncode - if r != 0: - raise subprocess.CalledProcessError(r, ' '.join(cmd)) - return v - -genrule( - name = 'gen_version', - cmd = ';'.join([ - 'cd $TMP', - 'mkdir -p com/google/gerrit/common', - 'echo "%s" >com/google/gerrit/common/Version' % git_describe(), - 'zip -9Dqr $OUT .', - ]), - out = 'version.jar', -) - java_test( name = 'client_tests', srcs = glob(['src/test/java/**/*.java']), diff --git a/gerrit-war/BUCK b/gerrit-war/BUCK index e1a5064de7..0a37f115e2 100644 --- a/gerrit-war/BUCK +++ b/gerrit-war/BUCK @@ -51,3 +51,32 @@ prebuilt_jar( '//tools/eclipse:classpath', ], ) + +prebuilt_jar( + name = 'version', + binary_jar = genfile('version.jar'), + deps = [':gen_version'], + visibility = ['//:'], +) + +# TODO(sop): Move git describe into an uncacheable genrule() +def git_describe(): + import subprocess + cmd = ['git', 'describe', '--match', 'v[0-9].*', '--dirty'] + p = subprocess.Popen(cmd, stdout = subprocess.PIPE) + v = p.communicate()[0].strip() + r = p.returncode + if r != 0: + raise subprocess.CalledProcessError(r, ' '.join(cmd)) + return v + +genrule( + name = 'gen_version', + cmd = ';'.join([ + 'cd $TMP', + 'mkdir -p com/google/gerrit/common', + 'echo "%s" >com/google/gerrit/common/Version' % git_describe(), + 'zip -9Dqr $OUT .', + ]), + out = 'version.jar', +) diff --git a/tools/build.defs b/tools/build.defs index bd1191b461..f25eb914cc 100644 --- a/tools/build.defs +++ b/tools/build.defs @@ -15,9 +15,8 @@ include_defs('//VERSION') DOCS = ['//Documentation:html.zip'] LIBS = [ - '//gerrit-common:version', - '//gerrit-war:init', '//gerrit-war:log4j-config', + '//gerrit-war:init', '//lib:postgresql', '//lib/log:impl_log4j', ] @@ -70,7 +69,7 @@ def war( def gerrit_war(name, ui = 'ui_optdbg', context = []): war( name = name, - libs = LIBS, + libs = LIBS + ['//gerrit-war:version'], pgmlibs = PGMLIBS, context = [ '//gerrit-main:main_bin.jar',