|
Boost-Build : |
Subject: Re: [Boost-build] Custom generator problem
From: Vladimir Prus (ghost_at_[hidden])
Date: 2009-11-25 12:35:41
On Wednesday 25 November 2009 16:48:22 Johan Nilsson wrote:
> Vladimir Prus wrote:
> >> On Tuesday 24 November 2009 11:51:17 Johan Nilsson wrote:
> >>
> >>> Vladimir Prus wrote:
> >>>> On Tuesday 17 November 2009 16:20:35 Johan Nilsson wrote:
> >>>>
> >>>>> Hi,
> >>>>>
> >>>>> I've been working on a custom generator for some time now, and
> >>>>> have it mostly working now, with one annoying problem. It appears
> >>>>> that using the alias rule on a target generated with my generator
> >>>>> triggers a "Duplicate name of actual target" error.
> >>>>
> >>>> local copy-target = [ new file-target $(target-base) : :
> >>>> $(project) : $(copy-action) ] ;
> >>>>
> >>>> copied-targets += $(copy-target) ;
> >>>>
> >>>> Here, you create a target, and never pass it via
> >>>> virtual-target.register. Every newly created target must be passed
> >>>> via it.
> >>>
> >>> Did you try to register $(copied-targets) as well? It doesn't make
> >>> any difference to me - still seeing the same problem in combination
> >>> with alias. I just changed the last line of generate-targets to
> >>> this (to no effect):
> >>>
> >>> return [ sequence.transform virtual-target.register :
> >>> $(main-target) $(main-foo2-target) $(copy2foo2tagged-target)
> >>> $(copied-targets) ] ;
> >>>
>
> [...]
>
> >>
> >> I'm sorry -- I examined the code you have provided, but did not run
> >> it.
> >> There are two issues:
> >>
> >> 1. If you add 'copied-targets' into the virtual-target.register call
> >> at the
> >> end, it won't work.
> >>
> >> 2. There's another such call missing.
> >>
> >> I attach a project that seem to work for me.
>
> This works for me to. Unfortunately I can't seem to get my actual generator
> to work by registering all targets, still having the same problem in
> combination with the "alias" rule.
>
> I'm attaching the real, updated, generator to this posting. Even though you
> won't be able to actully test it without having other stuff installed, maybe
> you can find out what the problem is by browsing the code. This is the the
> output when adding an alias for the test targets (paths snipped to protect
> the innocent):
local main-xml-target = [ new file-target $(name) : NUNIT_XML : $(project) : $(main-target-action) ] ;
main-targets += [ virtual-target.register $(main-xml-target) ] ;
...
local copy-xml-action = [ new action $(main-xml-target) : common.copy : $(xml-target-ps) ] ;
At this point 'main-xml-target' is *still* the target constructed by 'new'. Although you have
called virtual-target.register passing the current value of 'main-xml-target', you have stored
the result in 'main-targets', and 'main-xml-target' is what it was.
Does rewriting this as:
local main-xml-target = [ new file-target $(name) : NUNIT_XML : $(project) : $(main-target-action) ] ;
main-xml-target = [ virtual-target.register $(main-xml-target) ] ;
main-targets += $(main-xml-target) ;
...
local copy-xml-action = [ new action $(main-xml-target) : common.copy : $(xml-target-ps) ] ;
Improve things?
- 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