On Fri, Jun 12, 2009 at 11:05 AM, Alex Boisvert <boisv...@intalio.com>wrote:
> On Fri, Jun 12, 2009 at 6:12 AM, Martin Grotzke < > martin.grot...@javakaffee.de> 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"] sources = FileList[_("src/main/yak/**/*.yk")] FileList, provided by Rake, is a better Dir. Also there's generally no need to decompose and recompose paths. > > generate = file(path_to(:target, "generated-source") => sources) do |dir| likewise, file(_("target/generated-source")=>sources) Assaf > > mkdir_p dir.to_s # ensure directory is created > # generate sources > # e.g. > # ant('generate') do |ant| > # ... > # end > end > > compile.from generate > end > > I'm having issues creating the page in the wiki right now (confluence fails > on me). I'll create it when possible. > > alex >