OLD | NEW |
1 # Copyright (c) 2012 Google Inc. All rights reserved. | 1 # Copyright (c) 2012 Google Inc. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """ | 5 """ |
6 This module helps emulate Visual Studio 2008 behavior on top of other | 6 This module helps emulate Visual Studio 2008 behavior on top of other |
7 build systems, primarily ninja. | 7 build systems, primarily ninja. |
8 """ | 8 """ |
9 | 9 |
10 import os | 10 import os |
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 args = vs.SetupScript(arch) | 683 args = vs.SetupScript(arch) |
684 args.extend(('&&', 'set')) | 684 args.extend(('&&', 'set')) |
685 popen = subprocess.Popen( | 685 popen = subprocess.Popen( |
686 args, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | 686 args, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
687 variables, _ = popen.communicate() | 687 variables, _ = popen.communicate() |
688 env = _ExtractImportantEnvironment(variables) | 688 env = _ExtractImportantEnvironment(variables) |
689 env_block = _FormatAsEnvironmentBlock(env) | 689 env_block = _FormatAsEnvironmentBlock(env) |
690 f = open_out(os.path.join(toplevel_build_dir, 'environment.' + arch), 'wb') | 690 f = open_out(os.path.join(toplevel_build_dir, 'environment.' + arch), 'wb') |
691 f.write(env_block) | 691 f.write(env_block) |
692 f.close() | 692 f.close() |
| 693 |
| 694 def VerifyMissingSources(sources, build_dir, generator_flags, gyp_to_ninja): |
| 695 """Emulate behavior of msvs_error_on_missing_sources present in the msvs |
| 696 generator: Check that all regular source files, i.e. not created at run time, |
| 697 exist on disk. Missing files cause needless recompilation when building via |
| 698 VS, and we want this check to match for people/bots that build using ninja, |
| 699 so they're not surprised when the VS build fails.""" |
| 700 if int(generator_flags.get('msvs_error_on_missing_sources', 0)): |
| 701 no_specials = filter(lambda x: '$' not in x, sources) |
| 702 relative = [os.path.join(build_dir, gyp_to_ninja(s)) for s in no_specials] |
| 703 missing = filter(lambda x: not os.path.exists(x), relative) |
| 704 if missing: |
| 705 # They'll look like out\Release\..\..\stuff\things.cc, so normalize the |
| 706 # path for a slightly less crazy looking output. |
| 707 cleaned_up = [os.path.normpath(x) for x in missing] |
| 708 raise Exception('Missing input files:\n%s' % '\n'.join(cleaned_up)) |
OLD | NEW |