Boost logo

Boost-Build :

Subject: [Boost-build] One more issue with <embed-manifest> feature.
From: Alexey Pakhunov (alexeypa_at_[hidden])
Date: 2009-02-02 01:32:18


Hi,

There is another problem with <embed-manifest> feature. Currently
msvc-linking-generator.generated-targets uses the following code to
create file-target for generated manifest:

            result += [ virtual-target.register
                [ class.new file-target $(name) : MANIFEST :
$(project) : $(action) ] ] ;

Note that when $(action) is specified (which is normally the case) the
constructor of abstract-file-target will register the newly register
target with that action:

        self.action = $(action) ;
        if $(action)
        {
            $(action).add-targets $(__name__) ;

            if $(self.type) && ! $(exact)
            {
                _adjust-name $(name) ;
            }
        }

Now the problem is if the code above is executed twice two
file-targets will be created by [ class.new file-target ... ] but only
one of them will be returned. virtual-target.register checks it has
seen a particular target already and if so it will return the first
instance of the target to the caller.

The setup I can see it is a bit complex and I'm trying to reduce it to
a meaningful repro. But basically it is:

# file 1
exe build_tool : ... ;

# file 2
class build_tool_generator
{
    rule run ( ... )
    {
        # run is looking for build_tool target and:
        # 1. set is a dependency to the target this generator builds
        # 2. save binary path in a custom feature for later use
        # see quickbook.jam for example.
    }
}

generators.register [ new build_tool_generator : FOO : BAR ] ;

# file 3
bar baz : source.foo ;

exe rabbit : ... : <dependency>baz ;

# file 4
install dist : rabbit ;

build_tool_generator is used to build build_tool and use it for
converting .foo to .bar. When I build "dist" I see that
msvc-linking-generator.generated-targets is cassed twice for
build_tool.

At this point I'm not sure what is exactly the problem: unconditional
registration of file-target with their actions or multiple invocations
of generated-targets rule. But I hope that Vladimir can cast some
light on this problem. :-)

-- 
Best regards,
  Alexey Pakhunov.

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