[gnome-builder] plugins/flatpak: allow using flatpak runtime without manifest
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] plugins/flatpak: allow using flatpak runtime without manifest
- Date: Tue, 11 Oct 2022 16:18:29 +0000 (UTC)
commit 4294ec263fe847c5b1f5f5b638e284fd51f79197
Author: Christian Hergert <chergert redhat com>
Date: Tue Oct 11 11:18:06 2022 -0500
plugins/flatpak: allow using flatpak runtime without manifest
This allows you to select a runtime (like org.gnome.Sdk//master) from the
build configuration and use it to build even if you're not using a
Flatpak manifest.
Of course, you won't get any dependency management or proper flags passed
for build-options, finish-args, etc but you can build basic things.
If you want access to SDK extensions, they're generally mapped in auto-
matically, but you'll need to modify $PATH using an environment variable
in the build configuration.
src/plugins/flatpak/gbp-flatpak-pipeline-addin.c | 34 +++++++++++++-----------
1 file changed, 19 insertions(+), 15 deletions(-)
---
diff --git a/src/plugins/flatpak/gbp-flatpak-pipeline-addin.c
b/src/plugins/flatpak/gbp-flatpak-pipeline-addin.c
index 299f567f2..9de084aa7 100644
--- a/src/plugins/flatpak/gbp-flatpak-pipeline-addin.c
+++ b/src/plugins/flatpak/gbp-flatpak-pipeline-addin.c
@@ -718,19 +718,20 @@ gbp_flatpak_pipeline_addin_load (IdePipelineAddin *addin,
{
GbpFlatpakPipelineAddin *self = (GbpFlatpakPipelineAddin *)addin;
g_autoptr(GError) error = NULL;
- IdeConfig *config;
+ const char *runtime_id;
IdeContext *context;
+ IdeConfig *config;
g_assert (GBP_IS_FLATPAK_PIPELINE_ADDIN (self));
g_assert (IDE_IS_PIPELINE (pipeline));
+ context = ide_object_get_context (IDE_OBJECT (self));
config = ide_pipeline_get_config (pipeline);
+ runtime_id = ide_config_get_runtime_id (config);
- if (!GBP_IS_FLATPAK_MANIFEST (config))
- {
- g_message ("Not using flatpak manifest, refusing to add flatpak build pipeline stages");
- return;
- }
+ /* We must at least be using a flatpak runtime */
+ if (runtime_id == NULL || !g_str_has_prefix (runtime_id, "flatpak:"))
+ return;
sniff_flatpak_builder_version (self);
@@ -752,17 +753,20 @@ gbp_flatpak_pipeline_addin_load (IdePipelineAddin *addin,
NULL);
}
- /*
- * TODO: We should add the ability to mark a pipeline as broken, if we
- * detect something that is alarming. That will prevent builds from
- * occuring altogether and allow us to present issues within the UI.
- */
+ if (!register_mkdirs_stage (self, pipeline, context, &error) ||
+ !register_build_init_stage (self, pipeline, context, &error))
+ {
+ ide_object_warning (pipeline,
+ "Failed to configure flatpak pipeline: %s",
+ error->message);
+ return;
+ }
- context = ide_object_get_context (IDE_OBJECT (self));
+ /* We can't do anything more unless we have a flatpak manifest */
+ if (!GBP_IS_FLATPAK_MANIFEST (config))
+ return;
- if (!register_mkdirs_stage (self, pipeline, context, &error) ||
- !register_build_init_stage (self, pipeline, context, &error) ||
- !register_downloads_stage (self, pipeline, context, &error) ||
+ if (!register_downloads_stage (self, pipeline, context, &error) ||
!register_dependencies_stage (self, pipeline, context, &error) ||
!register_build_finish_stage (self, pipeline, context, &error) ||
!register_build_export_stage (self, pipeline, context, &error) ||
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]