Пример #1
0
int
main (gint   argc,
      gchar *argv[])
{
  GOptionEntry entries[] = {
    { "device", 'd', 0, G_OPTION_ARG_STRING, &deviceId,
      N_("The target device we are building for."),
      N_("DEVICE_ID")
    },
    { "rebuild", 'r', 0, G_OPTION_ARG_NONE, &rebuild,
      N_("Clean and rebuild the project.") },
    { "parallel", 'j', 0, G_OPTION_ARG_INT, &parallel,
      N_("Increase parallelism in the build."),
      N_("N") },
    { NULL }
  };
  g_autoptr(GOptionContext) context = NULL;
  g_autoptr(GError) error = NULL;
  g_autoptr(GFile) project_file = NULL;
  const gchar *project_path = ".";

  ide_set_program_name ("gnome-builder");
  g_set_prgname ("ide-build");

  context = g_option_context_new (_("- Build the project."));
  g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
  g_option_context_add_group (context, gtk_get_option_group (TRUE));

  if (!g_option_context_parse (context, &argc, &argv, &error))
    {
      g_printerr ("%s\n", error->message);
      return EXIT_FAILURE;
    }

  main_loop = g_main_loop_new (NULL, FALSE);

  if (argc > 1)
    project_path = argv [1];
  project_file = g_file_new_for_path (project_path);

  if (!deviceId)
    deviceId = g_strdup ("local");

  gb_plugins_init (NULL);

  ide_context_new_async (project_file, NULL, context_cb, NULL);

  g_main_loop_run (main_loop);
  g_clear_pointer (&main_loop, g_main_loop_unref);

  return exit_code;
}
Пример #2
0
gint
main (gint   argc,
      gchar *argv[])
{
  g_autoptr(GOptionContext) context = NULL;
  g_autoptr(GError) error = NULL;
  g_autoptr(GFile) project_file = NULL;
  const gchar *project_path = ".";

  ide_set_program_name ("gnome-builder");
  g_set_prgname ("ide-list-devices");

  ide_log_init (TRUE, NULL);

  gtk_init (&argc, &argv);

  context = g_option_context_new (_("- List devices found on the system."));

  if (!g_option_context_parse (context, &argc, &argv, &error))
    {
      g_printerr ("%s\n", error->message);
      return EXIT_FAILURE;
    }

  gMainLoop = g_main_loop_new (NULL, FALSE);

  if (argc > 1)
    project_path = argv [1];
  project_file = g_file_new_for_path (project_path);

  gb_plugins_init ();

  ide_context_new_async (project_file, NULL, context_cb, NULL);

  g_main_loop_run (gMainLoop);
  g_clear_pointer (&gMainLoop, g_main_loop_unref);

  return gExitCode;
}