| 133 | } |
| 134 | |
| 135 | KJob* MesonBuilder::configure(IProject* project, const Meson::BuildDir& buildDir, QStringList args, |
| 136 | DirectoryStatus status) |
| 137 | { |
| 138 | Q_ASSERT(project); |
| 139 | |
| 140 | if (!buildDir.isValid()) { |
| 141 | return new ErrorJob(this, i18n("The current build directory for %1 is invalid", project->name())); |
| 142 | } |
| 143 | |
| 144 | if (status == ___UNDEFINED___) { |
| 145 | status = evaluateBuildDirectory(buildDir.buildDir, buildDir.mesonBackend); |
| 146 | } |
| 147 | |
| 148 | KJob* job = nullptr; |
| 149 | |
| 150 | switch (status) { |
| 151 | case DOES_NOT_EXIST: |
| 152 | case CLEAN: |
| 153 | case MESON_FAILED_CONFIGURATION: |
| 154 | job = new MesonJob(buildDir, project, MesonJob::CONFIGURE, args, this); |
| 155 | connect(job, &KJob::result, this, [this, project]() { emit configured(project); }); |
| 156 | return job; |
| 157 | case MESON_CONFIGURED: |
| 158 | job = new MesonJob(buildDir, project, MesonJob::RE_CONFIGURE, args, this); |
| 159 | connect(job, &KJob::result, this, [this, project]() { emit configured(project); }); |
| 160 | return job; |
| 161 | case DIR_NOT_EMPTY: |
| 162 | return new ErrorJob( |
| 163 | this, |
| 164 | i18n("The directory '%1' is not empty and does not seem to be an already configured build directory", |
| 165 | buildDir.buildDir.toLocalFile())); |
| 166 | case INVALID_BUILD_DIR: |
| 167 | return new ErrorJob( |
| 168 | this, |
| 169 | i18n("The directory '%1' cannot be used as a meson build directory", buildDir.buildDir.toLocalFile())); |
| 170 | case EMPTY_STRING: |
| 171 | return new ErrorJob( |
| 172 | this, i18n("The current build configuration is broken, because the build directory is not specified")); |
| 173 | default: |
| 174 | // This code should NEVER be reached |
| 175 | return new ErrorJob(this, |
| 176 | i18n("Congratulations: You have reached unreachable code!\n" |
| 177 | "Please report a bug at https://bugs.kde.org/\n" |
| 178 | "FILE: %1:%2", |
| 179 | QStringLiteral(__FILE__), __LINE__)); |
| 180 | } |
| 181 | } |
| 182 | |
| 183 | KJob* MesonBuilder::configure(KDevelop::IProject* project) |
| 184 | { |
no test coverage detected