Qmake: Show real effective make call on Make step - take 2

Include custom Makefile.

Change-Id: Ibc6a341590f8b1ff0da2fa87f5e5bcd75182b6a7
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Orgad Shaneh
2019-10-07 12:08:48 +03:00
committed by Orgad Shaneh
parent 92c067ba36
commit d26140e7f1
7 changed files with 40 additions and 10 deletions

View File

@@ -85,7 +85,7 @@ bool MakeStep::init()
if (!bc)
emit addTask(Task::buildConfigurationMissingTask());
const CommandLine make = effectiveMakeCommand();
const CommandLine make = effectiveMakeCommand(Execution);
if (make.executable().isEmpty())
emit addTask(makeCommandMissingTask());
@@ -323,15 +323,27 @@ void MakeStep::setUserArguments(const QString &args)
m_userArguments = args;
}
QStringList MakeStep::displayArguments() const
{
return {};
}
FilePath MakeStep::makeCommand() const
{
return m_makeCommand;
}
CommandLine MakeStep::effectiveMakeCommand() const
FilePath MakeStep::makeExecutable() const
{
CommandLine cmd(m_makeCommand.isEmpty() ? defaultMakeCommand() : m_makeCommand);
return m_makeCommand.isEmpty() ? defaultMakeCommand() : m_makeCommand;
}
CommandLine MakeStep::effectiveMakeCommand(MakeCommandType type) const
{
CommandLine cmd(makeExecutable());
if (type == Display)
cmd.addArgs(displayArguments());
cmd.addArgs(m_userArguments, CommandLine::Raw);
cmd.addArgs(jobArguments());
cmd.addArgs(m_buildTargets);
@@ -431,6 +443,8 @@ MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep)
this, &MakeStepConfigWidget::updateDetails);
connect(m_makeStep->buildConfiguration(), &BuildConfiguration::buildDirectoryChanged,
this, &MakeStepConfigWidget::updateDetails);
connect(m_makeStep->project(), &Project::parsingFinished,
this, &MakeStepConfigWidget::updateDetails);
Core::VariableChooser::addSupportForChildWidgets(this, m_makeStep->macroExpander());
}
@@ -464,7 +478,7 @@ void MakeStepConfigWidget::updateDetails()
else
m_ui->makeLabel->setText(tr("Override %1:").arg(QDir::toNativeSeparators(defaultMake)));
const CommandLine make = m_makeStep->effectiveMakeCommand();
const CommandLine make = m_makeStep->effectiveMakeCommand(MakeStep::Display);
if (make.executable().isEmpty()) {
setSummaryText(tr("<b>Make:</b> %1").arg(MakeStep::msgNoMakeCommand()));
return;

View File

@@ -45,6 +45,10 @@ class PROJECTEXPLORER_EXPORT MakeStep : public ProjectExplorer::AbstractProcessS
Q_OBJECT
public:
enum MakeCommandType {
Display,
Execution
};
explicit MakeStep(ProjectExplorer::BuildStepList *parent, Core::Id id);
void setBuildTarget(const QString &buildTarget);
@@ -59,7 +63,8 @@ public:
void setUserArguments(const QString &args);
Utils::FilePath makeCommand() const;
void setMakeCommand(const Utils::FilePath &command);
Utils::CommandLine effectiveMakeCommand() const;
Utils::FilePath makeExecutable() const;
Utils::CommandLine effectiveMakeCommand(MakeCommandType type) const;
void setClean(bool clean);
bool isClean() const;
@@ -88,6 +93,7 @@ public:
protected:
bool fromMap(const QVariantMap &map) override;
void supportDisablingForSubdirs() { m_disablingForSubDirsSupported = true; }
virtual QStringList displayArguments() const;
private:
QVariantMap toMap() const override;

View File

@@ -946,7 +946,7 @@ MakeInstallCommand Project::makeInstallCommand(const Target *target, const QStri
if (const BuildConfiguration * const bc = target->activeBuildConfiguration()) {
if (const auto makeStep = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD)
->firstOfType<MakeStep>()) {
cmd.command = makeStep->effectiveMakeCommand().executable();
cmd.command = makeStep->makeExecutable();
}
}
cmd.arguments << "install" << ("INSTALL_ROOT=" + QDir::toNativeSeparators(installRoot));

View File

@@ -69,7 +69,7 @@ bool QmakeMakeStep::init()
if (!bc)
emit addTask(Task::buildConfigurationMissingTask());
const Utils::CommandLine unmodifiedMake = effectiveMakeCommand();
const Utils::CommandLine unmodifiedMake = effectiveMakeCommand(Execution);
const Utils::FilePath makeExecutable = unmodifiedMake.executable();
if (makeExecutable.isEmpty())
emit addTask(makeCommandMissingTask());
@@ -212,6 +212,14 @@ void QmakeMakeStep::finish(bool success)
MakeStep::finish(success);
}
QStringList QmakeMakeStep::displayArguments() const
{
const auto bc = static_cast<QmakeBuildConfiguration *>(buildConfiguration());
if (bc && !bc->makefile().isEmpty())
return {"-f", bc->makefile()};
return {};
}
///
// QmakeMakeStepFactory
///

View File

@@ -53,6 +53,7 @@ private:
void finish(bool success) override;
bool init() override;
void doRun() override;
QStringList displayArguments() const override;
bool m_scriptTarget = false;
QString m_makeFileToCheck;

View File

@@ -443,8 +443,9 @@ void QMakeStep::setSeparateDebugInfo(bool enable)
FilePath QMakeStep::makeCommand() const
{
auto ms = stepList()->firstOfType<MakeStep>();
return ms ? ms->effectiveMakeCommand().executable() : FilePath();
if (auto ms = stepList()->firstOfType<MakeStep>())
return ms->makeExecutable();
return FilePath();
}
QString QMakeStep::makeArguments(const QString &makefile) const

View File

@@ -214,7 +214,7 @@ void MakeInstallStep::updateFullCommandLine()
// FIXME: Only executable?
static_cast<BaseStringAspect *>(aspect(FullCommandLineAspectId))->setValue(
QDir::toNativeSeparators(
QtcProcess::quoteArg(effectiveMakeCommand().executable().toString()))
QtcProcess::quoteArg(makeExecutable().toString()))
+ ' ' + userArguments());
}