1 /* ide-pipeline.h 2 * 3 * Copyright 2016-2019 Christian Hergert <chergert@redhat.com> 4 * 5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 * 18 * SPDX-License-Identifier: GPL-3.0-or-later 19 */ 20 21 #pragma once 22 23 #if !defined (IDE_FOUNDRY_INSIDE) && !defined (IDE_FOUNDRY_COMPILATION) 24 # error "Only <libide-foundry.h> can be included directly." 25 #endif 26 27 #include <libide-core.h> 28 #include <libide-code.h> 29 #include <libide-threading.h> 30 #include <vte/vte.h> 31 32 #include "ide-foundry-types.h" 33 34 #include "ide-build-log.h" 35 #include "ide-config.h" 36 #include "ide-pipeline-stage.h" 37 #include "ide-pipeline-phase.h" 38 #include "ide-runtime.h" 39 #include "ide-triplet.h" 40 41 G_BEGIN_DECLS 42 43 #define IDE_TYPE_PIPELINE (ide_pipeline_get_type()) 44 #define IDE_PIPELINE_PHASE_MASK (0xFFFFFF) 45 #define IDE_PIPELINE_PHASE_WHENCE_MASK (IDE_PIPELINE_PHASE_BEFORE | IDE_PIPELINE_PHASE_AFTER) 46 #define IDE_BUILD_ERROR (ide_build_error_quark()) 47 48 typedef enum 49 { 50 IDE_BUILD_ERROR_UNKNOWN = 0, 51 IDE_BUILD_ERROR_BROKEN, 52 IDE_BUILD_ERROR_NOT_LOADED, 53 IDE_BUILD_ERROR_NEEDS_REBUILD, 54 } IdeBuildError; 55 56 IDE_AVAILABLE_IN_3_32 57 G_DECLARE_FINAL_TYPE (IdePipeline, ide_pipeline, IDE, PIPELINE, IdeObject) 58 59 IDE_AVAILABLE_IN_3_32 60 GQuark ide_build_error_quark (void) G_GNUC_CONST; 61 IDE_AVAILABLE_IN_3_32 62 gchar *ide_pipeline_get_arch (IdePipeline *self); 63 IDE_AVAILABLE_IN_3_32 64 gboolean ide_pipeline_is_native (IdePipeline *self); 65 IDE_AVAILABLE_IN_3_32 66 gboolean ide_pipeline_is_ready (IdePipeline *self); 67 IDE_AVAILABLE_IN_3_32 68 gboolean ide_pipeline_get_busy (IdePipeline *self); 69 IDE_AVAILABLE_IN_3_32 70 IdeConfig *ide_pipeline_get_config (IdePipeline *self); 71 IDE_AVAILABLE_IN_3_32 72 IdeDevice *ide_pipeline_get_device (IdePipeline *self); 73 IDE_AVAILABLE_IN_3_32 74 IdeDeviceInfo *ide_pipeline_get_device_info (IdePipeline *self); 75 IDE_AVAILABLE_IN_3_32 76 IdeTriplet *ide_pipeline_get_host_triplet (IdePipeline *self); 77 IDE_AVAILABLE_IN_3_32 78 IdeRuntime *ide_pipeline_get_runtime (IdePipeline *self); 79 IDE_AVAILABLE_IN_3_32 80 IdeToolchain *ide_pipeline_get_toolchain (IdePipeline *self); 81 IDE_AVAILABLE_IN_3_32 82 IdeToolchain *ide_pipeline_ref_toolchain (IdePipeline *self); 83 IDE_AVAILABLE_IN_3_32 84 const gchar *ide_pipeline_get_builddir (IdePipeline *self); 85 IDE_AVAILABLE_IN_3_32 86 const gchar *ide_pipeline_get_srcdir (IdePipeline *self); 87 IDE_AVAILABLE_IN_3_32 88 gchar *ide_pipeline_get_message (IdePipeline *self); 89 IDE_AVAILABLE_IN_3_32 90 IdePipelinePhase ide_pipeline_get_phase (IdePipeline *self); 91 IDE_AVAILABLE_IN_3_32 92 gboolean ide_pipeline_get_can_export (IdePipeline *self); 93 IDE_AVAILABLE_IN_3_32 94 VtePty *ide_pipeline_get_pty (IdePipeline *self); 95 IDE_AVAILABLE_IN_3_32 96 IdeSubprocessLauncher *ide_pipeline_create_launcher (IdePipeline *self, 97 GError **error); 98 IDE_AVAILABLE_IN_3_32 99 gchar *ide_pipeline_build_srcdir_path (IdePipeline *self, 100 const gchar *first_part, 101 ...) G_GNUC_NULL_TERMINATED; 102 IDE_AVAILABLE_IN_3_32 103 gchar *ide_pipeline_build_builddir_path (IdePipeline *self, 104 const gchar *first_part, 105 ...) G_GNUC_NULL_TERMINATED; 106 IDE_AVAILABLE_IN_3_32 107 void ide_pipeline_invalidate_phase (IdePipeline *self, 108 IdePipelinePhase phases); 109 IDE_AVAILABLE_IN_3_32 110 gboolean ide_pipeline_request_phase (IdePipeline *self, 111 IdePipelinePhase phase); 112 IDE_AVAILABLE_IN_3_32 113 guint ide_pipeline_attach (IdePipeline *self, 114 IdePipelinePhase phase, 115 gint priority, 116 IdePipelineStage *stage); 117 IDE_AVAILABLE_IN_3_32 118 guint ide_pipeline_attach_launcher (IdePipeline *self, 119 IdePipelinePhase phase, 120 gint priority, 121 IdeSubprocessLauncher *launcher); 122 IDE_AVAILABLE_IN_3_32 123 void ide_pipeline_detach (IdePipeline *self, 124 guint stage_id); 125 IDE_AVAILABLE_IN_3_32 126 IdePipelineStage *ide_pipeline_get_stage_by_id (IdePipeline *self, 127 guint stage_id); 128 IDE_AVAILABLE_IN_3_32 129 guint ide_pipeline_add_log_observer (IdePipeline *self, 130 IdeBuildLogObserver observer, 131 gpointer observer_data, 132 GDestroyNotify observer_data_destroy); 133 IDE_AVAILABLE_IN_3_32 134 gboolean ide_pipeline_remove_log_observer (IdePipeline *self, 135 guint observer_id); 136 IDE_AVAILABLE_IN_3_32 137 void ide_pipeline_emit_diagnostic (IdePipeline *self, 138 IdeDiagnostic *diagnostic); 139 IDE_AVAILABLE_IN_3_32 140 guint ide_pipeline_add_error_format (IdePipeline *self, 141 const gchar *regex, 142 GRegexCompileFlags flags); 143 IDE_AVAILABLE_IN_3_32 144 gboolean ide_pipeline_remove_error_format (IdePipeline *self, 145 guint error_format_id); 146 IDE_AVAILABLE_IN_3_32 147 void ide_pipeline_build_async (IdePipeline *self, 148 IdePipelinePhase phase, 149 GCancellable *cancellable, 150 GAsyncReadyCallback callback, 151 gpointer user_data); 152 IDE_AVAILABLE_IN_3_32 153 gboolean ide_pipeline_build_finish (IdePipeline *self, 154 GAsyncResult *result, 155 GError **error); 156 IDE_AVAILABLE_IN_3_32 157 void ide_pipeline_build_targets_async (IdePipeline *self, 158 IdePipelinePhase phase, 159 GPtrArray *targets, 160 GCancellable *cancellable, 161 GAsyncReadyCallback callback, 162 gpointer user_data); 163 IDE_AVAILABLE_IN_3_32 164 gboolean ide_pipeline_build_targets_finish (IdePipeline *self, 165 GAsyncResult *result, 166 GError **error); 167 IDE_AVAILABLE_IN_3_32 168 void ide_pipeline_foreach_stage (IdePipeline *self, 169 GFunc stage_callback, 170 gpointer user_data); 171 IDE_AVAILABLE_IN_3_32 172 void ide_pipeline_clean_async (IdePipeline *self, 173 IdePipelinePhase phase, 174 GCancellable *cancellable, 175 GAsyncReadyCallback callback, 176 gpointer user_data); 177 IDE_AVAILABLE_IN_3_32 178 gboolean ide_pipeline_clean_finish (IdePipeline *self, 179 GAsyncResult *result, 180 GError **error); 181 IDE_AVAILABLE_IN_3_32 182 void ide_pipeline_rebuild_async (IdePipeline *self, 183 IdePipelinePhase phase, 184 GPtrArray *targets, 185 GCancellable *cancellable, 186 GAsyncReadyCallback callback, 187 gpointer user_data); 188 IDE_AVAILABLE_IN_3_32 189 gboolean ide_pipeline_rebuild_finish (IdePipeline *self, 190 GAsyncResult *result, 191 GError **error); 192 IDE_AVAILABLE_IN_3_32 193 void ide_pipeline_attach_pty (IdePipeline *self, 194 IdeSubprocessLauncher *launcher); 195 IDE_AVAILABLE_IN_3_32 196 gboolean ide_pipeline_has_configured (IdePipeline *self); 197 IDE_AVAILABLE_IN_3_32 198 IdePipelinePhase ide_pipeline_get_requested_phase (IdePipeline *self); 199 IDE_AVAILABLE_IN_3_34 200 gboolean ide_pipeline_contains_program_in_path (IdePipeline *self, 201 const gchar *name, 202 GCancellable *cancellable); 203 204 G_END_DECLS 205