transitive project dependencies

View: New views
5 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@...>
>
>
>

Re: transitive project dependencies

by Stephen Bannasch-3 :: 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

Is this still planned for version 1.4?

The #transitive method in lib/buildr/packaging/artifact.rb doesn't
have any rdoc and isn't mentioned on the web site or pdf. The method
itself hasn't changed since it was checked in over a year ago.

In https://issues.apache.org:443/jira/browse/BUILDR-206 Assaf writes:

"Transitive is for people who work with POMs and eager to use
something until we work out transitive dependency support in the
framework."

Is there any documentation for this feature?

I'm trying to evaluate buildr for a project with a large number of
artifacts and transitive dependencies?

It's not clear to me if this is the kind of build task buildr is
intended for [1].

[1]
http://www.codecommit.com/blog/java/buildr-still-not-ready-for-prime-time,
May 2008

Re: transitive project dependencies

by Ittay Dror :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



Stephen Bannasch wrote:

>> 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
>
> Is this still planned for version 1.4?
>
> The #transitive method in lib/buildr/packaging/artifact.rb doesn't
> have any rdoc and isn't mentioned on the web site or pdf. The method
> itself hasn't changed since it was checked in over a year ago.
>
> In https://issues.apache.org:443/jira/browse/BUILDR-206 Assaf writes:
>
> "Transitive is for people who work with POMs and eager to use
> something until we work out transitive dependency support in the
> framework."
>
> Is there any documentation for this feature?
>
> I'm trying to evaluate buildr for a project with a large number of
> artifacts and transitive dependencies?
>
> It's not clear to me if this is the kind of build task buildr is
> intended for [1].
>
> [1]
> http://www.codecommit.com/blog/java/buildr-still-not-ready-for-prime-time,
> May 2008
While I love Buildr, this is one of its weak points. The #transitive
method does not work well, for example, it doesn't do any version
resolution (tried transitive on 'xom:xom:jar:1.1' and it downloaded xom
1.0b3 also...)

However, if working on a large project, I think you'll get a lot of
benefit from Buildr's flexibility and  task oriented approach. With the
problem above it took me ~5 minutes  to just list the transitive
dependencies in buildfile and continue working.

Anyone tried using the maven ant tasks (or maybe MavenEmbedder and the
dependency plugin) from Buildr?

(Note that, transitive dependencies is not a good idea for compiling (if
A depends on B for compiling, C may depend on A without needing B unless
using it directly)).

Ittay

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