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