Re: Actions, routes and builders in general

Lars Ivar Igesund <[email protected]> Thu, 03 Jun 2004 21:38:58 +0100
Newsgroups gmane.comp.tools.aap.devel
Message-ID <[email protected]>
I'm not sure that I've hit this problem, but I think your solution might 
be a good one.

Lars Ivar Igesund

Bram Moolenaar wrote:

> A while ago a problem with actions was identified: The supported
> filetypes can only be specified statically.  When the action works
> differently depending on the system or the currently selected tools,
> this can't be specified.
> 
> An example is that the "build" action on MS-Windows accepts a ".res"
> file.  Thus a ":program" command can accept a "foo.res" file and
> directly pass it to the build action.  How to define this, depending on
> the current system?
> 
> A related issue is that the ":route" command is a bit strange, in that
> it defines how to turn one filetype into another and then lists the
> names of the actions to be taken.  This is very unusual, no matter what
> background you have.
> 
> A possible solution would be to support something new and a bit more
> flexible: Builders.
> 
> 
> The basic idea of a Builder is that it specifies how to build a target
> from sources of a certain type.  For example: How to build an object
> file from a lex file.  Or how to build a dllobject file from a C++
> source file.
> 
> Besides the building itself, the Builder can be asked to return the
> supported types.  Both for sources and for targets.
> 
> Example:
> 
> 	:program foo : foo.c foo.res foo.l
> 
> The ":program" implementation would first find the Builder that produces
> an executable program.  From that Builder it obtains the list of file
> types it supports for its sources.  Let's call that "linktypes".
> 
> ":program" then goes through the lists of sources:
> - For "foo.c" it finds a Builder that can turn a C file into one of the
>   "linktypes".  That is a C compile Builder:  "c" -> "object"
> - For "foo.res" it sees that the filetype appears in "linktypes", thus
>   nothing needs to be done.
> - For "foo.l" a Builder is found that tuns a Lex file into an object
>   file.  It uses an intermediate C code file, a separate dependency is
>   used for the two steps.
> 
> This is very similar to what currently happens with routes and actions,
> but the filetypes are not defined statically, they are obtained from the
> Builder dynamically.  Thus selecting other tools may cause other
> Builders to be selected.
> 
> If a Builder consists of multiple steps, such as when a lex file is
> turned into C code and then into an object file, this should also be
> indicated somehow (only one of the steps may need to be done).
> 
> If several Builders are found that could do the work, it should not
> matter which one is used.  Perhaps some priority mechanism could be used
> to avoid illogical choices.
> 
> Since this involves several blocks of code to be associated with a
> Builder, an obvious way to implement this would be a Python object or
> dictionary.  Most of the Builders would be defined in the tools, which
> are Python scripts.  Thus defining Builders with Python sounds like a
> good plan.
> 
> I think it should be possible to have the :action and :route commands
> create a Builder object.  This provides backwards compatibility without
> doing everything twice.
> 
> Comments?
> 



-------------------------------------------------------
This SF.Net email is sponsored by the new InstallShield X.
From Windows to Linux, servers to mobile, InstallShield X is the one
installation-authoring solution that does it all. Learn more and
evaluate today! http://www.installshield.com/Dev2Dev/0504