Commit 3137a9a5 authored by Christian Hergert's avatar Christian Hergert

build: remove gnome-builder-cli and gnome-builder-worker

Having these programs split out was not very useful as we move to a
flatpak'd world. If we keep everything accessable via --type= then
we can allow things to work even through 'flatpak run ...'

Since we previously used a "hidden" parameter --type for the plugin
name, that has been renamed to --plugin= which is arguably a much
better choice.

Use --type=cli for the cli version and --type=worker for the plugin
worker version of gnome-builder.

For our old format, you can do something like this in your .bashrc:

Either:

  alias ide="gnome-builder --type=cli"
  alias ide="flatpak run org.gnome.Builder --type=cli"

And then:

  ide --list-commands
parent 38148868
......@@ -23,12 +23,6 @@ settings, and a bunch of other stuff.
This interface is used by plugins to hook into the application once-per UI
process. They will be loaded at startup, and shutdown with the application.
## ide-application-tool.*
This interface is used by plugins that want to expose a command line too
via the `gnome-builder-cli` command. You can add your own subcommand
like `gnome-builder-cli build`.
## ide-application-command-line.c
This file handles the machinery when we are in command-line mode. This includes
......
......@@ -170,7 +170,7 @@ ide_application_local_command_line (GApplication *application,
const gchar *shortdesc = NULL;
const gchar *prgname;
GError *error = NULL;
gchar *type = NULL;
gchar *plugin = NULL;
gchar *dbus_address = NULL;
gboolean standalone = FALSE;
gboolean version = FALSE;
......@@ -200,11 +200,11 @@ ide_application_local_command_line (GApplication *application,
&version,
N_("Show the application’s version") },
{ "type",
{ "plugin",
0,
G_OPTION_FLAG_HIDDEN,
G_OPTION_ARG_STRING,
&type },
&plugin },
{ "dbus-address",
0,
......@@ -268,7 +268,7 @@ ide_application_local_command_line (GApplication *application,
if (g_str_has_prefix (prgname, "lt-"))
prgname += strlen ("lt-");
if (g_str_equal (prgname, "gnome-builder-cli"))
if (self->mode == IDE_APPLICATION_MODE_TOOL)
{
g_assert_cmpstr (entries [0].long_name, ==, "list-commands");
entries [0].flags = 0;
......@@ -291,21 +291,13 @@ ide_application_local_command_line (GApplication *application,
* If we are the "cli" program, then we want to setup ourselves for
* verb style commands and add a commands group for help.
*/
if (g_str_equal (prgname, "gnome-builder-cli"))
if (self->mode == IDE_APPLICATION_MODE_TOOL)
{
gchar *command_help;
self->mode = IDE_APPLICATION_MODE_TOOL;
g_autofree gchar *command_help = NULL;
g_option_context_set_strict_posix (context, TRUE);
command_help = ide_application_get_command_help (self, TRUE);
g_option_context_set_summary (context, command_help);
g_free (command_help);
}
else if (g_str_equal (prgname, "gnome-builder-worker"))
{
self->mode = IDE_APPLICATION_MODE_WORKER;
}
else if (strstr (prgname, "test-") != NULL)
{
......@@ -408,9 +400,9 @@ ide_application_local_command_line (GApplication *application,
{
PeasPluginInfo *worker_plugin;
if (type == NULL)
if (plugin == NULL)
{
g_printerr ("%s\n", _("Please provide a worker type"));
g_printerr ("%s\n", _("Please provide a worker plugin"));
*exit_status = EXIT_FAILURE;
goto cleanup;
}
......@@ -422,11 +414,11 @@ ide_application_local_command_line (GApplication *application,
goto cleanup;
}
worker_plugin = ide_application_locate_worker (self, type);
worker_plugin = ide_application_locate_worker (self, plugin);
if (worker_plugin == NULL)
{
g_printerr ("%s: \"%s\"\n", _("No such worker"), type);
g_printerr ("%s: \"%s\"\n", _("No such worker"), plugin);
*exit_status = EXIT_FAILURE;
goto cleanup;
}
......@@ -493,7 +485,7 @@ ide_application_local_command_line (GApplication *application,
g_application_activate (application);
cleanup:
g_clear_pointer (&type, g_free);
g_clear_pointer (&plugin, g_free);
g_clear_pointer (&dbus_address, g_free);
g_clear_error (&error);
g_option_context_free (context);
......
......@@ -81,6 +81,8 @@ gboolean ide_application_open_finish (IdeApplication *self
GAsyncResult *reuslt,
GError **error);
void _ide_application_init_shortcuts (IdeApplication *self);
void _ide_application_set_mode (IdeApplication *self,
IdeApplicationMode mode);
G_END_DECLS
......
......@@ -50,6 +50,15 @@ G_DEFINE_TYPE (IdeApplication, ide_application, DZL_TYPE_APPLICATION)
static GThread *main_thread;
void
_ide_application_set_mode (IdeApplication *self,
IdeApplicationMode mode)
{
g_return_if_fail (IDE_IS_APPLICATION (self));
self->mode = mode;
}
static void
ide_application_make_skeleton_dirs (IdeApplication *self)
{
......
......@@ -6,10 +6,3 @@ panel and the build log panel.
Additionally, it provides the perspective for altering build configurations.
The configuration providers can use IdeBuildConfigurationView directly or with
subclasses to allow altering their build configuration.
The ide-build-tool.c provides a command line tool that can execute a build for a
project when run from the source directory.
```sh
gnome-builder-cli build
```
......@@ -206,20 +206,12 @@ ide_worker_manager_get_worker_process (IdeWorkerManager *self,
if (worker_process == NULL)
{
g_autofree gchar *address = NULL;
const gchar *path = PACKAGE_LIBEXECDIR G_DIR_SEPARATOR_S "gnome-builder-worker";
address = g_strdup_printf ("%s,guid=%s",
g_dbus_server_get_client_address (self->dbus_server),
g_dbus_server_get_guid (self->dbus_server));
/*
* If we are running out of tree, rely on PATH to access
* gnome-builder-worker from the build directory.
*/
if (g_getenv ("GB_IN_TREE_PLUGINS") != NULL)
path = "gnome-builder-worker";
worker_process = ide_worker_process_new (path, plugin_name, address);
worker_process = ide_worker_process_new ("gnome-builder", plugin_name, address);
g_hash_table_insert (self->plugin_name_to_worker, g_strdup (plugin_name), worker_process);
ide_worker_process_run (worker_process);
}
......
......@@ -114,7 +114,7 @@ ide_worker_process_respawn (IdeWorkerProcess *self)
{
g_autoptr(GSubprocessLauncher) launcher = NULL;
g_autoptr(GSubprocess) subprocess = NULL;
g_autofree gchar *type = NULL;
g_autofree gchar *plugin = NULL;
g_autofree gchar *dbus_address = NULL;
g_autoptr(GString) verbosearg = NULL;
GError *error = NULL;
......@@ -127,7 +127,7 @@ ide_worker_process_respawn (IdeWorkerProcess *self)
g_assert (IDE_IS_WORKER_PROCESS (self));
g_assert (self->subprocess == NULL);
type = g_strdup_printf ("--type=%s", self->plugin_name);
plugin = g_strdup_printf ("--plugin=%s", self->plugin_name);
dbus_address = g_strdup_printf ("--dbus-address=%s", self->dbus_address);
verbosearg = g_string_new ("-");
......@@ -138,7 +138,8 @@ ide_worker_process_respawn (IdeWorkerProcess *self)
launcher = g_subprocess_launcher_new (G_SUBPROCESS_FLAGS_NONE);
args = g_ptr_array_new ();
g_ptr_array_add (args, self->argv0); /* gnome-builder */
g_ptr_array_add (args, type); /* --type= */
g_ptr_array_add (args, "--type=worker");
g_ptr_array_add (args, plugin); /* --plugin= */
g_ptr_array_add (args, dbus_address); /* --dbus-address= */
g_ptr_array_add (args, verbosity > 0 ? verbosearg->str : NULL);
g_ptr_array_add (args, NULL);
......
......@@ -293,25 +293,6 @@ executable('gnome-builder', gnome_builder_sources,
dependencies: libide_deps + [libide_dep],
)
executable('gnome-builder-cli', gnome_builder_sources,
gui_app: false,
install: true,
c_args: exe_c_args,
link_args: exe_link_args,
install_rpath: pkglibdir_abs,
dependencies: libide_deps + [libide_dep],
)
executable('gnome-builder-worker', gnome_builder_sources,
gui_app: false,
install: true,
install_dir: get_option('libexecdir'),
c_args: exe_c_args,
link_args: exe_link_args,
install_rpath: pkglibdir_abs,
dependencies: libide_deps + [libide_dep],
)
meson.add_install_script('build-aux/meson/meson_post_install.py')
# 'dist' will be used by meson, avoid conflicting
......
......@@ -21,8 +21,12 @@
#include <ide.h>
#include <gtksourceview/gtksource.h>
#include "application/ide-application-private.h"
#include "bug-buddy.h"
static IdeApplicationMode early_mode;
static gboolean
verbose_cb (const gchar *option_name,
const gchar *value,
......@@ -34,12 +38,14 @@ verbose_cb (const gchar *option_name,
}
static void
early_verbose_check (gint *argc,
gchar ***argv)
early_params_check (gint *argc,
gchar ***argv)
{
GOptionContext *context;
static const GOptionEntry entries[] = {
g_autofree gchar *type = NULL;
g_autoptr(GOptionContext) context = NULL;
GOptionEntry entries[] = {
{ "verbose", 'v', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, verbose_cb },
{ "type", 0, 0, G_OPTION_ARG_STRING, &type },
{ NULL }
};
......@@ -48,7 +54,11 @@ early_verbose_check (gint *argc,
g_option_context_set_help_enabled (context, FALSE);
g_option_context_add_main_entries (context, entries, NULL);
g_option_context_parse (context, argc, argv, NULL);
g_option_context_free (context);
if (g_strcmp0 (type, "worker") == 0)
early_mode = IDE_APPLICATION_MODE_WORKER;
else if (g_strcmp0 (type, "cli") == 0)
early_mode = IDE_APPLICATION_MODE_TOOL;
}
static void
......@@ -95,7 +105,7 @@ main (int argc,
bug_buddy_init ();
ide_log_init (TRUE, NULL);
early_verbose_check (&argc, &argv);
early_params_check (&argc, &argv);
early_ssl_check ();
......@@ -120,6 +130,7 @@ main (int argc,
g_type_ensure (G_TYPE_ZLIB_DECOMPRESSOR);
app = ide_application_new ();
_ide_application_set_mode (app, early_mode);
ret = g_application_run (G_APPLICATION (app), argc, argv);
g_clear_object (&app);
......
Markdown is supported
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