gerrit/gerrit-common/BUCK
Christian Aistleitner 0d67fb4d51 Mark builds from a dirty tree as dirty.
Change-Id: I5833eee3d37cbbb114975a08f0e20d80c428f9fa
2013-07-05 23:03:31 +02:00

69 lines
1.5 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:gwtjsonrpc',
'//lib:gwtorm',
'//lib:jsr305',
'//lib/jgit:jgit',
],
visibility = ['PUBLIC'],
)
java_library(
name = 'server',
srcs = glob([SRC + 'common/**/*.java']),
deps = [
'//gerrit-patch-jgit:server',
'//gerrit-prettify:server',
'//gerrit-reviewdb:server',
'//lib:gwtjsonrpc',
'//lib:gwtorm',
'//lib:jsr305',
'//lib/jgit:jgit',
],
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', '--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 = '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'],
)