Changeset View
Changeset View
Standalone View
Standalone View
plugins/meson/mesonbuilder.cpp
Show First 20 Lines • Show All 134 Lines • ▼ Show 20 Line(s) | 131 | for (auto const& i : configured) { | |||
---|---|---|---|---|---|
135 | if (!currFI.exists()) { | 135 | if (!currFI.exists()) { | ||
136 | return MESON_FAILED_CONFIGURATION; | 136 | return MESON_FAILED_CONFIGURATION; | ||
137 | } | 137 | } | ||
138 | } | 138 | } | ||
139 | 139 | | |||
140 | return MESON_CONFIGURED; | 140 | return MESON_CONFIGURED; | ||
141 | } | 141 | } | ||
142 | 142 | | |||
143 | KJob* MesonBuilder::configure(IProject* project, const Meson::BuildDir& buildDir, DirectoryStatus status) | 143 | KJob* MesonBuilder::configure(IProject* project, const Meson::BuildDir& buildDir, QStringList args, | ||
144 | DirectoryStatus status) | ||||
144 | { | 145 | { | ||
145 | Q_ASSERT(project); | 146 | Q_ASSERT(project); | ||
146 | 147 | | |||
147 | if (!buildDir.isValid()) { | 148 | if (!buildDir.isValid()) { | ||
148 | return new ErrorJob(this, i18n("The current build directory for %1 is invalid", project->name())); | 149 | return new ErrorJob(this, i18n("The current build directory for %1 is invalid", project->name())); | ||
149 | } | 150 | } | ||
150 | 151 | | |||
151 | if (status == ___UNDEFINED___) { | 152 | if (status == ___UNDEFINED___) { | ||
152 | status = evaluateBuildDirectory(buildDir.buildDir, buildDir.mesonBackend); | 153 | status = evaluateBuildDirectory(buildDir.buildDir, buildDir.mesonBackend); | ||
153 | } | 154 | } | ||
154 | 155 | | |||
155 | KJob* job = nullptr; | 156 | KJob* job = nullptr; | ||
156 | 157 | | |||
157 | switch (status) { | 158 | switch (status) { | ||
158 | case DOES_NOT_EXIST: | 159 | case DOES_NOT_EXIST: | ||
159 | case CLEAN: | 160 | case CLEAN: | ||
160 | case MESON_FAILED_CONFIGURATION: | 161 | case MESON_FAILED_CONFIGURATION: | ||
161 | job = new MesonJob(buildDir, project, MesonJob::CONFIGURE, {}, this); | 162 | job = new MesonJob(buildDir, project, MesonJob::CONFIGURE, args, this); | ||
162 | connect(job, &KJob::result, this, [this, project]() { emit configured(project); }); | 163 | connect(job, &KJob::result, this, [this, project]() { emit configured(project); }); | ||
163 | return job; | 164 | return job; | ||
164 | case MESON_CONFIGURED: | 165 | case MESON_CONFIGURED: | ||
165 | job = new MesonJob(buildDir, project, MesonJob::RE_CONFIGURE, {}, this); | 166 | job = new MesonJob(buildDir, project, MesonJob::RE_CONFIGURE, args, this); | ||
166 | connect(job, &KJob::result, this, [this, project]() { emit configured(project); }); | 167 | connect(job, &KJob::result, this, [this, project]() { emit configured(project); }); | ||
167 | return job; | 168 | return job; | ||
168 | case DIR_NOT_EMPTY: | 169 | case DIR_NOT_EMPTY: | ||
169 | return new ErrorJob( | 170 | return new ErrorJob( | ||
170 | this, | 171 | this, | ||
171 | i18n("The directory '%1' is not empty and does not seem to be an already configured build directory", | 172 | i18n("The directory '%1' is not empty and does not seem to be an already configured build directory", | ||
172 | buildDir.buildDir.toLocalFile())); | 173 | buildDir.buildDir.toLocalFile())); | ||
173 | case INVALID_BUILD_DIR: | 174 | case INVALID_BUILD_DIR: | ||
Show All 12 Lines | 184 | i18n("Congratulations: You have reached unreachable code!\n" | |||
186 | QStringLiteral(__FILE__), __LINE__)); | 187 | QStringLiteral(__FILE__), __LINE__)); | ||
187 | } | 188 | } | ||
188 | } | 189 | } | ||
189 | 190 | | |||
190 | KJob* MesonBuilder::configure(KDevelop::IProject* project) | 191 | KJob* MesonBuilder::configure(KDevelop::IProject* project) | ||
191 | { | 192 | { | ||
192 | Q_ASSERT(project); | 193 | Q_ASSERT(project); | ||
193 | auto buildDir = Meson::currentBuildDir(project); | 194 | auto buildDir = Meson::currentBuildDir(project); | ||
194 | return configure(project, buildDir); | 195 | return configure(project, buildDir, {}); | ||
195 | } | 196 | } | ||
196 | 197 | | |||
197 | KJob* MesonBuilder::configureIfRequired(KDevelop::IProject* project, KJob* realJob) | 198 | KJob* MesonBuilder::configureIfRequired(KDevelop::IProject* project, KJob* realJob) | ||
198 | { | 199 | { | ||
199 | Q_ASSERT(project); | 200 | Q_ASSERT(project); | ||
200 | Meson::BuildDir buildDir = Meson::currentBuildDir(project); | 201 | Meson::BuildDir buildDir = Meson::currentBuildDir(project); | ||
201 | DirectoryStatus status = evaluateBuildDirectory(buildDir.buildDir, buildDir.mesonBackend); | 202 | DirectoryStatus status = evaluateBuildDirectory(buildDir.buildDir, buildDir.mesonBackend); | ||
202 | 203 | | |||
203 | if (status == MESON_CONFIGURED) { | 204 | if (status == MESON_CONFIGURED) { | ||
204 | return realJob; | 205 | return realJob; | ||
205 | } | 206 | } | ||
206 | 207 | | |||
207 | QList<KJob*> jobs = { | 208 | QList<KJob*> jobs = { | ||
208 | configure(project, buildDir, status), // First configure the build directory | 209 | configure(project, buildDir, {}, status), // First configure the build directory | ||
209 | realJob // If this succeeds execute the real job | 210 | realJob // If this succeeds execute the real job | ||
210 | }; | 211 | }; | ||
211 | 212 | | |||
212 | return new ExecuteCompositeJob(this, jobs); | 213 | return new ExecuteCompositeJob(this, jobs); | ||
213 | } | 214 | } | ||
214 | 215 | | |||
215 | KJob* MesonBuilder::build(KDevelop::ProjectBaseItem* item) | 216 | KJob* MesonBuilder::build(KDevelop::ProjectBaseItem* item) | ||
216 | { | 217 | { | ||
▲ Show 20 Lines • Show All 49 Lines • Show Last 20 Lines |