buildr-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Schröder ...@blau.de>
Subject AW: bad error-reporting
Date Sun, 22 Nov 2009 16:48:41 GMT
thx for the example, we will try that approach.
________________________________________
Von: Alex Boisvert [alex.boisvert@gmail.com]
Gesendet: Sonntag, 22. November 2009 17:42
An: users@buildr.apache.org
Betreff: Re: bad error-reporting

On Sat, Nov 21, 2009 at 5:55 AM, Peter Schröder <ps@blau.de> wrote:

> that's great!
>
> for additional information:
>
> we have lots of projects that we migrate to buildr and on that way we
> restructure them to have subprojects and to match the apache folder
> standard.
>
> so there is often the case that some sub projects misses a folder and so
> our standard tasks fail.
>
> it would be of great value if the failed task would print out its current
> scope so that one knows where to look for the missing source, or even that
> the problem is that there is something missing for packaging or compiling or
> whatever task is on its way...
>

As I explained, we now fail-fast so you'll get an error during project
definition, not later when the tasks are executing.

Adding a more explicit error about missing directories is difficult to do in
the general case because we opted for both "conventions over configurations"
and for automatically detecting what kind of project you're buildling (java,
groovy, scala, ...).   Without any indication, we don't really know what to
build so we can't provide meaningful error report.

I think your best bet is to write a simple extensions that checks for what
you're expecting, e.g.,

module JavaProject
  include Buildr::Extension

  before_define do |project|
    fail "Missing sources under src/main/java" unless File.exist?
project.path_to("src/main/java")
  end

  after_define do |project|
    project.package :jar if project.packages.size == 0
  end
end

and in your Buildfile,

define 'foo' do
  extend JavaProject
  ...
end

alex

Mime
View raw message