OLD | NEW |
1 # Copyright (c) 2011 Google Inc. All rights reserved. | 1 # Copyright (c) 2011 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 | 7 import common |
8 import os | 8 import os |
9 import random | 9 import random |
10 | 10 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 # Copy passed lists (or set to empty lists) | 132 # Copy passed lists (or set to empty lists) |
133 self.dependencies = list(dependencies or []) | 133 self.dependencies = list(dependencies or []) |
134 | 134 |
135 self.entry_type_guid = ENTRY_TYPE_GUIDS['project'] | 135 self.entry_type_guid = ENTRY_TYPE_GUIDS['project'] |
136 | 136 |
137 if config_platform_overrides: | 137 if config_platform_overrides: |
138 self.config_platform_overrides = config_platform_overrides | 138 self.config_platform_overrides = config_platform_overrides |
139 else: | 139 else: |
140 self.config_platform_overrides = {} | 140 self.config_platform_overrides = {} |
141 self.fixpath_prefix = fixpath_prefix | 141 self.fixpath_prefix = fixpath_prefix |
| 142 self.msbuild_toolset = None |
142 | 143 |
143 def set_dependencies(self, dependencies): | 144 def set_dependencies(self, dependencies): |
144 self.dependencies = list(dependencies or []) | 145 self.dependencies = list(dependencies or []) |
145 | 146 |
146 def get_guid(self): | 147 def get_guid(self): |
147 if self.guid is None: | 148 if self.guid is None: |
148 # Set GUID from path | 149 # Set GUID from path |
149 # TODO(rspangler): This is fragile. | 150 # TODO(rspangler): This is fragile. |
150 # 1. We can't just use the project filename sans path, since there could | 151 # 1. We can't just use the project filename sans path, since there could |
151 # be multiple projects with the same base name (for example, | 152 # be multiple projects with the same base name (for example, |
152 # foo/unittest.vcproj and bar/unittest.vcproj). | 153 # foo/unittest.vcproj and bar/unittest.vcproj). |
153 # 2. The path needs to be relative to $SOURCE_ROOT, so that the project | 154 # 2. The path needs to be relative to $SOURCE_ROOT, so that the project |
154 # GUID is the same whether it's included from base/base.sln or | 155 # GUID is the same whether it's included from base/base.sln or |
155 # foo/bar/baz/baz.sln. | 156 # foo/bar/baz/baz.sln. |
156 # 3. The GUID needs to be the same each time this builder is invoked, so | 157 # 3. The GUID needs to be the same each time this builder is invoked, so |
157 # that we don't need to rebuild the solution when the project changes. | 158 # that we don't need to rebuild the solution when the project changes. |
158 # 4. We should be able to handle pre-built project files by reading the | 159 # 4. We should be able to handle pre-built project files by reading the |
159 # GUID from the files. | 160 # GUID from the files. |
160 self.guid = MakeGuid(self.name) | 161 self.guid = MakeGuid(self.name) |
161 return self.guid | 162 return self.guid |
162 | 163 |
| 164 def set_msbuild_toolset(self, msbuild_toolset): |
| 165 self.msbuild_toolset = msbuild_toolset |
| 166 |
163 #------------------------------------------------------------------------------ | 167 #------------------------------------------------------------------------------ |
164 | 168 |
165 | 169 |
166 class MSVSSolution: | 170 class MSVSSolution: |
167 """Visual Studio solution.""" | 171 """Visual Studio solution.""" |
168 | 172 |
169 def __init__(self, path, version, entries=None, variants=None, | 173 def __init__(self, path, version, entries=None, variants=None, |
170 websiteProperties=True): | 174 websiteProperties=True): |
171 """Initializes the solution. | 175 """Initializes the solution. |
172 | 176 |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 for e in all_entries: | 333 for e in all_entries: |
330 if not isinstance(e, MSVSFolder): | 334 if not isinstance(e, MSVSFolder): |
331 continue # Does not apply to projects, only folders | 335 continue # Does not apply to projects, only folders |
332 for subentry in e.entries: | 336 for subentry in e.entries: |
333 f.write('\t\t%s = %s\r\n' % (subentry.get_guid(), e.get_guid())) | 337 f.write('\t\t%s = %s\r\n' % (subentry.get_guid(), e.get_guid())) |
334 f.write('\tEndGlobalSection\r\n') | 338 f.write('\tEndGlobalSection\r\n') |
335 | 339 |
336 f.write('EndGlobal\r\n') | 340 f.write('EndGlobal\r\n') |
337 | 341 |
338 f.close() | 342 f.close() |
OLD | NEW |