|
Boost-Build : |
Subject: Re: [Boost-build] adding to the "clean" target
From: Stefan Seefeld (stefan_at_[hidden])
Date: 2015-05-21 08:31:31
On 21/05/15 03:02 AM, Vladimir Prus wrote:
> On 5/19/2015 3:20 AM, Stefan Seefeld wrote:
>> On 18/05/15 03:03 AM, Vladimir Prus wrote:
>>> On 5/16/2015 9:01 PM, Stefan Seefeld wrote:
>>>> Hello,
>>>>
>>>> I'm building examples in Boost.Python's examples folder(s). Running
>>>> `bjam clean` will clean up some of the files, but no all. How can I
>>>> augment the "clean" rule to do additional cleanup ?
>>>
>>> Stefan,
>>>
>>> the best way to is to identify those files, and make sure that
>>> python.jam creates targets for them. Typically, it's done by
>>> making sure these files are listed as outputs of corresponding
>>> generators.
>>>
>>> Does this help?
>>
>> Sorry, I'm not very familiar with boost.build, and don't kow what
>> "output of generators" means.
>
> That's documented at:
>
> http://www.boost.org/build/doc/html/bbv2/extending/tools.html
>
>> I'm looking at
>> https://github.com/boostorg/python/blob/master/example/Jamroot, which
>> defines a new 'run-test' rule and some test targets. When I run `bjam
>> test` it builds (and runs) those tests, but `bjam clean` fails to remove
>> any of the files generated in the process. I'm wondering what is
>> missing.
>
> Could you be more specific as to what files are not removed?
This is what remains after I run `bjam clean`:
bin
âââ config.log
âââ gcc-4.9.2
â âââ debug
âââ project-cache.jam
âââ test1.test
â âââ gcc-4.9.2
â âââ debug
â âââ test1
â âââ test1.output
â âââ test1.test
âââ test2.test
â âââ gcc-4.9.2
â âââ debug
â âââ test2
â âââ test2.output
â âââ test2.test
âââ test3.test
âââ gcc-4.9.2
âââ debug
âââ test3
âââ test3.output
âââ test3.test
(test1, test2, and test3 have all been declared via something like
run-test test1 : getting_started1 test_getting_started1.py ;
>
>> (For example: could the 'run-test' rule itself declare the additional
>> output to be removed via the 'clean' target ? If not, what would be the
>> appropriate way to do that ?)
>
> The 'run-test' function declares a metatarget. When that metatarget is
> constructed with particular build properties, a generator is invoked
> to produce actual targets, which are either build, or cleaned - by
> running whatever commands are necessary.
>
> Therefore, the best way to make sure everything is cleaned to to make
> sure that the set of targets produced by the generator is equal to the
> set of files produced by whatever command invocations.
>
> The generator is defined in python.jam, lines 1181 and below:
>
> generators.register
> [ new python-test-generator python.capture-output : :
> RUN_PYD_OUTPUT ] ;
>
> generators.register-standard testing.expect-success
> : RUN_PYD_OUTPUT : RUN_PYD ;
>
> So, so creates two targets. One, RUN_PYD_OUTPUT, with the extension of
> .output, contains the output of the test run. Second, RUN_PYD with the
> extension of .test is an empty file that's created only if test passes.
>
> Which files are not removed?
Both (see above), plus a file named after the target containing the exit
status.
Stefan
-- ...ich hab' noch einen Koffer in Berlin...
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