[Rant] File tasks in sub.rant

Stefan Lang langstefan at gmx.at
Thu Sep 28 17:01:46 EDT 2006

On Monday 25 September 2006 05:11, Xavier Shay wrote:
> This is pretty much me thinking out loud...
> Consider:
> # Rantfile
> subdirs "subprj"
> # subprj/sub.rant
> file "../afile" do |t|
>   touch "../afile"
> end
> This creates a task called "subprj/../afile". I think it would be
> handy (and intuitive) to also create an identical task "afile",
> i.e. the expanded path. In particular, if I have multiple
> sub-projects building into a common directory. Things would work
> correctly if you had a task in your Rantfile depending on "afile".

Currently it is possible (perhaps you have figured it out already :)
to reference dependencies relative to the project's root directory
by preceding the name with an "@".

I.e. in some/sub/dir/sub.rant:

  file "foo" => "@bar/baz"

bar/baz is resolved relative to the project's root directory.
We could introduce:

  file "@foo"

and "foo" would be defined in the root directory.

The reason why I did not use ".." to mean "go one directory up"
was because people might think it is handled exactly as
file names and start feeding task names like
"./some/../random//garbage" and expect to get a task named
"random/garbage". For this to work, we'd have to normalize
every task and dependency name. I think this is overkill.
Iff ".." is ever handled special, then only at the beginning
of a task/dependency name.

So far, the "@" approach was enough for me. What do you think?
Do you need ".."?

Some related background: I've taken great care in the past to
keep Rant fast. As a result, for certain things (e.g. checking
many dependencies) Rant is much faster than similar tools like
SCons and Ant. On the other hand this attitude led to some
premature optimizations and not to the best design. I use Rant
for small/mid-sized projects and sometimes for small scripts
instead of plain Ruby. Perhaps it's time to shift the focus a
bit from performance to user convinience. Comments welcome.


More information about the make-cafe mailing list