abyss996 / gyp

Automatically exported from code.google.com/p/gyp
0 stars 0 forks source link

Ninja auto-regeneration. #352

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I'm not terribly familiar with gyp's internals, but from what I can glean, it 
seems that currently only Make supports build-file auto-regeneration after the 
.gyp files are changed.

Ninja has functionality specifically to support this (the `generator =` key on 
`rule`'s). I believe all it will take is adding the following to the top-level 
outputted .ninja file (using the ninja_syntax.py API):

n.rule('regenerate',
       command='<reinvoke gyp>',
       description='REGENERATE',
       generator=True) # <-- Important. Gives it special semantics.
n.build([<.ninja files generated by gyp>], 'regenerate',
        implicit=[<gyp files depended upon>])

If someone can point me at how to get at the <...> parts and where is the best 
place to do so (somewhere in pylib/gyp/generator/ninja.py I'm guessing?), I'd 
be glad to submit a patch, but I wasn't able to quite decipher the logic of 
what is happening in the .ninja generator (TBH I didn't try very hard...).

I can sort of piece together how to do some parts of that from make.py's 
WriteAutoRegenerationRule() function, but it's still kind of foggy.

Original issue reported on code.google.com by chisophu...@gmail.com on 20 Jun 2013 at 8:18