[jamming] I really wish this was handled in a manual somewhere...
John Waugh
john.waugh at gmail.com
Fri Aug 18 22:38:25 PDT 2006
I am not a Jam expert, and have had my own grist-ly issues, but here are my
2 cents:
It seems like a combination of SOURCE_GRIST and MakeLocate might do the
trick for you.
SOURCE_GRIST is a variable which is set up by SubDir. it will contain a
directory-specific grist for a given subdirectory (The example assumes
you've put SubDir at the top of your Jamfiles)
For instance, suppose you have a Jamfile in path/foo/ as well as in
path/bar/, and both those directories have a build.xml. Then in each Jamfile
you could have something like this:
local x = "build.xml" ;
x = $(x:G=$(SOURCE_GRIST)) ;
MakeLocate $(x) : $(SUBDIR) ;
Depends foo : $(x) ;
Echo x is $(x) ;
actions RunAnt
{
echo now we run ant on $(>)
}
RunAnt foo : $(x) ;
Then type 'jam foo' and you should get output like this:
x is <path!foo>build.xml
...found 2 target(s)...
...updating 1 target(s)...
RunAnt foo
now we run ant on path/foo/build.xml
...updated 1 target(s)...
Thus even though you gave the weird (but unique) target name <path!foo>
build.xml, it got resolved to path/foo/build.xml thanks to MakeLocate.
Incidentally, looking at the MakeLocate and MkDir rules in Jambase and
trying to grok them is helpful when trying to understand grist, I find.
-John
On 8/18/06, Matt Boyce <lordostone at gmail.com> wrote:
>
> but for the bagillionth time I'm having difficulty using grist.
>
> I've inherited a fairly complex build (The person who really
> understands how and why things are the way they are in it has left the
> project) which seems to use grist fairly inconsistently.
>
> What I'd like to know is what the lifecycle of a variable representing
> a file which needs to be uniquely identified is.
>
> That is, if I've got two files which share the same name in different
> directories (which is the situation in which I need grist if I
> understand it correctly).
>
> Where in the build do I first put grist on the variable? (When I
> first define it or can I delay until when it's passed into a rule)
> When do I strip grist off of a file or somehow convert it to a
> path-qualified file name?
>
> Just to make this interesting... you can solve part of the problem I'm
> having:
>
> I need jam to make calls to ant, so I've got a rule ApacheAnt
> it needs to call `ant -f "path/to/my/build.xml"` where the build.xml
> file is in the same directory as the jamfile that calls the rule.
> The call to the rule should know (<) what files it creates and (>)
> where it's build.xml and source .java files are (they are in a
> subdirectory of the directory containing build.xml)
> I've got multiple calls to ant, and thus several files called
> build.xml in different subdirectories.
>
>
> I'm aware that there have been tons of grist questions in the past,
> but I can't seem to find any very definitive answers... I'm sorry if
> I've missed something.
>
> Thanks a bunch,
> ~Matthew E. Boyce
> _______________________________________________
> jamming mailing list - jamming at perforce.com
> http://maillist.perforce.com/mailman/listinfo/jamming
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://maillist.perforce.com/pipermail/jamming/attachments/20060818/4818f08e/attachment.html
More information about the jamming
mailing list