SconsDynamicallyAddTargetToExecutor
Материал из CustisWiki
Consider the following situation.
- MainFile includes some GeneratedNN files (count of these files is unknown)
- All these GeneratedNN files (+some other files) generated by one Generator file (for example, python script).
- All included GeneratedNN files needed to be rescanned after generation (they can include other files).
I scan MainFile, and then I see inclusion of Generated1 file, I add something like this:
cmd=env.Command(Generated1, Generator, RunMePlease)
But actually I need
cmd=env.Command([Generated1,Generated2,…,GeneratedN], Generator, RunMePlease)
but I must add targets incrementally during MainFile scan…
So the question is: How to dynamically add targets to Command? I try something like
Generator.executor.targets.append(env.fs.Entry(GeneratedN))
but it seems not working…
Addition 01
Situation may be a little complex:
- There are a list of «mainfiles»: MainFile1, MainFile2…
- MainFileX includes some GeneratedNN files (count of these files is unknown)
- All these GeneratedNN files (+some other files) generated by one Generator file (for example, python script).
- All included GeneratedNN files needed to be rescanned after generation (they can include other files).
I scan MainFileX, and then I see inclusion of Generated1 file, I add something like this:
cmd=env.Command(Generated1, Generator, RunMePlease)
Actually I need after scanning and before starting build process:
cmd=env.Command([Generated1,Generated2,…,GeneratedN], Generator, RunMePlease)