Updating checkstyle rule in onos.bucklet
Change-Id: I16422bf02b55572d82d9463cb87c678545b79793
diff --git a/bucklets/onos.bucklet b/bucklets/onos.bucklet
index dd3252e..0a530e7 100644
--- a/bucklets/onos.bucklet
+++ b/bucklets/onos.bucklet
@@ -68,7 +68,7 @@
**kwargs
)
- cp = ':'.join(['$(classpath %s)' % c for c in deps])
+ cp = ':'.join(['$(classpath %s)' % c for c in deps]) if deps else '""'
args = ( '$(location :%s)' % bare_jar_name, #input jar
'$OUT', #output jar
@@ -110,29 +110,32 @@
### Checkstyle
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',
- )
+ chk_cmd = '#!/bin/sh\n'
+ # FIXME hack to add dependency on suppressions-xml in the checkstyle rule
+ chk_cmd += 'FOO="$(location //tools/build/conf:suppressions-xml)"\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
- sh_test(
- name = name + '-checkstyle',
- test = ':' + name + '-checkstyle-sh',
- deps = [ ':'+ bare_jar_name ],
- labels = [ 'checkstyle' ],
- )
+ 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' ],
+ )
else:
- print 'Not generating checkstyle rule for %s because there are no sources.' % name
+ print 'Not generating checkstyle rule for %s because there are no sources.' % name
# TODO add project config for intellij
# project_config(