tags:

views:

124

answers:

1

I'm trying to write a Rakefile that both builds my code normally when I run rake compile but puts the targets in a different directory and builds with -DTEST when I run rake test. I cannot for the life of me figure out how to do it, though. I've got something like this at the moment:

SRC = FileList['src/*.erl']
OBJ = SRC.pathmap("%{src,ebin}/X.beam")

rule ".beam" => ["%{ebin,src}X.erl"] do |t|
  sh "erlc ... -o ebin #{t.source}"
end

task :compile => OBJ

What I'd like is a task :test that put the compiler output into ebin_test (basically changed all instances of ebin into ebin_test in the above code) and added a -DTEST to the sh call. Anyone got any ideas?

A: 

Well, that wasn't a positive first question... no answers.

For the record, I solved the problem by having a task for both build and test that defined the compilation rules differently, and then had the public task call that task before doing the actual build/test run. A couple of scoping issues, but nothing exciting. I won't bother pasting the full resulting rakefile, but let me know if you're interested in taking a look.

womble