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

Method projectRootItem

plugins/qmakemanager/qmakemanager.cpp:135–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133}
134
135ProjectFolderItem* QMakeProjectManager::projectRootItem(IProject* project, const Path& path)
136{
137 QDir dir(path.toLocalFile());
138
139 auto item = new QMakeFolderItem(project, path);
140
141 const auto projectfiles = dir.entryList(QStringList() << QStringLiteral("*.pro"));
142 if (projectfiles.isEmpty()) {
143 return item;
144 }
145
146 QHash<QString, QString> qmvars = QMakeUtils::queryQMake(project);
147 const QString mkSpecFile = QMakeConfig::findBasicMkSpec(qmvars);
148 Q_ASSERT(!mkSpecFile.isEmpty());
149 auto* mkspecs = new QMakeMkSpecs(mkSpecFile, qmvars);
150 mkspecs->setProject(project);
151 mkspecs->read();
152 QMakeCache* cache = findQMakeCache(project);
153 if (cache) {
154 cache->setMkSpecs(mkspecs);
155 cache->read();
156 }
157
158 for (const auto& projectfile : projectfiles) {
159 Path proPath(path, projectfile);
160 /// TODO: use Path in QMakeProjectFile
161 auto* scope = new QMakeProjectFile(proPath.toLocalFile());
162 scope->setProject(project);
163 scope->setMkSpecs(mkspecs);
164 scope->setOwnMkSpecs(true);
165 if (cache) {
166 scope->setQMakeCache(cache);
167 }
168 scope->read();
169 qCDebug(KDEV_QMAKE) << "top-level scope with variables:" << scope->variables();
170 item->addProjectFile(scope);
171 }
172 return item;
173}
174
175ProjectFolderItem* QMakeProjectManager::buildFolderItem(IProject* project, const Path& path, ProjectBaseItem* parent)
176{

Callers

nothing calls this directly

Calls 10

QStringListClass · 0.85
toLocalFileMethod · 0.80
setOwnMkSpecsMethod · 0.80
setQMakeCacheMethod · 0.80
addProjectFileMethod · 0.80
isEmptyMethod · 0.45
setProjectMethod · 0.45
readMethod · 0.45
setMkSpecsMethod · 0.45
variablesMethod · 0.45

Tested by

no test coverage detected