2020-03-11 17:03:23 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** Copyright (C) 2020 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator.
|
|
|
|
|
**
|
|
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
|
|
|
|
**
|
|
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "ibconsolebuildstep.h"
|
|
|
|
|
|
2020-08-05 16:21:52 +02:00
|
|
|
#include "commandbuilderaspect.h"
|
2020-03-11 17:03:23 +02:00
|
|
|
#include "incredibuildconstants.h"
|
|
|
|
|
|
2020-07-28 18:49:06 +02:00
|
|
|
#include <projectexplorer/abstractprocessstep.h>
|
2020-03-11 17:03:23 +02:00
|
|
|
#include <projectexplorer/buildconfiguration.h>
|
|
|
|
|
#include <projectexplorer/gnumakeparser.h>
|
|
|
|
|
#include <projectexplorer/kit.h>
|
|
|
|
|
#include <projectexplorer/processparameters.h>
|
2020-07-28 18:49:06 +02:00
|
|
|
#include <projectexplorer/projectconfigurationaspects.h>
|
2020-03-11 17:03:23 +02:00
|
|
|
#include <projectexplorer/target.h>
|
2020-07-28 18:49:06 +02:00
|
|
|
|
2020-03-11 17:03:23 +02:00
|
|
|
using namespace ProjectExplorer;
|
2020-07-28 18:49:06 +02:00
|
|
|
using namespace Utils;
|
2020-03-11 17:03:23 +02:00
|
|
|
|
|
|
|
|
namespace IncrediBuild {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
namespace Constants {
|
|
|
|
|
const QLatin1String IBCONSOLE_NICE("IncrediBuild.IBConsole.Nice");
|
|
|
|
|
const QLatin1String IBCONSOLE_COMMANDBUILDER("IncrediBuild.IBConsole.CommandBuilder");
|
|
|
|
|
const QLatin1String IBCONSOLE_KEEPJOBNUM("IncrediBuild.IBConsole.KeepJobNum");
|
|
|
|
|
const QLatin1String IBCONSOLE_FORCEREMOTE("IncrediBuild.IBConsole.ForceRemote");
|
|
|
|
|
const QLatin1String IBCONSOLE_ALTERNATE("IncrediBuild.IBConsole.Alternate");
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-28 18:49:06 +02:00
|
|
|
class IBConsoleBuildStep final : public AbstractProcessStep
|
|
|
|
|
{
|
|
|
|
|
Q_DECLARE_TR_FUNCTIONS(IncrediBuild::Internal::IBConsoleBuildStep)
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
IBConsoleBuildStep(BuildStepList *buildStepList, Id id);
|
|
|
|
|
|
|
|
|
|
bool init() final;
|
|
|
|
|
void setupOutputFormatter(OutputFormatter *formatter) final;
|
|
|
|
|
|
2020-08-06 16:48:43 +02:00
|
|
|
private:
|
2020-08-05 16:21:52 +02:00
|
|
|
CommandBuilderAspect *m_commandBuilder;
|
2020-08-13 09:16:00 +02:00
|
|
|
IntegerAspect *m_nice{nullptr};
|
|
|
|
|
BoolAspect *m_keepJobNum{nullptr};
|
|
|
|
|
BoolAspect *m_forceRemote{nullptr};
|
|
|
|
|
BoolAspect *m_alternate{nullptr};
|
2020-07-28 18:49:06 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
IBConsoleBuildStep::IBConsoleBuildStep(BuildStepList *buildStepList, Id id)
|
|
|
|
|
: AbstractProcessStep(buildStepList, id)
|
|
|
|
|
{
|
2020-08-06 16:48:43 +02:00
|
|
|
setDisplayName(tr("IncrediBuild for Linux"));
|
|
|
|
|
|
|
|
|
|
addAspect<TextDisplay>("<b>" + tr("Target and Configuration"));
|
2020-07-28 18:49:06 +02:00
|
|
|
|
2020-08-05 16:21:52 +02:00
|
|
|
m_commandBuilder = addAspect<CommandBuilderAspect>(this);
|
|
|
|
|
m_commandBuilder->setSettingsKey(Constants::IBCONSOLE_COMMANDBUILDER);
|
|
|
|
|
|
2020-08-06 16:48:43 +02:00
|
|
|
addAspect<TextDisplay>("<i>" + tr("Enter the appropriate arguments to your build command."));
|
|
|
|
|
addAspect<TextDisplay>("<i>" + tr("Make sure the build command's "
|
|
|
|
|
"multi-job parameter value is large enough (such as "
|
|
|
|
|
"-j200 for the JOM or Make build tools)"));
|
2020-07-28 18:49:06 +02:00
|
|
|
|
2020-08-13 09:16:00 +02:00
|
|
|
m_keepJobNum = addAspect<BoolAspect>();
|
2020-07-28 18:49:06 +02:00
|
|
|
m_keepJobNum->setSettingsKey(Constants::IBCONSOLE_KEEPJOBNUM);
|
|
|
|
|
m_keepJobNum->setLabel(tr("Keep Original Jobs Num:"));
|
|
|
|
|
m_keepJobNum->setToolTip(tr("Setting this option to true, forces IncrediBuild to not override "
|
|
|
|
|
"the -j command line switch. The default IncrediBuild behavior is "
|
|
|
|
|
"to set a high value to the -j command line switch which controls "
|
|
|
|
|
"the number of processes that the build tools executed by Qt will "
|
|
|
|
|
"execute in parallel (the default IncrediBuild behavior will set "
|
|
|
|
|
"this value to 200)."));
|
|
|
|
|
|
2020-08-06 16:48:43 +02:00
|
|
|
addAspect<TextDisplay>("<b>" + tr("IncrediBuild Distribution Control"));
|
|
|
|
|
|
2020-08-13 09:16:00 +02:00
|
|
|
m_nice = addAspect<IntegerAspect>();
|
2020-08-06 16:48:43 +02:00
|
|
|
m_nice->setSettingsKey(Constants::IBCONSOLE_NICE);
|
|
|
|
|
m_nice->setToolTip(tr("Specify nice value. Nice Value should be numeric and between -20 and 19"));
|
|
|
|
|
m_nice->setLabel(tr("Nice value:"));
|
|
|
|
|
m_nice->setRange(-20, 19);
|
|
|
|
|
|
2020-08-13 09:16:00 +02:00
|
|
|
m_forceRemote = addAspect<BoolAspect>();
|
2020-07-28 18:49:06 +02:00
|
|
|
m_forceRemote->setSettingsKey(Constants::IBCONSOLE_ALTERNATE);
|
|
|
|
|
m_forceRemote->setLabel(tr("Force remote:"));
|
|
|
|
|
|
2020-08-13 09:16:00 +02:00
|
|
|
m_alternate = addAspect<BoolAspect>();
|
2020-07-28 18:49:06 +02:00
|
|
|
m_alternate->setSettingsKey(Constants::IBCONSOLE_FORCEREMOTE);
|
|
|
|
|
m_alternate->setLabel(tr("Alternate tasks preference:"));
|
2020-03-11 17:03:23 +02:00
|
|
|
}
|
|
|
|
|
|
2020-07-28 18:49:06 +02:00
|
|
|
void IBConsoleBuildStep::setupOutputFormatter(OutputFormatter *formatter)
|
2020-03-11 17:03:23 +02:00
|
|
|
{
|
|
|
|
|
formatter->addLineParser(new GnuMakeParser());
|
|
|
|
|
formatter->addLineParsers(target()->kit()->createOutputParsers());
|
|
|
|
|
formatter->addSearchDir(processParameters()->effectiveWorkingDirectory());
|
|
|
|
|
AbstractProcessStep::setupOutputFormatter(formatter);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool IBConsoleBuildStep::init()
|
|
|
|
|
{
|
|
|
|
|
QStringList args;
|
|
|
|
|
|
2020-07-28 18:49:06 +02:00
|
|
|
if (m_nice->value() != 0)
|
|
|
|
|
args.append(QString("--nice %0 ").arg(m_nice->value()));
|
2020-03-11 17:03:23 +02:00
|
|
|
|
2020-07-28 18:49:06 +02:00
|
|
|
if (m_alternate->value())
|
2020-03-11 17:03:23 +02:00
|
|
|
args.append("--alternate");
|
|
|
|
|
|
2020-07-28 18:49:06 +02:00
|
|
|
if (m_forceRemote->value())
|
2020-03-11 17:03:23 +02:00
|
|
|
args.append("--force-remote");
|
|
|
|
|
|
2020-08-06 18:11:52 +02:00
|
|
|
args.append(m_commandBuilder->fullCommandFlag(m_keepJobNum->value()));
|
2020-03-11 17:03:23 +02:00
|
|
|
|
2020-07-28 18:49:06 +02:00
|
|
|
CommandLine cmdLine("ib_console", args);
|
2020-03-11 17:03:23 +02:00
|
|
|
ProcessParameters *procParams = processParameters();
|
|
|
|
|
procParams->setCommandLine(cmdLine);
|
2020-07-28 18:49:06 +02:00
|
|
|
procParams->setEnvironment(Environment::systemEnvironment());
|
2020-03-11 17:03:23 +02:00
|
|
|
|
|
|
|
|
BuildConfiguration *buildConfig = buildConfiguration();
|
|
|
|
|
if (buildConfig) {
|
|
|
|
|
procParams->setWorkingDirectory(buildConfig->buildDirectory());
|
|
|
|
|
procParams->setEnvironment(buildConfig->environment());
|
2020-07-28 18:49:06 +02:00
|
|
|
procParams->setMacroExpander(buildConfig->macroExpander());
|
2020-03-11 17:03:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return AbstractProcessStep::init();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2020-07-28 18:49:06 +02:00
|
|
|
// IBConsoleStepFactory
|
|
|
|
|
|
|
|
|
|
IBConsoleStepFactory::IBConsoleStepFactory()
|
|
|
|
|
{
|
|
|
|
|
registerStep<IBConsoleBuildStep>(IncrediBuild::Constants::IBCONSOLE_BUILDSTEP_ID);
|
2020-08-06 16:48:43 +02:00
|
|
|
setDisplayName(IBConsoleBuildStep::tr("IncrediBuild for Linux"));
|
2020-07-28 18:49:06 +02:00
|
|
|
setSupportedStepLists({ProjectExplorer::Constants::BUILDSTEPS_BUILD,
|
|
|
|
|
ProjectExplorer::Constants::BUILDSTEPS_CLEAN});
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-11 17:03:23 +02:00
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace IncrediBuild
|