Bug 1057986 - Change the location of the eclipse workspace to be along side the srcdir. r=gps
authorBenoit Girard <b56girard@gmail.com>
Wed, 03 Sep 2014 16:09:36 -0400
changeset 203461 00275cee2708cf01ca8738e04215245fd20d4429
parent 203460 d13a843f2163ea58c91ff995d927b4b9ad361eb0
child 203462 decfb59e691c37e0615862f4fefdaaedd3ffef06
push id27428
push usercbook@mozilla.com
push dateThu, 04 Sep 2014 13:00:04 +0000
treeherdermozilla-central@7bfd030e8fc8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1057986
milestone35.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1057986 - Change the location of the eclipse workspace to be along side the srcdir. r=gps
python/mozbuild/mozbuild/backend/cpp_eclipse.py
--- a/python/mozbuild/mozbuild/backend/cpp_eclipse.py
+++ b/python/mozbuild/mozbuild/backend/cpp_eclipse.py
@@ -21,17 +21,17 @@ from ..frontend.data import (
 class CppEclipseBackend(CommonBackend):
     """Backend that generates Cpp Eclipse project files.
     """
 
     def _init(self):
         CommonBackend._init(self)
 
         self._paths_to_defines = {}
-        self._workspace_dir = os.path.join(self.environment.topobjdir, 'eclipse_workspace')
+        self._workspace_dir = self.get_workspace_path()
         self._project_dir = os.path.join(self._workspace_dir, 'gecko')
 
         self._macbundle = self.environment.substs['MOZ_MACBUNDLE_NAME']
         self._appname = self.environment.substs['MOZ_APP_NAME']
         self._bin_suffix = self.environment.substs['BIN_SUFFIX']
         self._cxx = self.environment.substs['CXX']
         # Note: We need the C Pre Processor (CPP) flags, not the CXX flags
         self._cppflags = self.environment.substs.get('CPPFLAGS', '')
@@ -43,16 +43,24 @@ class CppEclipseBackend(CommonBackend):
                    'NOTE: This will take about 10 minutes.\n\n' \
                    'Run with: eclipse -data %s\n' \
                    'Import the project using File > Import > General > Existing Project into workspace') \
                    % (self._workspace_dir, self._workspace_dir, self._project_dir, self._workspace_dir)
 
         self.summary.backend_detailed_summary = types.MethodType(detailed,
             self.summary)
 
+    def get_workspace_path(self):
+        # Eclipse doesn't support having the workspace inside the srcdir.
+        # Since most people have their objdir inside their srcdir it's easier
+        # and more consistent to just put the workspace along side the srcdir
+        srcdir_parent = os.path.dirname(self.environment.topsrcdir)
+        workspace_dirname = "eclipse_" + os.path.basename(self.environment.topobjdir)
+        return os.path.join(srcdir_parent, workspace_dirname)
+
     def consume_object(self, obj):
         obj.ack()
 
         reldir = getattr(obj, 'relativedir', None)
 
         # Note that unlike VS, Eclipse' indexer seem to crawl the headers and
         # isn't picky about the local includes.
         if isinstance(obj, Defines):