Changeset View
Changeset View
Standalone View
Standalone View
plugins/meson/mesonintrospectjob.h
- This file was added.
1 | /* This file is part of KDevelop | ||||
---|---|---|---|---|---|
2 | Copyright 2019 Daniel Mensinger <daniel@mensinger-ka.de> | ||||
3 | | ||||
4 | This library is free software; you can redistribute it and/or | ||||
5 | modify it under the terms of the GNU Library General Public | ||||
6 | License as published by the Free Software Foundation; either | ||||
7 | version 2 of the License, or (at your option) any later version. | ||||
8 | | ||||
9 | This library is distributed in the hope that it will be useful, | ||||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
12 | Library General Public License for more details. | ||||
13 | | ||||
14 | You should have received a copy of the GNU Library General Public License | ||||
15 | along with this library; see the file COPYING.LIB. If not, write to | ||||
16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||||
17 | Boston, MA 02110-1301, USA. | ||||
18 | */ | ||||
19 | | ||||
20 | #pragma once | ||||
21 | | ||||
22 | #include "mesonconfig.h" | ||||
23 | #include "mesonoptions.h" | ||||
24 | #include <QFutureWatcher> | ||||
25 | #include <interfaces/iproject.h> | ||||
26 | #include <kjob.h> | ||||
27 | #include <memory> | ||||
28 | | ||||
29 | class QJsonObject; | ||||
30 | | ||||
31 | class MesonIntrospectJob : public KJob | ||||
32 | { | ||||
33 | Q_OBJECT | ||||
34 | | ||||
35 | public: | ||||
36 | enum Type { BENCHMARKS, BUILDOPTIONS, BUILDSYSTEM_FILES, DEPENDENCIES, INSTALLED, PROJECTINFO, TARGETS, TESTS }; | ||||
37 | enum Mode { BUILD_DIR, MESON_FILE }; | ||||
38 | | ||||
39 | public: | ||||
40 | explicit MesonIntrospectJob(KDevelop::IProject* project, QVector<Type> types, Mode mode, QObject* parent); | ||||
41 | explicit MesonIntrospectJob(KDevelop::Path projectPath, KDevelop::Path meson, QVector<Type> types, QObject* parent); | ||||
42 | explicit MesonIntrospectJob(KDevelop::Path projectPath, Meson::BuildDir buildDir, QVector<Type> types, Mode mode, | ||||
43 | QObject* parent); | ||||
44 | | ||||
45 | void start() override; | ||||
46 | bool doKill() override; | ||||
47 | | ||||
48 | QString getTypeString(Type type) const; | ||||
49 | | ||||
50 | MESON_OPT_PTR buildOptions(); | ||||
51 | | ||||
52 | private: | ||||
53 | QString importJSONFile(Meson::BuildDir const& buildDir, Type type, QJsonObject* out); | ||||
54 | QString importMesonAPI(Meson::BuildDir const& buildDir, Type type, QJsonObject* out); | ||||
55 | QString import(Meson::BuildDir buildDir); | ||||
56 | void finished(); | ||||
57 | | ||||
58 | QFutureWatcher<QString> m_futureWatcher; | ||||
59 | | ||||
60 | // The commands to execute | ||||
61 | QVector<Type> m_types = {}; | ||||
62 | Mode m_mode = BUILD_DIR; | ||||
63 | Meson::BuildDir m_buildDir; | ||||
64 | KDevelop::Path m_projectPath; | ||||
65 | | ||||
66 | // The results | ||||
67 | MESON_OPT_PTR m_res_options = nullptr; | ||||
68 | }; |