Hi,

I would like to use transitive dependancies in buildr but only for my projects and not for external libs, so compile.with transitive('org.apache.wicket:wicket:jar:1.4-rc6') is not what i'm looking for (1.4-rc6, what a cool version name !)

If I have to projects A & B with B depending from A. B is a war, so I need to have all dependancies needed by A, otherwise I'll have a NoClassDefFoundError in runtime

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 project('A'), DEP_A_1, DEP_A_2, DEP_A_3
                compile.with DEP_B_1, DEP_B_2
                package :war
        end
end

I know I can write
compile.with project('A'), project('A').compile.dependancies
but I find it quite verbose and not very convinient when there are not 1 but 7 projects or more. I have 60 modules in my project and there are a lot of duplications.

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

  def transitive(*specs)
    specs.flatten.inject([]) do |set, spec|
      case spec
      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 Hash
        set |= [transitive(spec)]
      when String # Must always expand path.
        set |= transitive(file(File.expand_path(spec)))
      when Project
set |= transitive(spec.packages)

      when Rake::Task
set |= spec.respond_to?(:to_spec) ? transitive(spec.to_spec) : [spec]
      when Struct
        set |= transitive(spec.values)
      else
        fail "Invalid artifact specification in: #{specs.to_s}"
      end
    end
  end


I know I could write some my_transitive method, but I would imagine this could be done in buildr right away. Is there any way to do this ?

Thanks

-- Jean-Philippe Caruana
********************************
Ce message et toutes les pieces jointes (ci-apres le "message") sont
confidentiels et etablis a l'attention exclusive de ses destinataires.
Toute utilisation ou diffusion non autorisee est interdite.
Tout message electronique est susceptible d'alteration. Multimedia Business 
Services decline
toute responsabilite au titre de ce message s'il a ete altere, deforme
ou falsifie.
Si vous n'etes pas destinataire de ce message, merci de le detruire
immediatement et d'avertir l'expediteur.
*********************************
This message and any attachments (the "message") are confidential and
intended solely for the addressees. Any unauthorised use or
dissemination is prohibited.
Messages are susceptible to alteration. Multimedia Business Services shall not 
be liable for the
message if altered, changed or falsified.
If you are not the intended addressee of this message, please cancel it
immediately and inform the sender..
********************************

Reply via email to