forked from qt-creator/qt-creator
Docker: Rework auto-detection and removal of kit items
- Use more uniform messages for the different kinds of items - Remove all auto-detected items Change-Id: I0b0df0bca484337039432b163bd8e19593b1cd22 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -277,9 +277,10 @@ void CMakeKitAspect::setup(Kit *k)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Look for a suitable auto-detected one:
|
// Look for a suitable auto-detected one:
|
||||||
const QString id = k->autoDetectionSource();
|
const QString kitSource = k->autoDetectionSource();
|
||||||
for (CMakeTool *tool : CMakeToolManager::cmakeTools()) {
|
for (CMakeTool *tool : CMakeToolManager::cmakeTools()) {
|
||||||
if (tool->detectionSource() == id) {
|
const QString toolSource = tool->detectionSource();
|
||||||
|
if (!toolSource.isEmpty() && toolSource == kitSource) {
|
||||||
setCMakeTool(k, tool->id());
|
setCMakeTool(k, tool->id());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1043,8 +1044,6 @@ CMakeConfig CMakeConfigurationKitAspect::defaultConfiguration(const Kit *k)
|
|||||||
|
|
||||||
QVariant CMakeConfigurationKitAspect::defaultValue(const Kit *k) const
|
QVariant CMakeConfigurationKitAspect::defaultValue(const Kit *k) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(k)
|
|
||||||
|
|
||||||
// FIXME: Convert preload scripts
|
// FIXME: Convert preload scripts
|
||||||
CMakeConfig config = defaultConfiguration(k);
|
CMakeConfig config = defaultConfiguration(k);
|
||||||
const QStringList tmp
|
const QStringList tmp
|
||||||
|
@@ -110,6 +110,7 @@ public:
|
|||||||
, m_executable(item->filePath())
|
, m_executable(item->filePath())
|
||||||
, m_qchFile(item->qchFilePath())
|
, m_qchFile(item->qchFilePath())
|
||||||
, m_versionDisplay(item->versionDisplay())
|
, m_versionDisplay(item->versionDisplay())
|
||||||
|
, m_detectionSource(item->detectionSource())
|
||||||
, m_isAutoRun(item->isAutoRun())
|
, m_isAutoRun(item->isAutoRun())
|
||||||
, m_autodetected(item->isAutoDetected())
|
, m_autodetected(item->isAutoDetected())
|
||||||
, m_isSupported(item->hasFileApi())
|
, m_isSupported(item->hasFileApi())
|
||||||
@@ -145,9 +146,10 @@ public:
|
|||||||
cmake.setFilePath(m_executable);
|
cmake.setFilePath(m_executable);
|
||||||
m_isSupported = cmake.hasFileApi();
|
m_isSupported = cmake.hasFileApi();
|
||||||
|
|
||||||
m_tooltip = tr("Version: %1<br>Supports fileApi: %2")
|
m_tooltip = tr("Version: %1").arg(cmake.versionDisplay());
|
||||||
.arg(cmake.versionDisplay())
|
m_tooltip += "<br>" + tr("Supports fileApi: %1").arg(m_isSupported ? tr("yes") : tr("no"));
|
||||||
.arg(cmake.hasFileApi() ? tr("yes") : tr("no"));
|
m_tooltip += "<br>" + tr("Detection source: \"%1\"").arg(m_detectionSource);
|
||||||
|
|
||||||
m_versionDisplay = cmake.versionDisplay();
|
m_versionDisplay = cmake.versionDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -223,6 +225,7 @@ public:
|
|||||||
FilePath m_executable;
|
FilePath m_executable;
|
||||||
FilePath m_qchFile;
|
FilePath m_qchFile;
|
||||||
QString m_versionDisplay;
|
QString m_versionDisplay;
|
||||||
|
QString m_detectionSource;
|
||||||
bool m_isAutoRun = true;
|
bool m_isAutoRun = true;
|
||||||
bool m_pathExists = false;
|
bool m_pathExists = false;
|
||||||
bool m_pathIsFile = false;
|
bool m_pathIsFile = false;
|
||||||
@@ -362,6 +365,7 @@ void CMakeToolItemModel::apply()
|
|||||||
cmake->setDisplayName(item->m_name);
|
cmake->setDisplayName(item->m_name);
|
||||||
cmake->setFilePath(item->m_executable);
|
cmake->setFilePath(item->m_executable);
|
||||||
cmake->setQchFilePath(item->m_qchFile);
|
cmake->setQchFilePath(item->m_qchFile);
|
||||||
|
cmake->setDetectionSource(item->m_detectionSource);
|
||||||
cmake->setAutorun(item->m_isAutoRun);
|
cmake->setAutorun(item->m_isAutoRun);
|
||||||
} else {
|
} else {
|
||||||
toRegister.append(item);
|
toRegister.append(item);
|
||||||
@@ -375,6 +379,7 @@ void CMakeToolItemModel::apply()
|
|||||||
cmake->setDisplayName(item->m_name);
|
cmake->setDisplayName(item->m_name);
|
||||||
cmake->setFilePath(item->m_executable);
|
cmake->setFilePath(item->m_executable);
|
||||||
cmake->setQchFilePath(item->m_qchFile);
|
cmake->setQchFilePath(item->m_qchFile);
|
||||||
|
cmake->setDetectionSource(item->m_detectionSource);
|
||||||
if (!CMakeToolManager::registerCMakeTool(std::move(cmake)))
|
if (!CMakeToolManager::registerCMakeTool(std::move(cmake)))
|
||||||
item->m_changed = true;
|
item->m_changed = true;
|
||||||
}
|
}
|
||||||
|
@@ -53,6 +53,7 @@ const char CMAKE_INFORMATION_QCH_FILE_PATH[] = "QchFile";
|
|||||||
// obsolete since Qt Creator 5. Kept for backward compatibility
|
// obsolete since Qt Creator 5. Kept for backward compatibility
|
||||||
const char CMAKE_INFORMATION_AUTO_CREATE_BUILD_DIRECTORY[] = "AutoCreateBuildDirectory";
|
const char CMAKE_INFORMATION_AUTO_CREATE_BUILD_DIRECTORY[] = "AutoCreateBuildDirectory";
|
||||||
const char CMAKE_INFORMATION_AUTODETECTED[] = "AutoDetected";
|
const char CMAKE_INFORMATION_AUTODETECTED[] = "AutoDetected";
|
||||||
|
const char CMAKE_INFORMATION_DETECTIONSOURCE[] = "DetectionSource";
|
||||||
const char CMAKE_INFORMATION_READERTYPE[] = "ReaderType";
|
const char CMAKE_INFORMATION_READERTYPE[] = "ReaderType";
|
||||||
|
|
||||||
bool CMakeTool::Generator::matches(const QString &n, const QString &ex) const
|
bool CMakeTool::Generator::matches(const QString &n, const QString &ex) const
|
||||||
@@ -132,6 +133,7 @@ CMakeTool::CMakeTool(const QVariantMap &map, bool fromSdk) :
|
|||||||
//loading a CMakeTool from SDK is always autodetection
|
//loading a CMakeTool from SDK is always autodetection
|
||||||
if (!fromSdk)
|
if (!fromSdk)
|
||||||
m_isAutoDetected = map.value(CMAKE_INFORMATION_AUTODETECTED, false).toBool();
|
m_isAutoDetected = map.value(CMAKE_INFORMATION_AUTODETECTED, false).toBool();
|
||||||
|
m_detectionSource = map.value(CMAKE_INFORMATION_DETECTIONSOURCE).toString();
|
||||||
|
|
||||||
setFilePath(FilePath::fromString(map.value(CMAKE_INFORMATION_COMMAND).toString()));
|
setFilePath(FilePath::fromString(map.value(CMAKE_INFORMATION_COMMAND).toString()));
|
||||||
|
|
||||||
@@ -209,6 +211,7 @@ QVariantMap CMakeTool::toMap() const
|
|||||||
data.insert(CMAKE_INFORMATION_READERTYPE,
|
data.insert(CMAKE_INFORMATION_READERTYPE,
|
||||||
Internal::readerTypeToString(m_readerType.value()));
|
Internal::readerTypeToString(m_readerType.value()));
|
||||||
data.insert(CMAKE_INFORMATION_AUTODETECTED, m_isAutoDetected);
|
data.insert(CMAKE_INFORMATION_AUTODETECTED, m_isAutoDetected);
|
||||||
|
data.insert(CMAKE_INFORMATION_DETECTIONSOURCE, m_detectionSource);
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -122,6 +122,8 @@ private:
|
|||||||
void fetchFromCapabilities() const;
|
void fetchFromCapabilities() const;
|
||||||
void parseFromCapabilities(const QString &input) const;
|
void parseFromCapabilities(const QString &input) const;
|
||||||
|
|
||||||
|
// Note: New items here need also be handled in CMakeToolItemModel::apply()
|
||||||
|
// FIXME: Use a saner approach.
|
||||||
Utils::Id m_id;
|
Utils::Id m_id;
|
||||||
QString m_displayName;
|
QString m_displayName;
|
||||||
Utils::FilePath m_executable;
|
Utils::FilePath m_executable;
|
||||||
|
@@ -184,14 +184,14 @@ void CMakeToolManager::autoDetectCMakeForDevice(const FilePath &deviceRoot,
|
|||||||
const QString &detectionSource,
|
const QString &detectionSource,
|
||||||
QString *logMessage)
|
QString *logMessage)
|
||||||
{
|
{
|
||||||
QStringList messages;
|
QStringList messages{tr("Searching CMake binaries...")};
|
||||||
const FilePaths candidates = {FilePath::fromString("cmake").onDevice(deviceRoot)};
|
const FilePaths candidates = {FilePath::fromString("cmake").onDevice(deviceRoot)};
|
||||||
const Environment env = deviceRoot.deviceEnvironment();
|
const Environment env = deviceRoot.deviceEnvironment();
|
||||||
for (const FilePath &candidate : candidates) {
|
for (const FilePath &candidate : candidates) {
|
||||||
const FilePath cmake = candidate.searchOnDevice(env.path());
|
const FilePath cmake = candidate.searchOnDevice(env.path());
|
||||||
if (!cmake.isEmpty()) {
|
if (!cmake.isEmpty()) {
|
||||||
registerCMakeByPath(cmake, detectionSource);
|
registerCMakeByPath(cmake, detectionSource);
|
||||||
messages.append(tr("Found CMake binary: %1").arg(cmake.toUserOutput()));
|
messages.append(tr("Found \"%1\"").arg(cmake.toUserOutput()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (logMessage)
|
if (logMessage)
|
||||||
@@ -209,11 +209,28 @@ void CMakeToolManager::registerCMakeByPath(const FilePath &cmakePath, const QStr
|
|||||||
|
|
||||||
auto newTool = std::make_unique<CMakeTool>(CMakeTool::ManualDetection, id);
|
auto newTool = std::make_unique<CMakeTool>(CMakeTool::ManualDetection, id);
|
||||||
newTool->setFilePath(cmakePath);
|
newTool->setFilePath(cmakePath);
|
||||||
newTool->setDisplayName(cmakePath.toUserOutput());
|
|
||||||
newTool->setDetectionSource(detectionSource);
|
newTool->setDetectionSource(detectionSource);
|
||||||
|
newTool->setDisplayName(cmakePath.toUserOutput());
|
||||||
registerCMakeTool(std::move(newTool));
|
registerCMakeTool(std::move(newTool));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CMakeToolManager::removeDetectedCMake(const QString &detectionSource, QString *logMessage)
|
||||||
|
{
|
||||||
|
QStringList logMessages{tr("Removing CMake entries...")};
|
||||||
|
while (true) {
|
||||||
|
auto toRemove = Utils::take(d->m_cmakeTools, Utils::equal(&CMakeTool::detectionSource, detectionSource));
|
||||||
|
if (!toRemove.has_value())
|
||||||
|
break;
|
||||||
|
logMessages.append(tr("Removed \"%1\"").arg((*toRemove)->displayName()));
|
||||||
|
emit m_instance->cmakeRemoved((*toRemove)->id());
|
||||||
|
}
|
||||||
|
|
||||||
|
ensureDefaultCMakeToolIsValid();
|
||||||
|
updateDocumentation();
|
||||||
|
if (logMessage)
|
||||||
|
*logMessage = logMessages.join('\n');
|
||||||
|
}
|
||||||
|
|
||||||
void CMakeToolManager::notifyAboutUpdate(CMakeTool *tool)
|
void CMakeToolManager::notifyAboutUpdate(CMakeTool *tool)
|
||||||
{
|
{
|
||||||
if (!tool || !Utils::contains(d->m_cmakeTools, tool))
|
if (!tool || !Utils::contains(d->m_cmakeTools, tool))
|
||||||
|
@@ -68,6 +68,7 @@ public slots:
|
|||||||
QString *logMessage);
|
QString *logMessage);
|
||||||
void registerCMakeByPath(const Utils::FilePath &cmakePath,
|
void registerCMakeByPath(const Utils::FilePath &cmakePath,
|
||||||
const QString &detectionSource);
|
const QString &detectionSource);
|
||||||
|
void removeDetectedCMake(const QString &detectionSource, QString *logMessage);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void cmakeAdded (const Utils::Id &id);
|
void cmakeAdded (const Utils::Id &id);
|
||||||
|
@@ -92,7 +92,9 @@ public:
|
|||||||
QVariant registerDebugger(const DebuggerItem &item);
|
QVariant registerDebugger(const DebuggerItem &item);
|
||||||
void readDebuggers(const FilePath &fileName, bool isSystem);
|
void readDebuggers(const FilePath &fileName, bool isSystem);
|
||||||
void autoDetectCdbDebuggers();
|
void autoDetectCdbDebuggers();
|
||||||
void autoDetectGdbOrLldbDebuggers(const FilePath &deviceRoot, const QString &detectionSource);
|
void autoDetectGdbOrLldbDebuggers(const FilePath &deviceRoot,
|
||||||
|
const QString &detectionSource,
|
||||||
|
QString *logMessage = nullptr);
|
||||||
void autoDetectUvscDebuggers();
|
void autoDetectUvscDebuggers();
|
||||||
QString uniqueDisplayName(const QString &base);
|
QString uniqueDisplayName(const QString &base);
|
||||||
|
|
||||||
@@ -715,7 +717,8 @@ static Utils::FilePaths searchGdbPathsFromRegistry()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerItemManagerPrivate::autoDetectGdbOrLldbDebuggers(const FilePath &deviceRoot,
|
void DebuggerItemManagerPrivate::autoDetectGdbOrLldbDebuggers(const FilePath &deviceRoot,
|
||||||
const QString &detectionSource)
|
const QString &detectionSource,
|
||||||
|
QString *logMessage)
|
||||||
{
|
{
|
||||||
const QStringList filters = {"gdb-i686-pc-mingw32", "gdb-i686-pc-mingw32.exe", "gdb",
|
const QStringList filters = {"gdb-i686-pc-mingw32", "gdb-i686-pc-mingw32.exe", "gdb",
|
||||||
"gdb.exe", "lldb", "lldb.exe", "lldb-[1-9]*",
|
"gdb.exe", "lldb", "lldb.exe", "lldb-[1-9]*",
|
||||||
@@ -773,6 +776,7 @@ void DebuggerItemManagerPrivate::autoDetectGdbOrLldbDebuggers(const FilePath &de
|
|||||||
suspects.append(device->directoryEntries(globalPath, filters, QDir::Files | QDir::Executable));
|
suspects.append(device->directoryEntries(globalPath, filters, QDir::Files | QDir::Executable));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QStringList logMessages{tr("Searching debuggers...")};
|
||||||
for (const FilePath &command : qAsConst(suspects)) {
|
for (const FilePath &command : qAsConst(suspects)) {
|
||||||
const auto commandMatches = [command](const DebuggerTreeItem *titem) {
|
const auto commandMatches = [command](const DebuggerTreeItem *titem) {
|
||||||
return titem->m_item.command() == command;
|
return titem->m_item.command() == command;
|
||||||
@@ -796,7 +800,10 @@ void DebuggerItemManagerPrivate::autoDetectGdbOrLldbDebuggers(const FilePath &de
|
|||||||
const QString name = detectionSource.isEmpty() ? tr("System %1 at %2") : tr("Detected %1 at %2");
|
const QString name = detectionSource.isEmpty() ? tr("System %1 at %2") : tr("Detected %1 at %2");
|
||||||
item.setUnexpandedDisplayName(name.arg(item.engineTypeName()).arg(command.toUserOutput()));
|
item.setUnexpandedDisplayName(name.arg(item.engineTypeName()).arg(command.toUserOutput()));
|
||||||
m_model->addDebugger(item);
|
m_model->addDebugger(item);
|
||||||
|
logMessages.append(tr("Found: \"%1\"").arg(name));
|
||||||
}
|
}
|
||||||
|
if (logMessage)
|
||||||
|
*logMessage = logMessages.join('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerItemManagerPrivate::autoDetectUvscDebuggers()
|
void DebuggerItemManagerPrivate::autoDetectUvscDebuggers()
|
||||||
@@ -1030,9 +1037,31 @@ void DebuggerItemManager::deregisterDebugger(const QVariant &id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerItemManager::autoDetectDebuggersForDevice(const FilePath &deviceRoot,
|
void DebuggerItemManager::autoDetectDebuggersForDevice(const FilePath &deviceRoot,
|
||||||
const QString &detectionSource)
|
const QString &detectionSource,
|
||||||
|
QString *logMessage)
|
||||||
{
|
{
|
||||||
d->autoDetectGdbOrLldbDebuggers(deviceRoot, detectionSource);
|
d->autoDetectGdbOrLldbDebuggers(deviceRoot, detectionSource, logMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DebuggerItemManager::removeDetectedDebuggers(const QString &detectionSource,
|
||||||
|
QString *logMessage)
|
||||||
|
{
|
||||||
|
QStringList logMessages{tr("Removing debugger entries...")};
|
||||||
|
d->m_model->forItemsAtLevel<2>([detectionSource, &logMessages](DebuggerTreeItem *titem) {
|
||||||
|
if (titem->m_item.detectionSource() == detectionSource) {
|
||||||
|
logMessages.append(tr("Removed \"%1\"").arg(titem->m_item.displayName()));
|
||||||
|
d->m_model->destroyItem(titem);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// FIXME: These items appeared in early docker development. Ok to remove for Creator 7.0.
|
||||||
|
FilePath filePath = titem->m_item.command();
|
||||||
|
if (filePath.scheme() + ':' + filePath.host() == detectionSource) {
|
||||||
|
logMessages.append(tr("Removed \"%1\"").arg(titem->m_item.displayName()));
|
||||||
|
d->m_model->destroyItem(titem);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (logMessage)
|
||||||
|
*logMessage = logMessages.join('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Debugger
|
} // namespace Debugger
|
||||||
|
@@ -53,7 +53,9 @@ public:
|
|||||||
static void deregisterDebugger(const QVariant &id);
|
static void deregisterDebugger(const QVariant &id);
|
||||||
|
|
||||||
static void autoDetectDebuggersForDevice(const Utils::FilePath &deviceRoot,
|
static void autoDetectDebuggersForDevice(const Utils::FilePath &deviceRoot,
|
||||||
const QString &detectionSource);
|
const QString &detectionSource,
|
||||||
|
QString *logMessage);
|
||||||
|
static void removeDetectedDebuggers(const QString &detectionSource, QString *logMessage);
|
||||||
|
|
||||||
static const DebuggerItem *findByCommand(const Utils::FilePath &command);
|
static const DebuggerItem *findByCommand(const Utils::FilePath &command);
|
||||||
static const DebuggerItem *findById(const QVariant &id);
|
static const DebuggerItem *findById(const QVariant &id);
|
||||||
|
@@ -724,6 +724,7 @@ DebuggerPluginPrivate::DebuggerPluginPrivate(const QStringList &arguments)
|
|||||||
{
|
{
|
||||||
qRegisterMetaType<ContextData>("ContextData");
|
qRegisterMetaType<ContextData>("ContextData");
|
||||||
qRegisterMetaType<DebuggerRunParameters>("DebuggerRunParameters");
|
qRegisterMetaType<DebuggerRunParameters>("DebuggerRunParameters");
|
||||||
|
qRegisterMetaType<QString *>();
|
||||||
|
|
||||||
// Menu groups
|
// Menu groups
|
||||||
ActionContainer *mstart = ActionManager::actionContainer(PE::M_DEBUG_STARTDEBUGGING);
|
ActionContainer *mstart = ActionManager::actionContainer(PE::M_DEBUG_STARTDEBUGGING);
|
||||||
@@ -1747,9 +1748,15 @@ void DebuggerPlugin::getEnginesState(QByteArray *json) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerPlugin::autoDetectDebuggersForDevice(const FilePath &deviceRoot,
|
void DebuggerPlugin::autoDetectDebuggersForDevice(const FilePath &deviceRoot,
|
||||||
const QString &detectionId)
|
const QString &detectionSource,
|
||||||
|
QString *logMessage)
|
||||||
{
|
{
|
||||||
dd->m_debuggerItemManager.autoDetectDebuggersForDevice(deviceRoot, detectionId);
|
dd->m_debuggerItemManager.autoDetectDebuggersForDevice(deviceRoot, detectionSource, logMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DebuggerPlugin::removeDetectedDebuggers(const QString &detectionSource, QString *logMessage)
|
||||||
|
{
|
||||||
|
dd->m_debuggerItemManager.removeDetectedDebuggers(detectionSource, logMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerPluginPrivate::attachToQmlPort()
|
void DebuggerPluginPrivate::attachToQmlPort()
|
||||||
|
@@ -59,10 +59,15 @@ private:
|
|||||||
Q_SLOT void getEnginesState(QByteArray *json) const;
|
Q_SLOT void getEnginesState(QByteArray *json) const;
|
||||||
|
|
||||||
// Called from DockerDevice
|
// Called from DockerDevice
|
||||||
Q_SLOT void autoDetectDebuggersForDevice(const Utils::FilePath &deviceRoot, const QString &detectionId);
|
Q_SLOT void autoDetectDebuggersForDevice(const Utils::FilePath &deviceRoot,
|
||||||
|
const QString &detectionId,
|
||||||
|
QString *logMessage);
|
||||||
|
Q_SLOT void removeDetectedDebuggers(const QString &detectionId, QString *logMessage);
|
||||||
|
|
||||||
QVector<QObject *> createTestObjects() const override;
|
QVector<QObject *> createTestObjects() const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Debugger
|
} // namespace Debugger
|
||||||
|
|
||||||
|
Q_DECLARE_METATYPE(QString *)
|
||||||
|
@@ -471,26 +471,54 @@ DockerDeviceData &DockerDevice::data()
|
|||||||
|
|
||||||
void KitDetectorPrivate::undoAutoDetect() const
|
void KitDetectorPrivate::undoAutoDetect() const
|
||||||
{
|
{
|
||||||
|
emit q->logOutput(tr("Start removing auto-detected items associated with this docker image."));
|
||||||
|
|
||||||
|
emit q->logOutput('\n' + tr("Removing kits..."));
|
||||||
for (Kit *kit : KitManager::kits()) {
|
for (Kit *kit : KitManager::kits()) {
|
||||||
if (kit->autoDetectionSource() == m_sharedId) {
|
if (kit->autoDetectionSource() == m_sharedId) {
|
||||||
emit q->logOutput(tr("Removing kit: %1").arg(kit->displayName()));
|
emit q->logOutput(tr("Removed \"%1\"").arg(kit->displayName()));
|
||||||
KitManager::deregisterKit(kit);
|
KitManager::deregisterKit(kit);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
emit q->logOutput('\n' + tr("Removing Qt version entries..."));
|
||||||
for (BaseQtVersion *qtVersion : QtVersionManager::versions()) {
|
for (BaseQtVersion *qtVersion : QtVersionManager::versions()) {
|
||||||
if (qtVersion->detectionSource() == m_sharedId) {
|
if (qtVersion->detectionSource() == m_sharedId) {
|
||||||
emit q->logOutput(tr("Removing Qt version: %1").arg(qtVersion->displayName()));
|
emit q->logOutput(tr("Removed \"%1\"").arg(qtVersion->displayName()));
|
||||||
QtVersionManager::removeVersion(qtVersion);
|
QtVersionManager::removeVersion(qtVersion);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
emit q->logOutput(tr("Tool chains not removed."));
|
emit q->logOutput('\n' + tr("Removing toolchain entries..."));
|
||||||
// for (ToolChain *toolChain : ToolChainManager::toolChains()) {
|
for (ToolChain *toolChain : ToolChainManager::toolChains()) {
|
||||||
// if (toolChain->autoDetectionSource() == id.toString())
|
QString detectionSource = toolChain->detectionSource();
|
||||||
// // FIXME: Implement
|
if (toolChain->detectionSource() == m_sharedId) {
|
||||||
// };
|
emit q->logOutput(tr("Removed \"%1\"").arg(toolChain->displayName()));
|
||||||
|
ToolChainManager::deregisterToolChain(toolChain);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
emit q->logOutput(tr("Removal of previously auto-detected kit items finished.") + '\n');
|
if (QObject *cmakeManager = ExtensionSystem::PluginManager::getObjectByName("CMakeToolManager")) {
|
||||||
|
QString logMessage;
|
||||||
|
const bool res = QMetaObject::invokeMethod(cmakeManager,
|
||||||
|
"removeDetectedCMake",
|
||||||
|
Q_ARG(QString, m_sharedId),
|
||||||
|
Q_ARG(QString *, &logMessage));
|
||||||
|
QTC_CHECK(res);
|
||||||
|
emit q->logOutput('\n' + logMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (QObject *debuggerPlugin = ExtensionSystem::PluginManager::getObjectByName("DebuggerPlugin")) {
|
||||||
|
QString logMessage;
|
||||||
|
const bool res = QMetaObject::invokeMethod(debuggerPlugin,
|
||||||
|
"removeDetectedDebuggers",
|
||||||
|
Q_ARG(QString, m_sharedId),
|
||||||
|
Q_ARG(QString *, &logMessage));
|
||||||
|
QTC_CHECK(res);
|
||||||
|
emit q->logOutput('\n' + logMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
emit q->logOutput('\n' + tr("Removal of previously auto-detected kit items finished.") + "\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<BaseQtVersion *> KitDetectorPrivate::autoDetectQtVersions() const
|
QList<BaseQtVersion *> KitDetectorPrivate::autoDetectQtVersions() const
|
||||||
@@ -510,7 +538,7 @@ QList<BaseQtVersion *> KitDetectorPrivate::autoDetectQtVersions() const
|
|||||||
continue;
|
continue;
|
||||||
qtVersions.append(qtVersion);
|
qtVersions.append(qtVersion);
|
||||||
QtVersionManager::addVersion(qtVersion);
|
QtVersionManager::addVersion(qtVersion);
|
||||||
emit q->logOutput(tr("Found Qt: %1").arg(qtVersion->qmakeFilePath().toUserOutput()));
|
emit q->logOutput(tr("Found \"%1\"").arg(qtVersion->qmakeFilePath().toUserOutput()));
|
||||||
}
|
}
|
||||||
if (qtVersions.isEmpty())
|
if (qtVersions.isEmpty())
|
||||||
emit q->logOutput(tr("No Qt installation found."));
|
emit q->logOutput(tr("No Qt installation found."));
|
||||||
@@ -521,21 +549,24 @@ QList<ToolChain *> KitDetectorPrivate::autoDetectToolChains()
|
|||||||
{
|
{
|
||||||
const QList<ToolChainFactory *> factories = ToolChainFactory::allToolChainFactories();
|
const QList<ToolChainFactory *> factories = ToolChainFactory::allToolChainFactories();
|
||||||
|
|
||||||
QList<ToolChain *> toolChains;
|
QList<ToolChain *> alreadyKnown = ToolChainManager::toolChains();
|
||||||
|
QList<ToolChain *> allNewToolChains;
|
||||||
QApplication::processEvents();
|
QApplication::processEvents();
|
||||||
emit q->logOutput('\n' + tr("Searching toolchains..."));
|
emit q->logOutput('\n' + tr("Searching toolchains..."));
|
||||||
for (ToolChainFactory *factory : factories) {
|
for (ToolChainFactory *factory : factories) {
|
||||||
const QList<ToolChain *> newToolChains = factory->autoDetect(toolChains, m_device.constCast<IDevice>());
|
|
||||||
emit q->logOutput(tr("Searching toolchains of type %1").arg(factory->displayName()));
|
emit q->logOutput(tr("Searching toolchains of type %1").arg(factory->displayName()));
|
||||||
|
const QList<ToolChain *> newToolChains = factory->autoDetect(alreadyKnown, m_device.constCast<IDevice>());
|
||||||
for (ToolChain *toolChain : newToolChains) {
|
for (ToolChain *toolChain : newToolChains) {
|
||||||
emit q->logOutput(tr("Found tool chain: %1").arg(toolChain->compilerCommand().toUserOutput()));
|
emit q->logOutput(tr("Found \"%1\"").arg(toolChain->compilerCommand().toUserOutput()));
|
||||||
|
toolChain->setDetectionSource(m_sharedId);
|
||||||
ToolChainManager::registerToolChain(toolChain);
|
ToolChainManager::registerToolChain(toolChain);
|
||||||
toolChains.append(toolChain);
|
alreadyKnown.append(toolChain);
|
||||||
}
|
}
|
||||||
|
allNewToolChains.append(newToolChains);
|
||||||
}
|
}
|
||||||
emit q->logOutput(tr("%1 new tool chains found.").arg(toolChains.size()));
|
emit q->logOutput(tr("%1 new toolchains found.").arg(allNewToolChains.size()));
|
||||||
|
|
||||||
return toolChains;
|
return allNewToolChains;
|
||||||
}
|
}
|
||||||
|
|
||||||
void KitDetectorPrivate::autoDetectCMake()
|
void KitDetectorPrivate::autoDetectCMake()
|
||||||
@@ -544,16 +575,15 @@ void KitDetectorPrivate::autoDetectCMake()
|
|||||||
if (!cmakeManager)
|
if (!cmakeManager)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
emit q->logOutput('\n' + tr("Searching CMake binary..."));
|
|
||||||
const FilePath deviceRoot = m_device->mapToGlobalPath({});
|
const FilePath deviceRoot = m_device->mapToGlobalPath({});
|
||||||
QString error;
|
QString logMessage;
|
||||||
const bool res = QMetaObject::invokeMethod(cmakeManager,
|
const bool res = QMetaObject::invokeMethod(cmakeManager,
|
||||||
"autoDetectCMakeForDevice",
|
"autoDetectCMakeForDevice",
|
||||||
Q_ARG(Utils::FilePath, deviceRoot),
|
Q_ARG(Utils::FilePath, deviceRoot),
|
||||||
Q_ARG(QString, m_sharedId),
|
Q_ARG(QString, m_sharedId),
|
||||||
Q_ARG(QString *, &error));
|
Q_ARG(QString *, &logMessage));
|
||||||
QTC_CHECK(res);
|
QTC_CHECK(res);
|
||||||
emit q->logOutput(error);
|
emit q->logOutput('\n' + logMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KitDetectorPrivate::autoDetectDebugger()
|
void KitDetectorPrivate::autoDetectDebugger()
|
||||||
@@ -562,13 +592,15 @@ void KitDetectorPrivate::autoDetectDebugger()
|
|||||||
if (!debuggerPlugin)
|
if (!debuggerPlugin)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
emit q->logOutput('\n' + tr("Searching debuggers..."));
|
|
||||||
const FilePath deviceRoot = m_device->mapToGlobalPath({});
|
const FilePath deviceRoot = m_device->mapToGlobalPath({});
|
||||||
|
QString logMessage;
|
||||||
const bool res = QMetaObject::invokeMethod(debuggerPlugin,
|
const bool res = QMetaObject::invokeMethod(debuggerPlugin,
|
||||||
"autoDetectDebuggersForDevice",
|
"autoDetectDebuggersForDevice",
|
||||||
Q_ARG(Utils::FilePath, deviceRoot),
|
Q_ARG(Utils::FilePath, deviceRoot),
|
||||||
Q_ARG(QString, m_sharedId));
|
Q_ARG(QString, m_sharedId),
|
||||||
|
Q_ARG(QString *, &logMessage));
|
||||||
QTC_CHECK(res);
|
QTC_CHECK(res);
|
||||||
|
emit q->logOutput('\n' + logMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KitDetectorPrivate::autoDetect()
|
void KitDetectorPrivate::autoDetect()
|
||||||
|
Reference in New Issue
Block a user