Brian O'Connor

Updating checkstyle rule in onos.bucklet

Change-Id: I16422bf02b55572d82d9463cb87c678545b79793
...@@ -68,7 +68,7 @@ def osgi_jar( ...@@ -68,7 +68,7 @@ def osgi_jar(
68 **kwargs 68 **kwargs
69 ) 69 )
70 70
71 - cp = ':'.join(['$(classpath %s)' % c for c in deps]) 71 + cp = ':'.join(['$(classpath %s)' % c for c in deps]) if deps else '""'
72 72
73 args = ( '$(location :%s)' % bare_jar_name, #input jar 73 args = ( '$(location :%s)' % bare_jar_name, #input jar
74 '$OUT', #output jar 74 '$OUT', #output jar
...@@ -111,6 +111,8 @@ def osgi_jar( ...@@ -111,6 +111,8 @@ def osgi_jar(
111 ### Checkstyle 111 ### Checkstyle
112 if srcs: 112 if srcs:
113 chk_cmd = '#!/bin/sh\n' 113 chk_cmd = '#!/bin/sh\n'
114 + # FIXME hack to add dependency on suppressions-xml in the checkstyle rule
115 + chk_cmd += 'FOO="$(location //tools/build/conf:suppressions-xml)"\n'
114 base = get_base_path() 116 base = get_base_path()
115 chk_cmd += ' '.join(( 'java -jar $(location //lib:checkstyle)', 117 chk_cmd += ' '.join(( 'java -jar $(location //lib:checkstyle)',
116 '-c $(location //tools/build/conf:checkstyle-xml)', 118 '-c $(location //tools/build/conf:checkstyle-xml)',
...@@ -118,6 +120,7 @@ def osgi_jar( ...@@ -118,6 +120,7 @@ def osgi_jar(
118 chk_cmd += ' | grep -E "^[^: ]*:\d+:\d+: error:"' 120 chk_cmd += ' | grep -E "^[^: ]*:\d+:\d+: error:"'
119 chk_cmd += ' | sed "s#^.*%s/#%s:#g"\n' % (base, name) 121 chk_cmd += ' | sed "s#^.*%s/#%s:#g"\n' % (base, name)
120 chk_cmd += 'test ${PIPESTATUS[0]} -eq 0\n' # status of java command 122 chk_cmd += 'test ${PIPESTATUS[0]} -eq 0\n' # status of java command
123 +
121 genrule( 124 genrule(
122 name = name + '-checkstyle-sh', 125 name = name + '-checkstyle-sh',
123 bash = "echo '%s' > $OUT && chmod +x $OUT" % chk_cmd, 126 bash = "echo '%s' > $OUT && chmod +x $OUT" % chk_cmd,
......
...@@ -2,7 +2,7 @@ checkstyle_source = 'src/main/resources/onos/checkstyle.xml' ...@@ -2,7 +2,7 @@ checkstyle_source = 'src/main/resources/onos/checkstyle.xml'
2 suppression_source = 'src/main/resources/onos/suppressions.xml' 2 suppression_source = 'src/main/resources/onos/suppressions.xml'
3 3
4 xml = ('<module name="SuppressionFilter">' 4 xml = ('<module name="SuppressionFilter">'
5 - '<property name="file" value="$(location :suppressions.xml)"/>' 5 + '<property name="file" value="$(location :suppressions-xml)"/>'
6 '</module>' ) 6 '</module>' )
7 cmd = "sed 's#<module name=\"Checker\">#<module name=\"Checker\">%s#' %s > $OUT" % ( xml, checkstyle_source ) 7 cmd = "sed 's#<module name=\"Checker\">#<module name=\"Checker\">%s#' %s > $OUT" % ( xml, checkstyle_source )
8 8
...@@ -16,6 +16,7 @@ genrule( ...@@ -16,6 +16,7 @@ genrule(
16 16
17 #FIXME location suppression.xml does not trigger this rule 17 #FIXME location suppression.xml does not trigger this rule
18 export_file( 18 export_file(
19 - name = 'suppressions.xml', 19 + name = 'suppressions-xml',
20 src = suppression_source, 20 src = suppression_source,
21 + visibility = [ 'PUBLIC' ]
21 ) 22 )
......