| 160 | } |
| 161 | |
| 162 | void failedConnection(int code) { |
| 163 | Q_ASSERT(code > 0); |
| 164 | Q_ASSERT(!server->isServerAvailable()); |
| 165 | |
| 166 | qCDebug(CMAKE) << "CMake does not provide server mode, using compile_commands.json to import" << project->name(); |
| 167 | |
| 168 | // parse the JSON file |
| 169 | auto* job = new CMakeImportJsonJob(project, this); |
| 170 | |
| 171 | // create the JSON file if it doesn't exist |
| 172 | auto commandsFile = CMake::commandsFile(project); |
| 173 | if (!QFileInfo::exists(commandsFile.toLocalFile())) { |
| 174 | qCDebug(CMAKE) << "couldn't find commands file:" << commandsFile << "- now trying to reconfigure"; |
| 175 | addSubjob(manager->builder()->configure(project)); |
| 176 | } |
| 177 | |
| 178 | connect(job, &CMakeImportJsonJob::result, this, [this, job]() { |
| 179 | if (job->error() == 0) { |
| 180 | manager->integrateData(job->projectData(), job->project()); |
| 181 | } |
| 182 | }); |
| 183 | addSubjob(job); |
| 184 | ExecuteCompositeJob::start(); |
| 185 | } |
| 186 | |
| 187 | void reconfigureThenImport() |
| 188 | { |
nothing calls this directly
no test coverage detected