0

Is it possible to implement something like fallback building method in SCons?

For example, I have following code in my SConscript:

if check_something():
    MyBuilder(a, b)
....
if dont_know_how_to_build(a):
    FallBackBuilder(a, c)

I can't predict if "normal build method" will be activated. But I want that when it was not activated and SCons don't know how to build a, it used FallBackBuilder.

Of course I understand that it is bossible to write something like:

if check_something():
    MyBuilder(a, b)
else:
    FallBackBuilder(a, c)

but I'm not satisfied with this solution, because there are can be thousand places in my SConscript/SConstruct files where some builder for a could be specified.

I just want to specify some "fallback"-method at the and of SConscript.

What do you think? Is it possible? Or that is a wrong direction at all?

To say it with other words, if it possible in some place in SConscript get a list of objects that are already have associated builders?

For example:

Builder1(a,b)
Builder2(b,c)
list_of_buildable_objects = get_list_of_buildable_objects()
Builder3(c,d)

I want to know how to get the list of buildable objects that in this example must be equal to [a, b] or something like this.

Igor Chubin
  • 61,765
  • 13
  • 122
  • 144
  • This seems like a very generic request, is it something you have seen with other build tools? If so, can you give an example, please. – Brady Jun 21 '12 at 07:41
  • No, I haven't seen something like this in other tools, but I think that it is quite scons-specific question. I try to clarify the question a little bit – Igor Chubin Jun 21 '12 at 07:53

1 Answers1

0

Not currrently possible as you specify it.

The SConstruct/SConscripts are used to tell SCons what to do. It doesn't do those things immediately. It uses the information to build a dependency tree, which is added to by some source scanners to build a (hopefully) complete picture of all the dependencies in the system.

This DAG (directed acyclic graph) is then traversed to figure out the proper order of commands to issue.

Some of the objects in the graph have their builders assigned by SCons directly and not via the SConstruct/SConscripts.

Do you want this fallback builder to be run after other builders are run and fail? Or is this just for targets which the system has no other specified builders?

bdbaddog
  • 3,357
  • 2
  • 22
  • 33