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