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

Method populateTargets

plugins/meson/mesonmanager.cpp:184–219  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

182// ***************************
183
184void MesonManager::populateTargets(ProjectFolderItem* item, QVector<MesonTarget*> targets)
185{
186 // Remove all old targets
187 for (ProjectTargetItem* i : item->targetList()) {
188 delete i;
189 }
190
191 // Add the new targets
192 auto dirPath = item->path();
193 for (MesonTarget* i : targets) {
194 if (!dirPath.isDirectParentOf(i->definedIn())) {
195 continue;
196 }
197
198 if (i->type().contains(QStringLiteral("executable"))) {
199 auto outFiles = i->filename();
200 Path outFile;
201 if (outFiles.size() > 0) {
202 outFile = outFiles[0];
203 }
204 new MesonProjectExecutableTargetItem(item->project(), i->name(), item, outFile);
205 } else if (i->type().contains(QStringLiteral("library"))) {
206 new ProjectLibraryTargetItem(item->project(), i->name(), item);
207 } else {
208 new ProjectTargetItem(item->project(), i->name(), item);
209 }
210 }
211
212 // Recurse
213 for (ProjectFolderItem* i : item->folderList()) {
214 QVector<MesonTarget*> filteredTargets;
215 copy_if(begin(targets), end(targets), back_inserter(filteredTargets),
216 [i](MesonTarget* t) -> bool { return i->path().isParentOf(t->definedIn()); });
217 populateTargets(i, filteredTargets);
218 }
219}
220
221QList<ProjectTargetItem*> MesonManager::targets(ProjectFolderItem* item) const
222{

Callers

nothing calls this directly

Calls 15

populateTargetsFunction · 0.85
targetListMethod · 0.80
isDirectParentOfMethod · 0.80
definedInMethod · 0.80
folderListMethod · 0.80
isParentOfMethod · 0.80
beginFunction · 0.50
endFunction · 0.50
pathMethod · 0.45
containsMethod · 0.45
typeMethod · 0.45
filenameMethod · 0.45

Tested by

no test coverage detected