buildr-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Boisvert <alex.boisv...@gmail.com>
Subject Re: transitive dependancies for my projects only
Date Fri, 07 May 2010 18:43:37 GMT
On Fri, May 7, 2010 at 5:01 AM, Jean-Philippe Caruana <
jeanphilippe1.caruana@orange-ftgroup.com> wrote:

> I would like to write it that way :
>
> define 'myProject' do
>        define 'A' do
>                compile.with DEP_A_1, DEP_A_2, DEP_A_3
>                package :jar
>        end
>
>        define 'B' do
>                compile.with transitive(project('A'))
>                compile.with DEP_B_1, DEP_B_2
>                package :war
>        end
> end
>
> and even better "compile.with transitive(projects('A', 'other'))"
>
>
> this didn't work (under buildr 1.3.5)
>
> Buildr aborted!
> undefined method `invoke' for nil:NilClass
> /mypath/buildfile:188
> /var/lib/gems/1.8/gems/buildr-1.3.5/lib/buildr/core/application.rb:400:in
> `raw_load_buildfile'
> /var/lib/gems/1.8/gems/buildr-1.3.5/lib/buildr/core/application.rb:218:in
> `load_buildfile'
> /var/lib/gems/1.8/gems/buildr-1.3.5/lib/buildr/core/application.rb:213:in
> `load_buildfile'
>
>
> despite inside artifact/package.rb there is a "when Project" in the
> transitive method
>

The issue is that "compile.dependencies" returns a set of artifacts;
dependent projects have already been converted to artifacts.

We're currently missing proper semantic to declare project dependencies.
Either we continue to use compile.with and provide a way to retrieve
projects (not just artifacts), or we add a way to explicitly declare project
dependendies, e.g.

define "example" do

  define "a" do
    # ...
  end

  define "b" do
    depends_on_project "a"
    compile.with transitive_projects
  end

  define "c" do
    depends_on_project "b"
    compile.with transitive_projects
  end
end

that works today with the following prototype implementation,

class Buildr::Project
  def project_dependencies
    @project_dependencies ||= []
  end

  def depends_on_project(*projects)
    @project_dependencies ||= []
    @project_dependencies += projects.map { |p| p.instance_of?(Project) ? p
: project(p) }
  end

  def transitive_projects
    project_dependencies.collect { |p| [p] + p.transitive_projects }.uniq
  end
end

which you can paste directly in your Buildfile if that fits you needs.

alex

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