forked from qt-creator/qt-creator
ProjectExplorer: Allow users to schedule a run
... while a build for the corresponding project is going on. The respective application will be run after the build has finished. Fixes: QTCREATORBUG-14297 Change-Id: Ib0931c2ff6529d891faa41d499afe7ede97a11db Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -76,6 +76,7 @@ public:
|
||||
int m_progress = 0;
|
||||
int m_maxProgress = 0;
|
||||
bool m_running = false;
|
||||
bool m_isDeploying = false;
|
||||
// is set to true while canceling, so that nextBuildStep knows that the BuildStep finished because of canceling
|
||||
bool m_skipDisabled = false;
|
||||
bool m_canceling = false;
|
||||
@@ -180,6 +181,11 @@ bool BuildManager::isBuilding()
|
||||
return !d->m_buildQueue.isEmpty() || d->m_running;
|
||||
}
|
||||
|
||||
bool BuildManager::isDeploying()
|
||||
{
|
||||
return d->m_isDeploying;
|
||||
}
|
||||
|
||||
int BuildManager::getErrorTaskCount()
|
||||
{
|
||||
const int errors =
|
||||
@@ -243,6 +249,7 @@ void BuildManager::clearBuildQueue()
|
||||
d->m_buildQueue.clear();
|
||||
d->m_enabledState.clear();
|
||||
d->m_running = false;
|
||||
d->m_isDeploying = false;
|
||||
d->m_previousBuildStepProject = nullptr;
|
||||
d->m_currentBuildStep = nullptr;
|
||||
|
||||
@@ -452,6 +459,7 @@ void BuildManager::nextStep()
|
||||
d->m_currentBuildStep->run();
|
||||
} else {
|
||||
d->m_running = false;
|
||||
d->m_isDeploying = false;
|
||||
d->m_previousBuildStepProject = nullptr;
|
||||
d->m_progressFutureInterface->reportFinished();
|
||||
d->m_progressWatcher.setFuture(QFuture<void>());
|
||||
@@ -532,6 +540,7 @@ bool BuildManager::buildLists(QList<BuildStepList *> bsls, const QStringList &pr
|
||||
foreach (BuildStepList *list, bsls) {
|
||||
steps.append(list->steps());
|
||||
stepListNames.append(ProjectExplorerPlugin::displayNameForStepId(list->id()));
|
||||
d->m_isDeploying = d->m_isDeploying || list->id() == Constants::BUILDSTEPS_DEPLOY;
|
||||
}
|
||||
|
||||
QStringList names;
|
||||
|
@@ -49,6 +49,7 @@ public:
|
||||
static void extensionsInitialized();
|
||||
|
||||
static bool isBuilding();
|
||||
static bool isDeploying();
|
||||
static bool tasksAvailable();
|
||||
|
||||
static bool buildLists(QList<BuildStepList *> bsls,
|
||||
|
@@ -2368,6 +2368,7 @@ void ProjectExplorerPluginPrivate::buildQueueFinished(bool success)
|
||||
m_delayedRunConfiguration = nullptr;
|
||||
m_shouldHaveRunConfiguration = false;
|
||||
m_runMode = Constants::NO_RUN_MODE;
|
||||
emit m_instance->updateRunActions();
|
||||
}
|
||||
|
||||
void ProjectExplorerPluginPrivate::runConfigurationConfigurationFinished()
|
||||
@@ -2857,8 +2858,9 @@ void ProjectExplorerPlugin::runRunConfiguration(RunConfiguration *rc,
|
||||
|
||||
QList<Id> stepIds;
|
||||
if (!forceSkipDeploy && dd->m_projectExplorerSettings.deployBeforeRun) {
|
||||
if (dd->m_projectExplorerSettings.buildBeforeDeploy)
|
||||
if (!BuildManager::isBuilding() && dd->m_projectExplorerSettings.buildBeforeDeploy)
|
||||
stepIds << Id(Constants::BUILDSTEPS_BUILD);
|
||||
if (!BuildManager::isDeploying())
|
||||
stepIds << Id(Constants::BUILDSTEPS_DEPLOY);
|
||||
}
|
||||
|
||||
@@ -2868,7 +2870,9 @@ void ProjectExplorerPlugin::runRunConfiguration(RunConfiguration *rc,
|
||||
if (queueCount < 0) // something went wrong
|
||||
return;
|
||||
|
||||
if (queueCount > 0) {
|
||||
if (queueCount > 0 || BuildManager::isBuilding(rc->project())) {
|
||||
QTC_ASSERT(dd->m_runMode == Constants::NO_RUN_MODE, return);
|
||||
|
||||
// delay running till after our queued steps were processed
|
||||
dd->m_runMode = runMode;
|
||||
dd->m_delayedRunConfiguration = rc;
|
||||
@@ -3083,9 +3087,9 @@ bool ProjectExplorerPlugin::canRunStartupProject(Core::Id runMode, QString *whyN
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (dd->m_projectExplorerSettings.buildBeforeDeploy
|
||||
&& dd->m_projectExplorerSettings.deployBeforeRun
|
||||
&& !BuildManager::isBuilding(project)
|
||||
&& hasBuildSettings(project)) {
|
||||
QPair<bool, QString> buildState = dd->buildSettingsEnabled(project);
|
||||
if (!buildState.first) {
|
||||
@@ -3093,6 +3097,12 @@ bool ProjectExplorerPlugin::canRunStartupProject(Core::Id runMode, QString *whyN
|
||||
*whyNot = buildState.second;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (BuildManager::isBuilding()) {
|
||||
if (whyNot)
|
||||
*whyNot = tr("A build is still in progress.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// shouldn't actually be shown to the user...
|
||||
@@ -3102,9 +3112,9 @@ bool ProjectExplorerPlugin::canRunStartupProject(Core::Id runMode, QString *whyN
|
||||
return false;
|
||||
}
|
||||
|
||||
if (BuildManager::isBuilding()) {
|
||||
if (dd->m_delayedRunConfiguration && dd->m_delayedRunConfiguration->project() == project) {
|
||||
if (whyNot)
|
||||
*whyNot = tr("A build is still in progress.");
|
||||
*whyNot = tr("A run action is already scheduled for the active project.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user