From: Jim Weirich Date: 2005-04-07T13:56:56+09:00 Subject: Re: [ANN] Rant 0.3.2 On Wednesday 06 April 2005 09:09 pm, Lionel Thiry wrote: > > If I missed something, fill me in. > > http://www.scons.org/doc/PDF/scons-design.pdf Yeah, that's the same one I found. > I have forgotten one, the way tasks are executed. You can execute the TDG > in such a way that you don't have to check repeatedly each task to know if > it has already been executed. You just begin at the right starting nodes > and follows the arrows. > > Well, that's what I thought until I tried to code that myself. What a > nightmare! :) Hmmm ... I suppose you could do a topological sort on the nodes of the DAG and execute them in reverse order. There might be some dynamic behavior that is lost with that approach. And I'm not sure you would do any /less/ checking doing the sort. > Do you mean that every thing in the list above can already be done with > rake? Or will be added to rake? Will you really add all these features? If there is interest in any of those features, I would consider implementing them. Patches and source code contributions are always welcome too. I remain the final decision maker, but I try to keep an open mind to suggestions. > Especially about (1), would you plan to decouple Rake interface (the > Rakefiles) and Rake internals? Said another way, would you plan to make > rake usable through a standard ruby script? > > require 'rake' > # do rake stuff but more explicitly > # no more implicit tasks or rules > # no more implicit management of options See, you half way convinced me already. Actually, you /can/ do this today. In fact, that's how the unit tests work. But there is some cleanup that could be done to make the interface better. If you have specific suggestions, I'm listening. > For example, let's say task1 generate a source file. But then, you want to > compile that source file too and you may don't know in advance how to do > that until you know exactly what kind of source file has been generated. > > A possible solution is that when task1 has generated its target, it checks > the type of the result and then generates, on the fly, a task2 in charge of > compiling that file. file "source_file.c" do open("source_file.c", "w") do |f| f.puts '#include ' f.puts 'int main() { printf("HI\n"); return 0; }' end puts "Enter name of compiler: " compiler = gets.chomp file "prog" do |t| sh "#{compiler} -o prog source_file.c" end end file "prog" => ["source_file.c"] task :default => "prog" do sh "prog" end -- -- Jim Weirich jim@weirichhouse.org http://onestepback.org ----------------------------------------------------------------- "Beware of bugs in the above code; I have only proved it correct, not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)