| 133 | } |
| 134 | |
| 135 | ProjectFolderItem* 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 | |
| 175 | ProjectFolderItem* QMakeProjectManager::buildFolderItem(IProject* project, const Path& path, ProjectBaseItem* parent) |
| 176 | { |
nothing calls this directly
no test coverage detected