QMake: Let the user decide whether to run a make step for subdir builds

Amends 66237a6e04.

Fixes: QTCREATORBUG-22956
Change-Id: I1c611a281eb0c2bad1f066a9753e685595b1eee1
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
This commit is contained in:
Christian Kandeler
2019-10-07 10:51:53 +02:00
parent 962ca920d8
commit 425732f810
4 changed files with 39 additions and 5 deletions

View File

@@ -375,6 +375,15 @@ MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep)
m_ui = new Internal::Ui::MakeStep; m_ui = new Internal::Ui::MakeStep;
m_ui->setupUi(this); m_ui->setupUi(this);
if (!makeStep->disablingForSubdirsSupported()) {
m_ui->disableInSubDirsLabel->hide();
m_ui->disableInSubDirsCheckBox->hide();
} else {
connect(m_ui->disableInSubDirsCheckBox, &QCheckBox::toggled, this, [this] {
m_makeStep->setEnabledForSubDirs(!m_ui->disableInSubDirsCheckBox->isChecked());
});
}
const auto availableTargets = makeStep->availableTargets(); const auto availableTargets = makeStep->availableTargets();
for (const QString &target : availableTargets) { for (const QString &target : availableTargets) {
auto item = new QListWidgetItem(target, m_ui->targetsList); auto item = new QListWidgetItem(target, m_ui->targetsList);
@@ -472,6 +481,7 @@ void MakeStepConfigWidget::updateDetails()
m_makeStep->jobCountOverridesMakeflags() ? Qt::Checked : Qt::Unchecked); m_makeStep->jobCountOverridesMakeflags() ? Qt::Checked : Qt::Unchecked);
m_ui->nonOverrideWarning->setVisible(m_makeStep->makeflagsJobCountMismatch() m_ui->nonOverrideWarning->setVisible(m_makeStep->makeflagsJobCountMismatch()
&& !m_makeStep->jobCountOverridesMakeflags()); && !m_makeStep->jobCountOverridesMakeflags());
m_ui->disableInSubDirsCheckBox->setChecked(!m_makeStep->enabledForSubDirs());
ProcessParameters param; ProcessParameters param;
param.setMacroExpander(bc->macroExpander()); param.setMacroExpander(bc->macroExpander());

View File

@@ -79,10 +79,15 @@ public:
bool userArgsContainsJobCount() const; bool userArgsContainsJobCount() const;
bool makeflagsJobCountMismatch() const; bool makeflagsJobCountMismatch() const;
bool disablingForSubdirsSupported() const { return m_disablingForSubDirsSupported; }
bool enabledForSubDirs() const { return m_enabledForSubDirs; }
void setEnabledForSubDirs(bool enabled) { m_enabledForSubDirs = enabled; }
Utils::Environment environment(BuildConfiguration *bc) const; Utils::Environment environment(BuildConfiguration *bc) const;
protected: protected:
bool fromMap(const QVariantMap &map) override; bool fromMap(const QVariantMap &map) override;
void supportDisablingForSubdirs() { m_disablingForSubDirsSupported = true; }
private: private:
QVariantMap toMap() const override; QVariantMap toMap() const override;
@@ -96,6 +101,8 @@ private:
int m_userJobCount = 4; int m_userJobCount = 4;
bool m_overrideMakeflags = false; bool m_overrideMakeflags = false;
bool m_clean = false; bool m_clean = false;
bool m_disablingForSubDirsSupported = false;
bool m_enabledForSubDirs = true;
}; };
class PROJECTEXPLORER_EXPORT MakeStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget class PROJECTEXPLORER_EXPORT MakeStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget

View File

@@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>399</width> <width>422</width>
<height>279</height> <height>279</height>
</rect> </rect>
</property> </property>
@@ -59,7 +59,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="4" column="0">
<widget class="QLabel" name="targetsLabel"> <widget class="QLabel" name="targetsLabel">
<property name="text"> <property name="text">
<string>Targets:</string> <string>Targets:</string>
@@ -69,7 +69,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1"> <item row="4" column="1">
<widget class="QListWidget" name="targetsList"/> <widget class="QListWidget" name="targetsList"/>
</item> </item>
<item row="2" column="1"> <item row="2" column="1">
@@ -100,6 +100,23 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="3" column="0">
<widget class="QLabel" name="disableInSubDirsLabel">
<property name="toolTip">
<string/>
</property>
<property name="text">
<string>Disable in subdirectories:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="disableInSubDirsCheckBox">
<property name="toolTip">
<string>Runs this step only for a top-level build.</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<customwidgets> <customwidgets>

View File

@@ -60,6 +60,7 @@ QmakeMakeStep::QmakeMakeStep(BuildStepList *bsl)
setClean(true); setClean(true);
setUserArguments("clean"); setUserArguments("clean");
} }
supportDisablingForSubdirs();
} }
bool QmakeMakeStep::init() bool QmakeMakeStep::init()
@@ -79,8 +80,7 @@ bool QmakeMakeStep::init()
} }
// Ignore all but the first make step for a non-top-level build. See QTCREATORBUG-15794. // Ignore all but the first make step for a non-top-level build. See QTCREATORBUG-15794.
m_ignoredNonTopLevelBuild = (bc->fileNodeBuild() || bc->subNodeBuild()) m_ignoredNonTopLevelBuild = (bc->fileNodeBuild() || bc->subNodeBuild()) && !enabledForSubDirs();
&& stepList()->firstOfType<QmakeMakeStep>() != this;
ProcessParameters *pp = processParameters(); ProcessParameters *pp = processParameters();
pp->setMacroExpander(bc->macroExpander()); pp->setMacroExpander(bc->macroExpander());