Repository: buildr Updated Branches: refs/heads/master 55e38a403 -> 6c660221c
BUILDR-706 - Update the checkstyle addon use checkstyle 6.6 Submitted by Dieter Vrancken. Project: http://git-wip-us.apache.org/repos/asf/buildr/repo Commit: http://git-wip-us.apache.org/repos/asf/buildr/commit/6c660221 Tree: http://git-wip-us.apache.org/repos/asf/buildr/tree/6c660221 Diff: http://git-wip-us.apache.org/repos/asf/buildr/diff/6c660221 Branch: refs/heads/master Commit: 6c660221c717fa9276cba3ea74cbe6c72a4cc055 Parents: 55e38a4 Author: Peter Donald <[email protected]> Authored: Sun May 3 20:43:53 2015 +1000 Committer: Peter Donald <[email protected]> Committed: Sun May 3 20:43:53 2015 +1000 ---------------------------------------------------------------------- CHANGELOG | 2 ++ addon/buildr/checkstyle.rb | 11 +++++----- spec/addon/checkstyle_spec.rb | 42 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/buildr/blob/6c660221/CHANGELOG ---------------------------------------------------------------------- diff --git a/CHANGELOG b/CHANGELOG index 4486235..8861c05 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,6 @@ 1.4.23 (Pending) +* Change: BUILDR-706 - Update the checkstyle addon use checkstyle 6.6. Submitted + by Dieter Vrancken. * Fixed: Fix Buildr.rspec_present? so that it works under jruby 1.6.7.2 * Fixed: Remove debug output left in ipr.sql_dialect_mappings. http://git-wip-us.apache.org/repos/asf/buildr/blob/6c660221/addon/buildr/checkstyle.rb ---------------------------------------------------------------------- diff --git a/addon/buildr/checkstyle.rb b/addon/buildr/checkstyle.rb index 2e741e8..277dae4 100644 --- a/addon/buildr/checkstyle.rb +++ b/addon/buildr/checkstyle.rb @@ -23,10 +23,12 @@ module Buildr # The specs for requirements def dependencies [ - 'com.puppycrawl.tools:checkstyle:jar:6.1.1', + 'com.puppycrawl.tools:checkstyle:jar:6.6', 'antlr:antlr:jar:2.7.7', - 'org.antlr:antlr4-runtime:jar:4.3', + 'org.antlr:antlr4-runtime:jar:4.5', 'com.google.guava:guava:jar:18.0', + 'org.apache.commons:commons-lang3:jar:3.4', + 'org.abego.treelayout:org.abego.treelayout.core:jar:1.0.1', 'commons-cli:commons-cli:jar:1.2', 'commons-beanutils:commons-beanutils-core:jar:1.8.3', 'commons-logging:commons-logging:jar:1.1.1' @@ -48,10 +50,7 @@ module Buildr args << format args << '-o' args << output_file - source_paths.each do |source_path| - args << '-r' - args << source_path - end + args += source_paths begin Java::Commands.java 'com.puppycrawl.tools.checkstyle.Main', *(args + [{:classpath => cp, :properties => options[:properties], :java_args => options[:java_args]}]) http://git-wip-us.apache.org/repos/asf/buildr/blob/6c660221/spec/addon/checkstyle_spec.rb ---------------------------------------------------------------------- diff --git a/spec/addon/checkstyle_spec.rb b/spec/addon/checkstyle_spec.rb new file mode 100644 index 0000000..5e4079e --- /dev/null +++ b/spec/addon/checkstyle_spec.rb @@ -0,0 +1,42 @@ +require File.expand_path('../spec_helpers', File.dirname(__FILE__)) +Sandbox.require_optional_extension 'buildr/checkstyle' +artifacts(Buildr::Checkstyle::dependencies).map(&:invoke) + +CHECKS_CONTENT = <<CHECKS +<?xml version="1.0"?> +<!DOCTYPE module PUBLIC + "-//Puppy Crawl//DTD Check Configuration 1.2//EN" + "http://www.puppycrawl.com/dtds/configuration_1_2.dtd"> +<module name="Checker"> +</module> +CHECKS +GOOD_CONTENT = <<GOOD +public final class SomeClass { +} +GOOD + +describe Buildr::Checkstyle do + + before do + # Reloading the extension because the sandbox removes all its actions + Buildr.module_eval { remove_const :Checkstyle } + load File.expand_path('../addon/buildr/checkstyle.rb') + @tool_module = Buildr::Checkstyle + + write 'src/main/java/SomeClass.java', GOOD_CONTENT + write 'src/main/etc/checkstyle/checks.xml', CHECKS_CONTENT + end + + it 'should generate an XML report' do + define 'foo' + task('foo:checkstyle:xml').invoke + file(project('foo')._('reports/checkstyle/checkstyle.xml')).should exist + end + + it 'should generate an HTML report' do + define 'foo' + task('foo:checkstyle:html').invoke + file(project('foo')._('reports/checkstyle/checkstyle.html')).should exist + end + +end
