8f1c7fdeb7
Avoid rebuilding the GWT JS every time the Git commit changes by obtaining the version of the UI from the server as part of the host HTML page. This enables BUCK to avoid recompiling GWT code simply because the user modified server code. Change-Id: I4ac5167228bce20fd2dc89af5c1cea13ad3cf739
63 lines
1.3 KiB
Python
63 lines
1.3 KiB
Python
SRC = 'src/main/java/com/google/gerrit/'
|
|
VER = 'resources/com/google/gerrit/common/Version'
|
|
|
|
gwt_module(
|
|
name = 'client',
|
|
srcs = glob([SRC + 'common/**/*.java']),
|
|
gwtxml = SRC + 'Common.gwt.xml',
|
|
deps = [
|
|
'//gerrit-patch-jgit:client',
|
|
'//gerrit-prettify:client',
|
|
'//gerrit-reviewdb:client',
|
|
'//lib:jsr305',
|
|
],
|
|
visibility = ['PUBLIC'],
|
|
)
|
|
|
|
java_library(
|
|
name = 'server',
|
|
srcs = glob([SRC + 'common/**/*.java']),
|
|
deps = [
|
|
'//gerrit-patch-jgit:server',
|
|
'//gerrit-prettify:server',
|
|
'//gerrit-reviewdb:server',
|
|
'//lib:jsr305',
|
|
],
|
|
visibility = ['PUBLIC'],
|
|
)
|
|
|
|
java_library(
|
|
name = 'version',
|
|
resources = [genfile(VER)],
|
|
deps = [':git_describe'],
|
|
visibility = ['PUBLIC'],
|
|
)
|
|
|
|
# TODO(sop): Move git describe into an uncacheable genrule()
|
|
def git_describe():
|
|
import subprocess
|
|
cmd = ['git', 'describe', 'HEAD']
|
|
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 = 'git_describe',
|
|
cmd = 'mkdir -p $(dirname $OUT); echo "%s" >$OUT' % git_describe(),
|
|
srcs = [],
|
|
out = VER,
|
|
)
|
|
|
|
java_test(
|
|
name = 'client_tests',
|
|
srcs = glob(['src/test/java/**/*.java']),
|
|
deps = [
|
|
':client',
|
|
'//lib:junit',
|
|
],
|
|
source_under_test = [':client'],
|
|
)
|