[gnome-builder/wip/chergert/perspective] build: fix in-tree subprocess worker
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/chergert/perspective] build: fix in-tree subprocess worker
- Date: Fri, 20 Nov 2015 11:43:50 +0000 (UTC)
commit 0209167394b3db0476f2dcf31e90779a9b8bca1d
Author: Christian Hergert <christian hergert me>
Date: Fri Nov 20 03:16:23 2015 -0800
build: fix in-tree subprocess worker
This lets us spawn gnome-builder-worker from in-tree and both locate
the file and deal with lt-* wrappers.
This is no longer necessary since we ship gnome-builder-worker now.
They are both essentially the same process since all the work happens
in libide, but 20k isn't significantly different from doing a symlink.
I'm not against doing a symlink for this either though if someone knows
the automake trick for that.
Makefile.am | 4 ++
libide/ide-application-command-line.c | 6 ++-
libide/ide-application.c | 4 +-
libide/ide-worker-manager.c | 68 +-------------------------------
libide/ide-worker-manager.h | 2 +-
src/Makefile.am | 16 ++++---
6 files changed, 24 insertions(+), 76 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 52261f0..8044e10 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -76,6 +76,7 @@ run:
GB_IN_TREE_FONTS=1 \
GI_TYPELIB_PATH="libide:src:$(GI_TYPELIB_PATH)" \
GOBJECT_DEBUG=instance-count \
+ PATH=$(top_builddir)/src:${PATH} \
$(LIBTOOL) --mode=execute gdb -ex run --args src/gnome-builder -vvvv -s
strace:
@@ -84,6 +85,7 @@ strace:
GB_IN_TREE_FONTS=1 \
GI_TYPELIB_PATH="libide:src:$(GI_TYPELIB_PATH)" \
GOBJECT_DEBUG=instance-count \
+ PATH=$(top_builddir)/src:${PATH} \
$(LIBTOOL) --mode=execute strace -T src/gnome-builder -vvvv -s
debug:
@@ -93,6 +95,7 @@ debug:
GI_TYPELIB_PATH="libide:src:$(GI_TYPELIB_PATH)" \
G_DEBUG=fatal-criticals \
GOBJECT_DEBUG=instance-count \
+ PATH=$(top_builddir)/src:${PATH} \
$(LIBTOOL) --mode=execute gdb -ex run --args src/gnome-builder -vvvv -s
valgrind:
@@ -102,6 +105,7 @@ valgrind:
GI_TYPELIB_PATH="libide:src:$(GI_TYPELIB_PATH)" \
G_DEBUG=fatal-criticals \
G_SLICE=always-malloc \
+ PATH=$(top_builddir)/src:${PATH} \
$(LIBTOOL) --mode=execute valgrind src/gnome-builder -vvvv -s
-include $(top_srcdir)/git.mk
diff --git a/libide/ide-application-command-line.c b/libide/ide-application-command-line.c
index d48f1c2..ac69f2b 100644
--- a/libide/ide-application-command-line.c
+++ b/libide/ide-application-command-line.c
@@ -221,7 +221,8 @@ ide_application_local_command_line (GApplication *application,
* If we are the "ide" program, then we want to setup ourselves for
* verb style commands and add a commands group for help.
*/
- if (g_str_equal (g_get_prgname (), "ide"))
+ if (g_str_equal (g_get_prgname (), "ide") ||
+ g_str_equal (g_get_prgname (), "lt-ide"))
{
gchar *command_help;
@@ -233,7 +234,8 @@ ide_application_local_command_line (GApplication *application,
g_option_context_set_summary (context, command_help);
g_free (command_help);
}
- else if (g_str_equal (g_get_prgname (), "gnome-builder-worker"))
+ else if (g_str_equal (g_get_prgname (), "gnome-builder-worker") ||
+ g_str_equal (g_get_prgname (), "lt-gnome-builder-worker"))
{
self->mode = IDE_APPLICATION_MODE_WORKER;
}
diff --git a/libide/ide-application.c b/libide/ide-application.c
index ab03738..22aad8c 100644
--- a/libide/ide-application.c
+++ b/libide/ide-application.c
@@ -291,6 +291,8 @@ ide_application_activate (GApplication *application)
g_assert (IDE_IS_APPLICATION (self));
+ g_print ("~!!!! mode is %d\n", self->mode);
+
if (self->mode == IDE_APPLICATION_MODE_PRIMARY)
ide_application_activate_primary (self);
else if (self->mode == IDE_APPLICATION_MODE_WORKER)
@@ -460,7 +462,7 @@ ide_application_get_worker_async (IdeApplication *self,
return NULL;
if (self->worker_manager == NULL)
- self->worker_manager = ide_worker_manager_new ("gnome-builder-worker");
+ self->worker_manager = ide_worker_manager_new ();
task = g_task_new (self, cancellable, callback, user_data);
diff --git a/libide/ide-worker-manager.c b/libide/ide-worker-manager.c
index ea06b33..b8eceb5 100644
--- a/libide/ide-worker-manager.c
+++ b/libide/ide-worker-manager.c
@@ -35,7 +35,6 @@ struct _IdeWorkerManager
{
GObject parent_instance;
- gchar *argv0;
GDBusServer *dbus_server;
GHashTable *plugin_name_to_worker;
};
@@ -44,31 +43,6 @@ G_DEFINE_TYPE (IdeWorkerManager, ide_worker_manager, G_TYPE_OBJECT)
EGG_DEFINE_COUNTER (instances, "IdeWorkerManager", "Instances", "Number of IdeWorkerManager instances")
-enum {
- PROP_0,
- PROP_ARGV0,
- LAST_PROP
-};
-
-static GParamSpec *gParamSpecs [LAST_PROP];
-
-static void
-ide_worker_manager_set_argv0 (IdeWorkerManager *self,
- const gchar *argv0)
-{
- g_return_if_fail (IDE_IS_WORKER_MANAGER (self));
-
- if (argv0 == NULL)
- argv0 = "gnome-builder";
-
- if (g_strcmp0 (argv0, self->argv0) != 0)
- {
- g_free (self->argv0);
- self->argv0 = g_strdup (argv0);
- g_object_notify_by_pspec (G_OBJECT (self), gParamSpecs [PROP_ARGV0]);
- }
-}
-
static gboolean
ide_worker_manager_new_connection_cb (IdeWorkerManager *self,
GDBusConnection *connection,
@@ -182,7 +156,6 @@ ide_worker_manager_finalize (GObject *object)
IdeWorkerManager *self = (IdeWorkerManager *)object;
g_clear_pointer (&self->plugin_name_to_worker, g_hash_table_unref);
- g_clear_pointer (&self->argv0, g_free);
g_clear_object (&self->dbus_server);
G_OBJECT_CLASS (ide_worker_manager_parent_class)->finalize (object);
@@ -191,41 +164,12 @@ ide_worker_manager_finalize (GObject *object)
}
static void
-ide_worker_manager_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- IdeWorkerManager *self = IDE_WORKER_MANAGER (object);
-
- switch (prop_id)
- {
- case PROP_ARGV0:
- ide_worker_manager_set_argv0 (self, g_value_get_string (value));
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- }
-}
-
-static void
ide_worker_manager_class_init (IdeWorkerManagerClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->constructed = ide_worker_manager_constructed;
object_class->finalize = ide_worker_manager_finalize;
- object_class->set_property = ide_worker_manager_set_property;
-
- gParamSpecs [PROP_ARGV0] =
- g_param_spec_string ("argv0",
- _("Argv0"),
- _("The path to the process to spawn."),
- "gnome-builder",
- (G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_properties (object_class, LAST_PROP, gParamSpecs);
}
static void
@@ -233,8 +177,6 @@ ide_worker_manager_init (IdeWorkerManager *self)
{
EGG_COUNTER_INC (instances);
- self->argv0 = g_strdup ("gnome-builder");
-
self->plugin_name_to_worker =
g_hash_table_new_full (g_str_hash,
g_str_equal,
@@ -261,7 +203,7 @@ ide_worker_manager_get_worker_process (IdeWorkerManager *self,
g_dbus_server_get_client_address (self->dbus_server),
g_dbus_server_get_guid (self->dbus_server));
- worker_process = ide_worker_process_new (self->argv0, plugin_name, address);
+ worker_process = ide_worker_process_new ("gnome-builder-worker", plugin_name, address);
g_hash_table_insert (self->plugin_name_to_worker, g_strdup (plugin_name), worker_process);
ide_worker_process_run (worker_process);
}
@@ -330,11 +272,7 @@ ide_worker_manager_get_worker_finish (IdeWorkerManager *self,
}
IdeWorkerManager *
-ide_worker_manager_new (const gchar *argv0)
+ide_worker_manager_new (void)
{
- g_return_val_if_fail (argv0 != NULL, NULL);
-
- return g_object_new (IDE_TYPE_WORKER_MANAGER,
- "argv0", argv0,
- NULL);
+ return g_object_new (IDE_TYPE_WORKER_MANAGER, NULL);
}
diff --git a/libide/ide-worker-manager.h b/libide/ide-worker-manager.h
index cd56aad..c8e7ded 100644
--- a/libide/ide-worker-manager.h
+++ b/libide/ide-worker-manager.h
@@ -27,7 +27,7 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (IdeWorkerManager, ide_worker_manager, IDE, WORKER_MANAGER, GObject)
-IdeWorkerManager *ide_worker_manager_new (const gchar *argv0);
+IdeWorkerManager *ide_worker_manager_new (void);
void ide_worker_manager_get_worker_async (IdeWorkerManager *self,
const gchar *plugin_name,
GCancellable *cancellable,
diff --git a/src/Makefile.am b/src/Makefile.am
index 6c20762..3c7abb2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,8 +1,6 @@
-bin_PROGRAMS = gnome-builder
+bin_PROGRAMS = gnome-builder gnome-builder-worker
-gnome_builder_SOURCES = main.c
-
-gnome_builder_CFLAGS = \
+AM_CPPFLAGS = \
-DPACKAGE_LOCALE_DIR=\""${datadir}/locale"\" \
$(LIBIDE_CFLAGS) \
$(DEBUG_CFLAGS) \
@@ -13,14 +11,18 @@ gnome_builder_CFLAGS = \
-I$(top_srcdir)/libide \
$(NULL)
-gnome_builder_LDADD = \
+gnome_builder_libs = \
$(LIBIDE_LIBS) \
- $(top_builddir)/contrib/egg/libegg-private.la \
$(top_builddir)/data/icons/hicolor/libicons.la \
$(top_builddir)/libide/libide-1.0.la \
$(NULL)
-gnome_builder_LDFLAGS = -export-dynamic
+AM_LDFLAGS = -export-dynamic
+
+gnome_builder_SOURCES = main.c
+gnome_builder_LDADD = $(gnome_builder_libs)
+gnome_builder_worker_SOURCES = main.c
+gnome_builder_worker_LDADD = $(gnome_builder_libs)
-include $(top_srcdir)/git.mk
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]