| 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 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 } | 726 } |
| 727 result = ''.join([escape_dictionary.get(c, c) for c in s]) | 727 result = ''.join([escape_dictionary.get(c, c) for c in s]) |
| 728 return result | 728 return result |
| 729 | 729 |
| 730 | 730 |
| 731 def _EscapeCppDefineForMSBuild(s): | 731 def _EscapeCppDefineForMSBuild(s): |
| 732 """Escapes a CPP define so that it will reach the compiler unaltered.""" | 732 """Escapes a CPP define so that it will reach the compiler unaltered.""" |
| 733 s = _EscapeEnvironmentVariableExpansion(s) | 733 s = _EscapeEnvironmentVariableExpansion(s) |
| 734 s = _EscapeCommandLineArgumentForMSBuild(s) | 734 s = _EscapeCommandLineArgumentForMSBuild(s) |
| 735 s = _EscapeMSBuildSpecialCharacters(s) | 735 s = _EscapeMSBuildSpecialCharacters(s) |
| 736 # cl.exe replaces literal # characters with = in preprocesor definitions for |
| 737 # some reason. Octal-encode to work around that. |
| 738 s = s.replace('#', '\\%03o' % ord('#')) |
| 736 return s | 739 return s |
| 737 | 740 |
| 738 | 741 |
| 739 def _GenerateRulesForMSVS(p, output_dir, options, spec, | 742 def _GenerateRulesForMSVS(p, output_dir, options, spec, |
| 740 sources, excluded_sources, | 743 sources, excluded_sources, |
| 741 actions_to_add): | 744 actions_to_add): |
| 742 """Generate all the rules for a particular project. | 745 """Generate all the rules for a particular project. |
| 743 | 746 |
| 744 Arguments: | 747 Arguments: |
| 745 p: the project | 748 p: the project |
| (...skipping 2361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3107 action_spec.extend( | 3110 action_spec.extend( |
| 3108 # TODO(jeanluc) 'Document' for all or just if as_sources? | 3111 # TODO(jeanluc) 'Document' for all or just if as_sources? |
| 3109 [['FileType', 'Document'], | 3112 [['FileType', 'Document'], |
| 3110 ['Command', command], | 3113 ['Command', command], |
| 3111 ['Message', description], | 3114 ['Message', description], |
| 3112 ['Outputs', outputs] | 3115 ['Outputs', outputs] |
| 3113 ]) | 3116 ]) |
| 3114 if additional_inputs: | 3117 if additional_inputs: |
| 3115 action_spec.append(['AdditionalInputs', additional_inputs]) | 3118 action_spec.append(['AdditionalInputs', additional_inputs]) |
| 3116 actions_spec.append(action_spec) | 3119 actions_spec.append(action_spec) |
| OLD | NEW |