Multiple rake build files? large rake files

I’m using rake to build small java applications and have hit the
ceiling,
or my ceiling, for how “large” a single file should be. I want to break
my rake files into pieces somehow, and even have multiple rake files
dependant on each other, perhaps (or maybe independent).

It’s arbitrary, but can I have Rakefile call Rakefile.rb? That seems
absurd and a total kludge, but can it be done? Should I be using
modules?

I’m aware of other, and probably better, tools for building java code
with, but want to stick with rake for the time being.

Can I do something with namespaces?

Part of the requirement which I have in mind is to build one java
package
into Foo.jar and then another package in Bar.java, as seperate actions,
and then maybe have Baz.jar import Foo.jar and Bar.jar as external jar
files. I envision this as three independent build processes calling for
three rake files with different particulars. I wouldn’t want cram all
that into one rakefile.

thanks,

Thufir

thufir wrote:

thanks,

Thufir

The innards of a rake file (usually with an extension .rake by the way)
is just plain ruby, so you can break the code up as you want and just
require other files as and when you need them.

E.g. each task goes into a separate file

 require 'this.rake'
 require 'that.rake'
 require 'the_other.rake'

 desc 'do everything'
 task :everything => [:this, :that, :the_other] do

normal ruby code
end

the files this.rake, that.rake, etc contain the task :this, :that

Alternitively, if they are not separate tasks, you can just call methods
which are defined in other files, and require the files before you call
the methods

 require 'this.rake'
 require 'that.rake
 require 'the_other.rake'

 desc 'do everything'
 task :everything do
     this
     that
     the_other
 end

Or have I misunderstood the question?

On Mar 28, 3:55 pm, Stef R. [email protected] wrote:
[…]

 desc 'do everything'
 task :everything => [:this, :that, :the_other] do
    normal ruby code
 end

the files this.rake, that.rake, etc contain the task :this, :that
[…]
Or have I misunderstood the question?

That was the question which you answered quite well :slight_smile:

thanks,

Thufir

Just for the record, here’s the rake file:

thufir@arrakis:~/rake$
thufir@arrakis:~/rake$
thufir@arrakis:~/rake$ rake alc:all
(in /home/thufir/rake)
Purchased Vodka
Mixed Fuzzy Navel
Dood, everthing’s blurry, can I halff noth’r drinnnk?
all
thufir@arrakis:~/rake$
thufir@arrakis:~/rake$ cat rakefile.rb
require ‘alcoholic.rb’

namespace :alc do

task :all => :getSmashed do
puts “all”
end

end
thufir@arrakis:~/rake$
thufir@arrakis:~/rake$ cat alcoholic.rb
namespace :alc do

task :purchaseAlcohol do
puts “Purchased Vodka”
end

task :mixDrink => :purchaseAlcohol do
puts “Mixed Fuzzy Navel”
end

task :getSmashed => :mixDrink do
puts “Dood, everthing’s blurry, can I halff noth’r drinnnk?”
end

end
thufir@arrakis:~/rake$
thufir@arrakis:~/rake$

-Thufir