Commit e3a3792f authored by Thomas Hartmann's avatar Thomas Hartmann

Removing support for DebuggingHelpers

This patch removes infrastructure and ui for DebuggingHelpers
and specifically qmldumptool.

The qmldumptool was the last relevant DebuggingHelper and is only required
for Qt < 4.8.

Change-Id: I3767be0858e5eba16a33a3ab8436e95fc06a9e99
Reviewed-by: default avatarhjk <hjk@theqtcompany.com>
parent edb55e1f
......@@ -38,7 +38,6 @@
#include <projectexplorer/kit.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h>
#include <qtsupport/debugginghelperbuildtask.h>
#include <qtsupport/qtversionmanager.h>
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
......
......@@ -42,7 +42,6 @@
#include <coreplugin/coreicons.h>
#include <coreplugin/icore.h>
#include <coreplugin/icontext.h>
#include <qtsupport/debugginghelperbuildtask.h>
#include <qtsupport/qtkitinformation.h>
#include <qtsupport/qtversionmanager.h>
#include <qtsupport/qtsupportconstants.h>
......
......@@ -116,9 +116,7 @@ ModelManagerInterface::ProjectInfo ModelManager::defaultProjectInfoForProject(
}
if (projectInfo.tryQmlDump) {
ToolChain *toolChain = ToolChainKitInformation::toolChain(activeKit);
QtSupport::QmlDumpTool::pathAndEnvironment(project, qtVersion,
toolChain,
QtSupport::QmlDumpTool::pathAndEnvironment(qtVersion,
preferDebugDump, &projectInfo.qmlDumpPath,
&projectInfo.qmlDumpEnvironment);
projectInfo.qmlDumpHasRelocatableFlag = qtVersion->hasQmlDumpWithRelocatableFlag();
......
......@@ -37,7 +37,6 @@
#include <projectexplorer/toolchain.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/headerpath.h>
#include <qtsupport/debugginghelperbuildtask.h>
#include <qtsupport/qtkitinformation.h>
#include <qtsupport/qtsupportconstants.h>
......
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QtSupport::Internal::DebuggingHelper</class>
<widget class="QWidget" name="QtSupport::Internal::DebuggingHelper">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>330</width>
<height>85</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="2">
<widget class="QPushButton" name="qmlDumpBuildButton">
<property name="text">
<string>Build</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="qmlDumpLabel">
<property name="toolTip">
<string>Used to extract QML type information from library-based plugins.</string>
</property>
<property name="text">
<string>QML Dump:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="qmlDumpStatus">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>2</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">TextLabel</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="toolChainLabel">
<property name="text">
<string>Compiler:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="toolChainComboBox">
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContents</enum>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="showLogButton">
<property name="toolTip">
<string>Show compiler output of last build.</string>
</property>
<property name="text">
<string>Show Log</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="rebuildButton">
<property name="text">
<string>Build All</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "debugginghelperbuildtask.h"
#include "qmldumptool.h"
#include "baseqtversion.h"
#include "qtversionmanager.h"
#include <projectexplorer/toolchain.h>
#include <utils/qtcassert.h>
#include <QCoreApplication>
using namespace QtSupport;
using namespace QtSupport::Internal;
using namespace QtSupport::Internal;
using namespace ProjectExplorer;
DebuggingHelperBuildTask::DebuggingHelperBuildTask(const BaseQtVersion *version,
const ToolChain *toolChain,
Tools tools) :
m_tools(tools & availableTools(version)),
m_invalidQt(false),
m_showErrors(true)
{
if (!version || !version->isValid() || !toolChain) {
m_invalidQt = true;
return;
}
// allow type to be used in queued connections.
qRegisterMetaType<DebuggingHelperBuildTask::Tools>("DebuggingHelperBuildTask::Tools");
// Print result in application ouptut
connect(this, SIGNAL(logOutput(QString,Core::MessageManager::PrintToOutputPaneFlags)),
Core::MessageManager::instance(), SLOT(write(QString,Core::MessageManager::PrintToOutputPaneFlags)),
Qt::QueuedConnection);
//
// Extract all information we need from version, such that we don't depend on the existence
// of the version pointer while compiling
//
m_qtId = version->uniqueId();
m_qtInstallData = version->qmakeProperty("QT_INSTALL_DATA");
if (m_qtInstallData.isEmpty()) {
const QString error
= QCoreApplication::translate(
"QtVersion",
"Cannot determine the installation path for Qt version \"%1\"."
).arg(version->displayName());
log(QString(), error);
m_invalidQt = true;
return;
}
m_environment = Utils::Environment::systemEnvironment();
#if 0 // FIXME: Reenable this!
version->addToEnvironment(m_environment);
#endif
toolChain->addToEnvironment(m_environment);
log(QCoreApplication::translate("QtVersion", "Building helper(s) with toolchain \"%1\"...\n"
).arg(toolChain->displayName()), QString());
if (toolChain->targetAbi().os() == Abi::LinuxOS
&& Abi::hostAbi().os() == Abi::WindowsOS)
m_target = QLatin1String("-unix");
m_makeArguments << QLatin1String("all")
<< QLatin1String("-k");
m_qmakeCommand = version->qmakeCommand();
m_qmakeArguments = QStringList() << QLatin1String("-nocache");
if (toolChain->targetAbi().os() == Abi::MacOS
&& toolChain->targetAbi().architecture() == Abi::X86Architecture) {
// explicitly set 32 or 64 bit in case Qt is compiled with both
if (toolChain->targetAbi().wordWidth() == 32)
m_qmakeArguments << QLatin1String("CONFIG+=x86");
else if (toolChain->targetAbi().wordWidth() == 64)
m_qmakeArguments << QLatin1String("CONFIG+=x86_64");
}
m_makeCommand = toolChain->makeCommand(m_environment);
m_mkspec = version->mkspec();
// Make sure QtVersion cache is invalidated
connect(this, SIGNAL(updateQtVersions(Utils::FileName)),
QtVersionManager::instance(), SLOT(updateDumpFor(Utils::FileName)),
Qt::QueuedConnection);
}
DebuggingHelperBuildTask::Tools DebuggingHelperBuildTask::availableTools(const BaseQtVersion *version)
{
QTC_ASSERT(version, return 0);
// Check the build requirements of the tools
DebuggingHelperBuildTask::Tools tools = 0;
if (QmlDumpTool::canBuild(version))
tools |= QmlDump;
return tools;
}
void DebuggingHelperBuildTask::showOutputOnError(bool show)
{
m_showErrors = show;
}
void DebuggingHelperBuildTask::run(QFutureInterface<void> &future)
{
future.setProgressRange(0, 3);
future.setProgressValue(1);
if (m_invalidQt || !buildDebuggingHelper(future)) {
const QString error
= QCoreApplication::translate(
"QtVersion",
"Build failed.");
log(QString(), error);
} else {
const QString result
= QCoreApplication::translate(
"QtVersion",
"Build succeeded.");
log(result, QString());
}
emit finished(m_qtId, m_log, m_tools);
emit updateQtVersions(m_qmakeCommand);
deleteLater();
}
bool DebuggingHelperBuildTask::buildDebuggingHelper(QFutureInterface<void> &future)
{
Utils::BuildableHelperLibrary::BuildHelperArguments arguments;
arguments.makeCommand = m_makeCommand;
arguments.makeArguments = m_makeArguments;
arguments.qmakeCommand = m_qmakeCommand;
arguments.qmakeArguments = m_qmakeArguments;
arguments.targetMode = m_target;
arguments.mkspec = m_mkspec;
arguments.environment = m_environment;
future.setProgressValue(2);
if (m_tools & QmlDump) {
QString output, error;
bool success = true;
arguments.directory = QmlDumpTool::copy(m_qtInstallData, &error);
if (arguments.directory.isEmpty()
|| !QmlDumpTool::build(arguments, &output, &error))
success = false;
log(output, error);
if (!success)
return false;
}
future.setProgressValue(3);
return true;
}
void DebuggingHelperBuildTask::log(const QString &output, const QString &error)
{
if (output.isEmpty() && error.isEmpty())
return;
QString logEntry;
if (!output.isEmpty())
logEntry.append(output);
if (!error.isEmpty())
logEntry.append(error);
m_log.append(logEntry);
Core::MessageManager::PrintToOutputPaneFlags flag = Core::MessageManager::Silent;
if (m_showErrors && !error.isEmpty())
flag = Core::MessageManager::NoModeSwitch;
emit logOutput(logEntry, flag);
}
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#ifndef DEBUGGINGHELPERBUILDTASK_H
#define DEBUGGINGHELPERBUILDTASK_H
#include "qtsupport_global.h"
#include <utils/environment.h>
#include <utils/fileutils.h>
#include <coreplugin/messagemanager.h>
#include <QObject>
#include <QFutureInterface>
#include <QMetaType>
namespace ProjectExplorer { class ToolChain; }
namespace QtSupport {
class BaseQtVersion;
class QTSUPPORT_EXPORT DebuggingHelperBuildTask : public QObject
{
Q_OBJECT
public:
enum DebuggingHelper {
QmlDump = 0x02,
AllTools = QmlDump
};
Q_DECLARE_FLAGS(Tools, DebuggingHelper)
explicit DebuggingHelperBuildTask(const BaseQtVersion *version,
const ProjectExplorer::ToolChain *toolChain,
Tools tools = AllTools);
void showOutputOnError(bool show);
void run(QFutureInterface<void> &future);
static Tools availableTools(const BaseQtVersion *version);
signals:
void finished(int qtVersionId, const QString &output, DebuggingHelperBuildTask::Tools tools);
// used internally
void logOutput(const QString &output, Core::MessageManager::PrintToOutputPaneFlags flags);
void updateQtVersions(const Utils::FileName &qmakeCommand);
private:
bool buildDebuggingHelper(QFutureInterface<void> &future);
void log(const QString &output, const QString &error);
const Tools m_tools;
int m_qtId;
QString m_qtInstallData;
QString m_target;
Utils::FileName m_qmakeCommand;
QStringList m_qmakeArguments;
QString m_makeCommand;
QStringList m_makeArguments;
Utils::FileName m_mkspec;
Utils::Environment m_environment;
QString m_log;
bool m_invalidQt;
bool m_showErrors;
};
} // namespace QtSupport
Q_DECLARE_METATYPE(QtSupport::DebuggingHelperBuildTask::Tools)
#endif // DEBUGGINGHELPERBUILDTASK_H
......@@ -26,7 +26,6 @@
#include "qmldumptool.h"
#include "qtsupportconstants.h"
#include "qtversionmanager.h"
#include "debugginghelperbuildtask.h"
#include <coreplugin/icore.h>
#include <coreplugin/progressmanager/progressmanager.h>
......@@ -43,118 +42,6 @@
#include <QHash>
#include <QStandardPaths>
namespace {
using namespace QtSupport;
using namespace ProjectExplorer;
class QmlDumpBuildTask;
typedef QHash<int, QmlDumpBuildTask *> QmlDumpByVersion;
Q_GLOBAL_STATIC(QmlDumpByVersion, qmlDumpBuilds)
// A task suitable to be run by QtConcurrent to build qmldump.
class QmlDumpBuildTask : public QObject
{
Q_OBJECT
public:
explicit QmlDumpBuildTask(BaseQtVersion *version, ToolChain *toolChain)
: m_buildTask(new DebuggingHelperBuildTask(version, toolChain,
DebuggingHelperBuildTask::QmlDump))
, m_failed(false)
{
qmlDumpBuilds()->insert(version->uniqueId(), this);
// Don't open General Messages pane with errors
m_buildTask->showOutputOnError(false);
connect(m_buildTask, SIGNAL(finished(int,QString,DebuggingHelperBuildTask::Tools)),
this, SLOT(finish(int,QString,DebuggingHelperBuildTask::Tools)),
Qt::QueuedConnection);
}
void run(QFutureInterface<void> &future)
{
m_buildTask->run(future);
}
void updateProjectWhenDone(QPointer<Project> project, bool preferDebug)
{
foreach (const ProjectToUpdate &update, m_projectsToUpdate) {
if (update.project == project)
return;
}
ProjectToUpdate update;
update.project = project;
update.preferDebug = preferDebug;
m_projectsToUpdate += update;
}
bool hasFailed() const
{
return m_failed;
}
private slots:
void finish(int qtId, const QString &output, DebuggingHelperBuildTask::Tools tools)
{
BaseQtVersion *version = QtVersionManager::version(qtId);
QTC_ASSERT(tools == DebuggingHelperBuildTask::QmlDump, return);
QString errorMessage;
if (!version) {
m_failed = true;
errorMessage = QString::fromLatin1("Qt version became invalid");
} else {
if (!version->hasQmlDump()) {
m_failed = true;
errorMessage = QString::fromLatin1("Could not build QML plugin dumping helper for %1\n"
"Output:\n%2").
arg(version->displayName(), output);
}
}
if (m_failed) {
qWarning("%s", qPrintable(errorMessage));
return;
}
// update qmldump path for all the project
QmlJS::ModelManagerInterface *modelManager = QmlJS::ModelManagerInterface::instance();
if (!modelManager)
return;
foreach (const ProjectToUpdate &update, m_projectsToUpdate) {
if (!update.project)
continue;
QmlJS::ModelManagerInterface::ProjectInfo projectInfo = modelManager->projectInfo(update.project);
projectInfo.qmlDumpPath = version->qmlDumpTool(update.preferDebug);
if (projectInfo.qmlDumpPath.isEmpty())
projectInfo.qmlDumpPath = version->qmlDumpTool(!update.preferDebug);
projectInfo.qmlDumpEnvironment = version->qmlToolsEnvironment();
projectInfo.qmlDumpHasRelocatableFlag = version->hasQmlDumpWithRelocatableFlag();
modelManager->updateProjectInfo(projectInfo, update.project);
}
// clean up
qmlDumpBuilds()->remove(qtId);
deleteLater();
}
private:
class ProjectToUpdate {
public:
QPointer<Project> project;
bool preferDebug;
};
QList<ProjectToUpdate> m_projectsToUpdate;
DebuggingHelperBuildTask *m_buildTask; // deletes itself after run()
bool m_failed;
};
} // end of anonymous namespace
namespace QtSupport {
static inline QStringList validBinaryFilenames(bool debugBuild)
......@@ -311,25 +198,13 @@ QStringList QmlDumpTool::installDirectories(const QString &qtInstallData)
return directories;
}
void QmlDumpTool::pathAndEnvironment(Project *project, BaseQtVersion *version,
ToolChain *toolChain,
void QmlDumpTool::pathAndEnvironment(BaseQtVersion *version,
bool preferDebug, QString *dumperPath, Utils::Environment *env)
{
QString path;
if (version && !version->hasQmlDump() && QmlDumpTool::canBuild(version)) {
QmlDumpBuildTask *qmlDumpBuildTask = qmlDumpBuilds()->value(version->uniqueId());
if (qmlDumpBuildTask) {
if (!qmlDumpBuildTask->hasFailed())
qmlDumpBuildTask->updateProjectWhenDone(project, preferDebug);
} else {
QmlDumpBuildTask *buildTask = new QmlDumpBuildTask(version, toolChain);
buildTask->updateProjectWhenDone(project, preferDebug);
QFuture<void> task = QtConcurrent::run(&QmlDumpBuildTask::run, buildTask);
const QString taskName = QmlDumpBuildTask::tr("Building QML Helpers");
Core::ProgressManager::addTask(task, taskName, "QmakeProjectManager::BuildHelpers");
}
if (version && !version->hasQmlDump())
return;
}
QString path;
path = toolForVersion(version, preferDebug);
if (path.isEmpty())
......@@ -354,4 +229,3 @@ void QmlDumpTool::pathAndEnvironment(Project *project, BaseQtVersion *version,
} // namespace QtSupport
#include "qmldumptool.moc"
......@@ -57,8 +57,7 @@ public:
// Copy the source files to a target location and return the chosen target location.
static QString copy(const QString &qtInstallData, QString *errorMessage);
static void pathAndEnvironment(ProjectExplorer::Project *project, BaseQtVersion *version,
ProjectExplorer::ToolChain *toolChain,
static void pathAndEnvironment(BaseQtVersion *version,
bool preferDebug, QString *path, Utils::Environment *env);
private:
......
This diff is collapsed.
......@@ -26,8 +26,8 @@
#ifndef QTOPTIONSPAGE_H
#define QTOPTIONSPAGE_H
#include "debugginghelperbuildtask.h"
#include <coreplugin/dialogs/ioptionspage.h>
#include <utils/fileutils.h>
#include <QIcon>
#include <QPointer>
......@@ -56,7 +56,6 @@ class QtVersionItem;
namespace Ui {
class QtVersionManager;