[gnome-builder/wip/chergert/deviced] buildsystem: give buildsystem pipeline to get builddir
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/chergert/deviced] buildsystem: give buildsystem pipeline to get builddir
- Date: Mon, 5 Mar 2018 03:49:55 +0000 (UTC)
commit 3f638e4b47f6759614f7d9ba097e6253e8388f78
Author: Christian Hergert <chergert redhat com>
Date: Sun Mar 4 19:19:36 2018 -0800
buildsystem: give buildsystem pipeline to get builddir
When figuring out the build directory, we need access to the
pipeline. This gives us more flexibility in case we need more
stuff in the future.
It does mean we need to delay when we get the builddir, but that
is a bit easier now.
src/libide/buildsystem/ide-build-pipeline.c | 15 ++++++++++----
src/libide/buildsystem/ide-build-system.c | 23 +++++++++++-----------
src/libide/buildsystem/ide-build-system.h | 6 ++----
src/plugins/autotools/ide-autotools-build-system.c | 6 ++----
src/plugins/make/make_plugin.py | 4 ++--
src/plugins/meson/gbp-meson-build-system.c | 10 +++++-----
6 files changed, 33 insertions(+), 31 deletions(-)
---
diff --git a/src/libide/buildsystem/ide-build-pipeline.c b/src/libide/buildsystem/ide-build-pipeline.c
index b7f4b31c3..dc1ba1932 100644
--- a/src/libide/buildsystem/ide-build-pipeline.c
+++ b/src/libide/buildsystem/ide-build-pipeline.c
@@ -1325,7 +1325,6 @@ static void
ide_build_pipeline_constructed (GObject *object)
{
IdeBuildPipeline *self = IDE_BUILD_PIPELINE (object);
- IdeBuildSystem *build_system;
IdeContext *context;
IdeVcs *vcs;
GFile *workdir;
@@ -1337,12 +1336,10 @@ ide_build_pipeline_constructed (GObject *object)
g_assert (IDE_IS_CONFIGURATION (self->configuration));
context = ide_object_get_context (IDE_OBJECT (self));
- build_system = ide_context_get_build_system (context);
vcs = ide_context_get_vcs (context);
workdir = ide_vcs_get_working_directory (vcs);
self->srcdir = g_file_get_path (workdir);
- self->builddir = ide_build_system_get_builddir (build_system, self->configuration, self->device);
IDE_EXIT;
}
@@ -3631,7 +3628,17 @@ _ide_build_pipeline_set_runtime (IdeBuildPipeline *self,
g_return_if_fail (IDE_IS_BUILD_PIPELINE (self));
g_return_if_fail (!runtime || IDE_IS_RUNTIME (runtime));
- g_set_object (&self->runtime, runtime);
+ if (g_set_object (&self->runtime, runtime))
+ {
+ IdeBuildSystem *build_system;
+ IdeContext *context;
+
+ context = ide_object_get_context (IDE_OBJECT (self));
+ build_system = ide_context_get_build_system (context);
+
+ g_clear_pointer (&self->builddir, g_free);
+ self->builddir = ide_build_system_get_builddir (build_system, self);
+ }
}
/**
diff --git a/src/libide/buildsystem/ide-build-system.c b/src/libide/buildsystem/ide-build-system.c
index 4d0f705c7..6a3f91d20 100644
--- a/src/libide/buildsystem/ide-build-system.c
+++ b/src/libide/buildsystem/ide-build-system.c
@@ -513,42 +513,41 @@ ide_build_system_get_build_flags_for_files_finish (IdeBuildSystem *self,
gchar *
ide_build_system_get_builddir (IdeBuildSystem *self,
- IdeConfiguration *configuration,
- IdeDevice *device)
+ IdeBuildPipeline *pipeline)
{
gchar *ret = NULL;
IDE_ENTRY;
g_return_val_if_fail (IDE_IS_BUILD_SYSTEM (self), NULL);
- g_return_val_if_fail (IDE_IS_CONFIGURATION (configuration), NULL);
- g_return_val_if_fail (IDE_IS_DEVICE (device), NULL);
+ g_return_val_if_fail (IDE_IS_BUILD_PIPELINE (pipeline), NULL);
if (IDE_BUILD_SYSTEM_GET_IFACE (self)->get_builddir)
- ret = IDE_BUILD_SYSTEM_GET_IFACE (self)->get_builddir (self, configuration, device);
+ ret = IDE_BUILD_SYSTEM_GET_IFACE (self)->get_builddir (self, pipeline);
if (ret == NULL)
{
g_autofree gchar *name = NULL;
g_autofree gchar *branch = NULL;
+ IdeConfiguration *config;
const gchar *config_id;
- const gchar *device_id;
const gchar *runtime_id;
+ IdeRuntime *runtime;
IdeContext *context;
IdeVcs *vcs;
context = ide_object_get_context (IDE_OBJECT (self));
vcs = ide_context_get_vcs (context);
-
- config_id = ide_configuration_get_id (configuration);
- device_id = ide_device_get_id (device);
- runtime_id = ide_configuration_get_runtime_id (configuration);
+ config = ide_build_pipeline_get_configuration (pipeline);
+ config_id = ide_configuration_get_id (config);
+ runtime = ide_build_pipeline_get_runtime (pipeline);
+ runtime_id = ide_runtime_get_id (runtime);
branch = ide_vcs_get_branch_name (vcs);
if (branch != NULL)
- name = g_strdup_printf ("%s-%s-%s-%s", config_id, device_id, runtime_id, branch);
+ name = g_strdup_printf ("%s-%s-%s", config_id, runtime_id, branch);
else
- name = g_strdup_printf ("%s-%s-%s", config_id, device_id, runtime_id);
+ name = g_strdup_printf ("%s-%s", config_id, runtime_id);
g_strdelimit (name, "@:/", '-');
diff --git a/src/libide/buildsystem/ide-build-system.h b/src/libide/buildsystem/ide-build-system.h
index 87680da93..e658bcb79 100644
--- a/src/libide/buildsystem/ide-build-system.h
+++ b/src/libide/buildsystem/ide-build-system.h
@@ -52,8 +52,7 @@ struct _IdeBuildSystemInterface
GAsyncResult *result,
GError **error);
gchar *(*get_builddir) (IdeBuildSystem *self,
- IdeConfiguration *configuration,
- IdeDevice *device);
+ IdeBuildPipeline *pipeline);
gchar *(*get_id) (IdeBuildSystem *self);
gchar *(*get_display_name) (IdeBuildSystem *self);
};
@@ -76,8 +75,7 @@ IDE_AVAILABLE_IN_ALL
gint ide_build_system_get_priority (IdeBuildSystem *self);
IDE_AVAILABLE_IN_3_28
gchar *ide_build_system_get_builddir (IdeBuildSystem *self,
- IdeConfiguration *configuration,
- IdeDevice *device);
+ IdeBuildPipeline *pipeline);
IDE_AVAILABLE_IN_ALL
void ide_build_system_get_build_flags_async (IdeBuildSystem *self,
IdeFile *file,
diff --git a/src/plugins/autotools/ide-autotools-build-system.c
b/src/plugins/autotools/ide-autotools-build-system.c
index f52305b9f..01f44f6ce 100644
--- a/src/plugins/autotools/ide-autotools-build-system.c
+++ b/src/plugins/autotools/ide-autotools-build-system.c
@@ -494,8 +494,7 @@ ide_autotools_build_system_get_build_flags_finish (IdeBuildSystem *build_system
static gchar *
ide_autotools_build_system_get_builddir (IdeBuildSystem *build_system,
- IdeConfiguration *configuration,
- IdeDevice *device)
+ IdeBuildPipeline *pipeline)
{
IdeAutotoolsBuildSystem *self = (IdeAutotoolsBuildSystem *)build_system;
g_autoptr(GFile) makefile = NULL;
@@ -504,8 +503,7 @@ ide_autotools_build_system_get_builddir (IdeBuildSystem *build_system,
GFile *workdir;
g_assert (IDE_IS_AUTOTOOLS_BUILD_SYSTEM (self));
- g_assert (IDE_IS_CONFIGURATION (configuration));
- g_assert (IDE_IS_DEVICE (device));
+ g_assert (IDE_IS_BUILD_PIPELINE (pipeline));
/*
* If there is a Makefile in the build directory, then the project has been
diff --git a/src/plugins/make/make_plugin.py b/src/plugins/make/make_plugin.py
index 5738f8b83..56e1d684e 100644
--- a/src/plugins/make/make_plugin.py
+++ b/src/plugins/make/make_plugin.py
@@ -65,7 +65,7 @@ class MakeBuildSystem(Ide.Object, Ide.BuildSystem, Gio.AsyncInitable):
def do_get_priority(self):
return 0
- def do_get_builddir(self, config, device):
+ def do_get_builddir(self, pipeline):
context = self.get_context()
return context.get_vcs().get_working_directory().get_path()
@@ -103,7 +103,7 @@ class MakePipelineAddin(Ide.Object, Ide.BuildPipelineAddin):
make = config.getenv('MAKE') or "make"
srcdir = context.get_vcs().get_working_directory().get_path()
- builddir = build_system.get_builddir(config)
+ builddir = pipeline.get_builddir()
# Register the build launcher which will perform the incremental
# build of the project when the Ide.BuildPhase.BUILD phase is
diff --git a/src/plugins/meson/gbp-meson-build-system.c b/src/plugins/meson/gbp-meson-build-system.c
index b200b34a5..cf71d5a02 100644
--- a/src/plugins/meson/gbp-meson-build-system.c
+++ b/src/plugins/meson/gbp-meson-build-system.c
@@ -625,22 +625,22 @@ gbp_meson_build_system_get_build_flags_for_files_finish (IdeBuildSystem *build_
static gchar *
gbp_meson_build_system_get_builddir (IdeBuildSystem *build_system,
- IdeConfiguration *configuration,
- IdeDevice *device)
+ IdeBuildPipeline *pipeline)
{
GbpMesonBuildSystem *self = (GbpMesonBuildSystem *)build_system;
+ IdeConfiguration *config;
IdeBuildLocality locality;
g_assert (GBP_IS_MESON_BUILD_SYSTEM (self));
- g_assert (IDE_IS_CONFIGURATION (configuration));
- g_assert (IDE_IS_DEVICE (device));
+ g_assert (IDE_IS_BUILD_PIPELINE (pipeline));
/*
* If the build configuration requires that we do an in tree build (yuck),
* then use "_build" as our build directory to build in-tree.
*/
- locality = ide_configuration_get_locality (configuration);
+ config = ide_build_pipeline_get_configuration (pipeline);
+ locality = ide_configuration_get_locality (config);
if ((locality & IDE_BUILD_LOCALITY_OUT_OF_TREE) == 0)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]