1 /* ide-build-system.h
2  *
3  * Copyright 2015-2019 Christian Hergert <christian@hergert.me>
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 
30 #include "ide-foundry-types.h"
31 
32 G_BEGIN_DECLS
33 
34 #define IDE_TYPE_BUILD_SYSTEM (ide_build_system_get_type())
35 
36 IDE_AVAILABLE_IN_3_32
37 G_DECLARE_INTERFACE (IdeBuildSystem, ide_build_system, IDE, BUILD_SYSTEM, IdeObject)
38 
39 struct _IdeBuildSystemInterface
40 {
41   GTypeInterface parent_iface;
42 
43   gint        (*get_priority)                      (IdeBuildSystem       *self);
44   void        (*get_build_flags_async)             (IdeBuildSystem       *self,
45                                                     GFile                *file,
46                                                     GCancellable         *cancellable,
47                                                     GAsyncReadyCallback   callback,
48                                                     gpointer              user_data);
49   gchar     **(*get_build_flags_finish)            (IdeBuildSystem       *self,
50                                                     GAsyncResult         *result,
51                                                     GError              **error);
52   void        (*get_build_flags_for_files_async)   (IdeBuildSystem       *self,
53                                                     GPtrArray            *files,
54                                                     GCancellable         *cancellable,
55                                                     GAsyncReadyCallback   callback,
56                                                     gpointer              user_data);
57   GHashTable *(*get_build_flags_for_files_finish)  (IdeBuildSystem       *self,
58                                                     GAsyncResult         *result,
59                                                     GError              **error);
60   gchar      *(*get_builddir)                      (IdeBuildSystem       *self,
61                                                     IdePipeline     *pipeline);
62   gchar      *(*get_id)                            (IdeBuildSystem       *self);
63   gchar      *(*get_display_name)                  (IdeBuildSystem       *self);
64   gboolean    (*supports_toolchain)                (IdeBuildSystem       *self,
65                                                     IdeToolchain         *toolchain);
66   gchar      *(*get_project_version)               (IdeBuildSystem       *self);
67   gboolean    (*supports_language)                 (IdeBuildSystem       *self,
68                                                     const char           *language);
69 };
70 
71 IDE_AVAILABLE_IN_3_32
72 IdeBuildSystem  *ide_build_system_from_context                     (IdeContext           *context);
73 IDE_AVAILABLE_IN_3_32
74 gchar           *ide_build_system_get_id                           (IdeBuildSystem       *self);
75 IDE_AVAILABLE_IN_3_32
76 gchar           *ide_build_system_get_display_name                 (IdeBuildSystem       *self);
77 IDE_AVAILABLE_IN_3_32
78 gint             ide_build_system_get_priority                     (IdeBuildSystem       *self);
79 IDE_AVAILABLE_IN_3_32
80 gchar           *ide_build_system_get_builddir                     (IdeBuildSystem       *self,
81                                                                     IdePipeline     *pipeline);
82 IDE_AVAILABLE_IN_3_32
83 gchar           *ide_build_system_get_project_version              (IdeBuildSystem       *self);
84 IDE_AVAILABLE_IN_3_32
85 void             ide_build_system_get_build_flags_async            (IdeBuildSystem       *self,
86                                                                     GFile                *file,
87                                                                     GCancellable         *cancellable,
88                                                                     GAsyncReadyCallback   callback,
89                                                                     gpointer              user_data);
90 IDE_AVAILABLE_IN_3_32
91 gchar          **ide_build_system_get_build_flags_finish           (IdeBuildSystem       *self,
92                                                                     GAsyncResult         *result,
93                                                                     GError              **error);
94 IDE_AVAILABLE_IN_3_32
95 void             ide_build_system_get_build_flags_for_files_async  (IdeBuildSystem       *self,
96                                                                     GPtrArray            *files,
97                                                                     GCancellable         *cancellable,
98                                                                     GAsyncReadyCallback   callback,
99                                                                     gpointer              user_data);
100 IDE_AVAILABLE_IN_3_32
101 GHashTable      *ide_build_system_get_build_flags_for_files_finish (IdeBuildSystem       *self,
102                                                                     GAsyncResult         *result,
103                                                                     GError              **error);
104 IDE_AVAILABLE_IN_3_32
105 void             ide_build_system_get_build_flags_for_dir_async    (IdeBuildSystem       *self,
106                                                                     GFile                *directory,
107                                                                     GCancellable         *cancellable,
108                                                                     GAsyncReadyCallback   callback,
109                                                                     gpointer              user_data);
110 IDE_AVAILABLE_IN_3_32
111 GHashTable      *ide_build_system_get_build_flags_for_dir_finish   (IdeBuildSystem       *self,
112                                                                     GAsyncResult         *result,
113                                                                     GError              **error);
114 void             _ide_build_system_set_project_file                (IdeBuildSystem       *self,
115                                                                     GFile                *project_file) G_GNUC_INTERNAL;
116 IDE_AVAILABLE_IN_3_32
117 gboolean         ide_build_system_supports_toolchain               (IdeBuildSystem       *self,
118                                                                     IdeToolchain         *toolchain);
119 IDE_AVAILABLE_IN_41
120 gboolean         ide_build_system_supports_language                (IdeBuildSystem       *self,
121                                                                     const char           *language);
122 
123 G_END_DECLS
124