Index: pylib/gyp/msvs_emulation.py |
=================================================================== |
--- pylib/gyp/msvs_emulation.py (revision 1525) |
+++ pylib/gyp/msvs_emulation.py (working copy) |
@@ -690,3 +690,19 @@ |
f = open_out(os.path.join(toplevel_build_dir, 'environment.' + arch), 'wb') |
f.write(env_block) |
f.close() |
+ |
+def VerifyMissingSources(sources, build_dir, generator_flags, gyp_to_ninja): |
+ """Emulate behavior of msvs_error_on_missing_sources present in the msvs |
+ generator: Check that all regular source files, i.e. not created at run time, |
+ exist on disk. Missing files cause needless recompilation when building via |
+ VS, and we want this check to match for people/bots that build using ninja, |
+ so they're not surprised when the VS build fails.""" |
+ if int(generator_flags.get('msvs_error_on_missing_sources', 0)): |
+ no_specials = filter(lambda x: '$' not in x, sources) |
+ relative = [os.path.join(build_dir, gyp_to_ninja(s)) for s in no_specials] |
+ missing = filter(lambda x: not os.path.exists(x), relative) |
+ if missing: |
+ # They'll look like out\Release\..\..\stuff\things.cc, so normalize the |
+ # path for a slightly less crazy looking output. |
+ cleaned_up = [os.path.normpath(x) for x in missing] |
+ raise Exception('Missing input files:\n%s' % '\n'.join(cleaned_up)) |