1 /* ide-pipeline-stage.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 <dazzle.h> 28 #include <libide-core.h> 29 30 #include "ide-build-log.h" 31 #include "ide-foundry-types.h" 32 33 G_BEGIN_DECLS 34 35 #define IDE_TYPE_PIPELINE_STAGE (ide_pipeline_stage_get_type()) 36 37 IDE_AVAILABLE_IN_3_32 38 G_DECLARE_DERIVABLE_TYPE (IdePipelineStage, ide_pipeline_stage, IDE, PIPELINE_STAGE, IdeObject) 39 40 struct _IdePipelineStageClass 41 { 42 IdeObjectClass parent_class; 43 44 /** 45 * IdePipelineStage::build: 46 * 47 * This vfunc will be run in a thread by the default 48 * IdePipelineStage::build_async() and IdePipelineStage::build_finish() 49 * vfuncs. 50 * 51 * Only use thread-safe API from this function. 52 * 53 * Since: 3.32 54 */ 55 gboolean (*build) (IdePipelineStage *self, 56 IdePipeline *pipeline, 57 GCancellable *cancellable, 58 GError **error); 59 60 /** 61 * IdePipelineStage::build_async: 62 * 63 * Asynchronous version of the #IdePipelineStage API. This is the preferred 64 * way to subclass #IdePipelineStage. 65 * 66 * Since: 3.32 67 */ 68 void (*build_async) (IdePipelineStage *self, 69 IdePipeline *pipeline, 70 GCancellable *cancellable, 71 GAsyncReadyCallback callback, 72 gpointer user_data); 73 74 /** 75 * IdePipelineStage::build_finish: 76 * 77 * Completes an asynchronous call to ide_pipeline_stage_build_async(). 78 * 79 * Returns: %TRUE if successful; otherwise %FALSE and @error is set. 80 * Upon failure, the pipeline will be stopped. 81 * 82 * Since: 3.32 83 */ 84 gboolean (*build_finish) (IdePipelineStage *self, 85 GAsyncResult *result, 86 GError **error); 87 88 /** 89 * IdePipelineStage::clean_async: 90 * @self: an #IdePipelineStage 91 * @pipeline: An #IdePipeline 92 * @cancellable: (nullable): a #GCancellable or %NULL 93 * @callback: An async callback 94 * @user_data: user data for @callback 95 * 96 * This function will perform the clean operation. 97 * 98 * Since: 3.32 99 */ 100 void (*clean_async) (IdePipelineStage *self, 101 IdePipeline *pipeline, 102 GCancellable *cancellable, 103 GAsyncReadyCallback callback, 104 gpointer user_data); 105 106 /** 107 * IdePipelineStage::clean_finish: 108 * @self: an #IdePipelineStage 109 * @result: a #GErrorResult 110 * @error: A location for a #GError or %NULL. 111 * 112 * Completes an async operation to ide_pipeline_stage_clean_async(). 113 * 114 * Returns: %TRUE if successful; otherwise %FALSE and @error is set. 115 * 116 * Since: 3.32 117 */ 118 gboolean (*clean_finish) (IdePipelineStage *self, 119 GAsyncResult *result, 120 GError **error); 121 122 /* Signals */ 123 void (*query) (IdePipelineStage *self, 124 IdePipeline *pipeline, 125 GPtrArray *targets, 126 GCancellable *cancellable); 127 void (*reap) (IdePipelineStage *self, 128 DzlDirectoryReaper *reaper); 129 gboolean (*chain) (IdePipelineStage *self, 130 IdePipelineStage *next); 131 132 /*< private >*/ 133 gpointer _reserved[16]; 134 }; 135 136 IDE_AVAILABLE_IN_3_32 137 gboolean ide_pipeline_stage_get_active (IdePipelineStage *self); 138 IDE_AVAILABLE_IN_3_32 139 void ide_pipeline_stage_set_active (IdePipelineStage *self, 140 gboolean active); 141 IDE_AVAILABLE_IN_3_32 142 const gchar *ide_pipeline_stage_get_name (IdePipelineStage *self); 143 IDE_AVAILABLE_IN_3_32 144 void ide_pipeline_stage_set_name (IdePipelineStage *self, 145 const gchar *name); 146 IDE_AVAILABLE_IN_3_32 147 void ide_pipeline_stage_log (IdePipelineStage *self, 148 IdeBuildLogStream stream, 149 const gchar *message, 150 gssize message_len); 151 IDE_AVAILABLE_IN_3_32 152 void ide_pipeline_stage_log_subprocess (IdePipelineStage *self, 153 IdeSubprocess *subprocess); 154 IDE_AVAILABLE_IN_3_32 155 void ide_pipeline_stage_set_log_observer (IdePipelineStage *self, 156 IdeBuildLogObserver observer, 157 gpointer observer_data, 158 GDestroyNotify observer_data_destroy); 159 IDE_AVAILABLE_IN_3_32 160 void ide_pipeline_stage_set_stdout_path (IdePipelineStage *self, 161 const gchar *path); 162 IDE_AVAILABLE_IN_3_32 163 const gchar *ide_pipeline_stage_get_stdout_path (IdePipelineStage *self); 164 IDE_AVAILABLE_IN_3_32 165 gboolean ide_pipeline_stage_get_completed (IdePipelineStage *self); 166 IDE_AVAILABLE_IN_3_32 167 void ide_pipeline_stage_set_completed (IdePipelineStage *self, 168 gboolean completed); 169 IDE_AVAILABLE_IN_3_32 170 gboolean ide_pipeline_stage_get_disabled (IdePipelineStage *self); 171 IDE_AVAILABLE_IN_3_32 172 void ide_pipeline_stage_set_disabled (IdePipelineStage *self, 173 gboolean disabled); 174 IDE_AVAILABLE_IN_3_32 175 gboolean ide_pipeline_stage_get_check_stdout (IdePipelineStage *self); 176 IDE_AVAILABLE_IN_3_32 177 void ide_pipeline_stage_set_check_stdout (IdePipelineStage *self, 178 gboolean check_stdout); 179 IDE_AVAILABLE_IN_3_32 180 gboolean ide_pipeline_stage_get_transient (IdePipelineStage *self); 181 IDE_AVAILABLE_IN_3_32 182 void ide_pipeline_stage_set_transient (IdePipelineStage *self, 183 gboolean transient); 184 IDE_AVAILABLE_IN_3_32 185 void ide_pipeline_stage_build_async (IdePipelineStage *self, 186 IdePipeline *pipeline, 187 GCancellable *cancellable, 188 GAsyncReadyCallback callback, 189 gpointer user_data); 190 IDE_AVAILABLE_IN_3_32 191 gboolean ide_pipeline_stage_build_finish (IdePipelineStage *self, 192 GAsyncResult *result, 193 GError **error); 194 IDE_AVAILABLE_IN_3_32 195 void ide_pipeline_stage_clean_async (IdePipelineStage *self, 196 IdePipeline *pipeline, 197 GCancellable *cancellable, 198 GAsyncReadyCallback callback, 199 gpointer user_data); 200 IDE_AVAILABLE_IN_3_32 201 gboolean ide_pipeline_stage_clean_finish (IdePipelineStage *self, 202 GAsyncResult *result, 203 GError **error); 204 IDE_AVAILABLE_IN_3_32 205 gboolean ide_pipeline_stage_chain (IdePipelineStage *self, 206 IdePipelineStage *next); 207 IDE_AVAILABLE_IN_3_32 208 void ide_pipeline_stage_pause (IdePipelineStage *self); 209 IDE_AVAILABLE_IN_3_32 210 void ide_pipeline_stage_unpause (IdePipelineStage *self); 211 IDE_AVAILABLE_IN_3_32 212 void ide_pipeline_stage_emit_reap (IdePipelineStage *self, 213 DzlDirectoryReaper *reaper); 214 215 G_END_DECLS 216