Bug 1275297 - Use proper header in solution file; r?chmanchester draft
authorGregory Szorc <gps@mozilla.com>
Tue, 24 May 2016 07:58:25 -0700
changeset 370385 4dbf3bb3f333a8d90c29579774965813ccae8e8e
parent 370285 829d3be6ba648b838ee1953fdfa1a477dace752f
child 370386 043e6eb0a33da1c4d8c060bba4f842aa557056ae
push id19044
push userbmo:gps@mozilla.com
push dateTue, 24 May 2016 15:48:33 +0000
reviewerschmanchester
bugs1275297
milestone49.0a1
Bug 1275297 - Use proper header in solution file; r?chmanchester Upon further examination, VS2013 and VS2015 share the same file format version. They also write the internal version number in a comment, not the user-facing production version. MozReview-Commit-ID: 92HB0pEzeI6
python/mozbuild/mozbuild/backend/visualstudio.py
--- a/python/mozbuild/mozbuild/backend/visualstudio.py
+++ b/python/mozbuild/mozbuild/backend/visualstudio.py
@@ -32,21 +32,21 @@ from ..frontend.data import (
 from mozbuild.base import ExecutionSummary
 
 
 MSBUILD_NAMESPACE = 'http://schemas.microsoft.com/developer/msbuild/2003'
 
 def get_id(name):
     return str(uuid.uuid5(uuid.NAMESPACE_URL, name)).upper()
 
-def visual_studio_product_to_internal_version(version, solution=False):
+def visual_studio_product_to_solution_version(version):
     if version == '2013':
-        return '12.00'
+        return '12.00', '12'
     elif version == '2015':
-        return '14.00'
+        return '12.00', '14'
     else:
         raise Exception('Unknown version seen: %s' % version)
 
 def visual_studio_product_to_platform_toolset_version(version):
     if version == '2013':
         return 'v120'
     elif version == '2015':
         return 'v140'
@@ -247,24 +247,24 @@ class VisualStudioBackend(CommonBackend)
                 sources=sources,
                 debugger=debugger)
 
             projects[basename] = (project_id, basename, item)
 
         return projects
 
     def _write_solution(self, fh, projects):
-        version = visual_studio_product_to_internal_version(self._version, True)
+        format_version, comment_version = visual_studio_product_to_solution_version(self._version)
         # This is a Visual C++ Project type.
         project_type = '8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942'
 
         # Visual Studio seems to require this header.
         fh.write('Microsoft Visual Studio Solution File, Format Version %s\r\n' %
-            version)
-        fh.write('# Visual Studio %s\r\n' % self._version)
+                 format_version)
+        fh.write('# Visual Studio %s\r\n' % comment_version)
 
         binaries_id = projects['target_binaries'][0]
 
         # Write out entries for each project.
         for key in sorted(projects):
             project_id, basename, name = projects[key]
             path = os.path.join(self._projsubdir, '%s.vcxproj' % basename)