1 /* ide-config.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-threading.h>
29 
30 #include "ide-foundry-types.h"
31 #include "ide-pipeline-phase.h"
32 
33 G_BEGIN_DECLS
34 
35 #define IDE_TYPE_CONFIG (ide_config_get_type())
36 
37 IDE_AVAILABLE_IN_3_32
38 G_DECLARE_DERIVABLE_TYPE (IdeConfig, ide_config, IDE, CONFIG, IdeObject)
39 
40 typedef enum
41 {
42   IDE_BUILD_LOCALITY_IN_TREE     = 1 << 0,
43   IDE_BUILD_LOCALITY_OUT_OF_TREE = 1 << 1,
44   IDE_BUILD_LOCALITY_DEFAULT     = IDE_BUILD_LOCALITY_IN_TREE | IDE_BUILD_LOCALITY_OUT_OF_TREE,
45 } IdeBuildLocality;
46 
47 struct _IdeConfigClass
48 {
49   IdeObjectClass parent;
50 
51   IdeRuntime *(*get_runtime)      (IdeConfig  *self);
52   void        (*set_runtime)      (IdeConfig  *self,
53                                    IdeRuntime *runtime);
54   gboolean    (*supports_runtime) (IdeConfig  *self,
55                                    IdeRuntime *runtime);
56   GPtrArray  *(*get_extensions)   (IdeConfig  *self);
57 
58   /*< private >*/
59   gpointer _reserved[15];
60 };
61 
62 IDE_AVAILABLE_IN_41
63 const gchar          *ide_config_get_prepend_path          (IdeConfig             *self);
64 IDE_AVAILABLE_IN_41
65 void                  ide_config_set_prepend_path          (IdeConfig             *self,
66                                                             const gchar           *prepend_path);
67 IDE_AVAILABLE_IN_3_32
68 const gchar          *ide_config_get_append_path           (IdeConfig             *self);
69 IDE_AVAILABLE_IN_3_32
70 void                  ide_config_set_append_path           (IdeConfig             *self,
71                                                             const gchar           *append_path);
72 IDE_AVAILABLE_IN_3_32
73 const gchar          *ide_config_get_id                    (IdeConfig             *self);
74 IDE_AVAILABLE_IN_3_32
75 const gchar          *ide_config_get_runtime_id            (IdeConfig             *self);
76 IDE_AVAILABLE_IN_3_32
77 void                  ide_config_set_runtime_id            (IdeConfig             *self,
78                                                             const gchar           *runtime_id);
79 IDE_AVAILABLE_IN_3_32
80 const gchar          *ide_config_get_toolchain_id          (IdeConfig             *self);
81 IDE_AVAILABLE_IN_3_32
82 void                  ide_config_set_toolchain_id          (IdeConfig             *self,
83                                                             const gchar           *toolchain_id);
84 IDE_AVAILABLE_IN_3_32
85 gboolean              ide_config_get_dirty                 (IdeConfig             *self);
86 IDE_AVAILABLE_IN_3_32
87 void                  ide_config_set_dirty                 (IdeConfig             *self,
88                                                             gboolean               dirty);
89 IDE_AVAILABLE_IN_3_32
90 const gchar          *ide_config_get_display_name          (IdeConfig             *self);
91 IDE_AVAILABLE_IN_3_32
92 void                  ide_config_set_display_name          (IdeConfig             *self,
93                                                             const gchar           *display_name);
94 IDE_AVAILABLE_IN_3_32
95 IdeBuildLocality      ide_config_get_locality              (IdeConfig             *self);
96 IDE_AVAILABLE_IN_3_32
97 void                  ide_config_set_locality              (IdeConfig             *self,
98                                                             IdeBuildLocality       locality);
99 IDE_AVAILABLE_IN_3_32
100 gboolean              ide_config_get_ready                 (IdeConfig             *self);
101 IDE_AVAILABLE_IN_3_32
102 IdeRuntime           *ide_config_get_runtime               (IdeConfig             *self);
103 IDE_AVAILABLE_IN_3_32
104 void                  ide_config_set_runtime               (IdeConfig             *self,
105                                                             IdeRuntime            *runtime);
106 IDE_AVAILABLE_IN_3_32
107 IdeToolchain         *ide_config_get_toolchain             (IdeConfig             *self);
108 IDE_AVAILABLE_IN_3_32
109 void                  ide_config_set_toolchain             (IdeConfig             *self,
110                                                             IdeToolchain          *toolchain);
111 IDE_AVAILABLE_IN_3_32
112 gchar               **ide_config_get_environ               (IdeConfig             *self);
113 IDE_AVAILABLE_IN_3_32
114 const gchar          *ide_config_getenv                    (IdeConfig             *self,
115                                                             const gchar           *key);
116 IDE_AVAILABLE_IN_3_32
117 void                  ide_config_setenv                    (IdeConfig             *self,
118                                                             const gchar           *key,
119                                                             const gchar           *value);
120 IDE_AVAILABLE_IN_3_32
121 gboolean              ide_config_get_debug                 (IdeConfig             *self);
122 IDE_AVAILABLE_IN_3_32
123 void                  ide_config_set_debug                 (IdeConfig             *self,
124                                                             gboolean               debug);
125 IDE_AVAILABLE_IN_3_32
126 const gchar          *ide_config_get_prefix                (IdeConfig             *self);
127 IDE_AVAILABLE_IN_3_32
128 void                  ide_config_set_prefix                (IdeConfig             *self,
129                                                             const gchar           *prefix);
130 IDE_AVAILABLE_IN_3_34
131 gboolean              ide_config_get_prefix_set            (IdeConfig             *self);
132 IDE_AVAILABLE_IN_3_34
133 void                  ide_config_set_prefix_set            (IdeConfig             *self,
134                                                             gboolean               prefix_set);
135 IDE_AVAILABLE_IN_3_32
136 const gchar          *ide_config_get_config_opts           (IdeConfig             *self);
137 IDE_AVAILABLE_IN_3_32
138 void                  ide_config_set_config_opts           (IdeConfig             *self,
139                                                             const gchar           *config_opts);
140 IDE_AVAILABLE_IN_3_32
141 const gchar          *ide_config_get_run_opts              (IdeConfig             *self);
142 IDE_AVAILABLE_IN_3_32
143 void                  ide_config_set_run_opts              (IdeConfig             *self,
144                                                             const gchar           *run_opts);
145 IDE_AVAILABLE_IN_3_32
146 const gchar * const  *ide_config_get_build_commands        (IdeConfig             *self);
147 IDE_AVAILABLE_IN_3_32
148 void                  ide_config_set_build_commands        (IdeConfig             *self,
149                                                             const gchar *const    *build_commands);
150 IDE_AVAILABLE_IN_3_32
151 GFile                *ide_config_get_build_commands_dir    (IdeConfig             *self);
152 IDE_AVAILABLE_IN_3_32
153 void                  ide_config_set_build_commands_dir    (IdeConfig             *self,
154                                                             GFile                 *build_commands_dir);
155 IDE_AVAILABLE_IN_3_32
156 const gchar * const  *ide_config_get_post_install_commands (IdeConfig             *self);
157 IDE_AVAILABLE_IN_3_32
158 void                  ide_config_set_post_install_commands (IdeConfig             *self,
159                                                             const gchar *const    *post_install_commands);
160 IDE_AVAILABLE_IN_3_32
161 gint                  ide_config_get_parallelism           (IdeConfig             *self);
162 IDE_AVAILABLE_IN_3_32
163 void                  ide_config_set_parallelism           (IdeConfig             *self,
164                                                             gint                   parallelism);
165 IDE_AVAILABLE_IN_3_32
166 IdeEnvironment       *ide_config_get_environment           (IdeConfig             *self);
167 IDE_AVAILABLE_IN_3_32
168 void                  ide_config_set_environment           (IdeConfig             *self,
169                                                             IdeEnvironment        *environment);
170 IDE_AVAILABLE_IN_3_40
171 IdeEnvironment       *ide_config_get_runtime_environment   (IdeConfig             *self);
172 IDE_AVAILABLE_IN_3_40
173 void                  ide_config_set_runtime_environment   (IdeConfig             *self,
174                                                             IdeEnvironment        *environment);
175 IDE_AVAILABLE_IN_3_32
176 guint                 ide_config_get_sequence              (IdeConfig             *self);
177 IDE_AVAILABLE_IN_3_32
178 const gchar          *ide_config_get_app_id                (IdeConfig             *self);
179 IDE_AVAILABLE_IN_3_32
180 void                  ide_config_set_app_id                (IdeConfig             *self,
181                                                             const gchar           *app_id);
182 IDE_AVAILABLE_IN_3_32
183 void                  ide_config_apply_path                (IdeConfig             *self,
184                                                             IdeSubprocessLauncher *launcher);
185 IDE_AVAILABLE_IN_3_32
186 gboolean              ide_config_supports_runtime          (IdeConfig             *self,
187                                                             IdeRuntime            *runtime);
188 IDE_AVAILABLE_IN_3_32
189 const gchar          *ide_config_get_internal_string       (IdeConfig             *self,
190                                                             const gchar           *key);
191 IDE_AVAILABLE_IN_3_32
192 void                  ide_config_set_internal_string       (IdeConfig             *self,
193                                                             const gchar           *key,
194                                                             const gchar           *value);
195 IDE_AVAILABLE_IN_3_32
196 const gchar * const  *ide_config_get_internal_strv         (IdeConfig             *self,
197                                                             const gchar           *key);
198 IDE_AVAILABLE_IN_3_32
199 void                  ide_config_set_internal_strv         (IdeConfig             *self,
200                                                             const gchar           *key,
201                                                             const gchar *const    *value);
202 IDE_AVAILABLE_IN_3_32
203 gboolean              ide_config_get_internal_boolean      (IdeConfig             *self,
204                                                             const gchar           *key);
205 IDE_AVAILABLE_IN_3_32
206 void                  ide_config_set_internal_boolean      (IdeConfig             *self,
207                                                             const gchar           *key,
208                                                             gboolean               value);
209 IDE_AVAILABLE_IN_3_32
210 gint                  ide_config_get_internal_int          (IdeConfig             *self,
211                                                             const gchar           *key);
212 IDE_AVAILABLE_IN_3_32
213 void                  ide_config_set_internal_int          (IdeConfig             *self,
214                                                             const gchar           *key,
215                                                             gint                   value);
216 IDE_AVAILABLE_IN_3_32
217 gint64                ide_config_get_internal_int64        (IdeConfig             *self,
218                                                             const gchar           *key);
219 IDE_AVAILABLE_IN_3_32
220 void                  ide_config_set_internal_int64        (IdeConfig             *self,
221                                                             const gchar           *key,
222                                                             gint64                 value);
223 IDE_AVAILABLE_IN_3_32
224 gpointer              ide_config_get_internal_object       (IdeConfig             *self,
225                                                             const gchar           *key);
226 IDE_AVAILABLE_IN_3_32
227 void                  ide_config_set_internal_object       (IdeConfig             *self,
228                                                             const gchar           *key,
229                                                             gpointer               instance);
230 IDE_AVAILABLE_IN_3_34
231 GPtrArray            *ide_config_get_extensions            (IdeConfig             *self);
232 IDE_AVAILABLE_IN_41
233 const gchar * const  *ide_config_get_args_for_phase        (IdeConfig             *self,
234                                                             IdePipelinePhase       phase);
235 IDE_AVAILABLE_IN_41
236 void                  ide_config_set_args_for_phase        (IdeConfig             *self,
237                                                             IdePipelinePhase       phase,
238                                                             const gchar *const    *args);
239 
240 
241 G_END_DECLS
242