[gnome-builder] build the buildstream plugin as part of the plugins



commit 0b24c50a380b0861e11dce97c2b5f51c756a3652
Author: Adam Jones <adam jones codethink co uk>
Date:   Thu Mar 14 17:46:19 2019 +0000

    build the buildstream plugin as part of the plugins

 src/plugins/buildstream/buildstream_plugin.py | 25 +++++++++++++++++++------
 src/plugins/buildstream/meson.build           |  9 +++++++++
 2 files changed, 28 insertions(+), 6 deletions(-)
---
diff --git a/src/plugins/buildstream/buildstream_plugin.py b/src/plugins/buildstream/buildstream_plugin.py
index 1d4f36746..9cfbb6f1e 100644
--- a/src/plugins/buildstream/buildstream_plugin.py
+++ b/src/plugins/buildstream/buildstream_plugin.py
@@ -5,7 +5,6 @@ from gi.repository import GObject
 class BuildStreamBuildSystemDiscovery(Ide.SimpleBuildSystemDiscovery):
     def __init__(self, *args, **kwargs):
         super().__init__(*args, **kwargs)
-        print('find bst file............................\n')
         self.props.glob = 'project.conf'
         self.props.hint = 'buildstream_plugin'
         self.props.priority = 4000
@@ -14,7 +13,7 @@ class BuildStreamBuildSystem(Ide.Object, Ide.BuildSystem):
     project_file = GObject.Property(type=Gio.File)
 
     def do_get_id(self):
-        return 'buildstream'
+        return 'BuildStream'
 
     def do_get_display(self):
         return 'BuildStream'
@@ -28,14 +27,28 @@ class BuildStreamPipelineAddin(Ide.Object, Ide.PipelineAddin):
 
         context = self.get_context()
 
-        print(context)
-
         build_system = Ide.BuildSystem.from_context(context)
 
         if type(build_system) != BuildStreamBuildSystem:
             return
 
+        config = pipeline.get_config()
+        builddir = pipeline.get_builddir()
+        runtime = config.get_runtime()
+        srcdir = pipeline.get_srcdir()
+
+        if not runtime.contains_program_in_path('bst'):
+            raise OSError('The runtime must contain bst to build BuildStream projects')
+
         build_launcher = pipeline.create_launcher()
         build_launcher.set_cwd(srcdir)
-        build_launcher.push_argv("bst")
-        build_launcher.push_argv('compile')
+        build_launcher.push_argv('bst')
+        build_launcher.push_argv('build')
+
+        build_stage = Ide.PipelineStageLauncher.new(context, build_launcher)
+        build_stage.set_name(_("Building project"))
+        build_stage.connect('query', self._query)
+        self.track(pipeline.attach(Ide.PipelinePhase.BUILD, 0, build_stage))
+
+        def _query(self, stage, pipeline, targets, cancellable):
+            stage.set_completed(False)
diff --git a/src/plugins/buildstream/meson.build b/src/plugins/buildstream/meson.build
new file mode 100644
index 000000000..6b7835a94
--- /dev/null
+++ b/src/plugins/buildstream/meson.build
@@ -0,0 +1,9 @@
+install_data('buildstream_plugin.py', install_dir: plugindir)
+
+configure_file(
+    input: 'buildstream.plugin',
+    output: 'buildstream.plugin',
+    configuration: config_h,
+    install: true,
+    install_dir: plugindir,
+)


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