[gnome-builder] refactor: rename can_install to provides
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] refactor: rename can_install to provides
- Date: Thu, 18 Feb 2021 21:10:27 +0000 (UTC)
commit dc50dae900fa93a678c9eb766304225d70d1c40c
Author: peter <blackwolf12333 gmail com>
Date: Thu Feb 18 17:29:36 2021 +0100
refactor: rename can_install to provides
The reasoning behind this is as follows: A runtime might
need more time to finish setting up than is allowed in the
synch `_load`. In that case the provider extension will want
to indicate that it is able to provide the runtime for
the configured runtime_id, but that it's not yet ready.
The manager can then start the bootstrap process and allow
the provider to finish setting up, and then let the manager
know that it is done. So that the build manager knows when
the pipeline is configured and ready to go.
src/libide/foundry/ide-runtime-manager.c | 13 ++++++++++---
src/libide/foundry/ide-runtime-provider.c | 8 ++++----
src/libide/foundry/ide-runtime-provider.h | 6 +++---
src/plugins/flatpak/gbp-flatpak-runtime-provider.c | 4 ++--
4 files changed, 19 insertions(+), 12 deletions(-)
---
diff --git a/src/libide/foundry/ide-runtime-manager.c b/src/libide/foundry/ide-runtime-manager.c
index 976339d06..b12cb1707 100644
--- a/src/libide/foundry/ide-runtime-manager.c
+++ b/src/libide/foundry/ide-runtime-manager.c
@@ -280,7 +280,7 @@ ide_runtime_manager_get_runtime (IdeRuntimeManager *self,
}
static void
-install_lookup_cb (IdeExtensionSetAdapter *set,
+provides_lookup_cb (IdeExtensionSetAdapter *set,
PeasPluginInfo *plugin,
IdeRuntimeProvider *provider,
InstallLookup *lookup)
@@ -295,7 +295,7 @@ install_lookup_cb (IdeExtensionSetAdapter *set,
if (lookup->provider == NULL)
{
- if (ide_runtime_provider_can_install (provider, lookup->runtime_id))
+ if (ide_runtime_provider_provides (provider, lookup->runtime_id))
lookup->provider = provider;
}
}
@@ -376,8 +376,15 @@ _ide_runtime_manager_prepare_async (IdeRuntimeManager *self,
*/
lookup.runtime_id = runtime_id;
+
+ /*
+ * Detect extensions that are a runtime-provider for the configured runtime_id.
+ * Providers might need more time to finish setting up, but they can indicate here
+ * that they do provide the runtime for the current runtime_id. The runtime can then
+ * use the bootstrap_async method to finish the setup and let us know when it's ready.
+ */
ide_extension_set_adapter_foreach (self->extensions,
- (IdeExtensionSetAdapterForeachFunc) install_lookup_cb,
+ (IdeExtensionSetAdapterForeachFunc) provides_lookup_cb,
&lookup);
if (lookup.provider == NULL)
diff --git a/src/libide/foundry/ide-runtime-provider.c b/src/libide/foundry/ide-runtime-provider.c
index b5fbb8409..d340fc173 100644
--- a/src/libide/foundry/ide-runtime-provider.c
+++ b/src/libide/foundry/ide-runtime-provider.c
@@ -46,7 +46,7 @@ ide_runtime_provider_real_unload (IdeRuntimeProvider *self,
}
static gboolean
-ide_runtime_provider_real_can_install (IdeRuntimeProvider *self,
+ide_runtime_provider_real_provides (IdeRuntimeProvider *self,
const gchar *runtime_id)
{
return FALSE;
@@ -168,7 +168,7 @@ ide_runtime_provider_default_init (IdeRuntimeProviderInterface *iface)
{
iface->load = ide_runtime_provider_real_load;
iface->unload = ide_runtime_provider_real_unload;
- iface->can_install = ide_runtime_provider_real_can_install;
+ iface->provides = ide_runtime_provider_real_provides;
iface->install_async = ide_runtime_provider_real_install_async;
iface->install_finish = ide_runtime_provider_real_install_finish;
iface->bootstrap_async = ide_runtime_provider_real_bootstrap_async;
@@ -196,13 +196,13 @@ ide_runtime_provider_unload (IdeRuntimeProvider *self,
}
gboolean
-ide_runtime_provider_can_install (IdeRuntimeProvider *self,
+ide_runtime_provider_provides (IdeRuntimeProvider *self,
const gchar *runtime_id)
{
g_return_val_if_fail (IDE_IS_RUNTIME_PROVIDER (self), FALSE);
g_return_val_if_fail (runtime_id != NULL, FALSE);
- return IDE_RUNTIME_PROVIDER_GET_IFACE (self)->can_install (self, runtime_id);
+ return IDE_RUNTIME_PROVIDER_GET_IFACE (self)->provides (self, runtime_id);
}
void
diff --git a/src/libide/foundry/ide-runtime-provider.h b/src/libide/foundry/ide-runtime-provider.h
index 9e7b441a9..e485b50aa 100644
--- a/src/libide/foundry/ide-runtime-provider.h
+++ b/src/libide/foundry/ide-runtime-provider.h
@@ -43,7 +43,7 @@ struct _IdeRuntimeProviderInterface
IdeRuntimeManager *manager);
void (*unload) (IdeRuntimeProvider *self,
IdeRuntimeManager *manager);
- gboolean (*can_install) (IdeRuntimeProvider *self,
+ gboolean (*provides) (IdeRuntimeProvider *self,
const gchar *runtime_id);
void (*install_async) (IdeRuntimeProvider *self,
const gchar *runtime_id,
@@ -69,8 +69,8 @@ void ide_runtime_provider_load (IdeRuntimeProvider *self,
IDE_AVAILABLE_IN_3_32
void ide_runtime_provider_unload (IdeRuntimeProvider *self,
IdeRuntimeManager *manager);
-IDE_AVAILABLE_IN_3_32
-gboolean ide_runtime_provider_can_install (IdeRuntimeProvider *self,
+IDE_AVAILABLE_IN_3_40
+gboolean ide_runtime_provider_provides (IdeRuntimeProvider *self,
const gchar *runtime_id);
IDE_AVAILABLE_IN_3_32
void ide_runtime_provider_install_async (IdeRuntimeProvider *self,
diff --git a/src/plugins/flatpak/gbp-flatpak-runtime-provider.c
b/src/plugins/flatpak/gbp-flatpak-runtime-provider.c
index 87cc650b5..1fa5c17e7 100644
--- a/src/plugins/flatpak/gbp-flatpak-runtime-provider.c
+++ b/src/plugins/flatpak/gbp-flatpak-runtime-provider.c
@@ -263,7 +263,7 @@ gbp_flatpak_runtime_provider_init (GbpFlatpakRuntimeProvider *self)
}
static gboolean
-gbp_flatpak_runtime_provider_can_install (IdeRuntimeProvider *provider,
+gbp_flatpak_runtime_provider_provides (IdeRuntimeProvider *provider,
const gchar *runtime_id)
{
g_assert (GBP_IS_FLATPAK_RUNTIME_PROVIDER (provider));
@@ -857,7 +857,7 @@ runtime_provider_iface_init (IdeRuntimeProviderInterface *iface)
{
iface->load = gbp_flatpak_runtime_provider_load;
iface->unload = gbp_flatpak_runtime_provider_unload;
- iface->can_install = gbp_flatpak_runtime_provider_can_install;
+ iface->provides = gbp_flatpak_runtime_provider_provides;
iface->install_async = gbp_flatpak_runtime_provider_install_async;
iface->install_finish = gbp_flatpak_runtime_provider_install_finish;
iface->bootstrap_async = gbp_flatpak_runtime_provider_bootstrap_async;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]