Commit b38b970f authored by Christian Hergert's avatar Christian Hergert
Browse files

configuration: add IdeBuildLocality

This allows the build configuration to specify if it needs to
have in or out of tree builds. Flatpak can use this to propagate
the value of "builddir".
parent b12bdfc6
......@@ -22,6 +22,7 @@
#include "ide-context.h"
#include "ide-debug.h"
#include "ide-enums.h"
#include "buildsystem/ide-configuration.h"
#include "buildsystem/ide-configuration-manager.h"
......@@ -63,6 +64,8 @@ typedef struct
*/
guint device_ready : 1;
guint runtime_ready : 1;
IdeBuildLocality locality : 3;
} IdeConfigurationPrivate;
G_DEFINE_TYPE_WITH_PRIVATE (IdeConfiguration, ide_configuration, IDE_TYPE_OBJECT)
......@@ -79,6 +82,7 @@ enum {
PROP_DISPLAY_NAME,
PROP_ENVIRON,
PROP_ID,
PROP_LOCALITY,
PROP_PARALLELISM,
PROP_POST_INSTALL_COMMANDS,
PROP_PREFIX,
......@@ -432,6 +436,10 @@ ide_configuration_get_property (GObject *object,
g_value_set_string (value, ide_configuration_get_append_path (self));
break;
case PROP_LOCALITY:
g_value_set_flags (value, ide_configuration_get_locality (self));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
......@@ -511,6 +519,10 @@ ide_configuration_set_property (GObject *object,
ide_configuration_set_append_path (self, g_value_get_string (value));
break;
case PROP_LOCALITY:
ide_configuration_set_locality (self, g_value_get_flags (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
......@@ -659,6 +671,14 @@ ide_configuration_class_init (IdeConfigurationClass *klass)
NULL,
(G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));
properties [PROP_LOCALITY] =
g_param_spec_flags ("locality",
"Locality",
"Where the build may occur",
IDE_TYPE_BUILD_LOCALITY,
IDE_BUILD_LOCALITY_DEFAULT,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, N_PROPS, properties);
signals [CHANGED] =
......@@ -678,6 +698,7 @@ ide_configuration_init (IdeConfiguration *self)
priv->debug = TRUE;
priv->environment = ide_environment_new ();
priv->parallelism = -1;
priv->locality = IDE_BUILD_LOCALITY_DEFAULT;
priv->internal = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, _value_free);
......@@ -1714,3 +1735,30 @@ ide_configuration_set_append_path (IdeConfiguration *self,
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_APPEND_PATH]);
}
}
IdeBuildLocality
ide_configuration_get_locality (IdeConfiguration *self)
{
IdeConfigurationPrivate *priv = ide_configuration_get_instance_private (self);
g_return_val_if_fail (IDE_IS_CONFIGURATION (self), 0);
return priv->locality;
}
void
ide_configuration_set_locality (IdeConfiguration *self,
IdeBuildLocality locality)
{
IdeConfigurationPrivate *priv = ide_configuration_get_instance_private (self);
g_return_if_fail (IDE_IS_CONFIGURATION (self));
g_return_if_fail (locality > 0);
g_return_if_fail (locality <= IDE_BUILD_LOCALITY_DEFAULT);
if (priv->locality != locality)
{
priv->locality = locality;
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_LOCALITY]);
}
}
......@@ -31,6 +31,13 @@ G_BEGIN_DECLS
G_DECLARE_DERIVABLE_TYPE (IdeConfiguration, ide_configuration, IDE, CONFIGURATION, IdeObject)
typedef enum
{
IDE_BUILD_LOCALITY_IN_TREE = 1 << 0,
IDE_BUILD_LOCALITY_OUT_OF_TREE = 1 << 1,
IDE_BUILD_LOCALITY_DEFAULT = IDE_BUILD_LOCALITY_IN_TREE | IDE_BUILD_LOCALITY_OUT_OF_TREE,
} IdeBuildLocality;
struct _IdeConfigurationClass
{
IdeObjectClass parent;
......@@ -104,6 +111,11 @@ const gchar *ide_configuration_get_display_name (IdeConfigurat
IDE_AVAILABLE_IN_ALL
void ide_configuration_set_display_name (IdeConfiguration *self,
const gchar *display_name);
IDE_AVAILABLE_IN_3_28
IdeBuildLocality ide_configuration_get_locality (IdeConfiguration *self);
IDE_AVAILABLE_IN_3_28
void ide_configuration_set_locality (IdeConfiguration *self,
IdeBuildLocality locality);
IDE_AVAILABLE_IN_ALL
gboolean ide_configuration_get_ready (IdeConfiguration *self);
IDE_AVAILABLE_IN_ALL
......
......@@ -52,6 +52,7 @@ buildsystem_private_sources = [
buildsystem_enums = [
'ide-build-log.h',
'ide-build-pipeline.h',
'ide-configuration.h',
]
libide_enum_headers += files(buildsystem_enums)
......
......@@ -7,6 +7,7 @@
#include "buffers/ide-buffer.h"
#include "buildsystem/ide-build-log.h"
#include "buildsystem/ide-build-pipeline.h"
#include "buildsystem/ide-configuration.h"
#include "devices/ide-device.h"
#include "diagnostics/ide-diagnostic.h"
#include "doap/ide-doap.h"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment