buildr-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Boisvert <>
Subject Re: How to generate sources for/before compile
Date Fri, 12 Jun 2009 18:05:31 GMT
On Fri, Jun 12, 2009 at 6:12 AM, Martin Grotzke <> wrote:

> I needed to wrap the ant project with the generate = task ..., as
> otherwise (with just generate = ant('generate') do |ant| ...) the ant
> project was directly executed (AFAICS with the loading of the buildfile)
> and buildr complained with:
>  Buildr aborted!
>  Don't know how to build task 'Antwrap::AntProject[generate]'

Ooops. I forgot ant() didn't yeld a task; it executes right away.

Do you think the stuff above is ok, so that we could push this to the
> buildr howtos (wiki)? Or is there still room for improvement?

I think the main improvement would be in wiring dependencies so the task
only executes when needed.

Here's a revised version,

define "generate-sources-example" do

  # whatever you use to generate your sources
  sources = Dir[_("src/main/yak") + "/**/*.yk"]

  generate = file(path_to(:target, "generated-source") => sources) do |dir|
    mkdir_p dir.to_s # ensure directory is created
    # generate sources
    # e.g.
    # ant('generate') do |ant|
    #  ...
    # end

  compile.from generate

I'm having issues creating the page in the wiki right now (confluence fails
on me).  I'll create it when possible.


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message