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 import copy | 5 import copy |
6 import ntpath | 6 import ntpath |
7 import os | 7 import os |
8 import posixpath | 8 import posixpath |
9 import re | 9 import re |
10 import subprocess | 10 import subprocess |
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 print >> sys.stderr, ('Warning: MSVS may misinterpret the odd number of ' + | 687 print >> sys.stderr, ('Warning: MSVS may misinterpret the odd number of ' + |
688 'quotes in ' + s) | 688 'quotes in ' + s) |
689 return s | 689 return s |
690 | 690 |
691 | 691 |
692 def _EscapeCppDefineForMSVS(s): | 692 def _EscapeCppDefineForMSVS(s): |
693 """Escapes a CPP define so that it will reach the compiler unaltered.""" | 693 """Escapes a CPP define so that it will reach the compiler unaltered.""" |
694 s = _EscapeEnvironmentVariableExpansion(s) | 694 s = _EscapeEnvironmentVariableExpansion(s) |
695 s = _EscapeCommandLineArgumentForMSVS(s) | 695 s = _EscapeCommandLineArgumentForMSVS(s) |
696 s = _EscapeVCProjCommandLineArgListItem(s) | 696 s = _EscapeVCProjCommandLineArgListItem(s) |
| 697 # cl.exe replaces literal # characters with = in preprocesor definitions for |
| 698 # some reason. Octal-encode to work around that. |
| 699 s = s.replace('#', '\\%03o' % ord('#')) |
697 return s | 700 return s |
698 | 701 |
699 | 702 |
700 quote_replacer_regex2 = re.compile(r'(\\+)"') | 703 quote_replacer_regex2 = re.compile(r'(\\+)"') |
701 | 704 |
702 | 705 |
703 def _EscapeCommandLineArgumentForMSBuild(s): | 706 def _EscapeCommandLineArgumentForMSBuild(s): |
704 """Escapes a Windows command-line argument for use by MSBuild.""" | 707 """Escapes a Windows command-line argument for use by MSBuild.""" |
705 | 708 |
706 def _Replace(match): | 709 def _Replace(match): |
(...skipping 2397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3104 action_spec.extend( | 3107 action_spec.extend( |
3105 # TODO(jeanluc) 'Document' for all or just if as_sources? | 3108 # TODO(jeanluc) 'Document' for all or just if as_sources? |
3106 [['FileType', 'Document'], | 3109 [['FileType', 'Document'], |
3107 ['Command', command], | 3110 ['Command', command], |
3108 ['Message', description], | 3111 ['Message', description], |
3109 ['Outputs', outputs] | 3112 ['Outputs', outputs] |
3110 ]) | 3113 ]) |
3111 if additional_inputs: | 3114 if additional_inputs: |
3112 action_spec.append(['AdditionalInputs', additional_inputs]) | 3115 action_spec.append(['AdditionalInputs', additional_inputs]) |
3113 actions_spec.append(action_spec) | 3116 actions_spec.append(action_spec) |
OLD | NEW |