buildr-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Donald <pe...@realityforge.org>
Subject Layouts customized by project attributes
Date Fri, 19 Mar 2010 23:49:37 GMT
Hi,

My current usage of buildr has resulted in many subprojects. Some of
these subprojects actually have no files as they simply repackaging
jars as OSGi bundles (i.e. jars + more metadata). So I have decided to
have a central "target" directory under which each project has a dir.
i.e. The following snippet uses target/A and target/B as intermediate
dirs of each project

class CentralLayout < Layout::Default
  def initialize(key, top_level = false)
    super()
    prefix = top_level ? '' : '../'
    self[:target] = "#{prefix}target/#{key}"
    self[:target, :main] = "#{prefix}target/#{key}"
  end
end

define 'A', :layout => CentralLayout.new('A', true) do
   ...
   define 'B', :layout => CentralLayout.new('B') do
      ...
   end
end

Unfortunately I have to repeat the name of the project when
constructing the layout. Is there any easy way to avoid this? The only
way that I could think of is to make it an extension which is overkill
atm (However I suspect by the time I reach the 20 or so subprojects it
may be worthwhile).

So is this the way you should do this sort of thing? Or any other suggestions?

-- 
Cheers,

Peter Donald

Mime
View raw message