On 21/12/2001 00:30, "MikkelFJ" <mikkelj-anti-spam / post1.dknet.dk> wrote:

> And so I did.

I did too, and wow, I was pretty happy because my crude little stuff has a
lot in common with SCons: it detects changes using cached MD5 signatures,
use scanners to find dependencies, and so on...

Here is how the most simple build script looks like:

-----
# file buildscript.rb
require 'builder'

testtool = Builder::Tool( "test" )
testtool.to_build do
  testtool << "main.c"
end
testtool.build
-----

Doing 'ruby buildscript.rb' will build the mythical Hello World test app.

The 'Tool' class is a subclass of the 'Product' class (which knows how to
build stuff with other sub-products components, sources, resources, etc),
which is a "template" to produce a CLI tool. Similar classes are Library,
SharedLibrary, CocoaApplication (MacOSX specific class, which create the
appropriate application package), etc.

The different file types are mapped to specific handlers (compilers,
linkers, preprocessors, etc) using a map table which you can configure using
the global 'Environment' class. In the above example, the default 'Gcc'
class is used to produce the object file. I am invistigating a way to make
those file handlers easily pluggable (the current system is little hackish).

I have also introduced the concept of variants to describe a way to apply
different build styles. For example:

-----
# file buildscript.rb
require 'builder'

tool = Builder::Tool( "test" )
tool.to_build do
  tool << "main.c"
  tool.for_variant("debug") do
    Environment["gcc"]["debug"] = true
  end
  tool.for_variant("release") do
    Environment["gcc"]["optimize_level"] = 3
  end
end
tool.build
-----

This little snippet can build 2 variants of the 'test' application. I think
that the code speaks for itself ;)

Doing 'ruby buildscript.rb -v release' will build a blazingly fast mythical
Hello World test app.

There are a lot of specific details which are probably not important right
now, I just wanted to give you a sneak peek of what I was working on, since
the subject has been pretty hot lately ;-)

Tell me what you think.

-- 
Luc - lucsky / mac.com