Bug 1275297 - Create Visual Studio project files by default on Windows; r=glandium
authorGregory Szorc <gps@mozilla.com>
Tue, 24 May 2016 08:47:24 -0700
changeset 327826 3b9f92c4aeeefba589dc360368bc3350f729a991
parent 327825 4472f0c5c39204141ae4264ed67afbe7a56f326d
child 327827 0ab9f64ac47cd6ce83e645fe5720db97b491c5fc
push idunknown
push userunknown
push dateunknown
Bug 1275297 - Create Visual Studio project files by default on Windows; r=glandium Now that the VisualStudio backend will no-op if nothing has changed, it should be safe to always run this backend. On first run, backend generation takes ~3.5s on my machine. On subsequent run, it takes ~1.5s. Wall time for a no-op config.status is now ~15.7s. We could like make the Visual Studio backend faster by not writing so many project files. But this would require consolidating libraries in moz.build files. And that's out of scope for this change. We drop the check for MSVS_VERSION because it won't always be defined on MinGW/GCC builds. We simply default to "2015" if it isn't set. MozReview-Commit-ID: 5W38HMGmcuV
--- a/moz.configure
+++ b/moz.configure
@@ -104,22 +104,25 @@ include(memory_include)
 @imports(_from='mozbuild.backend', _import='backends')
 def build_backends_choices(help):
     return tuple(backends)
 option('--enable-build-backend', nargs='+', choices=build_backends_choices,
        help='Enable additional build backends')
-@depends('--enable-build-backend', '--enable-artifact-builds')
-def build_backend(backends, artifact_builds):
+@depends('--enable-build-backend', '--enable-artifact-builds', target,
+         compile_environment)
+def build_backend(backends, artifact_builds, target, compile_environment):
     if artifact_builds:
         all_backends = ['FasterMake+RecursiveMake']
         all_backends = ['RecursiveMake', 'FasterMake']
+    if target.os == 'WINNT' and compile_environment:
+        all_backends.append('VisualStudio')
     return unique_list(all_backends)
 set_config('BUILD_BACKENDS', build_backend)
 # Awk detection
 # ==============================================================
--- a/python/mozbuild/mozbuild/backend/visualstudio.py
+++ b/python/mozbuild/mozbuild/backend/visualstudio.py
@@ -65,19 +65,17 @@ class VisualStudioBackend(CommonBackend)
     def _init(self):
         # These should eventually evolve into parameters.
         self._out_dir = os.path.join(self.environment.topobjdir, 'msvc')
         self._projsubdir = 'projects'
-        self._version = self.environment.substs.get('MSVS_VERSION', None)
-        if not self._version:
-            raise Exception('MSVS_VERSION not defined; this should never happen')
+        self._version = self.environment.substs.get('MSVS_VERSION', '2015')
         self._paths_to_sources = {}
         self._paths_to_includes = {}
         self._paths_to_defines = {}
         self._paths_to_configs = {}
         self._libs_to_paths = {}
         self._progs_to_paths = {}