void ide_run_manager_discover_default_target_async (IdeRunManager *self, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { g_autoptr(GTask) task = NULL; IdeBuildSystem *build_system; IdeContext *context; IDE_ENTRY; g_return_if_fail (IDE_IS_RUN_MANAGER (self)); g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable)); task = g_task_new (self, cancellable, callback, user_data); g_task_set_source_tag (task, ide_run_manager_discover_default_target_async); context = ide_object_get_context (IDE_OBJECT (self)); build_system = ide_context_get_build_system (context); ide_build_system_get_build_targets_async (build_system, cancellable, ide_run_manager_discover_default_target_cb, g_object_ref (task)); IDE_EXIT; }
static void build_for_device (IdeContext *context, IdeDevice *device) { g_autoptr(IdeBuilder) builder = NULL; g_autoptr(IdeBuildResult) build_result = NULL; g_autoptr(GError) error = NULL; IdeBuildSystem *build_system; IdeBuilderBuildFlags flags = IDE_BUILDER_BUILD_FLAGS_NONE; GKeyFile *config; print_build_info (context, device); config = g_key_file_new (); if (rebuild) flags |= IDE_BUILDER_BUILD_FLAGS_FORCE_REBUILD; if (parallel) g_key_file_set_integer (config, "parallel", "workers", parallel); build_system = ide_context_get_build_system (context); builder = ide_build_system_get_builder (build_system, config, device, &error); g_key_file_unref (config); if (!builder) { g_printerr ("%s\n", error->message); quit (EXIT_FAILURE); return; } build_start = g_get_monotonic_time (); ide_builder_build_async (builder, flags, &build_result, NULL, build_cb, NULL); if (build_result) { GInputStream *stderr_stream; GInputStream *stdout_stream; stderr_stream = ide_build_result_get_stderr_stream (build_result); stdout_stream = ide_build_result_get_stdout_stream (build_result); log_dumper (stderr_stream, TRUE); log_dumper (stdout_stream, FALSE); g_object_unref (stderr_stream); g_object_unref (stdout_stream); } }
static void print_build_info (IdeContext *context, IdeDevice *device) { IdeProject *project; IdeBuildSystem *build_system; IdeVcs *vcs; const gchar *project_name; const gchar *vcs_name; const gchar *build_system_name; const gchar *device_id; const gchar *system_type; g_autofree gchar *build_date = NULL; GTimeVal tv; project = ide_context_get_project (context); project_name = ide_project_get_name (project); vcs = ide_context_get_vcs (context); vcs_name = g_type_name (G_TYPE_FROM_INSTANCE (vcs)); build_system = ide_context_get_build_system (context); build_system_name = g_type_name (G_TYPE_FROM_INSTANCE (build_system)); device_id = ide_device_get_id (device); system_type = ide_device_get_system_type (device); g_get_current_time (&tv); build_date = g_time_val_to_iso8601 (&tv); g_printerr (_("========================\n")); g_printerr (_(" Project Name: %s\n"), project_name); g_printerr (_(" Version Control System: %s\n"), vcs_name); g_printerr (_(" Build System: %s\n"), build_system_name); g_printerr (_(" Build Date and Time: %s\n"), build_date); g_printerr (_(" Building for Device: %s (%s)\n"), device_id, system_type); g_printerr (_("========================\n")); }
static void ide_clang_service_get_translation_unit_worker (EggTaskCache *cache, gconstpointer key, GTask *task, gpointer user_data) { g_autoptr(GTask) real_task = NULL; IdeClangService *self = user_data; IdeUnsavedFiles *unsaved_files; IdeBuildSystem *build_system; ParseRequest *request; IdeContext *context; const gchar *path; IdeFile *file = (IdeFile *)key; GFile *gfile; g_assert (IDE_IS_CLANG_SERVICE (self)); g_assert (IDE_IS_CLANG_SERVICE (self)); g_assert (IDE_IS_FILE (key)); g_assert (IDE_IS_FILE (file)); g_assert (G_IS_TASK (task)); context = ide_object_get_context (IDE_OBJECT (self)); unsaved_files = ide_context_get_unsaved_files (context); build_system = ide_context_get_build_system (context); gfile = ide_file_get_file (file); if (!gfile || !(path = g_file_get_path (gfile))) { g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, _("File must be saved locally to parse.")); return; } request = g_slice_new0 (ParseRequest); request->file = g_object_ref (file); request->index = self->index; request->source_filename = g_strdup (path); request->command_line_args = NULL; request->unsaved_files = ide_unsaved_files_to_array (unsaved_files); request->sequence = ide_unsaved_files_get_sequence (unsaved_files); /* * NOTE: * * I'm torn on this one. It requires a bunch of extra memory, but without it * we don't get information about macros. And since we need that to provide * quality highlighting, I'm going try try enabling it for now and see how * things go. */ request->options = (clang_defaultEditingTranslationUnitOptions () | CXTranslationUnit_DetailedPreprocessingRecord); real_task = g_task_new (self, g_task_get_cancellable (task), ide_clang_service_unit_completed_cb, g_object_ref (task)); g_task_set_task_data (real_task, request, parse_request_free); /* * Request the build flags necessary to build this module from the build system. */ IDE_TRACE_MSG ("Requesting build of translation unit"); ide_build_system_get_build_flags_async (build_system, file, g_task_get_cancellable (task), ide_clang_service__get_build_flags_cb, g_object_ref (real_task)); }