Move version.jar to gerrit-war
This saves about 70ms when running targets like //gerrit-gwtui:ui_chrome that reference a JAR in gerrit-common but do not need the Version file. Change-Id: Iab7377f3c5e1ce82cc3dc3ddcb3b1e4f9f12a8b7
This commit is contained in:
parent
da16183775
commit
1e6c3639f7
@ -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']),
|
||||
|
@ -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',
|
||||
)
|
||||
|
@ -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',
|
||||
|
Loading…
Reference in New Issue
Block a user