Boost logo

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