| 201 | } |
| 202 | |
| 203 | KJob* MesonBuilder::configureIfRequired(KDevelop::IProject* project, KJob* realJob) |
| 204 | { |
| 205 | Q_ASSERT(project); |
| 206 | Meson::BuildDir buildDir = Meson::currentBuildDir(project); |
| 207 | DirectoryStatus status = evaluateBuildDirectory(buildDir.buildDir, buildDir.mesonBackend); |
| 208 | |
| 209 | if (status == MESON_CONFIGURED) { |
| 210 | return realJob; |
| 211 | } |
| 212 | |
| 213 | KJob* configureJob = nullptr; |
| 214 | if (buildDir.isValid()) { |
| 215 | configureJob = configure(project, buildDir, {}, status); |
| 216 | } else { |
| 217 | // Create a new build directory |
| 218 | auto* bsm = project->buildSystemManager(); |
| 219 | auto* manager = dynamic_cast<MesonManager*>(bsm); |
| 220 | if (!manager) { |
| 221 | return new ErrorJob(this, i18n("Internal error: The buildsystem manager is not the MesonManager")); |
| 222 | } |
| 223 | |
| 224 | configureJob = manager->newBuildDirectory(project); |
| 225 | if (!configureJob) { |
| 226 | return new ErrorJob(this, i18n("Failed to create a new build directory")); |
| 227 | } |
| 228 | } |
| 229 | |
| 230 | QList<KJob*> jobs = { |
| 231 | configure(project, buildDir, {}, status), // First configure the build directory |
| 232 | realJob // If this succeeds execute the real job |
| 233 | }; |
| 234 | |
| 235 | return new ExecuteCompositeJob(this, jobs); |
| 236 | } |
| 237 | |
| 238 | KJob* MesonBuilder::build(KDevelop::ProjectBaseItem* item) |
| 239 | { |
nothing calls this directly
no test coverage detected