Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-06-21 06:37:03


elesende wrote:
> Thanks for you response. I'm not sure that I understand how
> Boost.Build works internally. But by examining the --debug-
> generators output I can see that the generator is spawned only once
> and from there on its get cloned for each target. The thing is that
> generated-targets is only called when it is spawned. Am I wrong?

You are right, mostly.

Boost.Build works this way for regular generators, because it assumes that a
generator with source type JAVA and target type CLASS takes a single JAVA
source and produces a single CLASS target, and for such cases caching the
transformation is OK.

For your case, it does not work that nice. There are actually two kinds of a
problem.

First is that top-level JAR generator will try to convert each source JAVA to
CLASS separately.

Second is that even if you pass several sources to JAVA->CLASS generator, as
written, it will run compiler several times, which is not good either.

The solution I see are:

1. For the JAVA->CLASS generator, override the run method. It should look
something like:

local consumed = ;
local bypassed = ;

convert-multiple-sources-to-consumable-types $(project)
: $(property-set) : $(sources) : consumed bypassed ;

local result ;
if $(consumed)
{
result = [ generated-targets $(consumed) : ........... ] ;
result += $(bypassed) ;
}

return $(result) ;

2. For the CLASS->JAR generator, you'd have to override the 'run' method as
well. It should look like this:

local classes = [ generators.construct ..... $(sources) .... ] ;
if $(classes) {
result = [ construct-result $(classes) : $(project) $(name) :
$(propert-set) ;
}
return $(result) ;

The second code peice will pass *all* sources to the further generators -- in
this case JAVA->CLASS. The first code piece will pass all JAVA targets to
generated-targets, where you can do all the logic you need -- in particular,
create the targets with the right paths.

Further questions are welcome.

BTW, I'm online from 10:00 till 18:00 Moscow time (GMT +03) and if you happen
to ever be online at the same time we can talk over ICQ/Jabber/IRC. This
sometimes turn out to be more efficient than email.

HTH,
Volodya

 


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk