MCPcopy Create free account
hub / github.com/KDE/kdevelop / getMesonConfig

Method getMesonConfig

plugins/meson/mesonconfig.cpp:74–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74MesonConfig Meson::getMesonConfig(IProject* project)
75{
76 KConfigGroup root = rootGroup(project);
77 MesonConfig result;
78
79 int numDirs = root.readEntry(NUM_BUILD_DIRS, 0);
80 result.currentIndex = root.readEntry(CURRENT_INDEX, -1);
81
82 for (int i = 0; i < numDirs; ++i) {
83 QString section = BUILD_DIR_SEC.arg(i);
84 if (!root.hasGroup(section)) {
85 continue;
86 }
87
88 KConfigGroup current = root.group(section);
89 BuildDir currBD;
90 currBD.buildDir = Path(current.readEntry(BUILD_DIR_PATH, QString()));
91 currBD.mesonExecutable = Path(current.readEntry(MESON_EXE, QString()));
92 currBD.mesonBackend = current.readEntry(BACKEND, QString());
93 currBD.mesonArgs = current.readEntry(EXTRA_ARGS, QString());
94
95 currBD.canonicalizePaths();
96
97 // Try to find meson if the config is bad
98 if (currBD.mesonExecutable.isEmpty()) {
99 Q_ASSERT(project);
100 IBuildSystemManager* ibsm = project->buildSystemManager();
101 auto* bsm = dynamic_cast<MesonManager*>(ibsm);
102 if (bsm) {
103 currBD.mesonExecutable = bsm->findMeson();
104 }
105 }
106
107 result.buildDirs.push_back(currBD);
108 }
109
110 if (result.buildDirs.isEmpty()) {
111 result.currentIndex = -1;
112 } else if (result.currentIndex < 0 || result.currentIndex >= result.buildDirs.size()) {
113 result.currentIndex = 0;
114 }
115
116 return result;
117}
118
119void Meson::writeMesonConfig(IProject* project, const MesonConfig& cfg)
120{

Callers

nothing calls this directly

Calls 9

readEntryMethod · 0.80
canonicalizePathsMethod · 0.80
buildSystemManagerMethod · 0.80
findMesonMethod · 0.80
PathClass · 0.50
QStringClass · 0.50
isEmptyMethod · 0.45
push_backMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected