> I would try:
>
> namespace "SubProject1"
> load "./SubProject1/Rakefile.rb"
> end
That worked perfectly...
Changing the import statement to load solved the first part of my
problem.
The second part is making the loaded rakefile run from the correct sub
directory.
At the moment I have encapsulated this in a task.
If you have any suggestions as to how the this could be packaged as a
new task flavor, I'm all ears.
My solution so far looks like this:
-- Master-rakefile --
require "rake"
task :default => [:master_build]
task :master_build => [:build_dependencies] do
puts "task :master_build run."
end
task :build_dependencies => [:build_sub1] do
puts "task :build_dependencies run."
end
@sub1_directory = Dir.pwd + "/Sub1"
namespace "sub1" do
puts "Importing sub1."
load "#{@sub1_directory}/Rakefile.rb"
puts "sub1 imported."
end
task :build_sub1 do
current_directory = Dir.pwd
Dir.chdir "#{@sub1_directory}"
Rake::Task["sub1:build"].invoke
Dir.chdir "#{current_directory}"
end
-- sub-rakefile --
require "rake"
task :default => [:build]
task :build do
puts "task :build run."
puts "Current directory: #{Dir.pwd}"
end
>> Now initially what goes wrong is that the task :default contains 2
>> prerequisites after the Sub1\Rakefile.rb is loaded. The result is
that
>> invoking the :default task of the master also invokes the :default
>> task of the sub.
> I would expect this to happen, as the sub project is usually a part of
the master project.
Yes, that does require some explanation:
The short answer is that a sub-project at times are part of more than
one master project.
The long answer is that in the interest of continues integration I want
dependent libraries and frameworks built and tested every time a release
is underway. This is why it is so important that the sub-projects are
independent of the master, they must be able to be a sub-project in
several projects. In essence the sub-project is not owned by the master
project in this setting.
By the way, thank you for your help so far.
/Jesper
_______________________________________________
Rake-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rake-devel