forked from qt-creator/qt-creator
overhaul process argument handling
get away from argument stringlists. instead, use native shell command lines which support quoting/splitting, environment variable expansion and redirections with well-understood semantics. Task-number: QTCREATORBUG-542 Task-number: QTCREATORBUG-1564
This commit is contained in:
@@ -32,6 +32,8 @@
|
||||
|
||||
#include "utils_global.h"
|
||||
|
||||
#include "environment.h"
|
||||
|
||||
#include <QtCore/QStringList>
|
||||
|
||||
namespace Utils {
|
||||
@@ -45,10 +47,10 @@ public:
|
||||
QString workingDirectory() const { return m_workingDir; }
|
||||
void setWorkingDirectory(const QString &dir) { m_workingDir = dir; }
|
||||
|
||||
QStringList environment() const { return m_environment; }
|
||||
void setEnvironment(const QStringList &env) { m_environment = env; }
|
||||
void setEnvironment(const Environment &env) { m_environment = env; }
|
||||
Environment environment() const { return m_environment; }
|
||||
|
||||
virtual bool start(const QString &program, const QStringList &args) = 0;
|
||||
virtual bool start(const QString &program, const QString &args) = 0;
|
||||
virtual void stop() = 0;
|
||||
|
||||
virtual bool isRunning() const = 0;
|
||||
@@ -63,14 +65,15 @@ public:
|
||||
static QStringList fixWinEnvironment(const QStringList &env);
|
||||
// Quote a Windows command line correctly for the "CreateProcess" API
|
||||
static QString createWinCommandline(const QString &program, const QStringList &args);
|
||||
static QString createWinCommandline(const QString &program, const QString &args);
|
||||
// Create a bytearray suitable to be passed on as environment
|
||||
// to the "CreateProcess" API (0-terminated UTF 16 strings).
|
||||
static QByteArray createWinEnvironment(const QStringList &env);
|
||||
#endif
|
||||
|
||||
private:
|
||||
protected:
|
||||
QString m_workingDir;
|
||||
QStringList m_environment;
|
||||
Environment m_environment;
|
||||
};
|
||||
|
||||
} //namespace Utils
|
||||
|
@@ -51,49 +51,57 @@ QStringList AbstractProcess::fixWinEnvironment(const QStringList &env)
|
||||
return envStrings;
|
||||
}
|
||||
|
||||
QString AbstractProcess::createWinCommandline(const QString &program, const QStringList &args)
|
||||
static QString quoteWinCommand(const QString &program)
|
||||
{
|
||||
const QChar doubleQuote = QLatin1Char('"');
|
||||
const QChar blank = QLatin1Char(' ');
|
||||
const QChar backSlash = QLatin1Char('\\');
|
||||
|
||||
// add the programm as the first arg ... it works better
|
||||
QString programName = program;
|
||||
if (!programName.startsWith(doubleQuote) && !programName.endsWith(doubleQuote) && programName.contains(blank)) {
|
||||
programName.insert(0, doubleQuote);
|
||||
programName.replace(QLatin1Char('/'), QLatin1Char('\\'));
|
||||
if (!programName.startsWith(doubleQuote) && !programName.endsWith(doubleQuote)
|
||||
&& programName.contains(QLatin1Char(' '))) {
|
||||
programName.prepend(doubleQuote);
|
||||
programName.append(doubleQuote);
|
||||
}
|
||||
// add the prgram as the first arrg ... it works better
|
||||
programName.replace(QLatin1Char('/'), backSlash);
|
||||
QString cmdLine = programName;
|
||||
if (args.empty())
|
||||
return cmdLine;
|
||||
return programName;
|
||||
}
|
||||
|
||||
cmdLine += blank;
|
||||
for (int i = 0; i < args.size(); ++i) {
|
||||
QString tmp = args.at(i);
|
||||
// in the case of \" already being in the string the \ must also be escaped
|
||||
tmp.replace(QLatin1String("\\\""), QLatin1String("\\\\\""));
|
||||
// escape a single " because the arguments will be parsed
|
||||
tmp.replace(QString(doubleQuote), QLatin1String("\\\""));
|
||||
if (tmp.isEmpty() || tmp.contains(blank) || tmp.contains('\t')) {
|
||||
// The argument must not end with a \ since this would be interpreted
|
||||
// as escaping the quote -- rather put the \ behind the quote: e.g.
|
||||
// rather use "foo"\ than "foo\"
|
||||
QString endQuote(doubleQuote);
|
||||
int i = tmp.length();
|
||||
while (i > 0 && tmp.at(i - 1) == backSlash) {
|
||||
--i;
|
||||
endQuote += backSlash;
|
||||
}
|
||||
cmdLine += QLatin1String(" \"");
|
||||
cmdLine += tmp.left(i);
|
||||
cmdLine += endQuote;
|
||||
} else {
|
||||
cmdLine += blank;
|
||||
cmdLine += tmp;
|
||||
}
|
||||
static QString quoteWinArgument(const QString &arg)
|
||||
{
|
||||
if (!arg.length())
|
||||
return QString::fromLatin1("\"\"");
|
||||
|
||||
QString ret(arg);
|
||||
// Quotes are escaped and their preceding backslashes are doubled.
|
||||
ret.replace(QRegExp(QLatin1String("(\\\\*)\"")), QLatin1String("\\1\\1\\\""));
|
||||
if (ret.contains(QRegExp(QLatin1String("\\s")))) {
|
||||
// The argument must not end with a \ since this would be interpreted
|
||||
// as escaping the quote -- rather put the \ behind the quote: e.g.
|
||||
// rather use "foo"\ than "foo\"
|
||||
ret.replace(QRegExp(QLatin1String("(\\\\*)$")), QLatin1String("\"\\1"));
|
||||
ret.prepend(QLatin1Char('"'));
|
||||
}
|
||||
return cmdLine;
|
||||
return ret;
|
||||
}
|
||||
|
||||
QString AbstractProcess::createWinCommandline(const QString &program, const QStringList &args)
|
||||
{
|
||||
QString programName = quoteWinCommand(program);
|
||||
foreach (const QString &arg, args) {
|
||||
programName += QLatin1Char(' ');
|
||||
programName += quoteWinArgument(arg);
|
||||
}
|
||||
return programName;
|
||||
}
|
||||
|
||||
QString AbstractProcess::createWinCommandline(const QString &program, const QString &args)
|
||||
{
|
||||
QString programName = quoteWinCommand(program);
|
||||
if (!args.isEmpty()) {
|
||||
programName += QLatin1Char(' ');
|
||||
programName += args;
|
||||
}
|
||||
return programName;
|
||||
}
|
||||
|
||||
QByteArray AbstractProcess::createWinEnvironment(const QStringList &env)
|
||||
|
@@ -54,7 +54,7 @@ public:
|
||||
ConsoleProcess(QObject *parent = 0);
|
||||
~ConsoleProcess();
|
||||
|
||||
bool start(const QString &program, const QStringList &args);
|
||||
bool start(const QString &program, const QString &args);
|
||||
void stop();
|
||||
|
||||
void setMode(Mode m);
|
||||
|
@@ -29,6 +29,9 @@
|
||||
|
||||
#include "consoleprocess.h"
|
||||
|
||||
#include "environment.h"
|
||||
#include "qtcprocess.h"
|
||||
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QSettings>
|
||||
@@ -66,6 +69,7 @@ ConsoleProcessPrivate::ConsoleProcessPrivate() :
|
||||
m_mode(ConsoleProcess::Run),
|
||||
m_appPid(0),
|
||||
m_stubSocket(0),
|
||||
m_tempFile(0),
|
||||
m_settings(0)
|
||||
{
|
||||
}
|
||||
@@ -114,18 +118,49 @@ void ConsoleProcess::setSettings(QSettings *settings)
|
||||
d->m_settings = settings;
|
||||
}
|
||||
|
||||
bool ConsoleProcess::start(const QString &program, const QStringList &args)
|
||||
bool ConsoleProcess::start(const QString &program, const QString &args)
|
||||
{
|
||||
if (isRunning())
|
||||
return false;
|
||||
|
||||
QtcProcess::SplitError perr;
|
||||
QStringList pargs = QtcProcess::prepareArgs(args, &perr, &m_environment, &m_workingDir);
|
||||
QString pcmd;
|
||||
if (perr == QtcProcess::SplitOk) {
|
||||
pcmd = program;
|
||||
} else {
|
||||
if (perr != QtcProcess::FoundMeta) {
|
||||
emit processMessage(tr("Quoting error in command."), true);
|
||||
return false;
|
||||
}
|
||||
if (d->m_mode == Debug) {
|
||||
// FIXME: QTCREATORBUG-2809
|
||||
emit processMessage(tr("Debugging complex shell commands in a terminal"
|
||||
" is currently not supported."), true);
|
||||
return false;
|
||||
}
|
||||
pcmd = QLatin1String("/bin/sh");
|
||||
pargs << QLatin1String("-c") << (QtcProcess::quoteArg(program) + QLatin1Char(' ') + args);
|
||||
}
|
||||
|
||||
QtcProcess::SplitError qerr;
|
||||
QStringList xtermArgs = QtcProcess::prepareArgs(terminalEmulator(d->m_settings), &qerr,
|
||||
&m_environment, &m_workingDir);
|
||||
if (qerr != QtcProcess::SplitOk) {
|
||||
emit processMessage(qerr == QtcProcess::BadQuoting
|
||||
? tr("Quoting error in terminal command.")
|
||||
: tr("Terminal command may not be a shell command."), true);
|
||||
return false;
|
||||
}
|
||||
|
||||
const QString err = stubServerListen();
|
||||
if (!err.isEmpty()) {
|
||||
emit processMessage(msgCommChannelFailed(err), true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!environment().isEmpty()) {
|
||||
QStringList env = m_environment.toStringList();
|
||||
if (!env.isEmpty()) {
|
||||
d->m_tempFile = new QTemporaryFile();
|
||||
if (!d->m_tempFile->open()) {
|
||||
stubServerShutdown();
|
||||
@@ -134,14 +169,13 @@ bool ConsoleProcess::start(const QString &program, const QStringList &args)
|
||||
d->m_tempFile = 0;
|
||||
return false;
|
||||
}
|
||||
foreach (const QString &var, environment()) {
|
||||
foreach (const QString &var, env) {
|
||||
d->m_tempFile->write(var.toLocal8Bit());
|
||||
d->m_tempFile->write("", 1);
|
||||
}
|
||||
d->m_tempFile->flush();
|
||||
}
|
||||
|
||||
QStringList xtermArgs = terminalEmulator(d->m_settings).split(QLatin1Char(' ')); // FIXME: quoting
|
||||
xtermArgs
|
||||
#ifdef Q_OS_MAC
|
||||
<< (QCoreApplication::applicationDirPath() + QLatin1String("/../Resources/qtcreator_process_stub"))
|
||||
@@ -153,7 +187,7 @@ bool ConsoleProcess::start(const QString &program, const QStringList &args)
|
||||
<< msgPromptToClose()
|
||||
<< workingDirectory()
|
||||
<< (d->m_tempFile ? d->m_tempFile->fileName() : QString())
|
||||
<< program << args;
|
||||
<< pcmd << pargs;
|
||||
|
||||
QString xterm = xtermArgs.takeFirst();
|
||||
d->m_process.start(xterm, xtermArgs);
|
||||
|
@@ -28,6 +28,8 @@
|
||||
**************************************************************************/
|
||||
|
||||
#include "consoleprocess.h"
|
||||
#include "environment.h"
|
||||
#include "qtcprocess.h"
|
||||
#include "winutils.h"
|
||||
|
||||
#include <windows.h>
|
||||
@@ -115,18 +117,28 @@ QProcess::ExitStatus ConsoleProcess::exitStatus() const
|
||||
return d->m_appStatus;
|
||||
}
|
||||
|
||||
bool ConsoleProcess::start(const QString &program, const QStringList &args)
|
||||
bool ConsoleProcess::start(const QString &program, const QString &args)
|
||||
{
|
||||
if (isRunning())
|
||||
return false;
|
||||
|
||||
QString pcmd;
|
||||
QString pargs;
|
||||
if (d->m_mode != Run) { // The debugger engines already pre-process the arguments.
|
||||
pcmd = program;
|
||||
pargs = args;
|
||||
} else {
|
||||
QtcProcess::prepareCommand(program, args, &pcmd, &pargs, &m_environment, &m_workingDir);
|
||||
}
|
||||
|
||||
const QString err = stubServerListen();
|
||||
if (!err.isEmpty()) {
|
||||
emit processMessage(msgCommChannelFailed(err), true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!environment().isEmpty()) {
|
||||
QStringList env = m_environment.toStringList();
|
||||
if (!env.isEmpty()) {
|
||||
d->m_tempFile = new QTemporaryFile();
|
||||
if (!d->m_tempFile->open()) {
|
||||
stubServerShutdown();
|
||||
@@ -138,7 +150,7 @@ bool ConsoleProcess::start(const QString &program, const QStringList &args)
|
||||
QTextStream out(d->m_tempFile);
|
||||
out.setCodec("UTF-16LE");
|
||||
out.setGenerateByteOrderMark(false);
|
||||
foreach (const QString &var, fixWinEnvironment(environment()))
|
||||
foreach (const QString &var, fixWinEnvironment(env))
|
||||
out << var << QChar(0);
|
||||
out << QChar(0);
|
||||
}
|
||||
@@ -159,7 +171,7 @@ bool ConsoleProcess::start(const QString &program, const QStringList &args)
|
||||
<< d->m_stubServer.fullServerName()
|
||||
<< workDir
|
||||
<< (d->m_tempFile ? d->m_tempFile->fileName() : 0)
|
||||
<< createWinCommandline(program, args)
|
||||
<< createWinCommandline(pcmd, pargs)
|
||||
<< msgPromptToClose();
|
||||
|
||||
const QString cmdLine = createWinCommandline(
|
||||
|
@@ -332,62 +332,6 @@ bool Environment::operator==(const Environment &other) const
|
||||
return m_values == other.m_values;
|
||||
}
|
||||
|
||||
QStringList Environment::parseCombinedArgString(const QString &program)
|
||||
{
|
||||
QStringList args;
|
||||
QString tmp;
|
||||
int quoteCount = 0;
|
||||
bool inQuote = false;
|
||||
|
||||
// handle quoting. tokens can be surrounded by double quotes
|
||||
// "hello world". three consecutive double quotes represent
|
||||
// the quote character itself.
|
||||
for (int i = 0; i < program.size(); ++i) {
|
||||
if (program.at(i) == QLatin1Char('"')) {
|
||||
++quoteCount;
|
||||
if (quoteCount == 3) {
|
||||
// third consecutive quote
|
||||
quoteCount = 0;
|
||||
tmp += program.at(i);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (quoteCount) {
|
||||
if (quoteCount == 1)
|
||||
inQuote = !inQuote;
|
||||
quoteCount = 0;
|
||||
}
|
||||
if (!inQuote && program.at(i).isSpace()) {
|
||||
if (!tmp.isEmpty()) {
|
||||
args += tmp;
|
||||
tmp.clear();
|
||||
}
|
||||
} else {
|
||||
tmp += program.at(i);
|
||||
}
|
||||
}
|
||||
if (!tmp.isEmpty())
|
||||
args += tmp;
|
||||
return args;
|
||||
}
|
||||
|
||||
QString Environment::joinArgumentList(const QStringList &arguments)
|
||||
{
|
||||
QString result;
|
||||
const QChar doubleQuote = QLatin1Char('"');
|
||||
foreach (QString arg, arguments) {
|
||||
if (!result.isEmpty())
|
||||
result += QLatin1Char(' ');
|
||||
arg.replace(QString(doubleQuote), QLatin1String("\"\"\""));
|
||||
if (arg.contains(QLatin1Char(' '))) {
|
||||
arg.insert(0, doubleQuote);
|
||||
arg += doubleQuote;
|
||||
}
|
||||
result += arg;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/** Expand environment variables in a string.
|
||||
*
|
||||
* Environment variables are accepted in the following forms:
|
||||
|
@@ -94,9 +94,6 @@ public:
|
||||
const QStringList & additionalDirs = QStringList()) const;
|
||||
QStringList path() const;
|
||||
|
||||
static QStringList parseCombinedArgString(const QString &program);
|
||||
static QString joinArgumentList(const QStringList &arguments);
|
||||
|
||||
QString expandVariables(const QString &) const;
|
||||
QStringList expandVariables(const QStringList &) const;
|
||||
|
||||
|
@@ -243,7 +243,7 @@ CMakeBuildConfiguration *CMakeBuildConfigurationFactory::create(ProjectExplorer:
|
||||
|
||||
MakeStep *cleanMakeStep = new MakeStep(cleanSteps);
|
||||
cleanSteps->insertStep(0, cleanMakeStep);
|
||||
cleanMakeStep->setAdditionalArguments(QStringList() << "clean");
|
||||
cleanMakeStep->setAdditionalArguments("clean");
|
||||
cleanMakeStep->setClean(true);
|
||||
|
||||
CMakeOpenProjectWizard copw(cmtarget->cmakeProject()->projectManager(),
|
||||
|
@@ -202,12 +202,12 @@ void CMakeOpenProjectWizard::setMsvcVersion(const QString &version)
|
||||
m_msvcVersion = version;
|
||||
}
|
||||
|
||||
QStringList CMakeOpenProjectWizard::arguments() const
|
||||
QString CMakeOpenProjectWizard::arguments() const
|
||||
{
|
||||
return m_arguments;
|
||||
}
|
||||
|
||||
void CMakeOpenProjectWizard::setArguments(const QStringList &args)
|
||||
void CMakeOpenProjectWizard::setArguments(const QString &args)
|
||||
{
|
||||
m_arguments = args;
|
||||
}
|
||||
@@ -426,7 +426,6 @@ void CMakeRunPage::runCMake()
|
||||
{
|
||||
m_runCMake->setEnabled(false);
|
||||
m_argumentsLineEdit->setEnabled(false);
|
||||
QStringList arguments = Utils::Environment::parseCombinedArgString(m_argumentsLineEdit->text());
|
||||
CMakeManager *cmakeManager = m_cmakeWizard->cmakeManager();
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
@@ -464,11 +463,11 @@ void CMakeRunPage::runCMake()
|
||||
m_output->clear();
|
||||
|
||||
if (m_cmakeWizard->cmakeManager()->isCMakeExecutableValid()) {
|
||||
m_cmakeProcess = new QProcess();
|
||||
m_cmakeProcess = new Utils::QtcProcess();
|
||||
connect(m_cmakeProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(cmakeReadyReadStandardOutput()));
|
||||
connect(m_cmakeProcess, SIGNAL(readyReadStandardError()), this, SLOT(cmakeReadyReadStandardError()));
|
||||
connect(m_cmakeProcess, SIGNAL(finished(int)), this, SLOT(cmakeFinished()));
|
||||
cmakeManager->createXmlFile(m_cmakeProcess, arguments, m_cmakeWizard->sourceDirectory(), m_buildDirectory, env, generator);
|
||||
cmakeManager->createXmlFile(m_cmakeProcess, m_argumentsLineEdit->text(), m_cmakeWizard->sourceDirectory(), m_buildDirectory, env, generator);
|
||||
} else {
|
||||
m_runCMake->setEnabled(true);
|
||||
m_argumentsLineEdit->setEnabled(true);
|
||||
@@ -522,7 +521,7 @@ void CMakeRunPage::cmakeFinished()
|
||||
}
|
||||
m_cmakeProcess->deleteLater();
|
||||
m_cmakeProcess = 0;
|
||||
m_cmakeWizard->setArguments(Utils::Environment::parseCombinedArgString(m_argumentsLineEdit->text()));
|
||||
m_cmakeWizard->setArguments(m_argumentsLineEdit->text());
|
||||
//TODO Actually test that running cmake was finished, for setting this bool
|
||||
emit completeChanged();
|
||||
}
|
||||
|
@@ -32,8 +32,8 @@
|
||||
|
||||
#include <utils/environment.h>
|
||||
#include <utils/wizard.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
|
||||
#include <QtCore/QProcess>
|
||||
#include <QtGui/QPushButton>
|
||||
#include <QtGui/QComboBox>
|
||||
#include <QtGui/QLineEdit>
|
||||
@@ -81,8 +81,8 @@ public:
|
||||
QString sourceDirectory() const;
|
||||
void setBuildDirectory(const QString &directory);
|
||||
CMakeManager *cmakeManager() const;
|
||||
QStringList arguments() const;
|
||||
void setArguments(const QStringList &args);
|
||||
QString arguments() const;
|
||||
void setArguments(const QString &args);
|
||||
Utils::Environment environment() const;
|
||||
QString msvcVersion() const;
|
||||
void setMsvcVersion(const QString &version);
|
||||
@@ -93,7 +93,7 @@ private:
|
||||
CMakeManager *m_cmakeManager;
|
||||
QString m_buildDirectory;
|
||||
QString m_sourceDirectory;
|
||||
QStringList m_arguments;
|
||||
QString m_arguments;
|
||||
QString m_msvcVersion;
|
||||
bool m_creatingCbpFiles;
|
||||
Utils::Environment m_environment;
|
||||
@@ -140,7 +140,7 @@ private:
|
||||
CMakeOpenProjectWizard *m_cmakeWizard;
|
||||
QPlainTextEdit *m_output;
|
||||
QPushButton *m_runCMake;
|
||||
QProcess *m_cmakeProcess;
|
||||
Utils::QtcProcess *m_cmakeProcess;
|
||||
QLineEdit *m_argumentsLineEdit;
|
||||
Utils::PathChooser *m_cmakeExecutable;
|
||||
QComboBox *m_generatorComboBox;
|
||||
|
@@ -32,6 +32,7 @@
|
||||
#include "cmakeproject.h"
|
||||
|
||||
#include <utils/synchronousprocess.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/uniqueidmanager.h>
|
||||
@@ -102,7 +103,7 @@ bool CMakeManager::hasCodeBlocksMsvcGenerator() const
|
||||
// we probably want the process instead of this function
|
||||
// cmakeproject then could even run the cmake process in the background, adding the files afterwards
|
||||
// sounds like a plan
|
||||
void CMakeManager::createXmlFile(QProcess *proc, const QStringList &arguments,
|
||||
void CMakeManager::createXmlFile(Utils::QtcProcess *proc, const QString &arguments,
|
||||
const QString &sourceDirectory, const QDir &buildDirectory,
|
||||
const Utils::Environment &env, const QString &generator)
|
||||
{
|
||||
@@ -117,11 +118,16 @@ void CMakeManager::createXmlFile(QProcess *proc, const QStringList &arguments,
|
||||
QString buildDirectoryPath = buildDirectory.absolutePath();
|
||||
buildDirectory.mkpath(buildDirectoryPath);
|
||||
proc->setWorkingDirectory(buildDirectoryPath);
|
||||
proc->setEnvironment(env.toStringList());
|
||||
proc->setEnvironment(env);
|
||||
|
||||
const QString srcdir = buildDirectory.exists(QLatin1String("CMakeCache.txt")) ?
|
||||
QString(QLatin1Char('.')) : sourceDirectory;
|
||||
proc->start(cmakeExecutable(), QStringList() << srcdir << arguments << generator);
|
||||
QString args;
|
||||
Utils::QtcProcess::addArg(&args, srcdir);
|
||||
Utils::QtcProcess::addArgs(&args, arguments);
|
||||
Utils::QtcProcess::addArg(&args, generator);
|
||||
proc->setCommand(cmakeExecutable(), args);
|
||||
proc->start();
|
||||
}
|
||||
|
||||
QString CMakeManager::findCbpFile(const QDir &directory)
|
||||
|
@@ -44,6 +44,10 @@
|
||||
QT_FORWARD_DECLARE_CLASS(QProcess)
|
||||
QT_FORWARD_DECLARE_CLASS(QLabel)
|
||||
|
||||
namespace Utils {
|
||||
class QtcProcess;
|
||||
}
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
@@ -66,8 +70,8 @@ public:
|
||||
|
||||
void setCMakeExecutable(const QString &executable);
|
||||
|
||||
void createXmlFile(QProcess *process,
|
||||
const QStringList &arguments,
|
||||
void createXmlFile(Utils::QtcProcess *process,
|
||||
const QString &arguments,
|
||||
const QString &sourceDirectory,
|
||||
const QDir &buildDirectory,
|
||||
const Utils::Environment &env,
|
||||
|
@@ -141,14 +141,9 @@ QString CMakeRunConfiguration::baseWorkingDirectory() const
|
||||
return m_workingDirectory;
|
||||
}
|
||||
|
||||
QStringList CMakeRunConfiguration::commandLineArguments() const
|
||||
QString CMakeRunConfiguration::commandLineArguments() const
|
||||
{
|
||||
return environment().expandVariables(baseCommandLineArguments());
|
||||
}
|
||||
|
||||
QStringList CMakeRunConfiguration::baseCommandLineArguments() const
|
||||
{
|
||||
return Utils::Environment::parseCombinedArgString(m_arguments);
|
||||
return m_arguments;
|
||||
}
|
||||
|
||||
QString CMakeRunConfiguration::title() const
|
||||
@@ -329,7 +324,7 @@ CMakeRunConfigurationWidget::CMakeRunConfigurationWidget(CMakeRunConfiguration *
|
||||
fl->setMargin(0);
|
||||
fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
||||
QLineEdit *argumentsLineEdit = new QLineEdit();
|
||||
argumentsLineEdit->setText(Utils::Environment::joinArgumentList(cmakeRunConfiguration->baseCommandLineArguments()));
|
||||
argumentsLineEdit->setText(cmakeRunConfiguration->commandLineArguments());
|
||||
connect(argumentsLineEdit, SIGNAL(textChanged(QString)),
|
||||
this, SLOT(setArguments(QString)));
|
||||
fl->addRow(tr("Arguments:"), argumentsLineEdit);
|
||||
|
@@ -68,7 +68,7 @@ public:
|
||||
QString executable() const;
|
||||
RunMode runMode() const;
|
||||
QString workingDirectory() const;
|
||||
QStringList commandLineArguments() const;
|
||||
QString commandLineArguments() const;
|
||||
Utils::Environment environment() const;
|
||||
QWidget *createConfigurationWidget();
|
||||
|
||||
@@ -104,7 +104,6 @@ protected:
|
||||
private:
|
||||
void setUserWorkingDirectory(const QString &workingDirectory);
|
||||
QString baseWorkingDirectory() const;
|
||||
QStringList baseCommandLineArguments() const;
|
||||
void ctor();
|
||||
|
||||
enum BaseEnvironmentBase { CleanEnvironmentBase = 0,
|
||||
|
@@ -209,7 +209,7 @@ CMakeTarget *CMakeTargetFactory::create(ProjectExplorer::Project *parent, const
|
||||
|
||||
MakeStep *cleanMakeStep = new MakeStep(cleanSteps);
|
||||
cleanSteps->insertStep(0, cleanMakeStep);
|
||||
cleanMakeStep->setAdditionalArguments(QStringList() << "clean");
|
||||
cleanMakeStep->setAdditionalArguments("clean");
|
||||
cleanMakeStep->setClean(true);
|
||||
|
||||
t->addBuildConfiguration(bc);
|
||||
|
@@ -39,6 +39,8 @@
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/gnumakeparser.h>
|
||||
|
||||
#include <utils/qtcprocess.h>
|
||||
|
||||
#include <QtGui/QFormLayout>
|
||||
#include <QtGui/QGroupBox>
|
||||
#include <QtGui/QCheckBox>
|
||||
@@ -78,7 +80,7 @@ MakeStep::MakeStep(BuildStepList *bsl, MakeStep *bs) :
|
||||
m_clean(bs->m_clean),
|
||||
m_futureInterface(0),
|
||||
m_buildTargets(bs->m_buildTargets),
|
||||
m_additionalArguments(bs->m_buildTargets)
|
||||
m_additionalArguments(Utils::QtcProcess::joinArgs(bs->m_buildTargets))
|
||||
{
|
||||
ctor();
|
||||
}
|
||||
@@ -117,7 +119,7 @@ bool MakeStep::fromMap(const QVariantMap &map)
|
||||
{
|
||||
m_clean = map.value(QLatin1String(CLEAN_KEY)).toBool();
|
||||
m_buildTargets = map.value(QLatin1String(BUILD_TARGETS_KEY)).toStringList();
|
||||
m_additionalArguments = map.value(QLatin1String(ADDITIONAL_ARGUMENTS_KEY)).toStringList();
|
||||
m_additionalArguments = map.value(QLatin1String(ADDITIONAL_ARGUMENTS_KEY)).toString();
|
||||
|
||||
return BuildStep::fromMap(map);
|
||||
}
|
||||
@@ -132,8 +134,8 @@ bool MakeStep::init()
|
||||
|
||||
setCommand(bc->toolChain()->makeCommand());
|
||||
|
||||
QStringList arguments = m_buildTargets;
|
||||
arguments << additionalArguments();
|
||||
QString arguments = Utils::QtcProcess::joinArgs(m_buildTargets);
|
||||
Utils::QtcProcess::addArgs(&arguments, additionalArguments());
|
||||
setArguments(arguments);
|
||||
setEnvironment(bc->environment());
|
||||
setIgnoreReturnValue(m_clean);
|
||||
@@ -191,12 +193,12 @@ void MakeStep::setBuildTarget(const QString &buildTarget, bool on)
|
||||
m_buildTargets = old;
|
||||
}
|
||||
|
||||
QStringList MakeStep::additionalArguments() const
|
||||
QString MakeStep::additionalArguments() const
|
||||
{
|
||||
return m_additionalArguments;
|
||||
}
|
||||
|
||||
void MakeStep::setAdditionalArguments(const QStringList &list)
|
||||
void MakeStep::setAdditionalArguments(const QString &list)
|
||||
{
|
||||
m_additionalArguments = list;
|
||||
}
|
||||
@@ -239,7 +241,7 @@ MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep)
|
||||
|
||||
void MakeStepConfigWidget::additionalArgumentsEdited()
|
||||
{
|
||||
m_makeStep->setAdditionalArguments(Utils::Environment::parseCombinedArgString(m_additionalArguments->text()));
|
||||
m_makeStep->setAdditionalArguments(m_additionalArguments->text());
|
||||
updateDetails();
|
||||
}
|
||||
|
||||
@@ -266,7 +268,7 @@ void MakeStepConfigWidget::init()
|
||||
// and connect again
|
||||
connect(m_buildTargetsList, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(itemChanged(QListWidgetItem*)));
|
||||
|
||||
m_additionalArguments->setText(Utils::Environment::joinArgumentList(m_makeStep->additionalArguments()));
|
||||
m_additionalArguments->setText(m_makeStep->additionalArguments());
|
||||
updateDetails();
|
||||
|
||||
CMakeProject *pro = m_makeStep->cmakeBuildConfiguration()->cmakeTarget()->cmakeProject();
|
||||
@@ -290,13 +292,13 @@ void MakeStepConfigWidget::buildTargetsChanged()
|
||||
|
||||
void MakeStepConfigWidget::updateDetails()
|
||||
{
|
||||
QStringList arguments = m_makeStep->m_buildTargets;
|
||||
arguments << m_makeStep->additionalArguments();
|
||||
QString arguments = Utils::QtcProcess::joinArgs(m_makeStep->m_buildTargets);
|
||||
Utils::QtcProcess::addArgs(&arguments, m_makeStep->additionalArguments());
|
||||
|
||||
CMakeBuildConfiguration *bc = m_makeStep->cmakeBuildConfiguration();
|
||||
ProjectExplorer::ToolChain *tc = bc->toolChain();
|
||||
if (tc)
|
||||
m_summaryText = tr("<b>Make:</b> %1 %2").arg(tc->makeCommand(), arguments.join(QString(QLatin1Char(' '))));
|
||||
m_summaryText = tr("<b>Make:</b> %1 %2").arg(tc->makeCommand(), arguments);
|
||||
else
|
||||
m_summaryText = tr("<b>Unknown Toolchain</b>");
|
||||
emit updateSummary();
|
||||
|
@@ -65,8 +65,8 @@ public:
|
||||
virtual bool immutable() const;
|
||||
bool buildsBuildTarget(const QString &target) const;
|
||||
void setBuildTarget(const QString &target, bool on);
|
||||
QStringList additionalArguments() const;
|
||||
void setAdditionalArguments(const QStringList &list);
|
||||
QString additionalArguments() const;
|
||||
void setAdditionalArguments(const QString &list);
|
||||
|
||||
void setClean(bool clean);
|
||||
|
||||
@@ -88,7 +88,7 @@ private:
|
||||
QRegExp m_percentProgress;
|
||||
QFutureInterface<bool> *m_futureInterface;
|
||||
QStringList m_buildTargets;
|
||||
QStringList m_additionalArguments;
|
||||
QString m_additionalArguments;
|
||||
};
|
||||
|
||||
class MakeStepConfigWidget :public ProjectExplorer::BuildStepConfigWidget
|
||||
|
@@ -56,6 +56,7 @@
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
#include <utils/winutils.h>
|
||||
#include <utils/consoleprocess.h>
|
||||
#include <utils/fancymainwindow.h>
|
||||
@@ -464,7 +465,17 @@ void CdbEngine::runEngine()
|
||||
needWatchTimer = true; // Fetch away module load, etc. even if crashed
|
||||
break;
|
||||
case StartInternal:
|
||||
case StartExternal:
|
||||
case StartExternal: {
|
||||
Utils::QtcProcess::SplitError perr;
|
||||
QString pargs = Utils::QtcProcess::prepareArgs(sp.processArgs, &perr,
|
||||
&sp.environment, &sp.workingDirectory);
|
||||
if (perr != Utils::QtcProcess::SplitOk) {
|
||||
// perr == BadQuoting is never returned on Windows
|
||||
// FIXME? QTCREATORBUG-2809
|
||||
errorMessage = QApplication::translate("DebuggerEngine", // Same message in GdbEngine
|
||||
"Debugging complex command lines is currently not supported under Windows");
|
||||
break;
|
||||
}
|
||||
if (sp.useTerminal) {
|
||||
// Attaching to console processes triggers an initial breakpoint, which we do not want
|
||||
m_d->m_ignoreInitialBreakPoint = true;
|
||||
@@ -472,7 +483,7 @@ void CdbEngine::runEngine()
|
||||
m_d->m_consoleStubProc.stop(); // We leave the console open, so recycle it now.
|
||||
m_d->m_consoleStubProc.setWorkingDirectory(sp.workingDirectory);
|
||||
m_d->m_consoleStubProc.setEnvironment(sp.environment);
|
||||
rc = m_d->m_consoleStubProc.start(sp.executable, sp.processArgs);
|
||||
rc = m_d->m_consoleStubProc.start(sp.executable, pargs);
|
||||
if (!rc)
|
||||
errorMessage = tr("The console stub process was unable to start '%1'.").arg(sp.executable);
|
||||
// continues in slotConsoleStubStarted()...
|
||||
@@ -480,11 +491,11 @@ void CdbEngine::runEngine()
|
||||
needWatchTimer = true;
|
||||
rc = m_d->startDebuggerWithExecutable(sp.workingDirectory,
|
||||
sp.executable,
|
||||
sp.processArgs,
|
||||
sp.environment,
|
||||
pargs,
|
||||
sp.environment.toStringList(),
|
||||
&errorMessage);
|
||||
}
|
||||
break;
|
||||
break; }
|
||||
case AttachCore:
|
||||
errorMessage = tr("Attaching to core files is not supported.");
|
||||
break;
|
||||
|
@@ -465,7 +465,7 @@ void CoreEngine::resetModuleLoadTimer()
|
||||
|
||||
bool CoreEngine::startDebuggerWithExecutable(const QString &workingDirectory,
|
||||
const QString &filename,
|
||||
const QStringList &args,
|
||||
const QString &args,
|
||||
const QStringList &envList,
|
||||
QString *errorMessage)
|
||||
{
|
||||
|
@@ -86,7 +86,7 @@ public:
|
||||
// Start functions
|
||||
bool startDebuggerWithExecutable(const QString &workingDirectory,
|
||||
const QString &filename,
|
||||
const QStringList &args,
|
||||
const QString &args,
|
||||
const QStringList &env,
|
||||
QString *errorMessage);
|
||||
|
||||
|
@@ -118,10 +118,9 @@ QDebug operator<<(QDebug d, DebuggerState state)
|
||||
QDebug operator<<(QDebug str, const DebuggerStartParameters &sp)
|
||||
{
|
||||
QDebug nospace = str.nospace();
|
||||
const QString sep = QString(QLatin1Char(','));
|
||||
nospace << "executable=" << sp.executable
|
||||
<< " coreFile=" << sp.coreFile
|
||||
<< " processArgs=" << sp.processArgs.join(sep)
|
||||
<< " processArgs=" << sp.processArgs
|
||||
<< " environment=<" << sp.environment.size() << " variables>"
|
||||
<< " workingDir=" << sp.workingDirectory
|
||||
<< " attachPID=" << sp.attachPID
|
||||
@@ -477,8 +476,8 @@ void DebuggerEngine::startDebugger(DebuggerRunControl *runControl)
|
||||
d->m_inferiorPid = d->m_startParameters.attachPID > 0
|
||||
? d->m_startParameters.attachPID : 0;
|
||||
|
||||
if (d->m_startParameters.environment.empty())
|
||||
d->m_startParameters.environment = Utils::Environment().toStringList();
|
||||
if (!d->m_startParameters.environment.size())
|
||||
d->m_startParameters.environment = Utils::Environment();
|
||||
|
||||
if (d->m_startParameters.breakAtMain)
|
||||
breakByFunctionMain();
|
||||
|
@@ -37,6 +37,8 @@
|
||||
|
||||
#include <coreplugin/ssh/sshconnection.h>
|
||||
|
||||
#include <utils/environment.h>
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QStringList>
|
||||
|
||||
@@ -70,8 +72,8 @@ public:
|
||||
QString displayName;
|
||||
QString coreFile;
|
||||
bool isSnapshot; // set if created internally
|
||||
QStringList processArgs;
|
||||
QStringList environment;
|
||||
QString processArgs;
|
||||
Utils::Environment environment;
|
||||
QString workingDirectory;
|
||||
qint64 attachPID;
|
||||
bool useTerminal;
|
||||
|
@@ -2047,10 +2047,9 @@ void DebuggerPluginPrivate::startExternalApplication()
|
||||
sp.workingDirectory = dlg.workingDirectory();
|
||||
sp.breakAtMain = dlg.breakAtMain();
|
||||
if (!dlg.executableArguments().isEmpty())
|
||||
sp.processArgs = dlg.executableArguments().split(QLatin1Char(' '));
|
||||
sp.processArgs = dlg.executableArguments();
|
||||
// Fixme: 1 of 3 testing hacks.
|
||||
if (!sp.processArgs.isEmpty()
|
||||
&& (sp.processArgs.front() == _("@tcf@") || sp.processArgs.front() == _("@sym@")))
|
||||
if (sp.processArgs.startsWith(__("@tcf@ ")) || sp.processArgs.startsWith(__("@sym@ ")))
|
||||
sp.toolChainType = ProjectExplorer::ToolChain_RVCT_ARMV5;
|
||||
|
||||
|
||||
|
@@ -171,7 +171,7 @@ static DebuggerStartParameters localStartParameters(RunConfiguration *runConfigu
|
||||
QTC_ASSERT(rc, return sp);
|
||||
|
||||
sp.startMode = StartInternal;
|
||||
sp.environment = rc->environment().toStringList();
|
||||
sp.environment = rc->environment();
|
||||
sp.workingDirectory = rc->workingDirectory();
|
||||
sp.executable = rc->executable();
|
||||
sp.processArgs = rc->commandLineArguments();
|
||||
@@ -429,7 +429,7 @@ void DebuggerRunControl::createEngine(const DebuggerStartParameters &startParams
|
||||
}
|
||||
|
||||
// Fixme: 1 of 3 testing hacks.
|
||||
if (sp.processArgs.size() >= 5 && sp.processArgs.at(0) == _("@tcf@"))
|
||||
if (sp.processArgs.startsWith(__("@tcf@ ")))
|
||||
engineType = GdbEngineType;
|
||||
|
||||
if (sp.processArgs.contains( _("@lldb@")))
|
||||
@@ -525,7 +525,7 @@ QString DebuggerRunControl::displayName() const
|
||||
|
||||
void DebuggerRunControl::setCustomEnvironment(Utils::Environment env)
|
||||
{
|
||||
d->m_engine->startParameters().environment = env.toStringList();
|
||||
d->m_engine->startParameters().environment = env;
|
||||
}
|
||||
|
||||
bool DebuggerRunControl::checkDebugConfiguration(int toolChain,
|
||||
|
@@ -32,6 +32,9 @@
|
||||
#include "abstractgdbprocess.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
#ifdef Q_OS_WIN
|
||||
#include <utils/qtcprocess.h>
|
||||
#endif
|
||||
|
||||
#include <QtCore/QProcess>
|
||||
|
||||
@@ -74,6 +77,24 @@ bool AbstractGdbAdapter::isTrkAdapter() const
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
bool AbstractGdbAdapter::prepareWinCommand()
|
||||
{
|
||||
Utils::QtcProcess::SplitError perr;
|
||||
startParameters().processArgs = Utils::QtcProcess::prepareArgs(
|
||||
startParameters().processArgs, &perr,
|
||||
&startParameters().environment, &startParameters().workingDirectory);
|
||||
if (perr != Utils::QtcProcess::SplitOk) {
|
||||
// perr == BadQuoting is never returned on Windows
|
||||
// FIXME? QTCREATORBUG-2809
|
||||
m_engine->handleAdapterStartFailed(QApplication::translate("DebuggerEngine", // Same message in CdbEngine
|
||||
"Debugging complex command lines is currently not supported under Windows"), QString());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
QString AbstractGdbAdapter::msgGdbStopFailed(const QString &why)
|
||||
{
|
||||
return tr("The Gdb process could not be stopped:\n%1").arg(why);
|
||||
|
@@ -95,6 +95,9 @@ protected:
|
||||
const DebuggerStartParameters &startParameters() const;
|
||||
DebuggerStartParameters &startParameters();
|
||||
void showMessage(const QString &msg, int channel = LogDebug, int timeout = 1);
|
||||
#ifdef Q_OS_WIN
|
||||
bool prepareWinCommand();
|
||||
#endif
|
||||
|
||||
GdbEngine * const m_engine;
|
||||
};
|
||||
|
@@ -53,7 +53,7 @@ void AbstractPlainGdbAdapter::setupInferior()
|
||||
{
|
||||
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
|
||||
if (!startParameters().processArgs.isEmpty()) {
|
||||
QString args = startParameters().processArgs.join(_(" "));
|
||||
QString args = startParameters().processArgs;
|
||||
m_engine->postCommand("-exec-arguments " + toLocalEncoding(args));
|
||||
}
|
||||
m_engine->postCommand("-file-exec-and-symbols \"" + execFilePath() + '"',
|
||||
|
@@ -1708,7 +1708,7 @@ AbstractGdbAdapter *GdbEngine::createAdapter()
|
||||
case ProjectExplorer::ToolChain_RVCT_ARMV5_GNUPOC:
|
||||
case ProjectExplorer::ToolChain_GCCE_GNUPOC:
|
||||
// fixme: 1 of 3 testing hacks
|
||||
if (sp.processArgs.size() >= 5 && sp.processArgs.at(0) == _("@tcf@"))
|
||||
if (sp.processArgs.startsWith(__("@tcf@ ")))
|
||||
return new TcfTrkGdbAdapter(this);
|
||||
return new TrkGdbAdapter(this);
|
||||
default:
|
||||
|
@@ -72,6 +72,11 @@ void LocalPlainGdbAdapter::startAdapter()
|
||||
QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
|
||||
showMessage(_("TRYING TO START ADAPTER"));
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
if (!prepareWinCommand())
|
||||
return;
|
||||
#endif
|
||||
|
||||
QStringList gdbArgs;
|
||||
|
||||
if (!m_outputCollector.listen()) {
|
||||
@@ -83,8 +88,8 @@ void LocalPlainGdbAdapter::startAdapter()
|
||||
|
||||
if (!startParameters().workingDirectory.isEmpty())
|
||||
m_gdbProc.setWorkingDirectory(startParameters().workingDirectory);
|
||||
if (!startParameters().environment.isEmpty())
|
||||
m_gdbProc.setEnvironment(startParameters().environment);
|
||||
if (startParameters().environment.size())
|
||||
m_gdbProc.setEnvironment(startParameters().environment.toStringList());
|
||||
|
||||
if (!m_engine->startGdb(gdbArgs)) {
|
||||
m_outputCollector.shutdown();
|
||||
|
@@ -32,6 +32,7 @@
|
||||
#include "remoteplaingdbadapter.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
|
||||
#include <QtCore/QFileInfo>
|
||||
|
||||
@@ -143,11 +144,11 @@ void RemoteGdbProcess::handleAppOutputReaderStarted()
|
||||
|
||||
connect(m_appOutputReader.data(), SIGNAL(outputAvailable(QByteArray)),
|
||||
this, SLOT(handleAppOutput(QByteArray)));
|
||||
QByteArray cmdLine = "DISPLAY=:0.0 " + m_command.toUtf8() + ' '
|
||||
+ m_cmdArgs.join(QLatin1String(" ")).toUtf8()
|
||||
QByteArray cmdLine = "DISPLAY=:0.0 " + Utils::QtcProcess::quoteArgUnix(m_command).toUtf8() + ' '
|
||||
+ Utils::QtcProcess::joinArgsUnix(m_cmdArgs).toUtf8()
|
||||
+ " -tty=" + m_appOutputFileName;
|
||||
if (!m_wd.isEmpty())
|
||||
cmdLine.prepend("cd " + m_wd.toUtf8() + " && ");
|
||||
cmdLine.prepend("cd " + Utils::QtcProcess::quoteArgUnix(m_wd).toUtf8() + " && ");
|
||||
m_gdbProc = m_conn->createRemoteProcess(cmdLine);
|
||||
connect(m_gdbProc.data(), SIGNAL(started()), this,
|
||||
SLOT(handleGdbStarted()));
|
||||
|
@@ -176,7 +176,7 @@ void RemoteGdbServerAdapter::setupInferior()
|
||||
const QByteArray gnuTarget = startParameters().gnuTarget.toLatin1();
|
||||
const QByteArray solibPath =
|
||||
QFileInfo(startParameters().dumperLibrary).path().toLocal8Bit();
|
||||
const QString args = startParameters().processArgs.join(_(" "));
|
||||
const QString args = startParameters().processArgs;
|
||||
|
||||
if (!remoteArch.isEmpty())
|
||||
m_engine->postCommand("set architecture " + remoteArch);
|
||||
|
@@ -109,8 +109,8 @@ void RemotePlainGdbAdapter::handleSetupDone(int qmlPort)
|
||||
startParameters().qmlServerPort = qmlPort;
|
||||
if (!startParameters().workingDirectory.isEmpty())
|
||||
m_gdbProc.setWorkingDirectory(startParameters().workingDirectory);
|
||||
if (!startParameters().environment.isEmpty())
|
||||
m_gdbProc.setEnvironment(startParameters().environment);
|
||||
if (startParameters().environment.size())
|
||||
m_gdbProc.setEnvironment(startParameters().environment.toStringList());
|
||||
m_gdbProc.realStart(m_engine->startParameters().debuggerCommand,
|
||||
QStringList() << QLatin1String("-i") << QLatin1String("mi"),
|
||||
m_engine->startParameters().executable);
|
||||
|
@@ -44,6 +44,7 @@
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/savedaction.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtCore/QDir>
|
||||
@@ -971,7 +972,7 @@ void TcfTrkGdbAdapter::startAdapter()
|
||||
// Retrieve parameters
|
||||
const DebuggerStartParameters ¶meters = startParameters();
|
||||
m_remoteExecutable = parameters.executable;
|
||||
m_remoteArguments = parameters.processArgs;
|
||||
m_remoteArguments = Utils::QtcProcess::splitArgs(parameters.processArgs);
|
||||
m_symbolFile = parameters.symbolFileName;
|
||||
|
||||
QPair<QString, unsigned short> tcfTrkAddress;
|
||||
@@ -983,15 +984,15 @@ void TcfTrkGdbAdapter::startAdapter()
|
||||
if (debug)
|
||||
qDebug() << parameters.processArgs;
|
||||
// Fixme: 1 of 3 testing hacks.
|
||||
if (parameters.processArgs.size() < 5 || parameters.processArgs.at(0) != _("@tcf@")) {
|
||||
if (m_remoteArguments.size() < 5 || m_remoteArguments.at(0) != __("@tcf@")) {
|
||||
m_engine->handleAdapterStartFailed(_("Parameter error"), QString());
|
||||
return;
|
||||
}
|
||||
|
||||
m_remoteExecutable = parameters.processArgs.at(1);
|
||||
m_uid = parameters.processArgs.at(2).toUInt(0, 16);
|
||||
m_symbolFile = parameters.processArgs.at(3);
|
||||
tcfTrkAddress = splitIpAddressSpec(parameters.processArgs.at(4), 1534);
|
||||
m_remoteExecutable = m_remoteArguments.at(1);
|
||||
m_uid = m_remoteArguments.at(2).toUInt(0, 16);
|
||||
m_symbolFile = m_remoteArguments.at(3);
|
||||
tcfTrkAddress = splitIpAddressSpec(m_remoteArguments.at(4), 1534);
|
||||
m_remoteArguments.clear();
|
||||
|
||||
// Unixish gdbs accept only forward slashes
|
||||
|
@@ -96,10 +96,14 @@ void TermGdbAdapter::startAdapter()
|
||||
// m_stubProc.stop();
|
||||
// m_stubProc.blockSignals(false);
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
if (!prepareWinCommand())
|
||||
return;
|
||||
#endif
|
||||
|
||||
m_stubProc.setWorkingDirectory(startParameters().workingDirectory);
|
||||
// Set environment + dumper preload.
|
||||
QStringList environment = startParameters().environment;
|
||||
m_stubProc.setEnvironment(environment);
|
||||
m_stubProc.setEnvironment(startParameters().environment);
|
||||
// FIXME: Starting the stub implies starting the inferior. This is
|
||||
// fairly unclean as far as the state machine and error reporting go.
|
||||
if (!m_stubProc.start(startParameters().executable,
|
||||
|
@@ -46,6 +46,7 @@
|
||||
#endif
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
#include <utils/savedaction.h>
|
||||
|
||||
#include <QtCore/QTimer>
|
||||
@@ -1551,10 +1552,11 @@ void TrkGdbAdapter::startAdapter()
|
||||
m_symbolFile = parameters.symbolFileName;
|
||||
QString remoteChannel = parameters.remoteChannel;
|
||||
// FIXME: testing hack, remove!
|
||||
if (parameters.processArgs.size() >= 4 && parameters.processArgs.at(0) == _("@sym@")) {
|
||||
remoteChannel = parameters.processArgs.at(1);
|
||||
m_remoteExecutable = parameters.processArgs.at(2);
|
||||
m_symbolFile = parameters.processArgs.at(3);
|
||||
if (m_remoteArguments.startsWith(__("@sym@ "))) {
|
||||
QStringList pa = Utils::QtcProcess::splitArgs(m_remoteArguments);
|
||||
remoteChannel = pa.at(1);
|
||||
m_remoteExecutable = pa.at(2);
|
||||
m_symbolFile = pa.at(3);
|
||||
m_remoteArguments.clear();
|
||||
}
|
||||
// Unixish gdbs accept only forward slashes
|
||||
|
@@ -224,7 +224,7 @@ private:
|
||||
trk::Session m_session; // global-ish data (process id, target information)
|
||||
Symbian::Snapshot m_snapshot; // local-ish data (memory and registers)
|
||||
QString m_remoteExecutable;
|
||||
QStringList m_remoteArguments;
|
||||
QString m_remoteArguments;
|
||||
QString m_symbolFile;
|
||||
int m_verbose;
|
||||
bool m_bufferedMemoryRead;
|
||||
|
@@ -101,7 +101,7 @@ void IPCEngineHost::setupInferior()
|
||||
SET_NATIVE_BYTE_ORDER(s);
|
||||
s << QFileInfo(startParameters().executable).absoluteFilePath();
|
||||
s << startParameters().processArgs;
|
||||
s << startParameters().environment;
|
||||
s << startParameters().environment.toStringList();
|
||||
}
|
||||
rpcCall(SetupInferior, p);
|
||||
}
|
||||
|
@@ -791,13 +791,7 @@ bool QmlEngine::isShadowBuildProject() const
|
||||
|
||||
QString QmlEngine::qmlImportPath() const
|
||||
{
|
||||
const QString qmlImportPathPrefix("QML_IMPORT_PATH=");
|
||||
QStringList env = startParameters().environment;
|
||||
foreach (const QString &envStr, env) {
|
||||
if (envStr.startsWith(qmlImportPathPrefix))
|
||||
return envStr.mid(qmlImportPathPrefix.length());
|
||||
}
|
||||
return QString();
|
||||
return startParameters().environment.value("QML_IMPORT_PATH");
|
||||
}
|
||||
|
||||
QString QmlEngine::toShadowBuildFilename(const QString &filename) const
|
||||
|
@@ -42,6 +42,7 @@
|
||||
#include <coreplugin/variablemanager.h>
|
||||
#include <utils/stringutils.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
|
||||
#include <QtGui/QFormLayout>
|
||||
#include <QtGui/QGroupBox>
|
||||
@@ -132,26 +133,18 @@ QVariantMap GenericMakeStep::toMap() const
|
||||
bool GenericMakeStep::fromMap(const QVariantMap &map)
|
||||
{
|
||||
m_buildTargets = map.value(QLatin1String(BUILD_TARGETS_KEY)).toStringList();
|
||||
m_makeArguments = map.value(QLatin1String(MAKE_ARGUMENTS_KEY)).toStringList();
|
||||
m_makeArguments = map.value(QLatin1String(MAKE_ARGUMENTS_KEY)).toString();
|
||||
m_makeCommand = map.value(QLatin1String(MAKE_COMMAND_KEY)).toString();
|
||||
|
||||
return BuildStep::fromMap(map);
|
||||
}
|
||||
|
||||
QStringList GenericMakeStep::replacedArguments() const
|
||||
QString GenericMakeStep::replacedArguments() const
|
||||
{
|
||||
Utils::AbstractMacroExpander *mx = Core::VariableManager::instance()->macroExpander();
|
||||
const QStringList targets = m_buildTargets;
|
||||
QStringList arguments = m_makeArguments;
|
||||
QStringList replacedArguments;
|
||||
foreach (QString arg, arguments) {
|
||||
Utils::expandMacros(&arg, mx);
|
||||
replacedArguments << arg;
|
||||
}
|
||||
foreach (QString arg, targets) {
|
||||
Utils::expandMacros(&arg, mx);
|
||||
replacedArguments << arg;
|
||||
}
|
||||
QString replacedArguments = m_makeArguments;
|
||||
Utils::QtcProcess::addArgs(&replacedArguments, m_buildTargets);
|
||||
Utils::QtcProcess::expandMacros(&replacedArguments,
|
||||
Core::VariableManager::instance()->macroExpander());
|
||||
return replacedArguments;
|
||||
}
|
||||
|
||||
@@ -245,11 +238,8 @@ void GenericMakeStepConfigWidget::init()
|
||||
{
|
||||
updateMakeOverrrideLabel();
|
||||
|
||||
QString makeCommand = m_makeStep->m_makeCommand;
|
||||
m_ui->makeLineEdit->setText(makeCommand);
|
||||
|
||||
const QStringList &makeArguments = m_makeStep->m_makeArguments;
|
||||
m_ui->makeArgumentsLineEdit->setText(Utils::Environment::joinArgumentList(makeArguments));
|
||||
m_ui->makeLineEdit->setText(m_makeStep->m_makeCommand);
|
||||
m_ui->makeArgumentsLineEdit->setText(m_makeStep->m_makeArguments);
|
||||
|
||||
// Disconnect to make the changes to the items
|
||||
disconnect(m_ui->targetsList, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(itemChanged(QListWidgetItem*)));
|
||||
@@ -268,8 +258,7 @@ void GenericMakeStepConfigWidget::init()
|
||||
void GenericMakeStepConfigWidget::updateDetails()
|
||||
{
|
||||
m_summaryText = tr("<b>Make:</b> %1 %2")
|
||||
.arg(m_makeStep->makeCommand(),
|
||||
Utils::Environment::joinArgumentList(m_makeStep->replacedArguments()));
|
||||
.arg(m_makeStep->makeCommand(), m_makeStep->replacedArguments());
|
||||
emit updateSummary();
|
||||
}
|
||||
|
||||
@@ -292,8 +281,7 @@ void GenericMakeStepConfigWidget::makeLineEditTextEdited()
|
||||
|
||||
void GenericMakeStepConfigWidget::makeArgumentsLineEditTextEdited()
|
||||
{
|
||||
m_makeStep->m_makeArguments =
|
||||
Utils::Environment::parseCombinedArgString(m_ui->makeArgumentsLineEdit->text());
|
||||
m_makeStep->m_makeArguments = m_ui->makeArgumentsLineEdit->text();
|
||||
updateDetails();
|
||||
}
|
||||
|
||||
|
@@ -67,7 +67,7 @@ public:
|
||||
virtual bool immutable() const;
|
||||
bool buildsTarget(const QString &target) const;
|
||||
void setBuildTarget(const QString &target, bool on);
|
||||
QStringList replacedArguments() const;
|
||||
QString replacedArguments() const;
|
||||
QString makeCommand() const;
|
||||
|
||||
QVariantMap toMap() const;
|
||||
@@ -81,7 +81,7 @@ private:
|
||||
void ctor();
|
||||
|
||||
QStringList m_buildTargets;
|
||||
QStringList m_makeArguments;
|
||||
QString m_makeArguments;
|
||||
QString m_makeCommand;
|
||||
};
|
||||
|
||||
|
@@ -49,6 +49,7 @@
|
||||
|
||||
#include <texteditor/itexteditor.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
#include <utils/synchronousprocess.h>
|
||||
#include <utils/environment.h>
|
||||
#include <vcsbase/vcsbaseeditor.h>
|
||||
@@ -1352,7 +1353,7 @@ bool GitClient::tryLauchingGitK(const QProcessEnvironment &env,
|
||||
#endif
|
||||
VCSBase::VCSBaseOutputWindow *outwin = VCSBase::VCSBaseOutputWindow::instance();
|
||||
if (!m_settings.gitkOptions.isEmpty())
|
||||
arguments.append(m_settings.gitkOptions.split(QLatin1Char(' ')));
|
||||
arguments.append(Utils::QtcProcess::splitArgs(m_settings.gitkOptions));
|
||||
outwin->appendCommand(workingDirectory, binary, arguments);
|
||||
// This should always use QProcess::startDetached (as not to kill
|
||||
// the child), but that does not have an environment parameter.
|
||||
|
@@ -35,6 +35,7 @@
|
||||
#include "target.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
|
||||
#include <QtCore/QEventLoop>
|
||||
#include <QtCore/QTimer>
|
||||
@@ -113,12 +114,12 @@ void AbstractProcessStep::setWorkingDirectory(const QString &workingDirectory)
|
||||
m_workingDirectory = workingDirectory;
|
||||
}
|
||||
|
||||
void AbstractProcessStep::setArguments(const QStringList &arguments)
|
||||
void AbstractProcessStep::setArguments(const QString &arguments)
|
||||
{
|
||||
m_arguments = arguments;
|
||||
}
|
||||
|
||||
QStringList AbstractProcessStep::arguments() const
|
||||
QString AbstractProcessStep::arguments() const
|
||||
{
|
||||
return m_arguments;
|
||||
}
|
||||
@@ -154,9 +155,9 @@ void AbstractProcessStep::run(QFutureInterface<bool> &fi)
|
||||
if (!wd.exists())
|
||||
wd.mkpath(wd.absolutePath());
|
||||
|
||||
m_process = new QProcess();
|
||||
m_process = new Utils::QtcProcess();
|
||||
m_process->setWorkingDirectory(wd.absolutePath());
|
||||
m_process->setEnvironment(m_environment.toStringList());
|
||||
m_process->setEnvironment(m_environment);
|
||||
|
||||
connect(m_process, SIGNAL(readyReadStandardOutput()),
|
||||
this, SLOT(processReadyReadStdOutput()),
|
||||
@@ -169,7 +170,8 @@ void AbstractProcessStep::run(QFutureInterface<bool> &fi)
|
||||
this, SLOT(slotProcessFinished(int, QProcess::ExitStatus)),
|
||||
Qt::DirectConnection);
|
||||
|
||||
m_process->start(expandedCommand(), m_environment.expandVariables(m_arguments));
|
||||
m_process->setCommand(expandedCommand(), m_arguments);
|
||||
m_process->start();
|
||||
if (!m_process->waitForStarted()) {
|
||||
processStartupFailed();
|
||||
delete m_process;
|
||||
@@ -210,8 +212,7 @@ void AbstractProcessStep::run(QFutureInterface<bool> &fi)
|
||||
void AbstractProcessStep::processStarted()
|
||||
{
|
||||
emit addOutput(tr("Starting: \"%1\" %2\n")
|
||||
.arg(QDir::toNativeSeparators(expandedCommand()),
|
||||
m_environment.expandVariables(m_arguments).join(QChar(' '))),
|
||||
.arg(QDir::toNativeSeparators(expandedCommand()), expandedArguments()),
|
||||
BuildStep::MessageOutput);
|
||||
}
|
||||
|
||||
@@ -232,9 +233,8 @@ void AbstractProcessStep::processFinished(int exitCode, QProcess::ExitStatus sta
|
||||
|
||||
void AbstractProcessStep::processStartupFailed()
|
||||
{
|
||||
emit addOutput(tr("Could not start process \"%1\" %2").
|
||||
arg(QDir::toNativeSeparators(expandedCommand()),
|
||||
m_environment.expandVariables(m_arguments).join(QChar(' '))),
|
||||
emit addOutput(tr("Could not start process \"%1\" %2")
|
||||
.arg(QDir::toNativeSeparators(expandedCommand()), expandedArguments()),
|
||||
BuildStep::ErrorMessageOutput);
|
||||
}
|
||||
|
||||
@@ -359,3 +359,21 @@ QString AbstractProcessStep::expandedCommand() const
|
||||
command = m_command;
|
||||
return command;
|
||||
}
|
||||
|
||||
QString AbstractProcessStep::expandedArguments() const
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
QString args;
|
||||
#else
|
||||
QStringList args;
|
||||
#endif
|
||||
Utils::QtcProcess::SplitError err;
|
||||
args = Utils::QtcProcess::prepareArgs(m_arguments, &err, &m_environment);
|
||||
if (err != Utils::QtcProcess::SplitOk)
|
||||
return m_arguments; // Sorry, too complex - just fall back.
|
||||
#ifdef Q_OS_WIN
|
||||
return args;
|
||||
#else
|
||||
return Utils::QtcProcess::joinArgs(args);
|
||||
#endif
|
||||
}
|
||||
|
@@ -34,8 +34,9 @@
|
||||
|
||||
#include <utils/environment.h>
|
||||
|
||||
#include <utils/qtcprocess.h>
|
||||
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QProcess>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QEventLoop;
|
||||
@@ -93,8 +94,8 @@ public:
|
||||
|
||||
/// sets the command line arguments used by the process for a \p buildConfiguration
|
||||
/// should be called from init()
|
||||
void setArguments(const QStringList &arguments);
|
||||
QStringList arguments() const;
|
||||
void setArguments(const QString &arguments);
|
||||
QString arguments() const;
|
||||
|
||||
/// enables or disables a BuildStep
|
||||
/// Disabled BuildSteps immediately return true from their run method
|
||||
@@ -125,6 +126,8 @@ protected:
|
||||
|
||||
/// Get the fully expanded command name to run:
|
||||
QString expandedCommand() const;
|
||||
/// Get the fully expanded command line args. This is for display purposes only!
|
||||
QString expandedArguments() const;
|
||||
|
||||
/// Called after the process is started
|
||||
/// the default implementation adds a process started message to the output message
|
||||
@@ -161,10 +164,10 @@ private:
|
||||
QFutureInterface<bool> *m_futureInterface;
|
||||
QString m_workingDirectory;
|
||||
QString m_command;
|
||||
QStringList m_arguments;
|
||||
QString m_arguments;
|
||||
bool m_enabled;
|
||||
bool m_ignoreReturnValue;
|
||||
QProcess *m_process;
|
||||
Utils::QtcProcess *m_process;
|
||||
QEventLoop *m_eventLoop;
|
||||
Utils::Environment m_environment;
|
||||
ProjectExplorer::IOutputParser *m_outputParserChain;
|
||||
|
@@ -32,12 +32,10 @@
|
||||
|
||||
#include "projectexplorer_export.h"
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtCore/QProcess>
|
||||
|
||||
namespace Utils {
|
||||
class ConsoleProcess;
|
||||
class Environment;
|
||||
}
|
||||
|
||||
namespace ProjectExplorer {
|
||||
@@ -57,10 +55,10 @@ public:
|
||||
~ApplicationLauncher();
|
||||
|
||||
void setWorkingDirectory(const QString &dir);
|
||||
void setEnvironment(const QStringList &env);
|
||||
void setEnvironment(const Utils::Environment &env);
|
||||
|
||||
void start(Mode mode, const QString &program,
|
||||
const QStringList &args = QStringList());
|
||||
const QString &args = QString());
|
||||
void stop();
|
||||
bool isRunning() const;
|
||||
qint64 applicationPID() const;
|
||||
|
@@ -69,13 +69,13 @@ void ApplicationLauncher::setWorkingDirectory(const QString &dir)
|
||||
d->m_consoleProcess.setWorkingDirectory(dir);
|
||||
}
|
||||
|
||||
void ApplicationLauncher::setEnvironment(const QStringList &env)
|
||||
void ApplicationLauncher::setEnvironment(const Utils::Environment &env)
|
||||
{
|
||||
d->m_winGuiProcess.setEnvironment(env);
|
||||
d->m_consoleProcess.setEnvironment(env);
|
||||
}
|
||||
|
||||
void ApplicationLauncher::start(Mode mode, const QString &program, const QStringList &args)
|
||||
void ApplicationLauncher::start(Mode mode, const QString &program, const QString &args)
|
||||
{
|
||||
d->m_currentMode = mode;
|
||||
if (mode == Gui) {
|
||||
|
@@ -32,6 +32,8 @@
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <utils/qtcprocess.h>
|
||||
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtCore/QTextCodec>
|
||||
|
||||
@@ -40,7 +42,7 @@ namespace ProjectExplorer {
|
||||
struct ApplicationLauncherPrivate {
|
||||
ApplicationLauncherPrivate();
|
||||
|
||||
QProcess m_guiProcess;
|
||||
Utils::QtcProcess m_guiProcess;
|
||||
Utils::ConsoleProcess m_consoleProcess;
|
||||
ApplicationLauncher::Mode m_currentMode;
|
||||
|
||||
@@ -87,17 +89,18 @@ void ApplicationLauncher::setWorkingDirectory(const QString &dir)
|
||||
d->m_consoleProcess.setWorkingDirectory(dir);
|
||||
}
|
||||
|
||||
void ApplicationLauncher::setEnvironment(const QStringList &env)
|
||||
void ApplicationLauncher::setEnvironment(const Utils::Environment &env)
|
||||
{
|
||||
d->m_guiProcess.setEnvironment(env);
|
||||
d->m_consoleProcess.setEnvironment(env);
|
||||
}
|
||||
|
||||
void ApplicationLauncher::start(Mode mode, const QString &program, const QStringList &args)
|
||||
void ApplicationLauncher::start(Mode mode, const QString &program, const QString &args)
|
||||
{
|
||||
d->m_currentMode = mode;
|
||||
if (mode == Gui) {
|
||||
d->m_guiProcess.start(program, args);
|
||||
d->m_guiProcess.setCommand(program, args);
|
||||
d->m_guiProcess.start();
|
||||
} else {
|
||||
d->m_consoleProcess.start(program, args);
|
||||
}
|
||||
|
@@ -48,4 +48,3 @@ LocalApplicationRunConfiguration::~LocalApplicationRunConfiguration()
|
||||
}
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
|
@@ -54,7 +54,7 @@ public:
|
||||
virtual QString executable() const = 0;
|
||||
virtual RunMode runMode() const = 0;
|
||||
virtual QString workingDirectory() const = 0;
|
||||
virtual QStringList commandLineArguments() const = 0;
|
||||
virtual QString commandLineArguments() const = 0;
|
||||
virtual Utils::Environment environment() const = 0;
|
||||
virtual QString dumperLibrary() const = 0;
|
||||
virtual QStringList dumperLibraryLocations() const = 0;
|
||||
|
@@ -231,7 +231,7 @@ void CustomExecutableConfigurationWidget::executableEdited()
|
||||
void CustomExecutableConfigurationWidget::argumentsEdited(const QString &arguments)
|
||||
{
|
||||
m_ignoreChange = true;
|
||||
m_runConfiguration->setBaseCommandLineArguments(arguments);
|
||||
m_runConfiguration->setCommandLineArguments(arguments);
|
||||
m_ignoreChange = false;
|
||||
}
|
||||
void CustomExecutableConfigurationWidget::workingDirectoryEdited()
|
||||
@@ -256,7 +256,7 @@ void CustomExecutableConfigurationWidget::changed()
|
||||
return;
|
||||
|
||||
m_executableChooser->setPath(m_runConfiguration->rawExecutable());
|
||||
m_commandLineArgumentsLineEdit->setText(Utils::Environment::joinArgumentList(m_runConfiguration->baseCommandLineArguments()));
|
||||
m_commandLineArgumentsLineEdit->setText(m_runConfiguration->commandLineArguments());
|
||||
m_workingDirectory->setPath(m_runConfiguration->baseWorkingDirectory());
|
||||
m_useTerminalCheck->setChecked(m_runConfiguration->runMode() == LocalApplicationRunConfiguration::Console);
|
||||
}
|
||||
|
@@ -141,7 +141,7 @@ QString CustomExecutableRunConfiguration::executable() const
|
||||
|
||||
QString oldExecutable = m_executable;
|
||||
QString oldWorkingDirectory = m_workingDirectory;
|
||||
QStringList oldCmdArguments = m_cmdArguments;
|
||||
QString oldCmdArguments = m_cmdArguments;
|
||||
|
||||
if (dialog.exec()) {
|
||||
return executable();
|
||||
@@ -183,12 +183,7 @@ QString CustomExecutableRunConfiguration::baseWorkingDirectory() const
|
||||
}
|
||||
|
||||
|
||||
QStringList CustomExecutableRunConfiguration::commandLineArguments() const
|
||||
{
|
||||
return environment().expandVariables(baseCommandLineArguments());
|
||||
}
|
||||
|
||||
QStringList CustomExecutableRunConfiguration::baseCommandLineArguments() const
|
||||
QString CustomExecutableRunConfiguration::commandLineArguments() const
|
||||
{
|
||||
return m_cmdArguments;
|
||||
}
|
||||
@@ -275,7 +270,7 @@ QVariantMap CustomExecutableRunConfiguration::toMap() const
|
||||
bool CustomExecutableRunConfiguration::fromMap(const QVariantMap &map)
|
||||
{
|
||||
m_executable = map.value(QLatin1String(EXECUTABLE_KEY)).toString();
|
||||
m_cmdArguments = map.value(QLatin1String(ARGUMENTS_KEY)).toStringList();
|
||||
m_cmdArguments = map.value(QLatin1String(ARGUMENTS_KEY)).toString();
|
||||
m_workingDirectory = map.value(QLatin1String(WORKING_DIRECTORY_KEY)).toString();
|
||||
m_runMode = map.value(QLatin1String(USE_TERMINAL_KEY)).toBool() ? Console : Gui;
|
||||
m_userEnvironmentChanges = Utils::EnvironmentItem::fromStringList(map.value(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY)).toStringList());
|
||||
@@ -294,9 +289,9 @@ void CustomExecutableRunConfiguration::setExecutable(const QString &executable)
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void CustomExecutableRunConfiguration::setBaseCommandLineArguments(const QString &commandLineArguments)
|
||||
void CustomExecutableRunConfiguration::setCommandLineArguments(const QString &commandLineArguments)
|
||||
{
|
||||
m_cmdArguments = Utils::Environment::parseCombinedArgString(commandLineArguments);
|
||||
m_cmdArguments = commandLineArguments;
|
||||
emit changed();
|
||||
}
|
||||
|
||||
|
@@ -69,7 +69,7 @@ public:
|
||||
|
||||
LocalApplicationRunConfiguration::RunMode runMode() const;
|
||||
QString workingDirectory() const;
|
||||
QStringList commandLineArguments() const;
|
||||
QString commandLineArguments() const;
|
||||
Utils::Environment environment() const;
|
||||
|
||||
QWidget *createConfigurationWidget();
|
||||
@@ -108,8 +108,7 @@ private:
|
||||
QList<Utils::EnvironmentItem> userEnvironmentChanges() const;
|
||||
|
||||
void setExecutable(const QString &executable);
|
||||
void setBaseCommandLineArguments(const QString &commandLineArguments);
|
||||
QStringList baseCommandLineArguments() const;
|
||||
void setCommandLineArguments(const QString &commandLineArguments);
|
||||
QString baseWorkingDirectory() const;
|
||||
void setBaseWorkingDirectory(const QString &workingDirectory);
|
||||
void setUserName(const QString &name);
|
||||
@@ -117,7 +116,7 @@ private:
|
||||
|
||||
QString m_executable;
|
||||
QString m_workingDirectory;
|
||||
QStringList m_cmdArguments;
|
||||
QString m_cmdArguments;
|
||||
RunMode m_runMode;
|
||||
bool m_userSetName;
|
||||
QString m_userName;
|
||||
|
@@ -40,6 +40,7 @@
|
||||
#include <utils/environment.h>
|
||||
#include <utils/pathchooser.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
#include <utils/unixutils.h>
|
||||
#include <utils/consoleprocess.h>
|
||||
|
||||
@@ -438,8 +439,8 @@ void FolderNavigationWidget::openTerminal(const QString &path)
|
||||
const QString terminalEmulator = QString::fromLocal8Bit(qgetenv("COMSPEC"));
|
||||
const QStringList args; // none
|
||||
#else
|
||||
QStringList args = Utils::ConsoleProcess::terminalEmulator(
|
||||
Core::ICore::instance()->settings()).split(QLatin1Char(' '));
|
||||
QStringList args = Utils::QtcProcess::splitArgs(
|
||||
Utils::ConsoleProcess::terminalEmulator(Core::ICore::instance()->settings()));
|
||||
const QString terminalEmulator = args.takeFirst();
|
||||
const QString shell = QString::fromLocal8Bit(qgetenv("SHELL"));
|
||||
args.append(shell);
|
||||
|
@@ -78,7 +78,7 @@ LocalApplicationRunControl::LocalApplicationRunControl(LocalApplicationRunConfig
|
||||
{
|
||||
Utils::Environment env = rc->environment();
|
||||
QString dir = rc->workingDirectory();
|
||||
m_applicationLauncher.setEnvironment(env.toStringList());
|
||||
m_applicationLauncher.setEnvironment(env);
|
||||
m_applicationLauncher.setWorkingDirectory(dir);
|
||||
|
||||
m_executable = rc->executable();
|
||||
|
@@ -66,7 +66,7 @@ private slots:
|
||||
private:
|
||||
ProjectExplorer::ApplicationLauncher m_applicationLauncher;
|
||||
QString m_executable;
|
||||
QStringList m_commandLineArguments;
|
||||
QString m_commandLineArguments;
|
||||
ProjectExplorer::ApplicationLauncher::Mode m_runMode;
|
||||
};
|
||||
|
||||
|
@@ -33,6 +33,7 @@
|
||||
#include "buildconfiguration.h"
|
||||
|
||||
#include <coreplugin/ifile.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
@@ -124,7 +125,7 @@ QString ProcessStep::command() const
|
||||
return m_command;
|
||||
}
|
||||
|
||||
QStringList ProcessStep::arguments() const
|
||||
QString ProcessStep::arguments() const
|
||||
{
|
||||
return m_arguments;
|
||||
}
|
||||
@@ -144,7 +145,7 @@ void ProcessStep::setCommand(const QString &command)
|
||||
m_command = command;
|
||||
}
|
||||
|
||||
void ProcessStep::setArguments(const QStringList &arguments)
|
||||
void ProcessStep::setArguments(const QString &arguments)
|
||||
{
|
||||
m_arguments = arguments;
|
||||
}
|
||||
@@ -176,7 +177,7 @@ QVariantMap ProcessStep::toMap() const
|
||||
bool ProcessStep::fromMap(const QVariantMap &map)
|
||||
{
|
||||
setCommand(map.value(QLatin1String(PROCESS_COMMAND_KEY)).toString());
|
||||
setArguments(map.value(QLatin1String(PROCESS_ARGUMENTS_KEY)).toStringList());
|
||||
setArguments(map.value(QLatin1String(PROCESS_ARGUMENTS_KEY)).toString());
|
||||
setWorkingDirectory(map.value(QLatin1String(PROCESS_WORKINGDIRECTORY_KEY)).toString());
|
||||
setEnabled(map.value(QLatin1String(PROCESS_ENABLED_KEY), false).toBool());
|
||||
return AbstractProcessStep::fromMap(map);
|
||||
@@ -277,7 +278,7 @@ void ProcessStepConfigWidget::updateDetails()
|
||||
m_summaryText = tr("<b>%1</b> %2 %3 %4")
|
||||
.arg(displayName,
|
||||
m_step->command(),
|
||||
m_step->arguments().join(QString(QLatin1Char(' '))),
|
||||
m_step->arguments(),
|
||||
m_step->enabled() ? QString() : tr("(disabled)"));
|
||||
emit updateSummary();
|
||||
}
|
||||
@@ -295,7 +296,7 @@ void ProcessStepConfigWidget::init()
|
||||
m_ui.workingDirectory->setEnvironment(m_step->buildConfiguration()->environment());
|
||||
m_ui.workingDirectory->setPath(m_step->workingDirectory());
|
||||
|
||||
m_ui.commandArgumentsLineEdit->setText(m_step->arguments().join(QString(QLatin1Char(' '))));
|
||||
m_ui.commandArgumentsLineEdit->setText(m_step->arguments());
|
||||
m_ui.enabledCheckBox->setChecked(m_step->enabled());
|
||||
|
||||
updateDetails();
|
||||
@@ -319,8 +320,7 @@ void ProcessStepConfigWidget::workingDirectoryLineEditTextEdited()
|
||||
|
||||
void ProcessStepConfigWidget::commandArgumentsLineEditTextEdited()
|
||||
{
|
||||
m_step->setArguments(m_ui.commandArgumentsLineEdit->text().split(QLatin1Char(' '),
|
||||
QString::SkipEmptyParts));
|
||||
m_step->setArguments(m_ui.commandArgumentsLineEdit->text());
|
||||
updateDetails();
|
||||
}
|
||||
|
||||
|
@@ -73,12 +73,12 @@ public:
|
||||
virtual bool immutable() const;
|
||||
|
||||
QString command() const;
|
||||
QStringList arguments() const;
|
||||
QString arguments() const;
|
||||
bool enabled() const;
|
||||
QString workingDirectory() const;
|
||||
|
||||
void setCommand(const QString &command);
|
||||
void setArguments(const QStringList &arguments);
|
||||
void setArguments(const QString &arguments);
|
||||
void setEnabled(bool enabled);
|
||||
void setWorkingDirectory(const QString &workingDirectory);
|
||||
|
||||
@@ -94,7 +94,7 @@ private:
|
||||
void ctor();
|
||||
|
||||
QString m_command;
|
||||
QStringList m_arguments;
|
||||
QString m_arguments;
|
||||
QString m_workingDirectory;
|
||||
Utils::Environment m_env;
|
||||
bool m_enabled;
|
||||
|
@@ -35,8 +35,8 @@
|
||||
#include "msvcparser.h"
|
||||
#include "linuxiccparser.h"
|
||||
|
||||
|
||||
#include <utils/synchronousprocess.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QFileInfo>
|
||||
@@ -768,16 +768,16 @@ MSVCToolChain::StringStringPairList MSVCToolChain::readEnvironmentSettingI(const
|
||||
if (!tf.open())
|
||||
return StringStringPairList();
|
||||
const QString filename = tf.fileName();
|
||||
QByteArray call = "call \"";
|
||||
call += varsBat.toLocal8Bit();
|
||||
call += '"';
|
||||
QByteArray call = "call ";
|
||||
call += Utils::QtcProcess::quoteArg(varsBat).toLocal8Bit();
|
||||
if (!args.isEmpty()) {
|
||||
call += ' ';
|
||||
call += args.join(QString(QLatin1Char(' '))).toLocal8Bit();
|
||||
call += Utils::QtcProcess::joinArgs(args).toLocal8Bit();
|
||||
}
|
||||
call += "\r\n";
|
||||
tf.write(call);
|
||||
const QByteArray redirect = "set > \"" + QDir::toNativeSeparators(tempOutputFileName).toLocal8Bit() + "\"\r\n";
|
||||
const QByteArray redirect = "set > " + Utils::QtcProcess::quoteArg(
|
||||
QDir::toNativeSeparators(tempOutputFileName)).toLocal8Bit() + "\r\n";
|
||||
tf.write(redirect);
|
||||
tf.flush();
|
||||
tf.waitForBytesWritten(30000);
|
||||
|
@@ -30,6 +30,8 @@
|
||||
#include "winguiprocess.h"
|
||||
#include "consoleprocess.h"
|
||||
|
||||
#include <utils/qtcprocess.h>
|
||||
|
||||
#include <QtCore/QDir>
|
||||
|
||||
using namespace ProjectExplorer::Internal;
|
||||
@@ -46,7 +48,7 @@ WinGuiProcess::~WinGuiProcess()
|
||||
stop();
|
||||
}
|
||||
|
||||
bool WinGuiProcess::start(const QString &program, const QStringList &args)
|
||||
bool WinGuiProcess::start(const QString &program, const QString &args)
|
||||
{
|
||||
m_program = program;
|
||||
m_args = args;
|
||||
@@ -112,11 +114,14 @@ void WinGuiProcess::run()
|
||||
|
||||
const bool dbgInterface = setupDebugInterface(bufferReadyEvent, dataReadyEvent, sharedFile, sharedMem);
|
||||
|
||||
const QString cmdLine = createWinCommandline(m_program, m_args);
|
||||
QString pcmd, pargs;
|
||||
QtcProcess::prepareCommand(m_program, m_args, &pcmd, &pargs, &m_environment, &m_workingDir);
|
||||
const QString cmdLine = createWinCommandline(pcmd, pargs);
|
||||
const QStringList env = m_environment.toStringList();
|
||||
started = CreateProcessW(0, (WCHAR*)cmdLine.utf16(),
|
||||
0, 0, TRUE, CREATE_UNICODE_ENVIRONMENT,
|
||||
environment().isEmpty() ? 0
|
||||
: createWinEnvironment(fixWinEnvironment(environment())).data(),
|
||||
env.isEmpty() ? 0
|
||||
: createWinEnvironment(fixWinEnvironment(env)).data(),
|
||||
workingDirectory().isEmpty() ? 0
|
||||
: (WCHAR*)QDir::convertSeparators(workingDirectory()).utf16(),
|
||||
&si, m_pid);
|
||||
|
@@ -53,7 +53,7 @@ public:
|
||||
explicit WinGuiProcess(QObject *parent = 0);
|
||||
virtual ~WinGuiProcess();
|
||||
|
||||
bool start(const QString &program, const QStringList &args);
|
||||
bool start(const QString &program, const QString &args);
|
||||
void stop();
|
||||
|
||||
bool isRunning() const;
|
||||
@@ -71,7 +71,7 @@ private:
|
||||
|
||||
PROCESS_INFORMATION *m_pid;
|
||||
QString m_program;
|
||||
QStringList m_args;
|
||||
QString m_args;
|
||||
unsigned long m_exitCode;
|
||||
};
|
||||
|
||||
|
@@ -30,6 +30,7 @@
|
||||
#include "qmljspreviewrunner.h"
|
||||
|
||||
#include <utils/environment.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
#include <utils/synchronousprocess.h>
|
||||
|
||||
#include <QtGui/QMessageBox>
|
||||
@@ -50,7 +51,7 @@ QmlJSPreviewRunner::QmlJSPreviewRunner(QObject *parent) :
|
||||
m_qmlViewerDefaultPath = Utils::SynchronousProcess::locateBinary(searchPath, QLatin1String("qmlviewer"));
|
||||
|
||||
Utils::Environment environment = Utils::Environment::systemEnvironment();
|
||||
m_applicationLauncher.setEnvironment(environment.toStringList());
|
||||
m_applicationLauncher.setEnvironment(environment);
|
||||
}
|
||||
|
||||
bool QmlJSPreviewRunner::isReady() const
|
||||
@@ -63,7 +64,7 @@ void QmlJSPreviewRunner::run(const QString &filename)
|
||||
QString errorMessage;
|
||||
if (!filename.isEmpty()) {
|
||||
m_applicationLauncher.start(ProjectExplorer::ApplicationLauncher::Gui, m_qmlViewerDefaultPath,
|
||||
QStringList() << filename);
|
||||
Utils::QtcProcess::quoteArg(filename));
|
||||
|
||||
} else {
|
||||
errorMessage = "No file specified.";
|
||||
|
@@ -43,6 +43,7 @@
|
||||
#include <utils/debuggerlanguagechooser.h>
|
||||
#include <utils/detailswidget.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
#include <qt4projectmanager/qtversionmanager.h>
|
||||
#include <qt4projectmanager/qt4projectmanagerconstants.h>
|
||||
#include <qt4projectmanager/qmlobservertool.h>
|
||||
@@ -135,23 +136,20 @@ QString QmlProjectRunConfiguration::observerPath() const
|
||||
}
|
||||
}
|
||||
|
||||
QStringList QmlProjectRunConfiguration::viewerArguments() const
|
||||
QString QmlProjectRunConfiguration::viewerArguments() const
|
||||
{
|
||||
QStringList args;
|
||||
|
||||
// arguments in .user file
|
||||
if (!m_qmlViewerArgs.isEmpty())
|
||||
args.append(m_qmlViewerArgs.split(QLatin1Char(' ')));
|
||||
QString args = m_qmlViewerArgs;
|
||||
|
||||
// arguments from .qmlproject file
|
||||
foreach (const QString &importPath, qmlTarget()->qmlProject()->importPaths()) {
|
||||
args.append(QLatin1String("-I"));
|
||||
args.append(importPath);
|
||||
Utils::QtcProcess::addArg(&args, "-I");
|
||||
Utils::QtcProcess::addArg(&args, importPath);
|
||||
}
|
||||
|
||||
const QString s = mainScript();
|
||||
if (! s.isEmpty())
|
||||
args.append(s);
|
||||
const QString &s = mainScript();
|
||||
if (!s.isEmpty())
|
||||
Utils::QtcProcess::addArg(&args, s);
|
||||
return args;
|
||||
}
|
||||
|
||||
|
@@ -75,7 +75,7 @@ public:
|
||||
|
||||
QString viewerPath() const;
|
||||
QString observerPath() const;
|
||||
QStringList viewerArguments() const;
|
||||
QString viewerArguments() const;
|
||||
QString workingDirectory() const;
|
||||
int qtVersionId() const;
|
||||
Qt4ProjectManager::QtVersion *qtVersion() const;
|
||||
|
@@ -37,6 +37,7 @@
|
||||
#include <qt4projectmanager/qtversionmanager.h>
|
||||
#include <utils/environment.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
|
||||
#include <debugger/debuggerrunner.h>
|
||||
#include <debugger/debuggerplugin.h>
|
||||
@@ -64,7 +65,9 @@ QmlRunControl::QmlRunControl(QmlProjectRunConfiguration *runConfiguration, QStri
|
||||
: RunControl(runConfiguration, mode)
|
||||
{
|
||||
if (Qt4ProjectManager::QtVersion *qtVersion = runConfiguration->qtVersion())
|
||||
m_applicationLauncher.setEnvironment(qtVersion->qmlToolsEnvironment().toStringList());
|
||||
m_applicationLauncher.setEnvironment(qtVersion->qmlToolsEnvironment());
|
||||
else
|
||||
m_applicationLauncher.setEnvironment(Utils::Environment::systemEnvironment());
|
||||
m_applicationLauncher.setWorkingDirectory(runConfiguration->workingDirectory());
|
||||
|
||||
if (mode == ProjectExplorer::Constants::RUNMODE) {
|
||||
@@ -96,7 +99,7 @@ void QmlRunControl::start()
|
||||
|
||||
emit started();
|
||||
emit appendMessage(this, tr("Starting %1 %2").arg(QDir::toNativeSeparators(m_executable),
|
||||
m_commandLineArguments.join(QLatin1String(" "))), false);
|
||||
m_commandLineArguments), false);
|
||||
}
|
||||
|
||||
RunControl::StopResult QmlRunControl::stop()
|
||||
@@ -200,10 +203,11 @@ ProjectExplorer::RunControl *QmlRunControlFactory::createDebugRunControl(QmlProj
|
||||
params.qmlServerAddress = "127.0.0.1";
|
||||
params.qmlServerPort = runConfig->qmlDebugServerPort();
|
||||
params.processArgs = runConfig->viewerArguments();
|
||||
params.processArgs.append(QLatin1String("-qmljsdebugger=port:") + QString::number(runConfig->qmlDebugServerPort()));
|
||||
Utils::QtcProcess::addArg(¶ms.processArgs,
|
||||
QLatin1String("-qmljsdebugger=port:") + QString::number(runConfig->qmlDebugServerPort()));
|
||||
params.workingDirectory = runConfig->workingDirectory();
|
||||
if (Qt4ProjectManager::QtVersion *qtVersion = runConfig->qtVersion())
|
||||
params.environment = qtVersion->qmlToolsEnvironment().toStringList();
|
||||
params.environment = qtVersion->qmlToolsEnvironment();
|
||||
params.displayName = runConfig->displayName();
|
||||
|
||||
if (params.executable.isEmpty()) {
|
||||
|
@@ -61,7 +61,7 @@ private:
|
||||
ProjectExplorer::ApplicationLauncher m_applicationLauncher;
|
||||
|
||||
QString m_executable;
|
||||
QStringList m_commandLineArguments;
|
||||
QString m_commandLineArguments;
|
||||
};
|
||||
|
||||
class QmlRunControlFactory : public ProjectExplorer::IRunControlFactory {
|
||||
|
@@ -43,6 +43,7 @@
|
||||
#include <projectexplorer/gnumakeparser.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QFileInfo>
|
||||
@@ -113,7 +114,7 @@ QVariantMap MakeStep::toMap() const
|
||||
bool MakeStep::fromMap(const QVariantMap &map)
|
||||
{
|
||||
m_makeCmd = map.value(QLatin1String(MAKE_COMMAND_KEY)).toString();
|
||||
m_userArgs = map.value(QLatin1String(MAKE_ARGUMENTS_KEY)).toStringList();
|
||||
m_userArgs = map.value(QLatin1String(MAKE_ARGUMENTS_KEY)).toString();
|
||||
m_clean = map.value(QLatin1String(CLEAN_KEY)).toBool();
|
||||
|
||||
return ProjectExplorer::AbstractProcessStep::fromMap(map);
|
||||
@@ -150,22 +151,26 @@ bool MakeStep::init()
|
||||
// we should stop the clean queue
|
||||
// That is mostly so that rebuild works on a already clean project
|
||||
setIgnoreReturnValue(m_clean);
|
||||
QStringList args;
|
||||
|
||||
QString args;
|
||||
|
||||
ProjectExplorer::ToolChain *toolchain = bc->toolChain();
|
||||
|
||||
if (bc->subNodeBuild()){
|
||||
if(!bc->subNodeBuild()->makefile().isEmpty()) {
|
||||
args << "-f" << bc->subNodeBuild()->makefile();
|
||||
Utils::QtcProcess::addArg(&args, QLatin1String("-f"));
|
||||
Utils::QtcProcess::addArg(&args, bc->subNodeBuild()->makefile());
|
||||
}
|
||||
} else if (!bc->makefile().isEmpty()) {
|
||||
args << "-f" << bc->makefile();
|
||||
Utils::QtcProcess::addArg(&args, QLatin1String("-f"));
|
||||
Utils::QtcProcess::addArg(&args, bc->makefile());
|
||||
}
|
||||
|
||||
args.append(m_userArgs);
|
||||
Utils::QtcProcess::addArgs(&args, m_userArgs);
|
||||
|
||||
if (!m_clean) {
|
||||
if (!bc->defaultMakeTarget().isEmpty())
|
||||
args << bc->defaultMakeTarget();
|
||||
Utils::QtcProcess::addArg(&args, bc->defaultMakeTarget());
|
||||
}
|
||||
// -w option enables "Enter"/"Leaving directory" messages, which we need for detecting the
|
||||
// absolute file path
|
||||
@@ -177,7 +182,7 @@ bool MakeStep::init()
|
||||
if (toolchain->type() != ProjectExplorer::ToolChain_MSVC &&
|
||||
toolchain->type() != ProjectExplorer::ToolChain_WINCE) {
|
||||
if (m_makeCmd.isEmpty())
|
||||
args << "-w";
|
||||
Utils::QtcProcess::addArg(&args, QLatin1String("-w"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,12 +240,12 @@ ProjectExplorer::BuildStepConfigWidget *MakeStep::createConfigWidget()
|
||||
return new MakeStepConfigWidget(this);
|
||||
}
|
||||
|
||||
QStringList MakeStep::userArguments()
|
||||
QString MakeStep::userArguments()
|
||||
{
|
||||
return m_userArgs;
|
||||
}
|
||||
|
||||
void MakeStep::setUserArguments(const QStringList &arguments)
|
||||
void MakeStep::setUserArguments(const QString &arguments)
|
||||
{
|
||||
m_userArgs = arguments;
|
||||
emit userArgumentsChanged();
|
||||
@@ -314,16 +319,16 @@ void MakeStepConfigWidget::updateDetails()
|
||||
// FIXME doing this without the user having a way to override this is rather bad
|
||||
// so we only do it for unix and if the user didn't override the make command
|
||||
// but for now this is the least invasive change
|
||||
QStringList args = m_makeStep->userArguments();
|
||||
QString args = m_makeStep->userArguments();
|
||||
ProjectExplorer::ToolChainType t = ProjectExplorer::ToolChain_UNKNOWN;
|
||||
ProjectExplorer::ToolChain *toolChain = bc->toolChain();
|
||||
if (toolChain)
|
||||
t = toolChain->type();
|
||||
if (t != ProjectExplorer::ToolChain_MSVC && t != ProjectExplorer::ToolChain_WINCE) {
|
||||
if (m_makeStep->m_makeCmd.isEmpty())
|
||||
args << "-w";
|
||||
Utils::QtcProcess::addArg(&args, QLatin1String("-w"));
|
||||
}
|
||||
m_summaryText = tr("<b>Make:</b> %1 %2 in %3").arg(QFileInfo(makeCmd).fileName(), args.join(" "),
|
||||
m_summaryText = tr("<b>Make:</b> %1 %2 in %3").arg(QFileInfo(makeCmd).fileName(), args,
|
||||
QDir::toNativeSeparators(workingDirectory));
|
||||
emit updateSummary();
|
||||
}
|
||||
@@ -342,8 +347,7 @@ void MakeStepConfigWidget::userArgumentsChanged()
|
||||
{
|
||||
if (m_ignoreChange)
|
||||
return;
|
||||
const QStringList &makeArguments = m_makeStep->userArguments();
|
||||
m_ui->makeArgumentsLineEdit->setText(Utils::Environment::joinArgumentList(makeArguments));
|
||||
m_ui->makeArgumentsLineEdit->setText(m_makeStep->userArguments());
|
||||
updateDetails();
|
||||
}
|
||||
|
||||
@@ -354,8 +358,7 @@ void MakeStepConfigWidget::init()
|
||||
const QString &makeCmd = m_makeStep->m_makeCmd;
|
||||
m_ui->makePathChooser->setPath(makeCmd);
|
||||
|
||||
const QStringList &makeArguments = m_makeStep->userArguments();
|
||||
m_ui->makeArgumentsLineEdit->setText(Utils::Environment::joinArgumentList(makeArguments));
|
||||
m_ui->makeArgumentsLineEdit->setText(m_makeStep->userArguments());
|
||||
updateDetails();
|
||||
}
|
||||
|
||||
@@ -368,8 +371,7 @@ void MakeStepConfigWidget::makeEdited()
|
||||
void MakeStepConfigWidget::makeArgumentsLineEdited()
|
||||
{
|
||||
m_ignoreChange = true;
|
||||
m_makeStep->setUserArguments(
|
||||
Utils::Environment::parseCombinedArgString(m_ui->makeArgumentsLineEdit->text()));
|
||||
m_makeStep->setUserArguments(m_ui->makeArgumentsLineEdit->text());
|
||||
m_ignoreChange = false;
|
||||
updateDetails();
|
||||
}
|
||||
|
@@ -91,8 +91,8 @@ public:
|
||||
|
||||
virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
|
||||
virtual bool immutable() const;
|
||||
QStringList userArguments();
|
||||
void setUserArguments(const QStringList &arguments);
|
||||
QString userArguments();
|
||||
void setUserArguments(const QString &arguments);
|
||||
void setClean(bool clean);
|
||||
|
||||
QVariantMap toMap() const;
|
||||
@@ -108,7 +108,7 @@ protected:
|
||||
private:
|
||||
void ctor();
|
||||
bool m_clean;
|
||||
QStringList m_userArgs;
|
||||
QString m_userArgs;
|
||||
QString m_makeCmd;
|
||||
ProjectExplorer::GnuMakeParser * m_gnuMakeParser;
|
||||
};
|
||||
|
@@ -42,6 +42,7 @@
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QFile>
|
||||
@@ -100,29 +101,34 @@ Qt4BuildConfiguration *QMakeStep::qt4BuildConfiguration() const
|
||||
/// config arguemnts
|
||||
/// moreArguments
|
||||
/// user arguments
|
||||
QStringList QMakeStep::allArguments()
|
||||
QString QMakeStep::allArguments(bool shorted)
|
||||
{
|
||||
QStringList additonalArguments = m_userArgs;
|
||||
QString additonalArguments = m_userArgs;
|
||||
Qt4BuildConfiguration *bc = qt4BuildConfiguration();
|
||||
QStringList arguments;
|
||||
if (bc->subNodeBuild())
|
||||
arguments << QDir::toNativeSeparators(bc->subNodeBuild()->path());
|
||||
else if (shorted)
|
||||
arguments << QDir::toNativeSeparators(QFileInfo(
|
||||
buildConfiguration()->target()->project()->file()->fileName()).fileName());
|
||||
else
|
||||
arguments << QDir::toNativeSeparators(buildConfiguration()->target()->project()->file()->fileName());
|
||||
arguments << "-r";
|
||||
|
||||
if (!additonalArguments.contains("-spec"))
|
||||
arguments << "-spec" << bc->qtVersion()->mkspec();
|
||||
for (Utils::QtcProcess::ArgIterator ait(&additonalArguments); ait.next(); )
|
||||
if (ait.value() == QLatin1String("-spec"))
|
||||
goto haveSpec;
|
||||
arguments << "-spec" << bc->qtVersion()->mkspec();
|
||||
haveSpec:
|
||||
|
||||
// Find out what flags we pass on to qmake
|
||||
arguments << bc->configCommandLineArguments();
|
||||
|
||||
if (!additonalArguments.isEmpty())
|
||||
arguments << additonalArguments;
|
||||
|
||||
arguments << moreArguments();
|
||||
|
||||
return arguments;
|
||||
QString args = Utils::QtcProcess::joinArgs(arguments);
|
||||
Utils::QtcProcess::addArgs(&args, additonalArguments);
|
||||
return args;
|
||||
}
|
||||
|
||||
///
|
||||
@@ -164,7 +170,7 @@ bool QMakeStep::init()
|
||||
Qt4BuildConfiguration *qt4bc = qt4BuildConfiguration();
|
||||
const QtVersion *qtVersion = qt4bc->qtVersion();
|
||||
|
||||
QStringList args = allArguments();
|
||||
QString args = allArguments();
|
||||
QString workingDirectory;
|
||||
|
||||
if (qt4bc->subNodeBuild())
|
||||
@@ -286,7 +292,7 @@ bool QMakeStep::processSucceeded(int exitCode, QProcess::ExitStatus status)
|
||||
return result;
|
||||
}
|
||||
|
||||
void QMakeStep::setUserArguments(const QStringList &arguments)
|
||||
void QMakeStep::setUserArguments(const QString &arguments)
|
||||
{
|
||||
if (m_userArgs == arguments)
|
||||
return;
|
||||
@@ -301,14 +307,13 @@ void QMakeStep::setUserArguments(const QStringList &arguments)
|
||||
QStringList QMakeStep::parserArguments()
|
||||
{
|
||||
QStringList result;
|
||||
foreach (const QString &str, allArguments()) {
|
||||
if (str.contains("="))
|
||||
result << str;
|
||||
}
|
||||
for (Utils::QtcProcess::ConstArgIterator ait(allArguments()); ait.next(); )
|
||||
if (ait.value().contains(QLatin1Char('=')))
|
||||
result << ait.value();
|
||||
return result;
|
||||
}
|
||||
|
||||
QStringList QMakeStep::userArguments()
|
||||
QString QMakeStep::userArguments()
|
||||
{
|
||||
return m_userArgs;
|
||||
}
|
||||
@@ -322,7 +327,7 @@ QVariantMap QMakeStep::toMap() const
|
||||
|
||||
bool QMakeStep::fromMap(const QVariantMap &map)
|
||||
{
|
||||
m_userArgs = map.value(QLatin1String(QMAKE_ARGUMENTS_KEY)).toStringList();
|
||||
m_userArgs = map.value(QLatin1String(QMAKE_ARGUMENTS_KEY)).toString();
|
||||
|
||||
return BuildStep::fromMap(map);
|
||||
}
|
||||
@@ -349,8 +354,7 @@ QMakeStepConfigWidget::QMakeStepConfigWidget(QMakeStep *step)
|
||||
|
||||
void QMakeStepConfigWidget::init()
|
||||
{
|
||||
QString qmakeArgs = Utils::Environment::joinArgumentList(m_step->userArguments());
|
||||
m_ui.qmakeAdditonalArgumentsLineEdit->setText(qmakeArgs);
|
||||
m_ui.qmakeAdditonalArgumentsLineEdit->setText(m_step->userArguments());
|
||||
|
||||
qmakeBuildConfigChanged();
|
||||
|
||||
@@ -393,8 +397,7 @@ void QMakeStepConfigWidget::userArgumentsChanged()
|
||||
{
|
||||
if (m_ignoreChange)
|
||||
return;
|
||||
QString qmakeArgs = Utils::Environment::joinArgumentList(m_step->userArguments());
|
||||
m_ui.qmakeAdditonalArgumentsLineEdit->setText(qmakeArgs);
|
||||
m_ui.qmakeAdditonalArgumentsLineEdit->setText(m_step->userArguments());
|
||||
updateSummaryLabel();
|
||||
updateEffectiveQMakeCall();
|
||||
}
|
||||
@@ -402,8 +405,7 @@ void QMakeStepConfigWidget::userArgumentsChanged()
|
||||
void QMakeStepConfigWidget::qmakeArgumentsLineEdited()
|
||||
{
|
||||
m_ignoreChange = true;
|
||||
m_step->setUserArguments(
|
||||
Utils::Environment::parseCombinedArgString(m_ui.qmakeAdditonalArgumentsLineEdit->text()));
|
||||
m_step->setUserArguments(m_ui.qmakeAdditonalArgumentsLineEdit->text());
|
||||
m_ignoreChange = false;
|
||||
|
||||
updateSummaryLabel();
|
||||
@@ -446,16 +448,11 @@ void QMakeStepConfigWidget::updateSummaryLabel()
|
||||
return;
|
||||
}
|
||||
|
||||
QStringList args = m_step->allArguments();
|
||||
// We don't want the full path to the .pro file
|
||||
const QString projectFileName = m_step->buildConfiguration()->target()->project()->file()->fileName();
|
||||
int index = args.indexOf(projectFileName);
|
||||
if (index != -1)
|
||||
args[index] = QFileInfo(projectFileName).fileName();
|
||||
|
||||
QString args = m_step->allArguments(true);
|
||||
// And we only use the .pro filename not the full path
|
||||
QString program = QFileInfo(qtVersion->qmakeCommand()).fileName();
|
||||
m_summaryText = tr("<b>qmake:</b> %1 %2").arg(program, args.join(QString(QLatin1Char(' '))));
|
||||
m_summaryText = tr("<b>qmake:</b> %1 %2").arg(program, args);
|
||||
emit updateSummary();
|
||||
|
||||
}
|
||||
@@ -465,7 +462,7 @@ void QMakeStepConfigWidget::updateEffectiveQMakeCall()
|
||||
Qt4BuildConfiguration *qt4bc = m_step->qt4BuildConfiguration();
|
||||
const QtVersion *qtVersion = qt4bc->qtVersion();
|
||||
QString program = QFileInfo(qtVersion->qmakeCommand()).fileName();
|
||||
m_ui.qmakeArgumentsEdit->setPlainText(program + QLatin1Char(' ') + Utils::Environment::joinArgumentList(m_step->allArguments()));
|
||||
m_ui.qmakeArgumentsEdit->setPlainText(program + QLatin1Char(' ') + m_step->allArguments());
|
||||
}
|
||||
|
||||
////
|
||||
|
@@ -86,11 +86,11 @@ public:
|
||||
bool forced();
|
||||
|
||||
// TODO clean up those functions
|
||||
QStringList allArguments();
|
||||
QString allArguments(bool shorted = false);
|
||||
QStringList moreArguments();
|
||||
QStringList parserArguments();
|
||||
QStringList userArguments();
|
||||
void setUserArguments(const QStringList &arguments);
|
||||
QString userArguments();
|
||||
void setUserArguments(const QString &arguments);
|
||||
|
||||
QVariantMap toMap() const;
|
||||
|
||||
@@ -112,7 +112,7 @@ private:
|
||||
QStringList m_lastEnv;
|
||||
bool m_forced;
|
||||
bool m_needToRunQMake; // set in init(), read in run()
|
||||
QStringList m_userArgs;
|
||||
QString m_userArgs;
|
||||
bool m_scriptTemplate;
|
||||
QList<ProjectExplorer::Task> m_tasks;
|
||||
};
|
||||
|
@@ -270,7 +270,7 @@ void MaemoDebugSupport::startDebugging()
|
||||
const QString cmdPrefix = MaemoGlobal::remoteCommandPrefix(remoteExe);
|
||||
const QString env
|
||||
= environment(m_debuggingType, m_runner->userEnvChanges());
|
||||
const QString args = m_runner->arguments().join(QLatin1String(" "));
|
||||
const QString args = m_runner->arguments();
|
||||
const QString remoteCommandLine
|
||||
= m_debuggingType == MaemoRunConfiguration::DebugQmlOnly
|
||||
? QString::fromLocal8Bit("%1 %2 %3 %4").arg(cmdPrefix).arg(env)
|
||||
|
@@ -49,6 +49,7 @@
|
||||
#include <qt4projectmanager/qt4project.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
|
||||
#include <QtCore/QStringBuilder>
|
||||
|
||||
@@ -185,7 +186,7 @@ bool MaemoRunConfiguration::fromMap(const QVariantMap &map)
|
||||
if (!RunConfiguration::fromMap(map))
|
||||
return false;
|
||||
|
||||
m_arguments = map.value(ArgumentsKey).toStringList();
|
||||
m_arguments = map.value(ArgumentsKey).toString();
|
||||
const QDir dir = QDir(target()->project()->projectDirectory());
|
||||
m_proFilePath = dir.filePath(map.value(ProFileKey).toString());
|
||||
m_useRemoteGdb = map.value(UseRemoteGdbKey, DefaultUseRemoteGdbValue).toBool();
|
||||
@@ -262,7 +263,7 @@ const QString MaemoRunConfiguration::targetRoot() const
|
||||
return QString();
|
||||
}
|
||||
|
||||
const QStringList MaemoRunConfiguration::arguments() const
|
||||
const QString MaemoRunConfiguration::arguments() const
|
||||
{
|
||||
return m_arguments;
|
||||
}
|
||||
@@ -334,7 +335,7 @@ bool MaemoRunConfiguration::useRemoteGdb() const
|
||||
return m_useRemoteGdb && toolchain()->allowsRemoteMounts();
|
||||
}
|
||||
|
||||
void MaemoRunConfiguration::setArguments(const QStringList &args)
|
||||
void MaemoRunConfiguration::setArguments(const QString &args)
|
||||
{
|
||||
m_arguments = args;
|
||||
}
|
||||
|
@@ -92,8 +92,8 @@ public:
|
||||
QString remoteExecutableFilePath() const;
|
||||
const QString sysRoot() const;
|
||||
const QString targetRoot() const;
|
||||
const QStringList arguments() const;
|
||||
void setArguments(const QStringList &args);
|
||||
const QString arguments() const;
|
||||
void setArguments(const QString &args);
|
||||
MaemoDeviceConfig deviceConfig() const;
|
||||
MaemoPortList freePorts() const;
|
||||
bool useRemoteGdb() const;
|
||||
@@ -149,7 +149,7 @@ private:
|
||||
QString m_proFilePath;
|
||||
mutable QString m_gdbPath;
|
||||
MaemoRemoteMountsModel *m_remoteMounts;
|
||||
QStringList m_arguments;
|
||||
QString m_arguments;
|
||||
bool m_useRemoteGdb;
|
||||
|
||||
BaseEnvironmentBase m_baseEnvironmentBase;
|
||||
|
@@ -137,7 +137,7 @@ void MaemoRunConfigurationWidget::addGenericWidgets(QVBoxLayout *mainLayout)
|
||||
formLayout->addRow(tr("Executable on host:"), m_localExecutableLabel);
|
||||
m_remoteExecutableLabel = new QLabel;
|
||||
formLayout->addRow(tr("Executable on device:"), m_remoteExecutableLabel);
|
||||
m_argsLineEdit = new QLineEdit(m_runConfiguration->arguments().join(" "));
|
||||
m_argsLineEdit = new QLineEdit(m_runConfiguration->arguments());
|
||||
formLayout->addRow(tr("Arguments:"), m_argsLineEdit);
|
||||
|
||||
QHBoxLayout * const debugButtonsLayout = new QHBoxLayout;
|
||||
@@ -293,7 +293,7 @@ void MaemoRunConfigurationWidget::addEnvironmentWidgets(QVBoxLayout *mainLayout)
|
||||
|
||||
void MaemoRunConfigurationWidget::argumentsEdited(const QString &text)
|
||||
{
|
||||
m_runConfiguration->setArguments(text.split(' ', QString::SkipEmptyParts));
|
||||
m_runConfiguration->setArguments(text);
|
||||
}
|
||||
|
||||
void MaemoRunConfigurationWidget::updateTargetInformation()
|
||||
|
@@ -104,7 +104,7 @@ void MaemoRunControl::startExecution()
|
||||
.arg(MaemoGlobal::remoteCommandPrefix(m_runner->remoteExecutable()))
|
||||
.arg(MaemoGlobal::remoteEnvironment(m_runner->userEnvChanges()))
|
||||
.arg(m_runner->remoteExecutable())
|
||||
.arg(m_runner->arguments().join(QLatin1String(" "))).toUtf8());
|
||||
.arg(m_runner->arguments()).toUtf8());
|
||||
}
|
||||
|
||||
void MaemoRunControl::handleRemoteProcessFinished(qint64 exitCode)
|
||||
|
@@ -74,7 +74,7 @@ public:
|
||||
MaemoPortList *freePorts() { return &m_freePorts; }
|
||||
MaemoDeviceConfig deviceConfig() const { return m_devConfig; }
|
||||
QString remoteExecutable() const { return m_remoteExecutable; }
|
||||
QStringList arguments() const { return m_appArguments; }
|
||||
QString arguments() const { return m_appArguments; }
|
||||
QList<Utils::EnvironmentItem> userEnvChanges() const { return m_userEnvChanges; }
|
||||
|
||||
static const qint64 InvalidExitCode;
|
||||
@@ -118,7 +118,7 @@ private:
|
||||
MaemoUsedPortsGatherer * const m_portsGatherer;
|
||||
const MaemoDeviceConfig m_devConfig;
|
||||
const QString m_remoteExecutable;
|
||||
const QStringList m_appArguments;
|
||||
const QString m_appArguments;
|
||||
const QList<Utils::EnvironmentItem> m_userEnvChanges;
|
||||
const MaemoPortList m_initialFreePorts;
|
||||
QList<MaemoMountSpecification> m_mountSpecs;
|
||||
|
@@ -225,7 +225,7 @@ bool S60DeviceRunConfiguration::fromMap(const QVariantMap &map)
|
||||
const QDir projectDir = QDir(target()->project()->projectDirectory());
|
||||
|
||||
m_proFilePath = projectDir.filePath(map.value(QLatin1String(PRO_FILE_KEY)).toString());
|
||||
m_commandLineArguments = map.value(QLatin1String(COMMAND_LINE_ARGUMENTS_KEY)).toStringList();
|
||||
m_commandLineArguments = map.value(QLatin1String(COMMAND_LINE_ARGUMENTS_KEY)).toString();
|
||||
|
||||
if (m_proFilePath.isEmpty())
|
||||
return false;
|
||||
@@ -368,12 +368,12 @@ QString S60DeviceRunConfiguration::projectFilePath() const
|
||||
return m_proFilePath;
|
||||
}
|
||||
|
||||
QStringList S60DeviceRunConfiguration::commandLineArguments() const
|
||||
QString S60DeviceRunConfiguration::commandLineArguments() const
|
||||
{
|
||||
return m_commandLineArguments;
|
||||
}
|
||||
|
||||
void S60DeviceRunConfiguration::setCommandLineArguments(const QStringList &args)
|
||||
void S60DeviceRunConfiguration::setCommandLineArguments(const QString &args)
|
||||
{
|
||||
m_commandLineArguments = args;
|
||||
}
|
||||
|
@@ -77,8 +77,8 @@ public:
|
||||
|
||||
ProjectExplorer::OutputFormatter *createOutputFormatter() const;
|
||||
|
||||
QStringList commandLineArguments() const;
|
||||
void setCommandLineArguments(const QStringList &args);
|
||||
QString commandLineArguments() const;
|
||||
void setCommandLineArguments(const QString &args);
|
||||
|
||||
QString projectFilePath() const;
|
||||
|
||||
@@ -112,7 +112,7 @@ private:
|
||||
void handleParserState(bool sucess);
|
||||
|
||||
QString m_proFilePath;
|
||||
QStringList m_commandLineArguments;
|
||||
QString m_commandLineArguments;
|
||||
bool m_validParse;
|
||||
};
|
||||
|
||||
@@ -184,7 +184,7 @@ private:
|
||||
QString m_serialPortName;
|
||||
QString m_serialPortFriendlyName;
|
||||
QString m_targetName;
|
||||
QStringList m_commandLineArguments;
|
||||
QString m_commandLineArguments;
|
||||
QString m_executableFileName;
|
||||
QString m_qtDir;
|
||||
QString m_qtBinPath;
|
||||
|
@@ -46,7 +46,7 @@ S60DeviceRunConfigurationWidget::S60DeviceRunConfigurationWidget(
|
||||
: QWidget(parent),
|
||||
m_runConfiguration(runConfiguration),
|
||||
m_detailsWidget(new Utils::DetailsWidget),
|
||||
m_argumentsLineEdit(new QLineEdit(m_runConfiguration->commandLineArguments().join(QString(QLatin1Char(' ')))))
|
||||
m_argumentsLineEdit(new QLineEdit(m_runConfiguration->commandLineArguments()))
|
||||
{
|
||||
m_detailsWidget->setState(Utils::DetailsWidget::NoSummary);
|
||||
QVBoxLayout *mainBoxLayout = new QVBoxLayout();
|
||||
@@ -76,13 +76,7 @@ S60DeviceRunConfigurationWidget::S60DeviceRunConfigurationWidget(
|
||||
|
||||
void S60DeviceRunConfigurationWidget::argumentsEdited(const QString &text)
|
||||
{
|
||||
const QString trimmed = text.trimmed();
|
||||
if (trimmed.isEmpty()) {
|
||||
m_runConfiguration->setCommandLineArguments(QStringList());
|
||||
} else {
|
||||
m_runConfiguration->setCommandLineArguments(trimmed.split(QLatin1Char(' '),
|
||||
QString::SkipEmptyParts));
|
||||
}
|
||||
m_runConfiguration->setCommandLineArguments(text.trimmed());
|
||||
}
|
||||
|
||||
void S60DeviceRunConfigurationWidget::runConfigurationEnabledChange(bool enabled)
|
||||
|
@@ -327,7 +327,7 @@ S60EmulatorRunControl::S60EmulatorRunControl(S60EmulatorRunConfiguration *runCon
|
||||
// stuff like the EPOCROOT and EPOCDEVICE env variable
|
||||
Utils::Environment env = Utils::Environment::systemEnvironment();
|
||||
runConfiguration->qt4Target()->activeBuildConfiguration()->toolChain()->addToEnvironment(env);
|
||||
m_applicationLauncher.setEnvironment(env.toStringList());
|
||||
m_applicationLauncher.setEnvironment(env);
|
||||
|
||||
m_executable = runConfiguration->executable();
|
||||
connect(&m_applicationLauncher, SIGNAL(applicationError(QString)),
|
||||
@@ -342,7 +342,7 @@ S60EmulatorRunControl::S60EmulatorRunControl(S60EmulatorRunConfiguration *runCon
|
||||
|
||||
void S60EmulatorRunControl::start()
|
||||
{
|
||||
m_applicationLauncher.start(ApplicationLauncher::Gui, m_executable, QStringList());
|
||||
m_applicationLauncher.start(ApplicationLauncher::Gui, m_executable, QString());
|
||||
emit started();
|
||||
|
||||
emit appendMessage(this, tr("Starting %1...").arg(QDir::toNativeSeparators(m_executable)), false);
|
||||
|
@@ -37,6 +37,7 @@
|
||||
#include "makestep.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
#include <limits>
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
@@ -494,7 +495,7 @@ bool Qt4BuildConfiguration::compareToImportFrom(const QString &makefile)
|
||||
QtVersion *version = qtVersion();
|
||||
if (version->qmakeCommand() == qmakePath) {
|
||||
// same qtversion
|
||||
QPair<QtVersion::QmakeBuildConfigs, QStringList> result =
|
||||
QPair<QtVersion::QmakeBuildConfigs, QString> result =
|
||||
QtVersionManager::scanMakeFile(makefile, version->defaultBuildConfig());
|
||||
if (qmakeBuildConfiguration() == result.first) {
|
||||
// The qmake Build Configuration are the same,
|
||||
@@ -502,18 +503,18 @@ bool Qt4BuildConfiguration::compareToImportFrom(const QString &makefile)
|
||||
// we have to compare without the spec/platform cmd argument
|
||||
// and compare that on its own
|
||||
QString workingDirectory = QFileInfo(makefile).absolutePath();
|
||||
QString actualSpec = extractSpecFromArgumentList(qs->userArguments(), workingDirectory, version);
|
||||
QString userArgs = qs->userArguments();
|
||||
QStringList actualArgs;
|
||||
QString actualSpec = extractSpecFromArguments(&userArgs, workingDirectory, version, &actualArgs);
|
||||
if (actualSpec.isEmpty()) {
|
||||
// Easy one: the user has chosen not to override the settings
|
||||
actualSpec = version->mkspec();
|
||||
}
|
||||
actualArgs += qs->moreArguments();
|
||||
|
||||
|
||||
QString parsedSpec = extractSpecFromArgumentList(result.second, workingDirectory, version);
|
||||
QStringList actualArgs = qs->moreArguments();
|
||||
actualArgs << qs->userArguments();
|
||||
actualArgs = removeSpecFromArgumentList(actualArgs);
|
||||
QStringList parsedArgs = removeSpecFromArgumentList(result.second);
|
||||
QString qmakeArgs = result.second;
|
||||
QStringList parsedArgs;
|
||||
QString parsedSpec = extractSpecFromArguments(&qmakeArgs, workingDirectory, version, &parsedArgs);
|
||||
|
||||
if (debug) {
|
||||
qDebug()<<"Actual args:"<<actualArgs;
|
||||
@@ -558,59 +559,53 @@ bool Qt4BuildConfiguration::compareToImportFrom(const QString &makefile)
|
||||
return false;
|
||||
}
|
||||
|
||||
QStringList Qt4BuildConfiguration::removeQMLInspectorFromArgumentList(const QStringList &old)
|
||||
void Qt4BuildConfiguration::removeQMLInspectorFromArguments(QString *args)
|
||||
{
|
||||
QStringList result;
|
||||
foreach (const QString &str, old)
|
||||
if (!str.startsWith(QLatin1String(Constants::QMAKEVAR_QMLJSDEBUGGER_PATH)))
|
||||
result << str;
|
||||
return result;
|
||||
for (Utils::QtcProcess::ArgIterator ait(args); ait.next(); )
|
||||
if (ait.value().startsWith(QLatin1String(Constants::QMAKEVAR_QMLJSDEBUGGER_PATH)))
|
||||
ait.deleteArg();
|
||||
}
|
||||
|
||||
// We match -spec and -platfrom separetly
|
||||
// We ignore -cache, because qmake contained a bug that it didn't
|
||||
// mention the -cache in the Makefile
|
||||
// That means changing the -cache option in the additional arguments
|
||||
// does not automatically rerun qmake. Alas, we could try more
|
||||
// intelligent matching for -cache, but i guess people rarely
|
||||
// do use that.
|
||||
|
||||
QStringList Qt4BuildConfiguration::removeSpecFromArgumentList(const QStringList &old)
|
||||
QString Qt4BuildConfiguration::extractSpecFromArguments(QString *args,
|
||||
const QString &directory, const QtVersion *version,
|
||||
QStringList *outArgs)
|
||||
{
|
||||
if (!old.contains("-spec") && !old.contains("-platform") && !old.contains("-cache"))
|
||||
return old;
|
||||
QStringList newList;
|
||||
QString parsedSpec;
|
||||
|
||||
bool ignoreNext = false;
|
||||
foreach(const QString &item, old) {
|
||||
bool nextIsSpec = false;
|
||||
for (Utils::QtcProcess::ArgIterator ait(args); ait.next(); ) {
|
||||
if (ignoreNext) {
|
||||
ignoreNext = false;
|
||||
} else if (item == "-spec" || item == "-platform" || item == "-cache") {
|
||||
ait.deleteArg();
|
||||
} else if (nextIsSpec) {
|
||||
nextIsSpec = false;
|
||||
parsedSpec = QDir::cleanPath(ait.value());
|
||||
ait.deleteArg();
|
||||
} else if (ait.value() == QLatin1String("-spec") || ait.value() == QLatin1String("-platform")) {
|
||||
nextIsSpec = true;
|
||||
ait.deleteArg();
|
||||
} else if (ait.value() == QLatin1String("-cache")) {
|
||||
// We ignore -cache, because qmake contained a bug that it didn't
|
||||
// mention the -cache in the Makefile.
|
||||
// That means changing the -cache option in the additional arguments
|
||||
// does not automatically rerun qmake. Alas, we could try more
|
||||
// intelligent matching for -cache, but i guess people rarely
|
||||
// do use that.
|
||||
ignoreNext = true;
|
||||
} else {
|
||||
newList << item;
|
||||
ait.deleteArg();
|
||||
} else if (outArgs && ait.isSimple()) {
|
||||
outArgs->append(ait.value());
|
||||
}
|
||||
}
|
||||
return newList;
|
||||
}
|
||||
|
||||
QString Qt4BuildConfiguration::extractSpecFromArgumentList(const QStringList &list, QString directory, QtVersion *version)
|
||||
{
|
||||
int index = list.indexOf("-spec");
|
||||
if (index == -1)
|
||||
index = list.indexOf("-platform");
|
||||
if (index == -1)
|
||||
return QString();
|
||||
|
||||
++index;
|
||||
|
||||
if (index >= list.length())
|
||||
if (parsedSpec.isEmpty())
|
||||
return QString();
|
||||
|
||||
QString baseMkspecDir = version->versionInfo().value("QMAKE_MKSPECS");
|
||||
if (baseMkspecDir.isEmpty())
|
||||
baseMkspecDir = version->versionInfo().value("QT_INSTALL_DATA") + "/mkspecs";
|
||||
|
||||
QString parsedSpec = QDir::cleanPath(list.at(index));
|
||||
#ifdef Q_OS_WIN
|
||||
baseMkspecDir = baseMkspecDir.toLower();
|
||||
parsedSpec = parsedSpec.toLower();
|
||||
@@ -753,12 +748,12 @@ BuildConfiguration *Qt4BuildConfigurationFactory::create(ProjectExplorer::Target
|
||||
qt4Target->addQt4BuildConfiguration(tr("%1 Debug").arg(buildConfigurationName),
|
||||
version,
|
||||
(version->defaultBuildConfig() | QtVersion::DebugBuild),
|
||||
QStringList(), QString());
|
||||
QString(), QString());
|
||||
BuildConfiguration *bc =
|
||||
qt4Target->addQt4BuildConfiguration(tr("%1 Release").arg(buildConfigurationName),
|
||||
version,
|
||||
(version->defaultBuildConfig() & ~QtVersion::DebugBuild),
|
||||
QStringList(), QString());
|
||||
QString(), QString());
|
||||
return bc;
|
||||
}
|
||||
|
||||
|
@@ -109,9 +109,10 @@ public:
|
||||
QString makefile() const;
|
||||
|
||||
bool compareToImportFrom(const QString &makefile);
|
||||
static QStringList removeQMLInspectorFromArgumentList(const QStringList &old);
|
||||
static QStringList removeSpecFromArgumentList(const QStringList &old);
|
||||
static QString extractSpecFromArgumentList(const QStringList &list, QString directory, QtVersion *version);
|
||||
static void removeQMLInspectorFromArguments(QString *args);
|
||||
static QString extractSpecFromArguments(QString *arguments,
|
||||
const QString &directory, const QtVersion *version,
|
||||
QStringList *outArgs = 0);
|
||||
|
||||
QVariantMap toMap() const;
|
||||
|
||||
|
@@ -43,6 +43,7 @@
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
#include <QtGui/QFileDialog>
|
||||
@@ -416,20 +417,22 @@ void Qt4ProjectConfigWidget::importLabelClicked()
|
||||
vm->addVersion(version);
|
||||
}
|
||||
|
||||
QPair<QtVersion::QmakeBuildConfigs, QStringList> result =
|
||||
QPair<QtVersion::QmakeBuildConfigs, QString> result =
|
||||
QtVersionManager::scanMakeFile(directory, version->defaultBuildConfig());
|
||||
QtVersion::QmakeBuildConfigs qmakeBuildConfig = result.first;
|
||||
QStringList additionalArguments = Qt4BuildConfiguration::removeSpecFromArgumentList(result.second);
|
||||
QString parsedSpec = Qt4BuildConfiguration::extractSpecFromArgumentList(result.second, directory, version);
|
||||
|
||||
QString aa = result.second;
|
||||
QString parsedSpec = Qt4BuildConfiguration::extractSpecFromArguments(&aa, directory, version);
|
||||
QString versionSpec = version->mkspec();
|
||||
QString additionalArguments;
|
||||
if (parsedSpec.isEmpty() || parsedSpec == versionSpec || parsedSpec == "default") {
|
||||
// using the default spec, don't modify additional arguments
|
||||
} else {
|
||||
additionalArguments.prepend(parsedSpec);
|
||||
additionalArguments.prepend("-spec");
|
||||
additionalArguments = "-spec " + Utils::QtcProcess::quoteArg(parsedSpec);
|
||||
}
|
||||
Utils::QtcProcess::addArgs(&additionalArguments, aa);
|
||||
|
||||
additionalArguments = Qt4BuildConfiguration::removeQMLInspectorFromArgumentList(additionalArguments);
|
||||
Qt4BuildConfiguration::removeQMLInspectorFromArguments(&additionalArguments);
|
||||
|
||||
// So we got all the information now apply it...
|
||||
m_buildConfiguration->setQtVersion(version);
|
||||
@@ -443,16 +446,25 @@ void Qt4ProjectConfigWidget::importLabelClicked()
|
||||
// If we are switching to BuildAll we want "release" in there and no "debug"
|
||||
// or "debug" in there and no "release"
|
||||
// If we are switching to not BuildAl we want neither "release" nor "debug" in there
|
||||
QStringList makeCmdArguments = makeStep->userArguments();
|
||||
bool debug = qmakeBuildConfig & QtVersion::DebugBuild;
|
||||
if (qmakeBuildConfig & QtVersion::BuildAll) {
|
||||
makeCmdArguments.removeAll(debug ? "release" : "debug");
|
||||
if (!makeCmdArguments.contains(debug ? "debug" : "release"))
|
||||
makeCmdArguments.append(debug ? "debug" : "release");
|
||||
} else {
|
||||
makeCmdArguments.removeAll("debug");
|
||||
makeCmdArguments.removeAll("release");
|
||||
bool haveTag = !(qmakeBuildConfig & QtVersion::BuildAll);
|
||||
QString makeCmdArguments = makeStep->userArguments();
|
||||
Utils::QtcProcess::ArgIterator ait(&makeCmdArguments);
|
||||
while (ait.next()) {
|
||||
if (ait.value() == QLatin1String("debug")) {
|
||||
if (!haveTag && debug)
|
||||
haveTag = true;
|
||||
else
|
||||
ait.deleteArg();
|
||||
} else if (ait.value() == QLatin1String("release")) {
|
||||
if (!haveTag && !debug)
|
||||
haveTag = true;
|
||||
else
|
||||
ait.deleteArg();
|
||||
}
|
||||
}
|
||||
if (!haveTag)
|
||||
ait.appendArg(QLatin1String(debug ? "debug" : "release"));
|
||||
makeStep->setUserArguments(makeCmdArguments);
|
||||
}
|
||||
}
|
||||
|
@@ -47,6 +47,7 @@
|
||||
#include <projectexplorer/environmenteditmodel.h>
|
||||
#include <projectexplorer/persistentsettings.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
#include <utils/pathchooser.h>
|
||||
#include <utils/detailswidget.h>
|
||||
#include <utils/debuggerlanguagechooser.h>
|
||||
@@ -220,7 +221,7 @@ Qt4RunConfigurationWidget::Qt4RunConfigurationWidget(Qt4RunConfiguration *qt4Run
|
||||
toplayout->addRow(tr("Executable:"), m_executableLineEdit);
|
||||
|
||||
QLabel *argumentsLabel = new QLabel(tr("Arguments:"), this);
|
||||
m_argumentsLineEdit = new QLineEdit(Utils::Environment::joinArgumentList(qt4RunConfiguration->baseCommandLineArguments()), this);
|
||||
m_argumentsLineEdit = new QLineEdit(qt4RunConfiguration->commandLineArguments(), this);
|
||||
argumentsLabel->setBuddy(m_argumentsLineEdit);
|
||||
toplayout->addRow(argumentsLabel, m_argumentsLineEdit);
|
||||
|
||||
@@ -326,7 +327,7 @@ Qt4RunConfigurationWidget::Qt4RunConfigurationWidget(Qt4RunConfiguration *qt4Run
|
||||
connect(qt4RunConfiguration, SIGNAL(baseWorkingDirectoryChanged(QString)),
|
||||
this, SLOT(workingDirectoryChanged(QString)));
|
||||
|
||||
connect(qt4RunConfiguration, SIGNAL(baseCommandLineArgumentsChanged(QString)),
|
||||
connect(qt4RunConfiguration, SIGNAL(commandLineArgumentsChanged(QString)),
|
||||
this, SLOT(commandLineArgumentsChanged(QString)));
|
||||
connect(qt4RunConfiguration, SIGNAL(runModeChanged(ProjectExplorer::LocalApplicationRunConfiguration::RunMode)),
|
||||
this, SLOT(runModeChanged(ProjectExplorer::LocalApplicationRunConfiguration::RunMode)));
|
||||
@@ -424,7 +425,7 @@ void Qt4RunConfigurationWidget::workingDirectoryReseted()
|
||||
void Qt4RunConfigurationWidget::argumentsEdited(const QString &args)
|
||||
{
|
||||
m_ignoreChange = true;
|
||||
m_qt4RunConfiguration->setBaseCommandLineArguments(args);
|
||||
m_qt4RunConfiguration->setCommandLineArguments(args);
|
||||
m_ignoreChange = false;
|
||||
}
|
||||
|
||||
@@ -514,7 +515,7 @@ QVariantMap Qt4RunConfiguration::toMap() const
|
||||
bool Qt4RunConfiguration::fromMap(const QVariantMap &map)
|
||||
{
|
||||
const QDir projectDir = QDir(target()->project()->projectDirectory());
|
||||
m_commandLineArguments = map.value(QLatin1String(COMMAND_LINE_ARGUMENTS_KEY)).toStringList();
|
||||
m_commandLineArguments = map.value(QLatin1String(COMMAND_LINE_ARGUMENTS_KEY)).toString();
|
||||
m_proFilePath = projectDir.filePath(map.value(QLatin1String(PRO_FILE_KEY)).toString());
|
||||
m_runMode = map.value(QLatin1String(USE_TERMINAL_KEY), false).toBool() ? Console : Gui;
|
||||
m_isUsingDyldImageSuffix = map.value(QLatin1String(USE_DYLD_IMAGE_SUFFIX_KEY), false).toBool();
|
||||
@@ -573,12 +574,7 @@ QString Qt4RunConfiguration::baseWorkingDirectory() const
|
||||
return ti.workingDir;
|
||||
}
|
||||
|
||||
QStringList Qt4RunConfiguration::commandLineArguments() const
|
||||
{
|
||||
return environment().expandVariables(baseCommandLineArguments());
|
||||
}
|
||||
|
||||
QStringList Qt4RunConfiguration::baseCommandLineArguments() const
|
||||
QString Qt4RunConfiguration::commandLineArguments() const
|
||||
{
|
||||
return m_commandLineArguments;
|
||||
}
|
||||
@@ -651,10 +647,10 @@ void Qt4RunConfiguration::setBaseWorkingDirectory(const QString &wd)
|
||||
emit baseWorkingDirectoryChanged(newWorkingDirectory);
|
||||
}
|
||||
|
||||
void Qt4RunConfiguration::setBaseCommandLineArguments(const QString &argumentsString)
|
||||
void Qt4RunConfiguration::setCommandLineArguments(const QString &argumentsString)
|
||||
{
|
||||
m_commandLineArguments = Utils::Environment::parseCombinedArgString(argumentsString);
|
||||
emit baseCommandLineArgumentsChanged(argumentsString);
|
||||
m_commandLineArguments = argumentsString;
|
||||
emit commandLineArgumentsChanged(argumentsString);
|
||||
}
|
||||
|
||||
void Qt4RunConfiguration::setRunMode(RunMode runMode)
|
||||
|
@@ -84,7 +84,7 @@ public:
|
||||
virtual QString executable() const;
|
||||
virtual RunMode runMode() const;
|
||||
virtual QString workingDirectory() const;
|
||||
virtual QStringList commandLineArguments() const;
|
||||
virtual QString commandLineArguments() const;
|
||||
virtual Utils::Environment environment() const;
|
||||
virtual QString dumperLibrary() const;
|
||||
virtual QStringList dumperLibraryLocations() const;
|
||||
@@ -101,7 +101,7 @@ public:
|
||||
ProjectExplorer::OutputFormatter *createOutputFormatter() const;
|
||||
|
||||
signals:
|
||||
void baseCommandLineArgumentsChanged(const QString&);
|
||||
void commandLineArgumentsChanged(const QString&);
|
||||
void baseWorkingDirectoryChanged(const QString&);
|
||||
void runModeChanged(ProjectExplorer::LocalApplicationRunConfiguration::RunMode runMode);
|
||||
void usingDyldImageSuffixChanged(bool);
|
||||
@@ -124,8 +124,7 @@ private:
|
||||
void setRunMode(RunMode runMode);
|
||||
void setBaseWorkingDirectory(const QString &workingDirectory);
|
||||
QString baseWorkingDirectory() const;
|
||||
void setBaseCommandLineArguments(const QString &argumentsString);
|
||||
QStringList baseCommandLineArguments() const;
|
||||
void setCommandLineArguments(const QString &argumentsString);
|
||||
enum BaseEnvironmentBase { CleanEnvironmentBase = 0,
|
||||
SystemEnvironmentBase = 1,
|
||||
BuildEnvironmentBase = 2 };
|
||||
@@ -141,7 +140,7 @@ private:
|
||||
QList<Utils::EnvironmentItem> userEnvironmentChanges() const;
|
||||
|
||||
void updateTarget();
|
||||
QStringList m_commandLineArguments;
|
||||
QString m_commandLineArguments;
|
||||
QString m_proFilePath; // Full path to the Application Pro File
|
||||
|
||||
// Cached startup sub project information
|
||||
|
@@ -274,7 +274,7 @@ Qt4Project *Qt4Target::qt4Project() const
|
||||
|
||||
Qt4BuildConfiguration *Qt4Target::addQt4BuildConfiguration(QString displayName, QtVersion *qtversion,
|
||||
QtVersion::QmakeBuildConfigs qmakeBuildConfiguration,
|
||||
QStringList additionalArguments,
|
||||
QString additionalArguments,
|
||||
QString directory)
|
||||
{
|
||||
Q_ASSERT(qtversion);
|
||||
@@ -297,14 +297,14 @@ Qt4BuildConfiguration *Qt4Target::addQt4BuildConfiguration(QString displayName,
|
||||
|
||||
MakeStep* cleanStep = new MakeStep(cleanSteps);
|
||||
cleanStep->setClean(true);
|
||||
cleanStep->setUserArguments(QStringList() << "clean");
|
||||
cleanStep->setUserArguments("clean");
|
||||
cleanSteps->insertStep(0, cleanStep);
|
||||
if (!additionalArguments.isEmpty())
|
||||
qmakeStep->setUserArguments(additionalArguments);
|
||||
|
||||
// set some options for qmake and make
|
||||
if (qmakeBuildConfiguration & QtVersion::BuildAll) // debug_and_release => explicit targets
|
||||
makeStep->setUserArguments(QStringList() << (debug ? "debug" : "release"));
|
||||
makeStep->setUserArguments(debug ? "debug" : "release");
|
||||
|
||||
bc->setQMakeBuildConfiguration(qmakeBuildConfiguration);
|
||||
|
||||
|
@@ -47,12 +47,12 @@ class Qt4DeployConfigurationFactory;
|
||||
|
||||
struct BuildConfigurationInfo {
|
||||
explicit BuildConfigurationInfo(QtVersion *v = 0, QtVersion::QmakeBuildConfigs bc = QtVersion::QmakeBuildConfig(0),
|
||||
const QStringList &aa = QStringList(), const QString &d = QString()) :
|
||||
const QString &aa = QString(), const QString &d = QString()) :
|
||||
version(v), buildConfig(bc), additionalArguments(aa), directory(d)
|
||||
{ }
|
||||
QtVersion *version;
|
||||
QtVersion::QmakeBuildConfigs buildConfig;
|
||||
QStringList additionalArguments;
|
||||
QString additionalArguments;
|
||||
QString directory;
|
||||
};
|
||||
|
||||
@@ -71,7 +71,7 @@ public:
|
||||
Internal::Qt4BuildConfiguration *addQt4BuildConfiguration(QString displayName,
|
||||
QtVersion *qtversion,
|
||||
QtVersion::QmakeBuildConfigs qmakeBuildConfiguration,
|
||||
QStringList additionalArguments,
|
||||
QString additionalArguments,
|
||||
QString directory);
|
||||
void addRunConfigurationForPath(const QString &proFilePath);
|
||||
|
||||
|
@@ -49,6 +49,7 @@
|
||||
#include <coreplugin/helpmanager.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
#ifdef Q_OS_WIN
|
||||
# include <utils/winutils.h>
|
||||
#endif
|
||||
@@ -884,25 +885,21 @@ bool QtVersionManager::makefileIsFor(const QString &makefile, const QString &pro
|
||||
return srcFileInfo == proFileInfo;
|
||||
}
|
||||
|
||||
QPair<QtVersion::QmakeBuildConfigs, QStringList> QtVersionManager::scanMakeFile(const QString &makefile, QtVersion::QmakeBuildConfigs defaultBuildConfig)
|
||||
QPair<QtVersion::QmakeBuildConfigs, QString> QtVersionManager::scanMakeFile(const QString &makefile, QtVersion::QmakeBuildConfigs defaultBuildConfig)
|
||||
{
|
||||
if (debug)
|
||||
qDebug()<<"ScanMakeFile, the gory details:";
|
||||
QtVersion::QmakeBuildConfigs result = defaultBuildConfig;
|
||||
QStringList result2;
|
||||
QString result2;
|
||||
|
||||
QString line = findQMakeLine(makefile, QLatin1String("# Command:"));
|
||||
if (!line.isEmpty()) {
|
||||
if (debug)
|
||||
qDebug()<<"Found line"<<line;
|
||||
line = trimLine(line);
|
||||
QStringList parts = splitLine(line);
|
||||
if (debug)
|
||||
qDebug()<<"Split into"<<parts;
|
||||
QList<QMakeAssignment> assignments;
|
||||
QList<QMakeAssignment> afterAssignments;
|
||||
QStringList additionalArguments;
|
||||
parseParts(parts, &assignments, &afterAssignments, &additionalArguments);
|
||||
parseArgs(line, &assignments, &afterAssignments, &result2);
|
||||
|
||||
if (debug) {
|
||||
dumpQMakeAssignments(assignments);
|
||||
@@ -918,13 +915,12 @@ QPair<QtVersion::QmakeBuildConfigs, QStringList> QtVersionManager::scanMakeFile(
|
||||
if (debug)
|
||||
dumpQMakeAssignments(assignments);
|
||||
|
||||
result2.append(additionalArguments);
|
||||
foreach(const QMakeAssignment &qa, assignments)
|
||||
result2.append(qa.variable + qa.op + qa.value);
|
||||
Utils::QtcProcess::addArg(&result2, qa.variable + qa.op + qa.value);
|
||||
if (!afterAssignments.isEmpty()) {
|
||||
result2.append("-after");
|
||||
Utils::QtcProcess::addArg(&result2, QLatin1String("-after"));
|
||||
foreach(const QMakeAssignment &qa, afterAssignments)
|
||||
result2.append(qa.variable + qa.op + qa.value);
|
||||
Utils::QtcProcess::addArg(&result2, qa.variable + qa.op + qa.value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -965,55 +961,23 @@ QString QtVersionManager::trimLine(const QString line)
|
||||
return line.mid(firstSpace).trimmed();
|
||||
}
|
||||
|
||||
QStringList QtVersionManager::splitLine(const QString &line)
|
||||
{
|
||||
// Split on each " ", except on those which are escaped
|
||||
// On Unix also remove all escaping
|
||||
// On Windows also, but different escaping
|
||||
bool escape = false;
|
||||
QString currentWord;
|
||||
QStringList results;
|
||||
int length = line.length();
|
||||
for (int i=0; i<length; ++i) {
|
||||
#ifdef Q_OS_WIN
|
||||
if (line.at(i) == '"') {
|
||||
escape = !escape;
|
||||
} else if (escape || line.at(i) != ' ') {
|
||||
currentWord += line.at(i);
|
||||
} else {
|
||||
results << currentWord;
|
||||
currentWord.clear();;
|
||||
}
|
||||
#else
|
||||
if (escape) {
|
||||
currentWord += line.at(i);
|
||||
escape = false;
|
||||
} else if (line.at(i) == ' ') {
|
||||
results << currentWord;
|
||||
currentWord.clear();
|
||||
} else if (line.at(i) == '\\') {
|
||||
escape = true;
|
||||
} else {
|
||||
currentWord += line.at(i);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
void QtVersionManager::parseParts(const QStringList &parts, QList<QMakeAssignment> *assignments, QList<QMakeAssignment> *afterAssignments, QStringList *additionalArguments)
|
||||
void QtVersionManager::parseArgs(const QString &args, QList<QMakeAssignment> *assignments, QList<QMakeAssignment> *afterAssignments, QString *additionalArguments)
|
||||
{
|
||||
QRegExp regExp("([^\\s\\+-]*)\\s*(\\+=|=|-=|~=)(.*)");
|
||||
bool after = false;
|
||||
bool ignoreNext = false;
|
||||
foreach (const QString &part, parts) {
|
||||
*additionalArguments = args;
|
||||
Utils::QtcProcess::ArgIterator ait(additionalArguments);
|
||||
while (ait.next()) {
|
||||
if (ignoreNext) {
|
||||
// Ignoring
|
||||
ignoreNext = false;
|
||||
} else if (part == "-after") {
|
||||
ait.deleteArg();
|
||||
} else if (ait.value() == QLatin1String("-after")) {
|
||||
after = true;
|
||||
} else if(part.contains('=')) {
|
||||
if (regExp.exactMatch(part)) {
|
||||
ait.deleteArg();
|
||||
} else if (ait.value().contains(QLatin1Char('='))) {
|
||||
if (regExp.exactMatch(ait.value())) {
|
||||
QMakeAssignment qa;
|
||||
qa.variable = regExp.cap(1);
|
||||
qa.op = regExp.cap(2);
|
||||
@@ -1025,21 +989,23 @@ void QtVersionManager::parseParts(const QStringList &parts, QList<QMakeAssignmen
|
||||
} else {
|
||||
qDebug()<<"regexp did not match";
|
||||
}
|
||||
} else if (part == "-o") {
|
||||
ait.deleteArg();
|
||||
} else if (ait.value() == QLatin1String("-o")) {
|
||||
ignoreNext = true;
|
||||
} else {
|
||||
additionalArguments->append(part);
|
||||
ait.deleteArg();
|
||||
#if defined(Q_OS_WIN32)
|
||||
} else if (ait.value() == QLatin1String("-win32")) {
|
||||
#elif defined(Q_OS_MAC)
|
||||
} else if (ait.value() == QLatin1String("-macx")) {
|
||||
#elif defined(Q_OS_QNX6)
|
||||
} else if (ait.value() == QLatin1String("-qnx6")) {
|
||||
#else
|
||||
} else if (ait.value() == QLatin1String("-unix")) {
|
||||
#endif
|
||||
ait.deleteArg();
|
||||
}
|
||||
}
|
||||
#if defined(Q_OS_WIN32)
|
||||
additionalArguments->removeAll("-win32");
|
||||
#elif defined(Q_OS_MAC)
|
||||
additionalArguments->removeAll("-macx");
|
||||
#elif defined(Q_OS_QNX6)
|
||||
additionalArguments->removeAll("-qnx6");
|
||||
#else
|
||||
additionalArguments->removeAll("-unix");
|
||||
#endif
|
||||
ait.deleteArg(); // The .pro file is always the last arg
|
||||
}
|
||||
|
||||
/// This function extracts all the CONFIG+=debug, CONFIG+=release
|
||||
|
@@ -265,9 +265,9 @@ public:
|
||||
|
||||
// Static Methods
|
||||
static bool makefileIsFor(const QString &makefile, const QString &proFile);
|
||||
static QPair<QtVersion::QmakeBuildConfigs, QStringList> scanMakeFile(const QString &makefile,
|
||||
QtVersion::QmakeBuildConfigs defaultBuildConfig);
|
||||
static QString findQMakeBinaryFromMakefile(const QString &makefile);
|
||||
static QPair<QtVersion::QmakeBuildConfigs, QString> scanMakeFile(const QString &makefile,
|
||||
QtVersion::QmakeBuildConfigs defaultBuildConfig);
|
||||
static QString findQMakeBinaryFromMakefile(const QString &directory);
|
||||
bool isValidId(int id) const;
|
||||
|
||||
signals:
|
||||
@@ -281,11 +281,10 @@ private:
|
||||
static bool equals(QtVersion *a, QtVersion *b);
|
||||
static QString findQMakeLine(const QString &directory, const QString &key);
|
||||
static QString trimLine(const QString line);
|
||||
static QStringList splitLine(const QString &line);
|
||||
static void parseParts(const QStringList &parts,
|
||||
QList<QMakeAssignment> *assignments,
|
||||
QList<QMakeAssignment> *afterAssignments,
|
||||
QStringList *additionalArguments);
|
||||
static void parseArgs(const QString &args,
|
||||
QList<QMakeAssignment> *assignments,
|
||||
QList<QMakeAssignment> *afterAssignments,
|
||||
QString *additionalArguments);
|
||||
static QtVersion::QmakeBuildConfigs qmakeBuildConfigFromCmdArgs(QList<QMakeAssignment> *assignments,
|
||||
QtVersion::QmakeBuildConfigs defaultBuildConfig);
|
||||
// Used by QtOptionsPage
|
||||
|
@@ -40,6 +40,7 @@
|
||||
#include <projectexplorer/task.h>
|
||||
#include <projectexplorer/taskhub.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
|
||||
#include <QtGui/QAction>
|
||||
#include <QtGui/QFileDialog>
|
||||
@@ -415,21 +416,20 @@ TargetSetupPage::recursivelyCheckDirectoryForBuild(const QString &directory, con
|
||||
info.isTemporary = true;
|
||||
}
|
||||
|
||||
QPair<QtVersion::QmakeBuildConfigs, QStringList> result =
|
||||
QPair<QtVersion::QmakeBuildConfigs, QString> result =
|
||||
QtVersionManager::scanMakeFile(directory + "/Makefile", info.version->defaultBuildConfig());
|
||||
info.buildConfig = result.first;
|
||||
info.additionalArguments = Qt4BuildConfiguration::removeSpecFromArgumentList(result.second);
|
||||
|
||||
QString parsedSpec = Qt4BuildConfiguration::extractSpecFromArgumentList(result.second, directory, info.version);
|
||||
QString aa = result.second;
|
||||
QString parsedSpec = Qt4BuildConfiguration::extractSpecFromArguments(&aa, directory, info.version);
|
||||
QString versionSpec = info.version->mkspec();
|
||||
|
||||
// Compare mkspecs and add to additional arguments
|
||||
if (parsedSpec.isEmpty() || parsedSpec == versionSpec || parsedSpec == "default") {
|
||||
// using the default spec, don't modify additional arguments
|
||||
} else {
|
||||
info.additionalArguments.prepend(parsedSpec);
|
||||
info.additionalArguments.prepend("-spec");
|
||||
info.additionalArguments = "-spec " + Utils::QtcProcess::quoteArg(parsedSpec);
|
||||
}
|
||||
Utils::QtcProcess::addArgs(&info.additionalArguments, aa);
|
||||
|
||||
results.append(info);
|
||||
return results;
|
||||
|
@@ -87,7 +87,7 @@ public:
|
||||
QtVersion *version;
|
||||
bool isTemporary;
|
||||
QtVersion::QmakeBuildConfigs buildConfig;
|
||||
QStringList additionalArguments;
|
||||
QString additionalArguments;
|
||||
QString directory;
|
||||
bool isExistingBuild;
|
||||
bool isShadowBuild;
|
||||
|
@@ -106,7 +106,7 @@ struct LauncherPrivate {
|
||||
CopyState m_copyState;
|
||||
DownloadState m_downloadState;
|
||||
QString m_fileName;
|
||||
QStringList m_commandLineArgs;
|
||||
QString m_commandLineArgs;
|
||||
QStringList m_installFileNames;
|
||||
int m_currentInstallFileName;
|
||||
int m_verbose;
|
||||
@@ -218,7 +218,7 @@ void Launcher::setInstallFileNames(const QStringList &names)
|
||||
d->m_currentInstallFileName = 0;
|
||||
}
|
||||
|
||||
void Launcher::setCommandLineArgs(const QStringList &args)
|
||||
void Launcher::setCommandLineArgs(const QString &args)
|
||||
{
|
||||
d->m_commandLineArgs = args;
|
||||
}
|
||||
@@ -267,7 +267,7 @@ bool Launcher::startServer(QString *errorMessage)
|
||||
if (!d->m_fileName.isEmpty())
|
||||
str << " Executable=" << d->m_fileName;
|
||||
if (!d->m_commandLineArgs.isEmpty())
|
||||
str << " Arguments= " << d->m_commandLineArgs.join(QString(QLatin1Char(' ')));
|
||||
str << " Arguments= " << d->m_commandLineArgs;
|
||||
for (int i = 0; i < d->m_copyState.sourceFileNames.size(); ++i) {
|
||||
str << " Package/Source=" << d->m_copyState.sourceFileNames.at(i);
|
||||
str << " Remote Package/Destination=" << d->m_copyState.destinationFileNames.at(i);
|
||||
@@ -955,7 +955,7 @@ void Launcher::handleInstallPackageFinished(const TrkResult &result)
|
||||
}
|
||||
|
||||
QByteArray Launcher::startProcessMessage(const QString &executable,
|
||||
const QStringList &arguments)
|
||||
const QString &arguments)
|
||||
{
|
||||
// It's not started yet
|
||||
QByteArray ba;
|
||||
@@ -965,7 +965,7 @@ QByteArray Launcher::startProcessMessage(const QString &executable,
|
||||
QByteArray commandLineBa = executable.toLocal8Bit();
|
||||
commandLineBa.append(char(0));
|
||||
if (!arguments.isEmpty())
|
||||
commandLineBa.append(arguments.join(QString(QLatin1Char(' '))).toLocal8Bit());
|
||||
commandLineBa.append(arguments.toLocal8Bit());
|
||||
appendString(&ba, commandLineBa, TargetByteOrder, true);
|
||||
return ba;
|
||||
}
|
||||
|
@@ -92,7 +92,7 @@ public:
|
||||
void setCopyFileNames(const QStringList &srcName, const QStringList &dstName);
|
||||
void setDownloadFileName(const QString &srcName, const QString &dstName);
|
||||
void setInstallFileNames(const QStringList &names);
|
||||
void setCommandLineArgs(const QStringList &args);
|
||||
void setCommandLineArgs(const QString &args);
|
||||
bool startServer(QString *errorMessage);
|
||||
void setInstallationMode(InstallationMode installation);
|
||||
void setInstallationDrive(char drive);
|
||||
@@ -122,7 +122,7 @@ public:
|
||||
|
||||
// Create Trk message to start a process.
|
||||
static QByteArray startProcessMessage(const QString &executable,
|
||||
const QStringList &arguments);
|
||||
const QString &arguments);
|
||||
// Create Trk message to read memory
|
||||
static QByteArray readMemoryMessage(uint pid, uint tid, uint from, uint len);
|
||||
static QByteArray readRegistersMessage(uint pid, uint tid);
|
||||
|
Reference in New Issue
Block a user