Boost logo

Boost-Build :

Subject: Re: [Boost-build] ALWAYS not working inside if block
From: Edward Mitchell (erm410_at_[hidden])
Date: 2014-10-12 23:54:41


On 10/12/2014 10:43 AM, Steven Watanabe wrote:
> AMDG
>
> On 10/11/2014 09:37 PM, Edward Mitchell wrote:
>> I am trying to update a target based on some external condition and have
>> encountered some interesting behavior. Running
>>
>> rule my-rule ( targets + : sources * : properties * )
>> {
>> ...
>> ALWAYS $(targets) ;
>> ...
>> }
>>
>> leads to all targets being updated, as one would expect. However
>>
>> rule my-rule ( targets + : sources * : properties * )
>> {
>> ...
>> # Update if my-condition is true or the target does not exist
>> if my-condition {
>> ECHO "got here" ;
>> ALWAYS $(targets) ;
>> } else {
>> ECHO "not updating" ;
>> NOUPDATE $(targets) ;
>> ...
>> }
>>
>> outputs "got here" or "not updating" as appropriate, but the targets are
>> updated only if my-condition is false and the target is missing, i.e.
>> the else block is behaving as expected, but the if block seems to be a
>> no-op. Has anyone else encountered this? Or is there a better way to
>> achieve what I am trying to do?
>>
> I don't see how this can possibly be the
> reason for your problem. Do you have a
> minimal test case?
>
> In Christ,
> Steven Watanabe
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
You are right, it was a little too far fetched. After a few more hours
investigating it turns out it was a coincidence of how I was testing.
-d+12 finally revealed that the issue was that the target is not in the
dependency graph in the case that its source does not exist at the time
that b2 is invoked. This leads me to the question: is it possible to add
a Jam target to the graph? I have tried both `DEPENDS $(sources) :
$(targets) ;` and `INCLUDES $(sources) : $(targets) ;` without success.

Thanks,
Ted


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