[Scons-users] How to let the action of a custom builder run before the emitters of dependent builders

getspammed iwanttogetspammed at gmx.net
Sat Sep 13 05:11:41 EDT 2014


I have a custom builder that takes some input files and creates several output files of different types - this is a code generation step. That builder has an emitter and an action.
In addition to that, there are several more custom and builtin builders that consume the generated files. Those additional custom builders also have emitters.

My problem is this:

In order to reason about what will be the sources and targets, the emitters of the secondary builders have to read the generated files. But they cannot do so, because scons seems to always run ALL the emitters FIRST - before the generator creates any files. Only AFTER that scons seems to run the required actions - which will create the required files too late.

Currently my solution is to have two seperate scons runs:
The first only has two build steps. First the code generation builder is invoked and the build targets of that are fed into another custom builder that calls scons again as a subprocess. That 'sub' scons instance than consumes all the generated files.
While this works, it has the drawback that any information that needs to be passed to the second stage has to be dealt with manually. E.g. transfering the commandline switches and build targets from the first to the second stage.

So i would like to know if there is a better way to do this.
Please note, that the code generation step is quite expensive and i would like not to execute it, if it isn't necessary.


Regards,
Rocco


More information about the Scons-users mailing list