Hi,

In the next release of buildr (not sure when that is happening?)
there will be checkstyle support baked in (as well as findbugs,
jdepend, pmd etc). You can see the next set of addons in [1] and the
checkstyle one in particular is [2]. You can rename [2] to end with
.rake and drop it in a tasks directory and start using it straight
away. In one of our projects we have something like


project ... do

  checkstyle.config_directory = _('planner/etc/checkstyle')
  checkstyle.source_paths << project('planner:shared')._(:source, :main, :java)
  checkstyle.source_paths << project('planner:client')._(:source, :main, :java)
  checkstyle.source_paths << project('planner:client')._(:test, :main, :java)
  checkstyle.source_paths << project('planner:server')._(:source, :main, :java)
  checkstyle.source_paths << project('planner:server')._(:test, :main, :java)
end


[1] https://github.com/apache/buildr/tree/trunk/addon/buildr
[2] https://github.com/apache/buildr/blob/trunk/addon/buildr/checkstyle.rb

On Tue, Apr 10, 2012 at 1:38 PM, Chris Adams <ch...@edatasource.com> wrote:
> Hi,
>
> I am trying to integrate checkstyle with builder. Thus far, this is what I 
> have come up with:
>    task :checkstyle do
>        begin
>            ant('checkstyle') do |ant|
>                rm_rf 'reports/checkstyle_report.xml'
>                mkdir_p 'reports'
>
>                ant.taskdef :resource=>"checkstyletask.properties", 
> :classpath=>Buildr.artifacts(CHECKSTYLE).each(&:invoke).map(&:name).join(File::PATH_SEPARATOR)
>                ant.checkstyle :config=>"buildconf/checkstyle.xml" do
>                    ant.formatter :type=>'plain'
>                    ant.formatter :type=>'xml', 
> :toFile=>"reports/checkstyle_report.xml"
>
>                    ant.property :key=>'javadoc.method.scope', :value=>'public'
>                    ant.property :key=>'javadoc.type.scope', :value=>'package'
>                    ant.property :key=>'javadoc.var.scope', :value=>'package'
>                    ant.property :key=>'javadoc.lazy', :value=>'false'
>
>                    ant.fileset :dir=>path_to(:src,:main,:java), 
> :includes=>'**/*.java'
>                end
>            end
>        end
>    end
>
> However, the problem I'm having is that path_to(:src, :main, :java) is at the 
> top-level parent directory (where my buildfile is located)… How would I make 
> the ":dir" relative to the current sub-project that the user is within or if 
> they are building from the root, all the sub-projects?
>
> Thanks for any help/info you can provide.
>
> Chris Adams
>
>
>
>



-- 
Cheers,

Peter Donald

Reply via email to