Boost logo

Boost-Build :

Subject: Re: [Boost-build] Custom generator problem
From: Johan Nilsson (r.johan.nilsson_at_[hidden])
Date: 2009-11-25 08:48:22


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):

---
C:\...\x>bjam -q -a debug
C:/.../x/tools/build/boost.build/build\virtual-target.jam:1066: in 
virtual-target.register-actual-name from module vi
rtual-target
error: Duplicate name of actual target: 
<pC:\...\x\tmp\build\xml>HirlamTest-debug.xml
error: previous virtual target { 
common%common.copy-HirlamTest-debug.xml.NUNIT_XML { 
nunit%nunit.run-test-HirlamTest.xml.NUNIT_XML {
 dotnet%dotnet.compile.dll.csc-Breeze.Layers.Hirlam.Test.dll.SHARED_LIB { 
/C:/.../x/src/Layers/Hirlam/test/src/Foreca
stParserTest.cs.CS } { 
/C:/.../x/src/Layers/Hirlam/test/src/ForecastTest.cs.CS } { 
/C:/.../x/src/Layer
s/Hirlam/test/src/HeaderTest.cs.CS } } } }
error: created from /C:/.../x/src/Layers/Hirlam/test/HirlamTest
error: another virtual target { 
common%common.copy-HirlamTest-debug.xml.NUNIT_XML { 
nunit%nunit.run-test-HirlamTest.xml.NUNIT_XML {
dotnet%dotnet.compile.dll.csc-Breeze.Layers.Hirlam.Test.dll.SHARED_LIB { 
/C:/.../x/src/Layers/Hirlam/test/src/Forecas
tParserTest.cs.CS } { 
/C:/.../x/src/Layers/Hirlam/test/src/ForecastTest.cs.CS } { 
/C:/.../x/src/Layers
/Hirlam/test/src/HeaderTest.cs.CS } } } }
error: created from /C:/.../x/src/Layers/Hirlam/test/HirlamTest
error: added properties: none
error: removed properties: none
C:/.../x/tools/build/boost.build/build\virtual-target.jam:490: in 
actualize-no-scanner from module object(file-target
)@161
C:/.../x/tools/build/boost.build/build\virtual-target.jam:135: in 
object(file-target)@161.actualize from module objec
t(file-target)@161
C:/.../x/tools/build/boost.build\build-system.jam:723: in load from module 
build-system
C:\...\x\tools\build\boost.build/kernel\modules.jam:283: in import from 
module modules
C:\...\x\tools\build\boost.build\kernel\bootstrap.jam:142: in boost-build 
from module
C:\...\x\boost-build.jam:1: in module scope from module
---
Any clues? Let me know if there's anything else you need to know.
Thanks / Johan



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