(t, name)
| 342 | |
| 343 | |
| 344 | def __write_appender(t, name): |
| 345 | t.write(name, |
| 346 | r"""# Copyright 2012 Jurko Gospodnetic |
| 347 | # Distributed under the Boost Software License, Version 1.0. |
| 348 | # (See accompanying file LICENSE_1_0.txt or copy at |
| 349 | # http://www.boost.org/LICENSE_1_0.txt) |
| 350 | |
| 351 | # Support for registering test generators that construct their targets by |
| 352 | # simply appending their given input data, e.g. list of sources & targets. |
| 353 | |
| 354 | import "class" : new ; |
| 355 | import generators ; |
| 356 | import modules ; |
| 357 | import sequence ; |
| 358 | |
| 359 | rule register ( id composing ? : source-types + : target-types + ) |
| 360 | { |
| 361 | local caller-module = [ CALLER_MODULE ] ; |
| 362 | id = $(caller-module).$(id) ; |
| 363 | local g = [ new generator $(id) $(composing) : $(source-types) : |
| 364 | $(target-types) ] ; |
| 365 | $(g).set-rule-name $(__name__).appender ; |
| 366 | generators.register $(g) ; |
| 367 | return $(id) ; |
| 368 | } |
| 369 | |
| 370 | if [ modules.peek : NT ] |
| 371 | { |
| 372 | X = ")" ; |
| 373 | ECHO_CMD = (echo. ; |
| 374 | } |
| 375 | else |
| 376 | { |
| 377 | X = \" ; |
| 378 | ECHO_CMD = "echo $(X)" ; |
| 379 | } |
| 380 | |
| 381 | local appender-runs ; |
| 382 | |
| 383 | # We set up separate actions for building each target in order to avoid having |
| 384 | # to iterate over them in action (i.e. shell) code. We have to be extra careful |
| 385 | # though to achieve the exact same effect as if doing all the work in just one |
| 386 | # action. Otherwise Boost Jam might, under some circumstances, run only some of |
| 387 | # our actions. To achieve this we register a series of actions for all the |
| 388 | # targets (since they all have the same target list - either all or none of them |
| 389 | # get run independent of which target actually needs to get built), each |
| 390 | # building only a single target. Since all our actions use the same targets, we |
| 391 | # can not use 'on-target' parameters to pass data to a specific action so we |
| 392 | # pass them using the second 'sources' parameter which our actions then know how |
| 393 | # to interpret correctly. This works well since Boost Jam does not automatically |
| 394 | # add dependency relations between specified action targets & sources and so the |
| 395 | # second argument, even though most often used to pass in a list of sources, can |
| 396 | # actually be used for passing in any type of information. |
| 397 | rule appender ( targets + : sources + : properties * ) |
| 398 | { |
| 399 | appender-runs = [ CALC $(appender-runs:E=0) + 1 ] ; |
| 400 | local target-index = 0 ; |
| 401 | local target-count = [ sequence.length $(targets) ] ; |
no test coverage detected