Opened 10 years ago

Closed 10 years ago

#7163 closed Bugs (fixed)

Issue in glob rule when invoked in <conditional>.

Reported by: Dmitriy Kinoshenko <dvb.kharkov@…> Owned by: Vladimir Prus
Milestone: To Be Determined Component: build
Version: Boost Development Trunk Severity: Problem
Keywords: bjam glob <conditional> Cc:

Description

Hi,

When we use glob rule inside conditional in dependency target, it makes "globbing" not inside directory of dependency project, but inside dependent one. To reproduce, take example/libraries from boost build repository, amend util/foo/jamfile to introduce <conditional>:

rule print-my-sources ( properties * ) {

ECHO My sources: ; ECHO [ glob *.cpp ] ;

}

project

: usage-requirements <include>include ;

lib bar : bar.cpp : <conditional>@print-my-sources ; <<<

Finally, build from jamroot.jam level and see the output: My sources: app.cpp My sources: app.cpp

We expected to see "bar.cpp", while it seems that context was not switched from dependent "app" to dependency "util/foo", and thus we got "app.cpp".

Attached reworked example/libraries.

Attachments (1)

libraries.tar.gz (910 bytes ) - added by Dmitriy Kinoshenko <dvb.kharkov@…> 10 years ago.

Download all attachments as: .zip

Change History (3)

by Dmitriy Kinoshenko <dvb.kharkov@…>, 10 years ago

Attachment: libraries.tar.gz added

comment:1 by Dmitriy Kinoshenko <dvb.kharkov@…>, 10 years ago

Summary: Issue in glob rule when defined in <conditional>.Issue in glob rule when invoked in <conditional>.

comment:2 by Jurko Gospodnetic, 10 years ago

Resolution: fixed
Status: newclosed

The issue has been solved by not allowing the global project level glob() rule after Boost Build's module loading phase. That rule globs from the folder containing the 'last/currently loaded project module' and since conditional rules get triggered only after the module loading phase has has been completed - it was 'accidentally' using some 'last loaded' project module.

Latest trunk Boost Build version will actually report a clean/readable error message in this case.

Use one of the globbing rules from the path.jam module that allow you to specify the folder you want to GLOB.

Hope this helps.

Best regards,

Jurko Gospodnetić

Note: See TracTickets for help on using tickets.