transitive project dependencies

View: New views
3 Messages — Rating Filter:   Alert me  

transitive project dependencies

by Ittay Dror :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I see this in the 'transitive' method:
      when /([^:]+:){2,4}/ # A spec as opposed to a file name.
        artifact = artifact(spec)
        set |= [artifact] unless artifact.type == :pom
        set |= POM.load(artifact.pom).dependencies.map { |spec|
artifact(spec) }
      ....
      when Project
        set |= transitive(spec.packages)
      when Rake::Task
        set |= spec.respond_to?(:to_spec) ? transitive(spec.to_spec) :
[spec]

so if I write compile.with(project('foo')), the method is recursively
called with the packages tasks, each is then turned to a spec which then
acts as if the artifact is in the repository, which means the previous
project should be installed, which is an unnecessary overhead and I'm
not sure will work as I'm not sure that a dependency on 'install' is
created anywhere.

also, what if i pass an Artifact ? it is a Rake::Task and supports the
to_spec, so again buildr will look in the repository, and also will turn
the Artifact to a spec, even though it is good as is.

am i wrong?

if not, why not add something like:
   when Rake::Task
      if(spec.respond_to?(:dependencies)) then
        set |= [spec]          
        set |= transitive(spec.dependencies)
      else
        set |= spec.respond_to?(:to_spec) ? transitive(spec.to_spec) :
[spec]
      end

also maybe add a 'when Artifact' before the 'when Rake::Task' clause,
and if the artifact is a repository artifact, try to read is pom,
otherwise, warn (to the user) that he should pass the project/task that
created the artifact.

ittay

--
--
Ittay Dror <ittay.dror@...>



Re: transitive project dependencies

by Ittay Dror :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Or, maybe what is needed is to classify Artifact classes: There's
RepositoryArtifact and BuildArtifact. both return 'dependencies' a
'package' task is a type of BuildArtifact, and it gets its dependencies
from the sibling compile task.

Ittay Dror wrote:

> Hi,
>
> I see this in the 'transitive' method:
>      when /([^:]+:){2,4}/ # A spec as opposed to a file name.
>        artifact = artifact(spec)
>        set |= [artifact] unless artifact.type == :pom
>        set |= POM.load(artifact.pom).dependencies.map { |spec|
> artifact(spec) }
>      ....
>      when Project
>        set |= transitive(spec.packages)
>      when Rake::Task
>        set |= spec.respond_to?(:to_spec) ? transitive(spec.to_spec) :
> [spec]
>
> so if I write compile.with(project('foo')), the method is recursively
> called with the packages tasks, each is then turned to a spec which
> then acts as if the artifact is in the repository, which means the
> previous project should be installed, which is an unnecessary overhead
> and I'm not sure will work as I'm not sure that a dependency on
> 'install' is created anywhere.
>
> also, what if i pass an Artifact ? it is a Rake::Task and supports the
> to_spec, so again buildr will look in the repository, and also will
> turn the Artifact to a spec, even though it is good as is.
>
> am i wrong?
>
> if not, why not add something like:
>   when Rake::Task
>      if(spec.respond_to?(:dependencies)) then
>        set |= [spec]                  set |=
> transitive(spec.dependencies)
>      else
>        set |= spec.respond_to?(:to_spec) ? transitive(spec.to_spec) :
> [spec]
>      end
>
> also maybe add a 'when Artifact' before the 'when Rake::Task' clause,
> and if the artifact is a repository artifact, try to read is pom,
> otherwise, warn (to the user) that he should pass the project/task
> that created the artifact.
>
> ittay
>

--
--
Ittay Dror <ittay.dror@...>



Re: transitive project dependencies

by Assaf Arkin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This method only works for artifacts you're downloading from the Maven
repository, not for anything created with Buildr.

Full transitive dependency support is planned for 1.4.

Assaf

On Thu, Jul 17, 2008 at 8:50 PM, Ittay Dror <ittay.dror@...> wrote:

> Hi,
>
> I see this in the 'transitive' method:
>     when /([^:]+:){2,4}/ # A spec as opposed to a file name.
>       artifact = artifact(spec)
>       set |= [artifact] unless artifact.type == :pom
>       set |= POM.load(artifact.pom).dependencies.map { |spec|
> artifact(spec) }
>     ....
>     when Project
>       set |= transitive(spec.packages)
>     when Rake::Task
>       set |= spec.respond_to?(:to_spec) ? transitive(spec.to_spec) : [spec]
>
> so if I write compile.with(project('foo')), the method is recursively
> called with the packages tasks, each is then turned to a spec which then
> acts as if the artifact is in the repository, which means the previous
> project should be installed, which is an unnecessary overhead and I'm not
> sure will work as I'm not sure that a dependency on 'install' is created
> anywhere.
>
> also, what if i pass an Artifact ? it is a Rake::Task and supports the
> to_spec, so again buildr will look in the repository, and also will turn the
> Artifact to a spec, even though it is good as is.
>
> am i wrong?
>
> if not, why not add something like:
>  when Rake::Task
>     if(spec.respond_to?(:dependencies)) then
>       set |= [spec]                 set |= transitive(spec.dependencies)
>     else
>       set |= spec.respond_to?(:to_spec) ? transitive(spec.to_spec) : [spec]
>     end
>
> also maybe add a 'when Artifact' before the 'when Rake::Task' clause, and
> if the artifact is a repository artifact, try to read is pom, otherwise,
> warn (to the user) that he should pass the project/task that created the
> artifact.
>
> ittay
>
> --
> --
> Ittay Dror <ittay.dror@...>
>
>
>
LightInTheBox - Buy quality products at wholesale price