buildr-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Grotzke <martin.grot...@javakaffee.de>
Subject Re: How to define a task for all subprojects
Date Sun, 14 Jun 2009 21:52:10 GMT
Great, this works!

Just what I wonder: why is this Buildr::ant()? Isn't ant() an instance
method of the Buildr::Ant module (according to [1])?

Probably this is just basics and I should start learning this? (you
probably already know that I have no knowledge of ruby at all) ;)

Thanx && cheers,
Martin


[1] http://buildr.apache.org/rdoc/

On Sat, 2009-06-13 at 17:03 -0700, Alex Boisvert wrote:
> Try Buildr::ant() instead of just ant()
> 
> alex
> 
> 
> On Sat, Jun 13, 2009 at 3:22 PM, Martin Grotzke <
> martin.grotzke@javakaffee.de> wrote:
> 
> > Hi Daniel,
> >
> > On Fri, 2009-06-12 at 10:36 -0500, Daniel Spiewak wrote:
> > > In order to define a project-aware task which affects more than one
> > project,
> > > you will need to use the extension API.
> > Ok, so I'll try that road.
> >
> > Can you help me with the issue regarding ant('foo')? As I wrote in my
> > email:
> > I'm already trying to create a Checkstyle extension that uses ant
> > internally (ant('checkstyle') do |ant| ant.taskdef ...), but with this
> > buildr complains about "undefined method `ant'"...
> >
> > I asume this is because ant() is an instance method on Buildr, and my
> > extension does not have such an instance.
> >
> > My extension basically looks like
> >
> > ====================================================================
> > require 'buildr/java'
> > require 'buildr/java/ant'
> >
> > module CheckstyleAnt include Buildr::Extension
> >
> >  first_time do
> >    # Define task not specific to any projet.
> >    desc 'Check code conventions in current project'
> >    Project.local_task('checkstyle')
> >  end
> >
> >  before_define do |project|
> >    # Define the loc task for this particular project.
> >    task :checkstyle do |task|
> >      ant('checkstyle') do |ant|
> >          # define checkstyle task and target / execute
> >      end
> >
> >    end
> >  end
> >
> >  after_define do |project|
> >  end
> >
> >  def checkstyle()
> >    task('checkstyle')
> >  end
> >
> > end
> >
> > class Buildr::Project
> >  include CheckstyleAnt
> > end
> > ====================================================================
> >
> > And I just require this extension in my buildfile...
> >
> > What can I do to have ant() available in the extension?
> >
> > Thanx in advance,
> > cheers,
> > Martin
> >
> >
> >
> > >   Effectively, you will be triggering
> > > the re-definition of that same task every time a new project is created.
> > > You can embed the extension within your buildfile, so it really isn't a
> > real
> > > hardship.  To eliminate the project-name prefix (e.g. `buildr
> > > myproject:checkstyle` as opposed to `buildr checkstyle` in the
> > appropriate
> > > directory), you must use the following invocation:
> > >
> > >   Project.local_task :checkstyle
> > >
> > > That should do the trick!
> > >
> > > Daniel
> > >
> > > On Fri, Jun 12, 2009 at 10:00 AM, Martin Grotzke <
> > > martin.grotzke@javakaffee.de> wrote:
> > >
> > > > Hi,
> > > >
> > > > is it possible to define a task project wide, so that it's available to
> > > > each submodule?
> > > >
> > > > In my case I want to define checkstyle once and have it available in
> > > > each submodule. It would be great if I could invoke
> > > >  buildr checkstyle
> > > > directly in the submodule.
> > > >
> > > > Is this possible without creating an extension?
> > > >
> > > > I'm already trying to create a Checkstyle extension that uses ant
> > > > internally (ant('checkstyle') do |ant| ant.taskdef ...), but with this
> > > > buildr complains about "undefined method `ant'"...
> > > >
> > > > Thanx for your help,
> > > > cheers,
> > > > Martin
> > > >
> > > >
> >

Mime
View raw message