OLD | NEW |
1 # Copyright (c) 2011 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 """New implementation of Visual Studio project generation for SCons.""" | 5 """New implementation of Visual Studio project generation for SCons.""" |
6 | 6 |
7 import common | |
8 import os | 7 import os |
9 import random | 8 import random |
10 | 9 |
11 import gyp.common | 10 import gyp.common |
12 | 11 |
13 # hashlib is supplied as of Python 2.5 as the replacement interface for md5 | 12 # hashlib is supplied as of Python 2.5 as the replacement interface for md5 |
14 # and other secure hashes. In 2.6, md5 is deprecated. Import hashlib if | 13 # and other secure hashes. In 2.6, md5 is deprecated. Import hashlib if |
15 # available, avoiding a deprecation warning under 2.6. Import md5 otherwise, | 14 # available, avoiding a deprecation warning under 2.6. Import md5 otherwise, |
16 # preserving 2.4 compatibility. | 15 # preserving 2.4 compatibility. |
17 try: | 16 try: |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 # to project config. Should we be able to handle variants being a dict, | 200 # to project config. Should we be able to handle variants being a dict, |
202 # or add a separate variant_map variable? If it's a dict, we can't | 201 # or add a separate variant_map variable? If it's a dict, we can't |
203 # guarantee the order of variants since dict keys aren't ordered. | 202 # guarantee the order of variants since dict keys aren't ordered. |
204 | 203 |
205 | 204 |
206 # TODO(rspangler): Automatically write to disk for now; should delay until | 205 # TODO(rspangler): Automatically write to disk for now; should delay until |
207 # node-evaluation time. | 206 # node-evaluation time. |
208 self.Write() | 207 self.Write() |
209 | 208 |
210 | 209 |
211 def Write(self, writer=common.WriteOnDiff): | 210 def Write(self, writer=gyp.common.WriteOnDiff): |
212 """Writes the solution file to disk. | 211 """Writes the solution file to disk. |
213 | 212 |
214 Raises: | 213 Raises: |
215 IndexError: An entry appears multiple times. | 214 IndexError: An entry appears multiple times. |
216 """ | 215 """ |
217 # Walk the entry tree and collect all the folders and projects. | 216 # Walk the entry tree and collect all the folders and projects. |
218 all_entries = set() | 217 all_entries = set() |
219 entries_to_check = self.entries[:] | 218 entries_to_check = self.entries[:] |
220 while entries_to_check: | 219 while entries_to_check: |
221 e = entries_to_check.pop(0) | 220 e = entries_to_check.pop(0) |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 for e in all_entries: | 332 for e in all_entries: |
334 if not isinstance(e, MSVSFolder): | 333 if not isinstance(e, MSVSFolder): |
335 continue # Does not apply to projects, only folders | 334 continue # Does not apply to projects, only folders |
336 for subentry in e.entries: | 335 for subentry in e.entries: |
337 f.write('\t\t%s = %s\r\n' % (subentry.get_guid(), e.get_guid())) | 336 f.write('\t\t%s = %s\r\n' % (subentry.get_guid(), e.get_guid())) |
338 f.write('\tEndGlobalSection\r\n') | 337 f.write('\tEndGlobalSection\r\n') |
339 | 338 |
340 f.write('EndGlobal\r\n') | 339 f.write('EndGlobal\r\n') |
341 | 340 |
342 f.close() | 341 f.close() |
OLD | NEW |