forked from qt-creator/qt-creator
qmldump: Allow for debug and release versions and choose the right one.
Task-number: QTCREATORBUG-3549 Reviewed-by: Kai Koehne
This commit is contained in:
@@ -134,7 +134,7 @@ void QmlProject::refresh(RefreshOptions options)
|
|||||||
QmlJS::ModelManagerInterface::ProjectInfo pinfo(this);
|
QmlJS::ModelManagerInterface::ProjectInfo pinfo(this);
|
||||||
pinfo.sourceFiles = files();
|
pinfo.sourceFiles = files();
|
||||||
pinfo.importPaths = importPaths();
|
pinfo.importPaths = importPaths();
|
||||||
Qt4ProjectManager::QmlDumpTool::pathAndEnvironment(this, &pinfo.qmlDumpPath, &pinfo.qmlDumpEnvironment);
|
Qt4ProjectManager::QmlDumpTool::pathAndEnvironment(this, false, &pinfo.qmlDumpPath, &pinfo.qmlDumpEnvironment);
|
||||||
m_modelManager->updateProjectInfo(pinfo);
|
m_modelManager->updateProjectInfo(pinfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -82,9 +82,9 @@ public:
|
|||||||
m_buildTask->run(future);
|
m_buildTask->run(future);
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateProjectWhenDone(ProjectExplorer::Project *project)
|
void updateProjectWhenDone(ProjectExplorer::Project *project, bool preferDebug)
|
||||||
{
|
{
|
||||||
m_projectsToUpdate.insert(project);
|
m_projectsToUpdate.insert(qMakePair(project, preferDebug));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hasFailed() const
|
bool hasFailed() const
|
||||||
@@ -104,7 +104,7 @@ private slots:
|
|||||||
} else {
|
} else {
|
||||||
version->invalidateCache();
|
version->invalidateCache();
|
||||||
|
|
||||||
if (version->qmlDumpTool().isEmpty()) {
|
if (!version->hasQmlDump()) {
|
||||||
m_failed = true;
|
m_failed = true;
|
||||||
errorMessage = QString::fromLatin1("Could not build QML plugin dumping helper for %1\n"
|
errorMessage = QString::fromLatin1("Could not build QML plugin dumping helper for %1\n"
|
||||||
"Output:\n%2").
|
"Output:\n%2").
|
||||||
@@ -121,9 +121,12 @@ private slots:
|
|||||||
if (!modelManager)
|
if (!modelManager)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
foreach (ProjectExplorer::Project *project, m_projectsToUpdate) {
|
typedef QPair<ProjectExplorer::Project *, bool> ProjectAndDebug;
|
||||||
QmlJS::ModelManagerInterface::ProjectInfo projectInfo = modelManager->projectInfo(project);
|
foreach (ProjectAndDebug projectAndDebug, m_projectsToUpdate) {
|
||||||
projectInfo.qmlDumpPath = version->qmlDumpTool();
|
QmlJS::ModelManagerInterface::ProjectInfo projectInfo = modelManager->projectInfo(projectAndDebug.first);
|
||||||
|
projectInfo.qmlDumpPath = version->qmlDumpTool(projectAndDebug.second);
|
||||||
|
if (projectInfo.qmlDumpPath.isEmpty())
|
||||||
|
projectInfo.qmlDumpPath = version->qmlDumpTool(!projectAndDebug.second);
|
||||||
projectInfo.qmlDumpEnvironment = version->qmlToolsEnvironment();
|
projectInfo.qmlDumpEnvironment = version->qmlToolsEnvironment();
|
||||||
modelManager->updateProjectInfo(projectInfo);
|
modelManager->updateProjectInfo(projectInfo);
|
||||||
}
|
}
|
||||||
@@ -134,7 +137,7 @@ private slots:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSet<ProjectExplorer::Project *> m_projectsToUpdate;
|
QSet<QPair<ProjectExplorer::Project *, bool> > m_projectsToUpdate;
|
||||||
Internal::DebuggingHelperBuildTask *m_buildTask; // deletes itself after run()
|
Internal::DebuggingHelperBuildTask *m_buildTask; // deletes itself after run()
|
||||||
QtVersion m_version;
|
QtVersion m_version;
|
||||||
bool m_failed;
|
bool m_failed;
|
||||||
@@ -144,13 +147,17 @@ private:
|
|||||||
|
|
||||||
namespace Qt4ProjectManager {
|
namespace Qt4ProjectManager {
|
||||||
|
|
||||||
static inline QStringList validBinaryFilenames()
|
static inline QStringList validBinaryFilenames(bool debugBuild)
|
||||||
{
|
{
|
||||||
return QStringList()
|
QStringList list = QStringList()
|
||||||
<< QLatin1String("debug/qmldump.exe")
|
|
||||||
<< QLatin1String("qmldump.exe")
|
<< QLatin1String("qmldump.exe")
|
||||||
<< QLatin1String("qmldump")
|
<< QLatin1String("qmldump")
|
||||||
<< QLatin1String("qmldump.app/Contents/MacOS/qmldump");
|
<< QLatin1String("qmldump.app/Contents/MacOS/qmldump");
|
||||||
|
if (debugBuild)
|
||||||
|
list.prepend(QLatin1String("debug/qmldump.exe"));
|
||||||
|
else
|
||||||
|
list.prepend(QLatin1String("release/qmldump.exe"));
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QmlDumpTool::canBuild(const QtVersion *qtVersion)
|
bool QmlDumpTool::canBuild(const QtVersion *qtVersion)
|
||||||
@@ -195,9 +202,7 @@ static QtVersion *qtVersionForProject(ProjectExplorer::Project *project)
|
|||||||
foreach (QtVersion *version, qtVersions->validVersions()) {
|
foreach (QtVersion *version, qtVersions->validVersions()) {
|
||||||
if (version->supportsTargetId(Constants::DESKTOP_TARGET_ID)
|
if (version->supportsTargetId(Constants::DESKTOP_TARGET_ID)
|
||||||
|| version->supportsTargetId(Constants::QT_SIMULATOR_TARGET_ID)) {
|
|| version->supportsTargetId(Constants::QT_SIMULATOR_TARGET_ID)) {
|
||||||
const QString qtInstallData = version->versionInfo().value("QT_INSTALL_DATA");
|
if (version->hasQmlDump())
|
||||||
const QString path = QmlDumpTool::toolByInstallData(qtInstallData);
|
|
||||||
if (!path.isEmpty())
|
|
||||||
return version;
|
return version;
|
||||||
|
|
||||||
if (!canBuildQmlDump && QmlDumpTool::canBuild(version)) {
|
if (!canBuildQmlDump && QmlDumpTool::canBuild(version)) {
|
||||||
@@ -209,19 +214,19 @@ static QtVersion *qtVersionForProject(ProjectExplorer::Project *project)
|
|||||||
return canBuildQmlDump;
|
return canBuildQmlDump;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QmlDumpTool::toolForProject(ProjectExplorer::Project *project)
|
QString QmlDumpTool::toolForProject(ProjectExplorer::Project *project, bool debugDump)
|
||||||
{
|
{
|
||||||
QtVersion *version = qtVersionForProject(project);
|
QtVersion *version = qtVersionForProject(project);
|
||||||
if (version) {
|
if (version) {
|
||||||
QString qtInstallData = version->versionInfo().value("QT_INSTALL_DATA");
|
QString qtInstallData = version->versionInfo().value("QT_INSTALL_DATA");
|
||||||
QString toolPath = toolByInstallData(qtInstallData);
|
QString toolPath = toolByInstallData(qtInstallData, debugDump);
|
||||||
return toolPath;
|
return toolPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QmlDumpTool::toolByInstallData(const QString &qtInstallData)
|
QString QmlDumpTool::toolByInstallData(const QString &qtInstallData, bool debugDump)
|
||||||
{
|
{
|
||||||
if (!Core::ICore::instance())
|
if (!Core::ICore::instance())
|
||||||
return QString();
|
return QString();
|
||||||
@@ -229,16 +234,16 @@ QString QmlDumpTool::toolByInstallData(const QString &qtInstallData)
|
|||||||
const QString mainFilename = Core::ICore::instance()->resourcePath()
|
const QString mainFilename = Core::ICore::instance()->resourcePath()
|
||||||
+ QLatin1String("/qml/qmldump/main.cpp");
|
+ QLatin1String("/qml/qmldump/main.cpp");
|
||||||
const QStringList directories = installDirectories(qtInstallData);
|
const QStringList directories = installDirectories(qtInstallData);
|
||||||
const QStringList binFilenames = validBinaryFilenames();
|
const QStringList binFilenames = validBinaryFilenames(debugDump);
|
||||||
|
|
||||||
return byInstallDataHelper(mainFilename, directories, binFilenames);
|
return byInstallDataHelper(mainFilename, directories, binFilenames);
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList QmlDumpTool::locationsByInstallData(const QString &qtInstallData)
|
QStringList QmlDumpTool::locationsByInstallData(const QString &qtInstallData, bool debugDump)
|
||||||
{
|
{
|
||||||
QStringList result;
|
QStringList result;
|
||||||
QFileInfo fileInfo;
|
QFileInfo fileInfo;
|
||||||
const QStringList binFilenames = validBinaryFilenames();
|
const QStringList binFilenames = validBinaryFilenames(debugDump);
|
||||||
foreach(const QString &directory, installDirectories(qtInstallData)) {
|
foreach(const QString &directory, installDirectories(qtInstallData)) {
|
||||||
if (getHelperFileInfoFor(binFilenames, directory, &fileInfo))
|
if (getHelperFileInfoFor(binFilenames, directory, &fileInfo))
|
||||||
result << fileInfo.filePath();
|
result << fileInfo.filePath();
|
||||||
@@ -291,21 +296,20 @@ QStringList QmlDumpTool::installDirectories(const QString &qtInstallData)
|
|||||||
return directories;
|
return directories;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlDumpTool::pathAndEnvironment(ProjectExplorer::Project *project, QString *dumperPath, Utils::Environment *env)
|
void QmlDumpTool::pathAndEnvironment(ProjectExplorer::Project *project, bool preferDebug,
|
||||||
|
QString *dumperPath, Utils::Environment *env)
|
||||||
{
|
{
|
||||||
QString path;
|
QString path;
|
||||||
|
|
||||||
path = Qt4ProjectManager::QmlDumpTool::toolForProject(project);
|
|
||||||
|
|
||||||
QtVersion *version = qtVersionForProject(project);
|
QtVersion *version = qtVersionForProject(project);
|
||||||
if (version && path.isEmpty() && QmlDumpTool::canBuild(version)) {
|
if (version && !version->hasQmlDump() && QmlDumpTool::canBuild(version)) {
|
||||||
QmlDumpBuildTask *qmlDumpBuildTask = qmlDumpBuilds()->value(version->uniqueId());
|
QmlDumpBuildTask *qmlDumpBuildTask = qmlDumpBuilds()->value(version->uniqueId());
|
||||||
if (qmlDumpBuildTask) {
|
if (qmlDumpBuildTask) {
|
||||||
if (!qmlDumpBuildTask->hasFailed())
|
if (!qmlDumpBuildTask->hasFailed())
|
||||||
qmlDumpBuildTask->updateProjectWhenDone(project);
|
qmlDumpBuildTask->updateProjectWhenDone(project, preferDebug);
|
||||||
} else {
|
} else {
|
||||||
QmlDumpBuildTask *buildTask = new QmlDumpBuildTask(version);
|
QmlDumpBuildTask *buildTask = new QmlDumpBuildTask(version);
|
||||||
buildTask->updateProjectWhenDone(project);
|
buildTask->updateProjectWhenDone(project, preferDebug);
|
||||||
QFuture<void> task = QtConcurrent::run(&QmlDumpBuildTask::run, buildTask);
|
QFuture<void> task = QtConcurrent::run(&QmlDumpBuildTask::run, buildTask);
|
||||||
const QString taskName = QmlDumpBuildTask::tr("Building helper");
|
const QString taskName = QmlDumpBuildTask::tr("Building helper");
|
||||||
Core::ICore::instance()->progressManager()->addTask(task, taskName,
|
Core::ICore::instance()->progressManager()->addTask(task, taskName,
|
||||||
@@ -314,6 +318,10 @@ void QmlDumpTool::pathAndEnvironment(ProjectExplorer::Project *project, QString
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
path = Qt4ProjectManager::QmlDumpTool::toolForProject(project, preferDebug);
|
||||||
|
if (path.isEmpty())
|
||||||
|
path = Qt4ProjectManager::QmlDumpTool::toolForProject(project, !preferDebug);
|
||||||
|
|
||||||
if (!path.isEmpty()) {
|
if (!path.isEmpty()) {
|
||||||
QFileInfo qmldumpFileInfo(path);
|
QFileInfo qmldumpFileInfo(path);
|
||||||
if (!qmldumpFileInfo.exists()) {
|
if (!qmldumpFileInfo.exists()) {
|
||||||
|
@@ -52,9 +52,9 @@ class QT4PROJECTMANAGER_EXPORT QmlDumpTool : public Utils::BuildableHelperLibrar
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static bool canBuild(const QtVersion *qtVersion);
|
static bool canBuild(const QtVersion *qtVersion);
|
||||||
static QString toolForProject(ProjectExplorer::Project *project);
|
static QString toolForProject(ProjectExplorer::Project *project, bool debugDump);
|
||||||
static QString toolByInstallData(const QString &qtInstallData);
|
static QString toolByInstallData(const QString &qtInstallData, bool debugDump);
|
||||||
static QStringList locationsByInstallData(const QString &qtInstallData);
|
static QStringList locationsByInstallData(const QString &qtInstallData, bool debugDump);
|
||||||
|
|
||||||
// Build the helpers and return the output log/errormessage.
|
// Build the helpers and return the output log/errormessage.
|
||||||
static bool build(const QString &directory, const QString &makeCommand,
|
static bool build(const QString &directory, const QString &makeCommand,
|
||||||
@@ -65,7 +65,8 @@ public:
|
|||||||
// Copy the source files to a target location and return the chosen target location.
|
// Copy the source files to a target location and return the chosen target location.
|
||||||
static QString copy(const QString &qtInstallData, QString *errorMessage);
|
static QString copy(const QString &qtInstallData, QString *errorMessage);
|
||||||
|
|
||||||
static void pathAndEnvironment(ProjectExplorer::Project *project, QString *path, Utils::Environment *env);
|
static void pathAndEnvironment(ProjectExplorer::Project *project, bool preferDebug,
|
||||||
|
QString *path, Utils::Environment *env);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static QStringList installDirectories(const QString &qtInstallData);
|
static QStringList installDirectories(const QString &qtInstallData);
|
||||||
|
@@ -584,7 +584,9 @@ void Qt4Project::updateQmlJSCodeModel()
|
|||||||
foreach (Qt4ProFileNode *node, proFiles) {
|
foreach (Qt4ProFileNode *node, proFiles) {
|
||||||
projectInfo.importPaths.append(node->variableValue(QmlImportPathVar));
|
projectInfo.importPaths.append(node->variableValue(QmlImportPathVar));
|
||||||
}
|
}
|
||||||
|
bool preferDebugDump = false;
|
||||||
if (activeTarget() && activeTarget()->activeBuildConfiguration()) {
|
if (activeTarget() && activeTarget()->activeBuildConfiguration()) {
|
||||||
|
preferDebugDump = activeTarget()->activeBuildConfiguration()->qmakeBuildConfiguration() & QtVersion::DebugBuild;
|
||||||
const QtVersion *qtVersion = activeTarget()->activeBuildConfiguration()->qtVersion();
|
const QtVersion *qtVersion = activeTarget()->activeBuildConfiguration()->qtVersion();
|
||||||
if (qtVersion->isValid()) {
|
if (qtVersion->isValid()) {
|
||||||
const QString qtVersionImportPath = qtVersion->versionInfo().value("QT_INSTALL_IMPORTS");
|
const QString qtVersionImportPath = qtVersion->versionInfo().value("QT_INSTALL_IMPORTS");
|
||||||
@@ -592,7 +594,7 @@ void Qt4Project::updateQmlJSCodeModel()
|
|||||||
projectInfo.importPaths += qtVersionImportPath;
|
projectInfo.importPaths += qtVersionImportPath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QmlDumpTool::pathAndEnvironment(this, &projectInfo.qmlDumpPath, &projectInfo.qmlDumpEnvironment);
|
QmlDumpTool::pathAndEnvironment(this, preferDebugDump, &projectInfo.qmlDumpPath, &projectInfo.qmlDumpEnvironment);
|
||||||
projectInfo.importPaths.removeDuplicates();
|
projectInfo.importPaths.removeDuplicates();
|
||||||
|
|
||||||
modelManager->updateProjectInfo(projectInfo);
|
modelManager->updateProjectInfo(projectInfo);
|
||||||
|
@@ -484,7 +484,7 @@ void QtOptionsPageWidget::updateDebuggingHelperInfo(const QtVersion *version)
|
|||||||
bool canBuildQmlObserver = QmlObserverTool::canBuild(version);
|
bool canBuildQmlObserver = QmlObserverTool::canBuild(version);
|
||||||
|
|
||||||
bool hasGdbHelper = !version->debuggingHelperLibrary().isEmpty();
|
bool hasGdbHelper = !version->debuggingHelperLibrary().isEmpty();
|
||||||
bool hasQmlDumper = !version->qmlDumpTool().isEmpty();
|
bool hasQmlDumper = version->hasQmlDump();
|
||||||
bool hasQmlObserver = !version->qmlObserverTool().isEmpty();
|
bool hasQmlObserver = !version->qmlObserverTool().isEmpty();
|
||||||
|
|
||||||
// get names of tools from labels
|
// get names of tools from labels
|
||||||
@@ -513,7 +513,13 @@ void QtOptionsPageWidget::updateDebuggingHelperInfo(const QtVersion *version)
|
|||||||
|
|
||||||
QString qmlDumpStatusText;
|
QString qmlDumpStatusText;
|
||||||
if (hasQmlDumper) {
|
if (hasQmlDumper) {
|
||||||
qmlDumpStatusText = version->qmlDumpTool();
|
qmlDumpStatusText = version->qmlDumpTool(false);
|
||||||
|
const QString debugQmlDumpPath = version->qmlDumpTool(true);
|
||||||
|
if (qmlDumpStatusText != debugQmlDumpPath) {
|
||||||
|
if (!qmlDumpStatusText.isEmpty())
|
||||||
|
qmlDumpStatusText += QLatin1String("\n");
|
||||||
|
qmlDumpStatusText += debugQmlDumpPath;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (canBuildQmlDumper) {
|
if (canBuildQmlDumper) {
|
||||||
qmlDumpStatusText = tr("<i>Not yet built.</i>");
|
qmlDumpStatusText = tr("<i>Not yet built.</i>");
|
||||||
|
@@ -1159,7 +1159,7 @@ void QtVersion::updateVersionInfo() const
|
|||||||
|
|
||||||
if (!qtInstallData.isEmpty()) {
|
if (!qtInstallData.isEmpty()) {
|
||||||
m_hasDebuggingHelper = !DebuggingHelperLibrary::debuggingHelperLibraryByInstallData(qtInstallData).isEmpty();
|
m_hasDebuggingHelper = !DebuggingHelperLibrary::debuggingHelperLibraryByInstallData(qtInstallData).isEmpty();
|
||||||
m_hasQmlDump = !QmlDumpTool::toolByInstallData(qtInstallData).isEmpty();
|
m_hasQmlDump = !QmlDumpTool::toolByInstallData(qtInstallData, false).isEmpty() || !QmlDumpTool::toolByInstallData(qtInstallData, true).isEmpty();
|
||||||
m_hasQmlObserver = !QmlObserverTool::toolByInstallData(qtInstallData).isEmpty();
|
m_hasQmlObserver = !QmlObserverTool::toolByInstallData(qtInstallData).isEmpty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1726,12 +1726,12 @@ QString QtVersion::debuggingHelperLibrary() const
|
|||||||
return DebuggingHelperLibrary::debuggingHelperLibraryByInstallData(qtInstallData);
|
return DebuggingHelperLibrary::debuggingHelperLibraryByInstallData(qtInstallData);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QtVersion::qmlDumpTool() const
|
QString QtVersion::qmlDumpTool(bool debugVersion) const
|
||||||
{
|
{
|
||||||
QString qtInstallData = versionInfo().value("QT_INSTALL_DATA");
|
QString qtInstallData = versionInfo().value("QT_INSTALL_DATA");
|
||||||
if (qtInstallData.isEmpty())
|
if (qtInstallData.isEmpty())
|
||||||
return QString();
|
return QString();
|
||||||
return QmlDumpTool::toolByInstallData(qtInstallData);
|
return QmlDumpTool::toolByInstallData(qtInstallData, debugVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QtVersion::qmlObserverTool() const
|
QString QtVersion::qmlObserverTool() const
|
||||||
|
@@ -129,7 +129,7 @@ public:
|
|||||||
|
|
||||||
bool hasDebuggingHelper() const;
|
bool hasDebuggingHelper() const;
|
||||||
QString debuggingHelperLibrary() const;
|
QString debuggingHelperLibrary() const;
|
||||||
QString qmlDumpTool() const;
|
QString qmlDumpTool(bool debugVersion) const;
|
||||||
QString qmlObserverTool() const;
|
QString qmlObserverTool() const;
|
||||||
QStringList debuggingHelperLibraryLocations() const;
|
QStringList debuggingHelperLibraryLocations() const;
|
||||||
bool supportsBinaryDebuggingHelper() const;
|
bool supportsBinaryDebuggingHelper() const;
|
||||||
|
Reference in New Issue
Block a user