[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Passing data to rant/rake for a customized build?

Gavin Kistner

3/20/2007 6:46:00 PM

Summary: How do I use a single rantfile or rakefile to perform some
varying commands based on data that I want to pass to it?


Background: My company makes a Windows-based middleware product
helping next-gen game developers create UIs. In the process of
creating the UI, our tool gathers information about the raw 3D models
and 2D images and data files and so forth needed to create the end
result. When the artist presses the "Preview" button, the application
needs to essentially perform a 'build' process. Various assets are
conditioned (going from bloated formats to runtime-appropriate
binaries) using various standalone applications. Only those resources
that have changed want to be conditioned, and thus some dependency
management is needed to do as little work as possible as quickly as
possible. Depending on the target platform, some files may need to be
copied over the network to the PS3 or 360 dev kit. The final 'product'
of the build is launching the preview application and passing it some
descriptor to show the end result.

The process changes slightly based on:
* debug/release mode,
* the target platform to preview on,
* the actual project being worked on and the assets it contains
....but otherwise is the same for every project file, for a given
customer. Each customer, however, may change the process entirely.


Question: I'm looking at Rant (or perhaps Rake) for this right now.[1]
The idea is that the application would run a Rant target (perhaps
based on a combination of debug/release and target platform), which
would kick off all the conditioners as appropriate and finally launch
the viewer application.

My question is...how do I pass data to a rantfile? The command line
for rant is just:
rant [-f Rantfile] [Options] [targets]
which gives me no way of simply passing along the name of the project
and other assets from our tool.

Is the best choice to have our tool write out a text file manifest of
all the assets of the various types, and have Rant tasks use that?
[This would sort of match the ability of make (or rant) to derive
dependencies from files with a known format (like C includes).]

Do I build a folder structure and copy/alias all the resources into
known buckets and have Rant enumerate the directories? (I'd have to
copy the rantfile into the right spot to set the context to run with.)
[This would match the *.c->*.o type mentality.]

Do I use something like ERB and have a rantfile template (editable by
customers) that our tool can use to dynamically customize the rantfile
on each preview command?

Is the rant "gen" method (that I don't yet understand) the answer I'm
looking for?


I've only just begun reading the documentation on Rant, and I haven't
used any make system (other than blindly typing "configure/make/make
install") in many, many, many years. Please forgive me (and help) if
I'm asking really basic questions.

Thanks in advance for any help!


[1] I'm also looking at MSBuild, NAnt, and maybe Jam, and maybe
others. I'm leaning towards Rant/Rake right now because I think full
Ruby-based tasks will provide the power and flexibility game customers
will need (no limitations in what can be done) in a clear, clean
fashion.

3 Answers

Gavin Kistner

3/20/2007 6:59:00 PM

0

On Mar 20, 12:45 pm, "Phrogz" <g...@refinery.com> wrote:
> Is the best choice to have our tool write out a text file manifest of
> all the assets of the various types, and have Rant tasks use that?
> [This would sort of match the ability of make (or rant) to derive
> dependencies from files with a known format (like C includes).]
>
> Do I build a folder structure and copy/alias all the resources into
> known buckets and have Rant enumerate the directories? (I'd have to
> copy the rantfile into the right spot to set the context to run with.)
> [This would match the *.c->*.o type mentality.]
>
> Do I use something like ERB and have a rantfile template (editable by
> customers) that our tool can use to dynamically customize the rantfile
> on each preview command?
>
> Is the rant "gen" method (that I don't yet understand) the answer I'm
> looking for?

I left off one other option I had thought of: setting one or more
environment variables with the data in question before kicking off the
build. It's nice because there's no file I/O needed, but it prevents
the preview from being launched by anything but our tool. Command-line
preview/nightly builds are also desirable.

Ara.T.Howard

3/20/2007 6:59:00 PM

0

Joel VanderWerf

3/21/2007 4:20:00 AM

0

Phrogz wrote:
> On Mar 20, 12:45 pm, "Phrogz" <g...@refinery.com> wrote:
>> Is the best choice to have our tool write out a text file manifest of
>> all the assets of the various types, and have Rant tasks use that?
>> [This would sort of match the ability of make (or rant) to derive
>> dependencies from files with a known format (like C includes).]
>>
>> Do I build a folder structure and copy/alias all the resources into
>> known buckets and have Rant enumerate the directories? (I'd have to
>> copy the rantfile into the right spot to set the context to run with.)
>> [This would match the *.c->*.o type mentality.]
>>
>> Do I use something like ERB and have a rantfile template (editable by
>> customers) that our tool can use to dynamically customize the rantfile
>> on each preview command?
>>
>> Is the rant "gen" method (that I don't yet understand) the answer I'm
>> looking for?
>
> I left off one other option I had thought of: setting one or more
> environment variables with the data in question before kicking off the
> build. It's nice because there's no file I/O needed, but it prevents
> the preview from being launched by anything but our tool. Command-line
> preview/nightly builds are also desirable.

You might not be aware of this, but rake accepts env vars with this syntax:

rake e1=v1 e2=v2 ... task ...

For example:

$ cat rakefile
task :bar do
p ENV['foo']
end

$ rake foo=3 bar
(in /tmp)
"3"

Maybe rant has the same feature?

--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407