mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-17 02:11:38 +02:00
Fix from Brian for checkstyle rule with no sources
Change-Id: I37a85b38b61d9b008dc3456345bbd9ded6718281
This commit is contained in:
parent
12c1d51c93
commit
db01621f1e
@ -109,27 +109,30 @@ def osgi_jar(
|
||||
)
|
||||
|
||||
### Checkstyle
|
||||
chk_cmd = '#!/bin/sh\n'
|
||||
base = get_base_path()
|
||||
chk_cmd += ' '.join(( 'java -jar $(location //lib:checkstyle)',
|
||||
'-c $(location //tools/build/conf:checkstyle-xml)',
|
||||
' '.join(['%s/%s' % (base, s) for s in srcs]) ))
|
||||
chk_cmd += ' | grep -E "^[^: ]*:\d+:\d+: error:"'
|
||||
chk_cmd += ' | sed "s#^.*%s/#%s:#g"\n' % (base, name)
|
||||
chk_cmd += 'test ${PIPESTATUS[0]} -eq 0\n' # status of java command
|
||||
genrule(
|
||||
name = name + '-checkstyle-sh',
|
||||
bash = "echo '%s' > $OUT && chmod +x $OUT" % chk_cmd,
|
||||
srcs = srcs,
|
||||
out = 'checkstyle.sh',
|
||||
)
|
||||
if srcs:
|
||||
chk_cmd = '#!/bin/sh\n'
|
||||
base = get_base_path()
|
||||
chk_cmd += ' '.join(( 'java -jar $(location //lib:checkstyle)',
|
||||
'-c $(location //tools/build/conf:checkstyle-xml)',
|
||||
' '.join(['%s/%s' % (base, s) for s in srcs]) ))
|
||||
chk_cmd += ' | grep -E "^[^: ]*:\d+:\d+: error:"'
|
||||
chk_cmd += ' | sed "s#^.*%s/#%s:#g"\n' % (base, name)
|
||||
chk_cmd += 'test ${PIPESTATUS[0]} -eq 0\n' # status of java command
|
||||
genrule(
|
||||
name = name + '-checkstyle-sh',
|
||||
bash = "echo '%s' > $OUT && chmod +x $OUT" % chk_cmd,
|
||||
srcs = srcs,
|
||||
out = 'checkstyle.sh',
|
||||
)
|
||||
|
||||
sh_test(
|
||||
name = name + '-checkstyle',
|
||||
test = ':' + name + '-checkstyle-sh',
|
||||
deps = [ ':'+ bare_jar_name ],
|
||||
labels = [ 'checkstyle' ],
|
||||
)
|
||||
sh_test(
|
||||
name = name + '-checkstyle',
|
||||
test = ':' + name + '-checkstyle-sh',
|
||||
deps = [ ':'+ bare_jar_name ],
|
||||
labels = [ 'checkstyle' ],
|
||||
)
|
||||
else:
|
||||
print 'Not generating checkstyle rule for %s because there are no sources.' % name
|
||||
|
||||
# TODO add project config for intellij
|
||||
# project_config(
|
||||
|
Loading…
x
Reference in New Issue
Block a user