forked from qt-creator/qt-creator
Debugger/JS Code model: Set environment for QML tools correctly.
Set complete build environment (MinGW).
Reviewed-by: Christian Kamm <christian.d.kamm@nokia.com>
Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
Task-number: QTCREATORBUG-2883
(cherry picked from commit f1fb0bddb1)
This commit is contained in:
@@ -33,6 +33,8 @@
|
||||
#include "qmljs_global.h"
|
||||
#include "qmljsdocument.h"
|
||||
|
||||
#include <utils/environment.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QStringList>
|
||||
#include <QSharedPointer>
|
||||
@@ -77,6 +79,7 @@ public:
|
||||
QStringList sourceFiles;
|
||||
QStringList importPaths;
|
||||
QString qmlDumpPath;
|
||||
Utils::Environment qmlDumpEnvironment;
|
||||
};
|
||||
|
||||
class WorkingCopy
|
||||
|
||||
@@ -478,6 +478,7 @@ void ModelManager::onLoadPluginTypes(const QString &libraryPath, const QString &
|
||||
return;
|
||||
|
||||
QProcess *process = new QProcess(this);
|
||||
process->setEnvironment(info.qmlDumpEnvironment.toStringList());
|
||||
connect(process, SIGNAL(finished(int)), SLOT(qmlPluginTypeDumpDone(int)));
|
||||
connect(process, SIGNAL(error(QProcess::ProcessError)), SLOT(qmlPluginTypeDumpError(QProcess::ProcessError)));
|
||||
QStringList args;
|
||||
|
||||
@@ -131,11 +131,16 @@ void QmlProject::refresh(RefreshOptions options)
|
||||
QmlJS::ModelManagerInterface::ProjectInfo pinfo(this);
|
||||
pinfo.sourceFiles = files();
|
||||
pinfo.importPaths = importPaths();
|
||||
|
||||
if (pinfo.qmlDumpPath.isNull()) {
|
||||
pinfo.qmlDumpPath = Qt4ProjectManager::QmlDumpTool::qmlDumpPath(this);
|
||||
}
|
||||
|
||||
if (activeTarget()) {
|
||||
if (const QmlProjectRunConfiguration *runConfig =
|
||||
qobject_cast<QmlProjectRunConfiguration*>(activeTarget()->activeRunConfiguration())) {
|
||||
if (runConfig->qtVersion()) {
|
||||
pinfo.qmlDumpEnvironment = runConfig->qtVersion()->qmlToolsEnvironment();
|
||||
}
|
||||
}
|
||||
}
|
||||
m_modelManager->updateProjectInfo(pinfo);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
#include <coreplugin/modemanager.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/applicationlauncher.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
#include <qt4projectmanager/qtversionmanager.h>
|
||||
#include <utils/environment.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
@@ -62,9 +64,8 @@ namespace Internal {
|
||||
QmlRunControl::QmlRunControl(QmlProjectRunConfiguration *runConfiguration, QString mode)
|
||||
: RunControl(runConfiguration, mode)
|
||||
{
|
||||
Utils::Environment environment = Utils::Environment::systemEnvironment();
|
||||
|
||||
m_applicationLauncher.setEnvironment(environment.toStringList());
|
||||
if (Qt4ProjectManager::QtVersion *qtVersion = runConfiguration->qtVersion())
|
||||
m_applicationLauncher.setEnvironment(qtVersion->qmlToolsEnvironment().toStringList());
|
||||
m_applicationLauncher.setWorkingDirectory(runConfiguration->workingDirectory());
|
||||
|
||||
if (mode == ProjectExplorer::Constants::RUNMODE) {
|
||||
@@ -195,7 +196,6 @@ QWidget *QmlRunControlFactory::createConfigurationWidget(RunConfiguration *runCo
|
||||
|
||||
ProjectExplorer::RunControl *QmlRunControlFactory::createDebugRunControl(QmlProjectRunConfiguration *runConfig)
|
||||
{
|
||||
Utils::Environment environment = Utils::Environment::systemEnvironment();
|
||||
Debugger::DebuggerStartParameters params;
|
||||
params.startMode = Debugger::StartInternal;
|
||||
params.executable = runConfig->observerPath();
|
||||
@@ -204,7 +204,8 @@ ProjectExplorer::RunControl *QmlRunControlFactory::createDebugRunControl(QmlProj
|
||||
params.processArgs = runConfig->viewerArguments();
|
||||
params.processArgs.append(QLatin1String("-qmljsdebugger=port:") + QString::number(runConfig->qmlDebugServerPort()));
|
||||
params.workingDirectory = runConfig->workingDirectory();
|
||||
params.environment = environment.toStringList();
|
||||
if (Qt4ProjectManager::QtVersion *qtVersion = runConfig->qtVersion())
|
||||
params.environment = qtVersion->qmlToolsEnvironment().toStringList();
|
||||
params.displayName = runConfig->displayName();
|
||||
|
||||
if (params.executable.isEmpty()) {
|
||||
|
||||
@@ -112,12 +112,11 @@ public slots:
|
||||
|
||||
foreach (ProjectExplorer::Project *project, m_projectsToUpdate) {
|
||||
QmlJS::ModelManagerInterface::ProjectInfo projectInfo = modelManager->projectInfo(project);
|
||||
if (projectInfo.qmlDumpPath.isEmpty()) {
|
||||
projectInfo.qmlDumpPath = qmldumpPath;
|
||||
projectInfo.qmlDumpEnvironment = m_version.qmlToolsEnvironment();
|
||||
modelManager->updateProjectInfo(projectInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
QSet<ProjectExplorer::Project *> m_projectsToUpdate;
|
||||
|
||||
@@ -597,14 +597,12 @@ void Qt4Project::updateQmlJSCodeModel()
|
||||
const QString qtVersionImportPath = qtVersion->versionInfo().value("QT_INSTALL_IMPORTS");
|
||||
if (!qtVersionImportPath.isEmpty())
|
||||
projectInfo.importPaths += qtVersionImportPath;
|
||||
projectInfo.qmlDumpEnvironment = qtVersion->qmlToolsEnvironment();
|
||||
projectInfo.qmlDumpPath = QmlDumpTool::qmlDumpPath(this);
|
||||
}
|
||||
}
|
||||
projectInfo.importPaths.removeDuplicates();
|
||||
|
||||
if (projectInfo.qmlDumpPath.isNull()) {
|
||||
projectInfo.qmlDumpPath = QmlDumpTool::qmlDumpPath(this);
|
||||
}
|
||||
|
||||
modelManager->updateProjectInfo(projectInfo);
|
||||
}
|
||||
|
||||
|
||||
@@ -1638,6 +1638,19 @@ bool QtVersion::hasQmlObserver() const
|
||||
return m_hasQmlObserver;
|
||||
}
|
||||
|
||||
Utils::Environment QtVersion::qmlToolsEnvironment() const
|
||||
{
|
||||
Utils::Environment environment = Utils::Environment::systemEnvironment();
|
||||
addToEnvironment(environment);
|
||||
|
||||
// add preferred toolchain, as that is how the tools are built, compare QtVersion::buildDebuggingHelperLibrary
|
||||
QList<QSharedPointer<ProjectExplorer::ToolChain> > alltc = toolChains();
|
||||
if (!alltc.isEmpty())
|
||||
alltc.first().data()->addToEnvironment(environment);
|
||||
|
||||
return environment;
|
||||
}
|
||||
|
||||
QString QtVersion::debuggingHelperLibrary() const
|
||||
{
|
||||
QString qtInstallData = versionInfo().value("QT_INSTALL_DATA");
|
||||
|
||||
@@ -119,6 +119,7 @@ public:
|
||||
|
||||
bool hasQmlDump() const;
|
||||
bool hasQmlObserver() const;
|
||||
Utils::Environment qmlToolsEnvironment() const;
|
||||
|
||||
// Builds a debugging library
|
||||
// returns the output of the commands
|
||||
|
||||
Reference in New Issue
Block a user