Incredibuild: Use new AbstractProcessStep convenience functions

Change-Id: Id741ed68f146bbe6473925bc6bcdaa2f330f3ea6
Reviewed-by: <nir.bar@panel-sw.co.il>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2020-08-13 17:34:48 +02:00
parent b0fb06b8ef
commit eb0d2518f9
2 changed files with 305 additions and 348 deletions

View File

@@ -67,231 +67,14 @@ const QLatin1String BUILDCONSOLE_KEEPJOBNUM("IncrediBuild.BuildConsole.KeepJobNu
const QLatin1String BUILDCONSOLE_COMMANDBUILDER("IncrediBuild.BuildConsole.CommandBuilder");
}
class BuildConsoleBuildStep : public AbstractProcessStep
static QString normalizeWinVerArgument(QString winVer)
{
Q_DECLARE_TR_FUNCTIONS(IncrediBuild::Internal::BuildConsoleBuildStep)
public:
BuildConsoleBuildStep(BuildStepList *buildStepList, Id id);
bool init() final;
void setupOutputFormatter(OutputFormatter *formatter) final;
const QStringList &supportedWindowsVersions() const;
private:
CommandBuilderAspect *m_commandBuilder;
BoolAspect *m_avoidLocal{nullptr};
StringAspect *m_profileXml{nullptr};
IntegerAspect *m_maxCpu{nullptr};
SelectionAspect *m_maxWinVer{nullptr};
SelectionAspect *m_minWinVer{nullptr};
StringAspect *m_title{nullptr};
StringAspect *m_monFile{nullptr};
BoolAspect *m_suppressStdOut{nullptr};
StringAspect *m_logFile{nullptr};
BoolAspect *m_showCmd{nullptr};
BoolAspect *m_showAgents{nullptr};
BoolAspect *m_showTime{nullptr};
BoolAspect *m_hideHeader{nullptr};
SelectionAspect *m_logLevel{nullptr};
StringAspect *m_setEnv{nullptr};
BoolAspect *m_stopOnError{nullptr};
StringAspect *m_additionalArguments{nullptr};
BoolAspect *m_openMonitor{nullptr};
BoolAspect *m_keepJobNum{nullptr};
};
BuildConsoleBuildStep::BuildConsoleBuildStep(BuildStepList *buildStepList, Id id)
: AbstractProcessStep(buildStepList, id)
{
setDisplayName(tr("IncrediBuild for Windows"));
addAspect<TextDisplay>("<b>" + tr("Target and Configuration"));
m_commandBuilder = addAspect<CommandBuilderAspect>(this);
m_commandBuilder->setSettingsKey(Constants::BUILDCONSOLE_COMMANDBUILDER);
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)"));
m_keepJobNum = addAspect<BoolAspect>();
m_keepJobNum->setSettingsKey(Constants::BUILDCONSOLE_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.<p>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 Creator will execute in parallel (the default "
"IncrediBuild behavior will set this value to 200)"));
addAspect<TextDisplay>("<b>" + tr("IncrediBuild Distribution Control"));
m_profileXml = addAspect<StringAspect>();
m_profileXml->setSettingsKey(Constants::BUILDCONSOLE_PROFILEXML);
m_profileXml->setLabelText(tr("Profile.xml:"));
m_profileXml->setDisplayStyle(StringAspect::PathChooserDisplay);
m_profileXml->setExpectedKind(PathChooser::Kind::File);
m_profileXml->setBaseFileName(FilePath::fromString(PathChooser::homePath()));
m_profileXml->setHistoryCompleter("IncrediBuild.BuildConsole.ProfileXml.History");
m_profileXml->setToolTip(tr("The Profile XML file is used to define how Automatic "
"Interception Interface should handle the various processes "
"involved in a distributed job. It is not necessary for "
"\"Visual Studio\" or \"Make and Build tools\" builds, "
"but can be used to provide configuration options if those "
"builds use additional processes that are not included in "
"those packages. It is required to configure distributable "
"processes in \"Dev Tools\" builds."));
m_avoidLocal = addAspect<BoolAspect>();
m_avoidLocal->setSettingsKey(Constants::BUILDCONSOLE_AVOIDLOCAL);
m_avoidLocal->setLabel(tr("Avoid Local:"));
m_avoidLocal->setToolTip(tr("Overrides the Agent Settings dialog Avoid task execution on local "
"machine when possible option. This allows to free more resources "
"on the initiator machine and could be beneficial to distribution "
"in scenarios where the initiating machine is bottlenecking the "
"build with High CPU usage."));
m_maxCpu = addAspect<IntegerAspect>();
m_maxCpu->setSettingsKey(Constants::BUILDCONSOLE_MAXCPU);
m_maxCpu->setToolTip(tr("Determines the maximum number of CPU cores that can be used in a "
"build, regardless of the number of available Agents. "
"It takes into account both local and remote cores, even if the "
"Avoid Task Execution on Local Machine option is selected."));
m_maxCpu->setLabel(tr("Maximum CPUs to utilize in the build:"));
m_maxCpu->setRange(0, 65536);
m_maxWinVer = addAspect<SelectionAspect>();
m_maxWinVer->setSettingsKey(Constants::BUILDCONSOLE_MAXWINVER);
m_maxWinVer->setDisplayName(tr("Newest allowed helper machine OS:"));
m_maxWinVer->setDisplayStyle(SelectionAspect::DisplayStyle::ComboBox);
m_maxWinVer->setToolTip(tr("Specifies the newest operating system installed on a helper "
"machine to be allowed to participate as helper in the build."));
for (const QString &version : supportedWindowsVersions())
m_maxWinVer->addOption(version);
m_minWinVer = addAspect<SelectionAspect>();
m_minWinVer->setSettingsKey(Constants::BUILDCONSOLE_MINWINVER);
m_minWinVer->setDisplayName(tr("Oldest allowed helper machine OS:"));
m_minWinVer->setDisplayStyle(SelectionAspect::DisplayStyle::ComboBox);
m_minWinVer->setToolTip(tr("Specifies the oldest operating system installed on a helper "
"machine to be allowed to participate as helper in the build."));
for (const QString &version : supportedWindowsVersions())
m_minWinVer->addOption(version);
addAspect<TextDisplay>("<b>" + tr("Output and Logging"));
m_title = addAspect<StringAspect>();
m_title->setSettingsKey(Constants::BUILDCONSOLE_TITLE);
m_title->setLabelText(tr("Build Title:"));
m_title->setDisplayStyle(StringAspect::LineEditDisplay);
m_title->setToolTip(tr("Specifies a custom header line which will be displayed in the "
"beginning of the build output text. This title will also be used "
"for the Build History and Build Monitor displays."));
m_monFile = addAspect<StringAspect>();
m_monFile->setSettingsKey(Constants::BUILDCONSOLE_MONFILE);
m_monFile->setLabelText(tr("Save IncrediBuild monitor file:"));
m_monFile->setDisplayStyle(StringAspect::PathChooserDisplay);
m_monFile->setExpectedKind(PathChooser::Kind::Any);
m_monFile->setBaseFileName(FilePath::fromString(PathChooser::homePath()));
m_monFile->setHistoryCompleter(QLatin1String("IncrediBuild.BuildConsole.MonFile.History"));
m_monFile->setToolTip(tr("Writes a copy of the build progress (.ib_mon) file to the specified "
"location. - If only a folder name is given, IncrediBuild generates a "
"GUID for the file name. - A message containing the location of the "
"saved .ib_mon file is added to the end of the build output"));
m_suppressStdOut = addAspect<BoolAspect>();
m_suppressStdOut->setSettingsKey(Constants::BUILDCONSOLE_SUPPRESSSTDOUT);
m_suppressStdOut->setLabel(tr("Suppress STDOUT:"));
m_suppressStdOut->setToolTip(tr("Does not write anything to the standard output."));
m_logFile = addAspect<StringAspect>();
m_logFile->setSettingsKey(Constants::BUILDCONSOLE_LOGFILE);
m_logFile->setLabelText(tr("Output Log file:"));
m_logFile->setDisplayStyle(StringAspect::PathChooserDisplay);
m_logFile->setExpectedKind(PathChooser::Kind::SaveFile);
m_logFile->setBaseFileName(FilePath::fromString(PathChooser::homePath()));
m_logFile->setHistoryCompleter(QLatin1String("IncrediBuild.BuildConsole.LogFile.History"));
m_logFile->setToolTip(tr("Writes build output to a file."));
m_showCmd = addAspect<BoolAspect>();
m_showCmd->setSettingsKey(Constants::BUILDCONSOLE_SHOWCMD);
m_showCmd->setLabel(tr("Show Commands in output:"));
m_showCmd->setToolTip(tr("Shows, for each file built, the command-line used by IncrediBuild "
"to build the file."));
m_showAgents = addAspect<BoolAspect>();
m_showAgents->setSettingsKey(Constants::BUILDCONSOLE_SHOWAGENTS);
m_showAgents->setLabel(tr("Show Agents in output:"));
m_showAgents->setToolTip(tr("Shows the Agent used to build each file."));
m_showTime = addAspect<BoolAspect>();
m_showTime->setSettingsKey(Constants::BUILDCONSOLE_SHOWTIME);
m_showTime->setLabel(tr("Show Time in output:"));
m_showTime->setToolTip(tr("Shows the Start and Finish time for each file built."));
m_hideHeader = addAspect<BoolAspect>();
m_hideHeader->setSettingsKey(Constants::BUILDCONSOLE_HIDEHEADER);
m_hideHeader->setLabel(tr("Hide IncrediBuild Header in output:"));
m_hideHeader->setToolTip(tr("Suppresses the \"IncrediBuild\" header in the build output"));
m_logLevel = addAspect<SelectionAspect>();
m_logLevel->setSettingsKey(Constants::BUILDCONSOLE_LOGLEVEL);
m_logLevel->setDisplayName(tr("Internal IncrediBuild logging level:"));
m_logLevel->setDisplayStyle(SelectionAspect::DisplayStyle::ComboBox);
m_logLevel->addOption(QString());
m_logLevel->addOption("Minimal");
m_logLevel->addOption("Extended");
m_logLevel->addOption("Detailed");
m_logLevel->setToolTip(tr("Overrides the internal Incredibuild logging level for this build. "
"Does not affect output or any user accessible logging. Used mainly "
"to troubleshoot issues with the help of IncrediBuild support"));
addAspect<TextDisplay>("<b>" + tr("Miscellaneous"));
m_setEnv = addAspect<StringAspect>();
m_setEnv->setSettingsKey(Constants::BUILDCONSOLE_SETENV);
m_setEnv->setLabelText(tr("Set an Environment Variable:"));
m_setEnv->setDisplayStyle(StringAspect::LineEditDisplay);
m_setEnv->setToolTip(tr("Sets or overrides environment variables for the context of the build."));
m_stopOnError = addAspect<BoolAspect>();
m_stopOnError->setSettingsKey(Constants::BUILDCONSOLE_STOPONERROR);
m_stopOnError->setLabel(tr("Stop On Errors:"));
m_stopOnError->setToolTip(tr("When specified, the execution will stop as soon as an error "
"is encountered. This is the default behavior in "
"\"Visual Studio\" builds, but not the default for "
"\"Make and Build tools\" or \"Dev Tools\" builds"));
m_additionalArguments = addAspect<StringAspect>();
m_additionalArguments->setSettingsKey(Constants::BUILDCONSOLE_ADDITIONALARGUMENTS);
m_additionalArguments->setLabelText(tr("Additional Arguments:"));
m_additionalArguments->setDisplayStyle(StringAspect::LineEditDisplay);
m_additionalArguments->setToolTip(tr("Add additional buildconsole arguments manually. "
"The value of this field will be concatenated to the "
"final buildconsole command line"));
m_openMonitor = addAspect<BoolAspect>();
m_openMonitor->setSettingsKey(Constants::BUILDCONSOLE_OPENMONITOR);
m_openMonitor->setLabel(tr("Open Monitor:"));
m_openMonitor->setToolTip(tr("Opens an IncrediBuild Build Monitor that graphically displays "
"the build progress once the build starts."));
winVer.remove("Windows ");
winVer.remove("Server ");
return winVer.toUpper();
}
void BuildConsoleBuildStep::setupOutputFormatter(OutputFormatter *formatter)
{
formatter->addLineParser(new GnuMakeParser());
formatter->addLineParsers(target()->kit()->createOutputParsers());
formatter->addSearchDir(processParameters()->effectiveWorkingDirectory());
AbstractProcessStep::setupOutputFormatter(formatter);
}
const QStringList& BuildConsoleBuildStep::supportedWindowsVersions() const
const QStringList &supportedWindowsVersions()
{
static QStringList list({QString(),
"Windows 7",
@@ -305,89 +88,275 @@ const QStringList& BuildConsoleBuildStep::supportedWindowsVersions() const
return list;
}
static QString normalizeWinVerArgument(QString winVer)
class BuildConsoleBuildStep : public AbstractProcessStep
{
winVer.remove("Windows ");
winVer.remove("Server ");
return winVer.toUpper();
Q_DECLARE_TR_FUNCTIONS(IncrediBuild::Internal::BuildConsoleBuildStep)
public:
BuildConsoleBuildStep(BuildStepList *buildStepList, Id id);
bool init() final;
void setupOutputFormatter(OutputFormatter *formatter) final;
};
BuildConsoleBuildStep::BuildConsoleBuildStep(BuildStepList *buildStepList, Id id)
: AbstractProcessStep(buildStepList, id)
{
setDisplayName(tr("IncrediBuild for Windows"));
addAspect<TextDisplay>("<b>" + tr("Target and Configuration"));
auto commandBuilder = addAspect<CommandBuilderAspect>(this);
commandBuilder->setSettingsKey(Constants::BUILDCONSOLE_COMMANDBUILDER);
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)"));
auto keepJobNum = addAspect<BoolAspect>();
keepJobNum->setSettingsKey(Constants::BUILDCONSOLE_KEEPJOBNUM);
keepJobNum->setLabel(tr("Keep Original Jobs Num:"));
keepJobNum->setToolTip(tr("Setting this option to true, forces IncrediBuild to not override "
"the -j command line switch.<p>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 Creator will execute in parallel (the default "
"IncrediBuild behavior will set this value to 200)"));
addAspect<TextDisplay>("<b>" + tr("IncrediBuild Distribution Control"));
auto profileXml = addAspect<StringAspect>();
profileXml->setSettingsKey(Constants::BUILDCONSOLE_PROFILEXML);
profileXml->setLabelText(tr("Profile.xml:"));
profileXml->setDisplayStyle(StringAspect::PathChooserDisplay);
profileXml->setExpectedKind(PathChooser::Kind::File);
profileXml->setBaseFileName(FilePath::fromString(PathChooser::homePath()));
profileXml->setHistoryCompleter("IncrediBuild.BuildConsole.ProfileXml.History");
profileXml->setToolTip(tr("The Profile XML file is used to define how Automatic "
"Interception Interface should handle the various processes "
"involved in a distributed job. It is not necessary for "
"\"Visual Studio\" or \"Make and Build tools\" builds, "
"but can be used to provide configuration options if those "
"builds use additional processes that are not included in "
"those packages. It is required to configure distributable "
"processes in \"Dev Tools\" builds."));
auto avoidLocal = addAspect<BoolAspect>();
avoidLocal->setSettingsKey(Constants::BUILDCONSOLE_AVOIDLOCAL);
avoidLocal->setLabel(tr("Avoid Local:"));
avoidLocal->setToolTip(tr("Overrides the Agent Settings dialog Avoid task execution on local "
"machine when possible option. This allows to free more resources "
"on the initiator machine and could be beneficial to distribution "
"in scenarios where the initiating machine is bottlenecking the "
"build with High CPU usage."));
auto maxCpu = addAspect<IntegerAspect>();
maxCpu->setSettingsKey(Constants::BUILDCONSOLE_MAXCPU);
maxCpu->setToolTip(tr("Determines the maximum number of CPU cores that can be used in a "
"build, regardless of the number of available Agents. "
"It takes into account both local and remote cores, even if the "
"Avoid Task Execution on Local Machine option is selected."));
maxCpu->setLabel(tr("Maximum CPUs to utilize in the build:"));
maxCpu->setRange(0, 65536);
auto maxWinVer = addAspect<SelectionAspect>();
maxWinVer->setSettingsKey(Constants::BUILDCONSOLE_MAXWINVER);
maxWinVer->setDisplayName(tr("Newest allowed helper machine OS:"));
maxWinVer->setDisplayStyle(SelectionAspect::DisplayStyle::ComboBox);
maxWinVer->setToolTip(tr("Specifies the newest operating system installed on a helper "
"machine to be allowed to participate as helper in the build."));
for (const QString &version : supportedWindowsVersions())
maxWinVer->addOption(version);
auto minWinVer = addAspect<SelectionAspect>();
minWinVer->setSettingsKey(Constants::BUILDCONSOLE_MINWINVER);
minWinVer->setDisplayName(tr("Oldest allowed helper machine OS:"));
minWinVer->setDisplayStyle(SelectionAspect::DisplayStyle::ComboBox);
minWinVer->setToolTip(tr("Specifies the oldest operating system installed on a helper "
"machine to be allowed to participate as helper in the build."));
for (const QString &version : supportedWindowsVersions())
minWinVer->addOption(version);
addAspect<TextDisplay>("<b>" + tr("Output and Logging"));
auto title = addAspect<StringAspect>();
title->setSettingsKey(Constants::BUILDCONSOLE_TITLE);
title->setLabelText(tr("Build Title:"));
title->setDisplayStyle(StringAspect::LineEditDisplay);
title->setToolTip(tr("Specifies a custom header line which will be displayed in the "
"beginning of the build output text. This title will also be used "
"for the Build History and Build Monitor displays."));
auto monFile = addAspect<StringAspect>();
monFile->setSettingsKey(Constants::BUILDCONSOLE_MONFILE);
monFile->setLabelText(tr("Save IncrediBuild monitor file:"));
monFile->setDisplayStyle(StringAspect::PathChooserDisplay);
monFile->setExpectedKind(PathChooser::Kind::Any);
monFile->setBaseFileName(FilePath::fromString(PathChooser::homePath()));
monFile->setHistoryCompleter(QLatin1String("IncrediBuild.BuildConsole.MonFile.History"));
monFile->setToolTip(tr("Writes a copy of the build progress (.ib_mon) file to the specified "
"location. - If only a folder name is given, IncrediBuild generates a "
"GUID for the file name. - A message containing the location of the "
"saved .ib_mon file is added to the end of the build output"));
auto suppressStdOut = addAspect<BoolAspect>();
suppressStdOut->setSettingsKey(Constants::BUILDCONSOLE_SUPPRESSSTDOUT);
suppressStdOut->setLabel(tr("Suppress STDOUT:"));
suppressStdOut->setToolTip(tr("Does not write anything to the standard output."));
auto logFile = addAspect<StringAspect>();
logFile->setSettingsKey(Constants::BUILDCONSOLE_LOGFILE);
logFile->setLabelText(tr("Output Log file:"));
logFile->setDisplayStyle(StringAspect::PathChooserDisplay);
logFile->setExpectedKind(PathChooser::Kind::SaveFile);
logFile->setBaseFileName(FilePath::fromString(PathChooser::homePath()));
logFile->setHistoryCompleter(QLatin1String("IncrediBuild.BuildConsole.LogFile.History"));
logFile->setToolTip(tr("Writes build output to a file."));
auto showCmd = addAspect<BoolAspect>();
showCmd->setSettingsKey(Constants::BUILDCONSOLE_SHOWCMD);
showCmd->setLabel(tr("Show Commands in output:"));
showCmd->setToolTip(tr("Shows, for each file built, the command-line used by IncrediBuild "
"to build the file."));
auto showAgents = addAspect<BoolAspect>();
showAgents->setSettingsKey(Constants::BUILDCONSOLE_SHOWAGENTS);
showAgents->setLabel(tr("Show Agents in output:"));
showAgents->setToolTip(tr("Shows the Agent used to build each file."));
auto showTime = addAspect<BoolAspect>();
showTime->setSettingsKey(Constants::BUILDCONSOLE_SHOWTIME);
showTime->setLabel(tr("Show Time in output:"));
showTime->setToolTip(tr("Shows the Start and Finish time for each file built."));
auto hideHeader = addAspect<BoolAspect>();
hideHeader->setSettingsKey(Constants::BUILDCONSOLE_HIDEHEADER);
hideHeader->setLabel(tr("Hide IncrediBuild Header in output:"));
hideHeader->setToolTip(tr("Suppresses the \"IncrediBuild\" header in the build output"));
auto logLevel = addAspect<SelectionAspect>();
logLevel->setSettingsKey(Constants::BUILDCONSOLE_LOGLEVEL);
logLevel->setDisplayName(tr("Internal IncrediBuild logging level:"));
logLevel->setDisplayStyle(SelectionAspect::DisplayStyle::ComboBox);
logLevel->addOption(QString());
logLevel->addOption("Minimal");
logLevel->addOption("Extended");
logLevel->addOption("Detailed");
logLevel->setToolTip(tr("Overrides the internal Incredibuild logging level for this build. "
"Does not affect output or any user accessible logging. Used mainly "
"to troubleshoot issues with the help of IncrediBuild support"));
addAspect<TextDisplay>("<b>" + tr("Miscellaneous"));
auto setEnv = addAspect<StringAspect>();
setEnv->setSettingsKey(Constants::BUILDCONSOLE_SETENV);
setEnv->setLabelText(tr("Set an Environment Variable:"));
setEnv->setDisplayStyle(StringAspect::LineEditDisplay);
setEnv->setToolTip(tr("Sets or overrides environment variables for the context of the build."));
auto stopOnError = addAspect<BoolAspect>();
stopOnError->setSettingsKey(Constants::BUILDCONSOLE_STOPONERROR);
stopOnError->setLabel(tr("Stop On Errors:"));
stopOnError->setToolTip(tr("When specified, the execution will stop as soon as an error "
"is encountered. This is the default behavior in "
"\"Visual Studio\" builds, but not the default for "
"\"Make and Build tools\" or \"Dev Tools\" builds"));
auto additionalArguments = addAspect<StringAspect>();
additionalArguments->setSettingsKey(Constants::BUILDCONSOLE_ADDITIONALARGUMENTS);
additionalArguments->setLabelText(tr("Additional Arguments:"));
additionalArguments->setDisplayStyle(StringAspect::LineEditDisplay);
additionalArguments->setToolTip(tr("Add additional buildconsole arguments manually. "
"The value of this field will be concatenated to the "
"final buildconsole command line"));
auto openMonitor = addAspect<BoolAspect>();
openMonitor->setSettingsKey(Constants::BUILDCONSOLE_OPENMONITOR);
openMonitor->setLabel(tr("Open Monitor:"));
openMonitor->setToolTip(tr("Opens an IncrediBuild Build Monitor that graphically displays "
"the build progress once the build starts."));
setCommandLineProvider([=] {
QStringList args;
QString cmd("/Command= %0");
cmd = cmd.arg(commandBuilder->fullCommandFlag(keepJobNum->value()));
args.append(cmd);
if (!profileXml->value().isEmpty())
args.append("/Profile=" + profileXml->value());
args.append(QString("/AvoidLocal=%1").arg(avoidLocal->value() ? QString("ON") : QString("OFF")));
if (maxCpu->value() > 0)
args.append(QString("/MaxCPUs=%1").arg(maxCpu->value()));
if (!maxWinVer->stringValue().isEmpty())
args.append(QString("/MaxWinVer=%1").arg(normalizeWinVerArgument(maxWinVer->stringValue())));
if (!minWinVer->stringValue().isEmpty())
args.append(QString("/MinWinVer=%1").arg(normalizeWinVerArgument(minWinVer->stringValue())));
if (!title->value().isEmpty())
args.append(QString("/Title=" + title->value()));
if (!monFile->value().isEmpty())
args.append(QString("/Mon=" + monFile->value()));
if (suppressStdOut->value())
args.append("/Silent");
if (!logFile->value().isEmpty())
args.append(QString("/Log=" + logFile->value()));
if (showCmd->value())
args.append("/ShowCmd");
if (showAgents->value())
args.append("/ShowAgent");
if (showAgents->value())
args.append("/ShowTime");
if (hideHeader->value())
args.append("/NoLogo");
if (!logLevel->stringValue().isEmpty())
args.append(QString("/LogLevel=" + logLevel->stringValue()));
if (!setEnv->value().isEmpty())
args.append(QString("/SetEnv=" + setEnv->value()));
if (stopOnError->value())
args.append("/StopOnErrors");
if (!additionalArguments->value().isEmpty())
args.append(additionalArguments->value());
if (openMonitor->value())
args.append("/OpenMonitor");
return CommandLine("BuildConsole.exe", args);
});
}
bool BuildConsoleBuildStep::init()
{
QStringList args;
QString cmd("/Command= %0");
cmd = cmd.arg(m_commandBuilder->fullCommandFlag(m_keepJobNum->value()));
args.append(cmd);
if (!m_profileXml->value().isEmpty())
args.append("/Profile=" + m_profileXml->value());
args.append(QString("/AvoidLocal=%1").arg(m_avoidLocal->value() ? QString("ON") : QString("OFF")));
if (m_maxCpu->value() > 0)
args.append(QString("/MaxCPUs=%1").arg(m_maxCpu->value()));
if (!m_maxWinVer->stringValue().isEmpty())
args.append(QString("/MaxWinVer=%1").arg(normalizeWinVerArgument(m_maxWinVer->stringValue())));
if (!m_minWinVer->stringValue().isEmpty())
args.append(QString("/MinWinVer=%1").arg(normalizeWinVerArgument(m_minWinVer->stringValue())));
if (!m_title->value().isEmpty())
args.append(QString("/Title=" + m_title->value()));
if (!m_monFile->value().isEmpty())
args.append(QString("/Mon=" + m_monFile->value()));
if (m_suppressStdOut->value())
args.append("/Silent");
if (!m_logFile->value().isEmpty())
args.append(QString("/Log=" + m_logFile->value()));
if (m_showCmd->value())
args.append("/ShowCmd");
if (m_showAgents->value())
args.append("/ShowAgent");
if (m_showAgents->value())
args.append("/ShowTime");
if (m_hideHeader->value())
args.append("/NoLogo");
if (!m_logLevel->stringValue().isEmpty())
args.append(QString("/LogLevel=" + m_logLevel->stringValue()));
if (!m_setEnv->value().isEmpty())
args.append(QString("/SetEnv=" + m_setEnv->value()));
if (m_stopOnError->value())
args.append("/StopOnErrors");
if (!m_additionalArguments->value().isEmpty())
args.append(m_additionalArguments->value());
if (m_openMonitor->value())
args.append("/OpenMonitor");
CommandLine cmdLine("BuildConsole.exe", args);
ProcessParameters* procParams = processParameters();
procParams->setCommandLine(cmdLine);
procParams->setEnvironment(Environment::systemEnvironment());
BuildConfiguration *buildConfig = buildConfiguration();
if (buildConfig) {
procParams->setWorkingDirectory(buildConfig->buildDirectory());
procParams->setEnvironment(buildConfig->environment());
procParams->setMacroExpander(buildConfig->macroExpander());
}
ProcessParameters *procParams = processParameters();
setupProcessParameters(procParams);
return AbstractProcessStep::init();
}
void BuildConsoleBuildStep::setupOutputFormatter(OutputFormatter *formatter)
{
formatter->addLineParser(new GnuMakeParser());
formatter->addLineParsers(target()->kit()->createOutputParsers());
formatter->addSearchDir(processParameters()->effectiveWorkingDirectory());
AbstractProcessStep::setupOutputFormatter(formatter);
}
// BuildConsoleStepFactory
BuildConsoleStepFactory::BuildConsoleStepFactory()

View File

@@ -59,13 +59,6 @@ public:
bool init() final;
void setupOutputFormatter(OutputFormatter *formatter) final;
private:
CommandBuilderAspect *m_commandBuilder;
IntegerAspect *m_nice{nullptr};
BoolAspect *m_keepJobNum{nullptr};
BoolAspect *m_forceRemote{nullptr};
BoolAspect *m_alternate{nullptr};
};
IBConsoleBuildStep::IBConsoleBuildStep(BuildStepList *buildStepList, Id id)
@@ -75,39 +68,56 @@ IBConsoleBuildStep::IBConsoleBuildStep(BuildStepList *buildStepList, Id id)
addAspect<TextDisplay>("<b>" + tr("Target and Configuration"));
m_commandBuilder = addAspect<CommandBuilderAspect>(this);
m_commandBuilder->setSettingsKey(Constants::IBCONSOLE_COMMANDBUILDER);
auto commandBuilder = addAspect<CommandBuilderAspect>(this);
commandBuilder->setSettingsKey(Constants::IBCONSOLE_COMMANDBUILDER);
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)"));
m_keepJobNum = addAspect<BoolAspect>();
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)."));
auto keepJobNum = addAspect<BoolAspect>();
keepJobNum->setSettingsKey(Constants::IBCONSOLE_KEEPJOBNUM);
keepJobNum->setLabel(tr("Keep Original Jobs Num:"));
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)."));
addAspect<TextDisplay>("<b>" + tr("IncrediBuild Distribution Control"));
m_nice = addAspect<IntegerAspect>();
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);
auto nice = addAspect<IntegerAspect>();
nice->setSettingsKey(Constants::IBCONSOLE_NICE);
nice->setToolTip(tr("Specify nice value. Nice Value should be numeric and between -20 and 19"));
nice->setLabel(tr("Nice value:"));
nice->setRange(-20, 19);
m_forceRemote = addAspect<BoolAspect>();
m_forceRemote->setSettingsKey(Constants::IBCONSOLE_ALTERNATE);
m_forceRemote->setLabel(tr("Force remote:"));
auto forceRemote = addAspect<BoolAspect>();
forceRemote->setSettingsKey(Constants::IBCONSOLE_ALTERNATE);
forceRemote->setLabel(tr("Force remote:"));
m_alternate = addAspect<BoolAspect>();
m_alternate->setSettingsKey(Constants::IBCONSOLE_FORCEREMOTE);
m_alternate->setLabel(tr("Alternate tasks preference:"));
auto alternate = addAspect<BoolAspect>();
alternate->setSettingsKey(Constants::IBCONSOLE_FORCEREMOTE);
alternate->setLabel(tr("Alternate tasks preference:"));
setCommandLineProvider([=] {
QStringList args;
if (nice->value() != 0)
args.append(QString("--nice %0 ").arg(nice->value()));
if (alternate->value())
args.append("--alternate");
if (forceRemote->value())
args.append("--force-remote");
args.append(commandBuilder->fullCommandFlag(keepJobNum->value()));
return CommandLine("ib_console", args);
});
}
void IBConsoleBuildStep::setupOutputFormatter(OutputFormatter *formatter)
@@ -120,30 +130,8 @@ void IBConsoleBuildStep::setupOutputFormatter(OutputFormatter *formatter)
bool IBConsoleBuildStep::init()
{
QStringList args;
if (m_nice->value() != 0)
args.append(QString("--nice %0 ").arg(m_nice->value()));
if (m_alternate->value())
args.append("--alternate");
if (m_forceRemote->value())
args.append("--force-remote");
args.append(m_commandBuilder->fullCommandFlag(m_keepJobNum->value()));
CommandLine cmdLine("ib_console", args);
ProcessParameters *procParams = processParameters();
procParams->setCommandLine(cmdLine);
procParams->setEnvironment(Environment::systemEnvironment());
BuildConfiguration *buildConfig = buildConfiguration();
if (buildConfig) {
procParams->setWorkingDirectory(buildConfig->buildDirectory());
procParams->setEnvironment(buildConfig->environment());
procParams->setMacroExpander(buildConfig->macroExpander());
}
setupProcessParameters(procParams);
return AbstractProcessStep::init();
}