[gnome-builder] make: Set directory of build launchers



commit 100c5e6a7336a5daa388301a1c31fa138d65aea5
Author: Matthew Leeds <mleeds redhat com>
Date:   Fri Mar 24 11:43:00 2017 -0500

    make: Set directory of build launchers
    
    This sets the working directory of the launchers (for make, make clean,
    etc.) to the directory containing the Makefile, which is important in
    case it's a subdirectory of the root project directory (the one with
    .git/).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=780499

 plugins/make/make_plugin/__init__.py |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/plugins/make/make_plugin/__init__.py b/plugins/make/make_plugin/__init__.py
index 4108ce3..dc4c200 100644
--- a/plugins/make/make_plugin/__init__.py
+++ b/plugins/make/make_plugin/__init__.py
@@ -29,6 +29,7 @@ _ = Ide.gettext
 
 class MakeBuildSystem(Ide.Object, Ide.BuildSystem, Gio.AsyncInitable):
     project_file = GObject.Property(type=Gio.File)
+    make_dir = GObject.Property(type=Gio.File)
 
     def do_init_async(self, priority, cancel, callback, data=None):
         task = Gio.Task.new(self, cancel, callback)
@@ -37,11 +38,13 @@ class MakeBuildSystem(Ide.Object, Ide.BuildSystem, Gio.AsyncInitable):
         # TODO: Be async here also
         project_file = self.get_context().get_project_file()
         if project_file.get_basename() == 'Makefile':
+            self.props.make_dir = project_file.get_parent()
             task.return_boolean(True)
         else:
             child = project_file.get_child('Makefile')
             exists = child.query_exists(cancel)
             if exists:
+                self.props.make_dir = project_file
                 self.props.project_file = child
             task.return_boolean(exists)
 
@@ -74,6 +77,8 @@ class MakeBuildSystem(Ide.Object, Ide.BuildSystem, Gio.AsyncInitable):
         if result.propagate_boolean():
             return result.build_targets
 
+    def get_make_dir(self):
+        return self.props.make_dir
 
 class MakePipelineAddin(Ide.Object, Ide.BuildPipelineAddin):
     """
@@ -102,11 +107,13 @@ class MakePipelineAddin(Ide.Object, Ide.BuildPipelineAddin):
         # build of the project when the Ide.BuildPhase.BUILD phase is
         # requested of the pipeline.
         build_launcher = pipeline.create_launcher()
+        build_launcher.set_cwd(build_system.get_make_dir().get_path())
         build_launcher.push_argv(make)
         if config.props.parallelism > 0:
             build_launcher.push_argv('-j{}'.format(config.props.parallelism))
 
         clean_launcher = pipeline.create_launcher()
+        clean_launcher.set_cwd(build_system.get_make_dir().get_path())
         clean_launcher.push_argv(make)
         clean_launcher.push_argv('clean')
 
@@ -119,6 +126,7 @@ class MakePipelineAddin(Ide.Object, Ide.BuildPipelineAddin):
         # "make install" when the Ide.BuildPhase.INSTALL phase
         # is requested of the pipeline.
         install_launcher = pipeline.create_launcher()
+        install_launcher.set_cwd(build_system.get_make_dir().get_path())
         install_launcher.push_argv(make)
         install_launcher.push_argv('install')
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]