2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2012-09-18 15:58:07 +02:00
|
|
|
**
|
2016-01-15 14:57:14 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2012-09-18 15:58:07 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2012-09-18 15:58:07 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** 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
|
2016-01-15 14:57:14 +01:00
|
|
|
** 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.
|
2012-09-18 15:58:07 +02:00
|
|
|
**
|
2016-01-15 14:57:14 +01:00
|
|
|
** 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.
|
2012-09-18 15:58:07 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2012-09-18 15:58:07 +02:00
|
|
|
|
|
|
|
|
#include "addkitoperation.h"
|
|
|
|
|
|
2016-11-17 14:07:03 +01:00
|
|
|
#include "addcmakeoperation.h"
|
2012-09-18 15:58:07 +02:00
|
|
|
#include "addkeysoperation.h"
|
2014-03-04 11:06:51 +01:00
|
|
|
#include "addtoolchainoperation.h"
|
|
|
|
|
#include "addqtoperation.h"
|
|
|
|
|
#include "adddeviceoperation.h"
|
2012-09-18 15:58:07 +02:00
|
|
|
#include "findkeyoperation.h"
|
|
|
|
|
#include "findvalueoperation.h"
|
|
|
|
|
#include "getoperation.h"
|
|
|
|
|
#include "rmkeysoperation.h"
|
|
|
|
|
|
|
|
|
|
#include "settings.h"
|
|
|
|
|
|
2016-01-19 14:21:28 +01:00
|
|
|
#include <QDir>
|
2014-04-03 16:43:01 +02:00
|
|
|
#include <QRegExp>
|
|
|
|
|
|
2012-09-18 15:58:07 +02:00
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
|
|
// Qt version file stuff:
|
2013-10-29 16:44:24 +01:00
|
|
|
const char PREFIX[] = "Profile.";
|
|
|
|
|
const char VERSION[] = "Version";
|
|
|
|
|
const char COUNT[] = "Profile.Count";
|
|
|
|
|
const char DEFAULT[] = "Profile.Default";
|
2012-09-18 15:58:07 +02:00
|
|
|
|
|
|
|
|
// Kit:
|
2013-10-29 16:44:24 +01:00
|
|
|
const char ID[] = "PE.Profile.Id";
|
|
|
|
|
const char DISPLAYNAME[] = "PE.Profile.Name";
|
|
|
|
|
const char ICON[] = "PE.Profile.Icon";
|
2014-07-02 11:58:09 +03:00
|
|
|
const char AUTODETECTED[] = "PE.Profile.AutoDetected";
|
2013-10-29 16:44:24 +01:00
|
|
|
const char SDK[] = "PE.Profile.SDK";
|
2015-04-30 12:55:26 +02:00
|
|
|
const char ENV[] = "PE.Profile.Environment";
|
2013-10-29 16:44:24 +01:00
|
|
|
const char DATA[] = "PE.Profile.Data";
|
2012-09-18 15:58:07 +02:00
|
|
|
|
|
|
|
|
// Standard KitInformation:
|
2013-10-29 16:44:24 +01:00
|
|
|
const char DEBUGGER[] = "Debugger.Information";
|
|
|
|
|
const char DEBUGGER_ENGINE[] = "EngineType";
|
|
|
|
|
const char DEBUGGER_BINARY[] = "Binary";
|
|
|
|
|
const char DEVICE_TYPE[] = "PE.Profile.DeviceType";
|
2014-03-04 14:11:12 +01:00
|
|
|
const char DEVICE_ID[] = "PE.Profile.Device";
|
2013-10-29 16:44:24 +01:00
|
|
|
const char SYSROOT[] = "PE.Profile.SysRoot";
|
2016-07-15 11:52:13 +02:00
|
|
|
const char TOOLCHAIN[] = "PE.Profile.ToolChains";
|
2013-10-29 16:44:24 +01:00
|
|
|
const char MKSPEC[] = "QtPM4.mkSpecInformation";
|
|
|
|
|
const char QT[] = "QtSupport.QtInformation";
|
2016-11-17 14:07:03 +01:00
|
|
|
const char CMAKE_ID[] = "CMakeProjectManager.CMakeKitInformation";
|
|
|
|
|
const char CMAKE_GENERATOR[] = "CMake.GeneratorKitInformation";
|
|
|
|
|
const char CMAKE_CONFIGURATION[] = "CMake.ConfigurationKitInformation";
|
2012-09-18 15:58:07 +02:00
|
|
|
|
|
|
|
|
QString AddKitOperation::name() const
|
|
|
|
|
{
|
2016-07-20 10:58:54 +02:00
|
|
|
return QString("addKit");
|
2012-09-18 15:58:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString AddKitOperation::helpText() const
|
|
|
|
|
{
|
2017-08-29 11:48:48 +02:00
|
|
|
return QString("add a Kit");
|
2012-09-18 15:58:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString AddKitOperation::argumentsHelpText() const
|
|
|
|
|
{
|
2016-07-20 10:58:54 +02:00
|
|
|
return QString(
|
|
|
|
|
" --id <ID> id of the new kit (required).\n"
|
2016-07-15 12:42:00 +02:00
|
|
|
" --name <NAME> display name of the new kit (required).\n"
|
|
|
|
|
" --icon <PATH> icon of the new kit.\n"
|
|
|
|
|
" --debuggerid <ID> the id of the debugger to use.\n"
|
|
|
|
|
" (not compatible with --debugger and --debuggerengine)\n"
|
|
|
|
|
" --debuggerengine <ENGINE> debuggerengine of the new kit.\n"
|
|
|
|
|
" --debugger <PATH> debugger of the new kit.\n"
|
|
|
|
|
" --devicetype <TYPE> device type of the new kit (required).\n"
|
|
|
|
|
" --device <ID> device id to use (optional).\n"
|
|
|
|
|
" --sysroot <PATH> sysroot of the new kit.\n"
|
2016-07-22 10:55:43 +02:00
|
|
|
" --toolchain <ID> tool chain of the new kit (obsolete!).\n"
|
|
|
|
|
" --<LANG>toolchain <ID> tool chain for a language.\n"
|
2016-07-15 12:42:00 +02:00
|
|
|
" --qt <ID> Qt of the new kit.\n"
|
|
|
|
|
" --mkspec <PATH> mkspec of the new kit.\n"
|
|
|
|
|
" --env <VALUE> add a custom environment setting. [may be repeated]\n"
|
2016-11-17 14:07:03 +01:00
|
|
|
" --cmake <ID> set a cmake tool.\n"
|
|
|
|
|
" --cmake-generator <GEN>:<EXTRA>:<TOOLSET>:<PLATFORM>\n"
|
|
|
|
|
" set a cmake generator.\n"
|
|
|
|
|
" --cmake-config <KEY:TYPE=VALUE> set a cmake configuration value [may be repeated]\n"
|
2016-07-20 10:58:54 +02:00
|
|
|
" <KEY> <TYPE:VALUE> extra key value pairs\n");
|
2012-09-18 15:58:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool AddKitOperation::setArguments(const QStringList &args)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < args.count(); ++i) {
|
|
|
|
|
const QString current = args.at(i);
|
|
|
|
|
const QString next = ((i + 1) < args.count()) ? args.at(i + 1) : QString();
|
|
|
|
|
|
2016-07-15 12:42:00 +02:00
|
|
|
if (current == "--id") {
|
2012-09-18 15:58:07 +02:00
|
|
|
if (next.isNull())
|
|
|
|
|
return false;
|
|
|
|
|
++i; // skip next;
|
|
|
|
|
m_id = next;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-15 12:42:00 +02:00
|
|
|
if (current == "--name") {
|
2012-09-18 15:58:07 +02:00
|
|
|
if (next.isNull())
|
|
|
|
|
return false;
|
|
|
|
|
++i; // skip next;
|
|
|
|
|
m_displayName = next;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-15 12:42:00 +02:00
|
|
|
if (current == "--icon") {
|
2012-09-18 15:58:07 +02:00
|
|
|
if (next.isNull())
|
|
|
|
|
return false;
|
|
|
|
|
++i; // skip next;
|
|
|
|
|
m_icon = next;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-15 12:42:00 +02:00
|
|
|
if (current == "--debuggerengine") {
|
2012-09-18 15:58:07 +02:00
|
|
|
if (next.isNull())
|
|
|
|
|
return false;
|
|
|
|
|
++i; // skip next;
|
|
|
|
|
bool ok;
|
|
|
|
|
m_debuggerEngine = next.toInt(&ok);
|
|
|
|
|
if (!ok) {
|
|
|
|
|
std::cerr << "Debugger type is not an integer!" << std::endl;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-15 12:42:00 +02:00
|
|
|
if (current == "--debuggerid") {
|
2013-10-29 16:40:57 +01:00
|
|
|
if (next.isNull())
|
|
|
|
|
return false;
|
|
|
|
|
++i; // skip next;
|
|
|
|
|
m_debuggerId = next;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-15 12:42:00 +02:00
|
|
|
if (current == "--debugger") {
|
2012-09-18 15:58:07 +02:00
|
|
|
if (next.isNull())
|
|
|
|
|
return false;
|
|
|
|
|
++i; // skip next;
|
|
|
|
|
m_debugger = next;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-15 12:42:00 +02:00
|
|
|
if (current == "--devicetype") {
|
2012-09-18 15:58:07 +02:00
|
|
|
if (next.isNull())
|
|
|
|
|
return false;
|
|
|
|
|
++i; // skip next;
|
|
|
|
|
m_deviceType = next;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-15 12:42:00 +02:00
|
|
|
if (current == "--device") {
|
2014-03-04 14:11:12 +01:00
|
|
|
if (next.isNull())
|
|
|
|
|
return false;
|
|
|
|
|
++i; // skip next;
|
|
|
|
|
m_device = next;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-15 12:42:00 +02:00
|
|
|
if (current == "--sysroot") {
|
2012-09-18 15:58:07 +02:00
|
|
|
if (next.isNull())
|
|
|
|
|
return false;
|
|
|
|
|
++i; // skip next;
|
2016-01-19 14:21:28 +01:00
|
|
|
m_sysRoot = QDir::fromNativeSeparators(next);
|
2012-09-18 15:58:07 +02:00
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-22 10:55:43 +02:00
|
|
|
if (current.startsWith("--") && current.endsWith("toolchain")) {
|
2012-09-18 15:58:07 +02:00
|
|
|
if (next.isNull())
|
|
|
|
|
return false;
|
|
|
|
|
++i; // skip next;
|
2016-07-15 11:52:13 +02:00
|
|
|
|
2016-07-22 10:55:43 +02:00
|
|
|
const QString tmp = current.mid(2);
|
|
|
|
|
const QString tmp2 = tmp.mid(0, tmp.count() - 9 /* toolchain */);
|
|
|
|
|
const QString lang = tmp2.isEmpty() ? QString("Cxx") : tmp2;
|
|
|
|
|
|
2016-07-15 11:52:13 +02:00
|
|
|
if (next.isEmpty()) {
|
|
|
|
|
std::cerr << "Empty langid for toolchain given." << std::endl << std::endl;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2016-07-22 10:55:43 +02:00
|
|
|
if (m_tcs.contains(lang)) {
|
2016-07-15 11:52:13 +02:00
|
|
|
std::cerr << "No langid for toolchain given twice." << std::endl << std::endl;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2016-07-22 10:55:43 +02:00
|
|
|
m_tcs.insert(lang, next);
|
2012-09-18 15:58:07 +02:00
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-15 12:42:00 +02:00
|
|
|
if (current == "--qt") {
|
2012-09-18 15:58:07 +02:00
|
|
|
if (next.isNull())
|
|
|
|
|
return false;
|
|
|
|
|
++i; // skip next;
|
|
|
|
|
m_qt = next;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-15 12:42:00 +02:00
|
|
|
if (current == "--mkspec") {
|
2012-09-18 15:58:07 +02:00
|
|
|
if (next.isNull())
|
|
|
|
|
return false;
|
|
|
|
|
++i; // skip next;
|
|
|
|
|
m_mkspec = next;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-15 12:42:00 +02:00
|
|
|
if (current == "--env") {
|
2015-04-30 12:55:26 +02:00
|
|
|
if (next.isNull())
|
|
|
|
|
return false;
|
|
|
|
|
++i; // skip next;
|
|
|
|
|
m_env.append(next);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2016-11-17 14:07:03 +01:00
|
|
|
if (current == "--cmake") {
|
|
|
|
|
if (next.isNull())
|
|
|
|
|
return false;
|
|
|
|
|
++i;
|
|
|
|
|
m_cmakeId = next;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (current == "--cmake-generator") {
|
|
|
|
|
if (next.isNull())
|
|
|
|
|
return false;
|
|
|
|
|
++i;
|
|
|
|
|
QStringList parts = next.split(':');
|
|
|
|
|
m_cmakeGenerator = parts.count() >= 1 ? parts.at(0) : QString();
|
|
|
|
|
m_cmakeExtraGenerator = parts.count() >= 2 ? parts.at(1) : QString();
|
|
|
|
|
m_cmakeGeneratorToolset = parts.count() >= 3 ? parts.at(2) : QString();
|
|
|
|
|
m_cmakeGeneratorPlatform = parts.count() >= 4 ? parts.at(3) : QString();
|
|
|
|
|
if (parts.count() > 4)
|
|
|
|
|
return false;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (current == "--cmake-config") {
|
|
|
|
|
if (next.isNull())
|
|
|
|
|
return false;
|
|
|
|
|
++i;
|
|
|
|
|
m_cmakeConfiguration.append(next);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 15:58:07 +02:00
|
|
|
if (next.isNull())
|
|
|
|
|
return false;
|
|
|
|
|
++i; // skip next;
|
|
|
|
|
KeyValuePair pair(current, next);
|
|
|
|
|
if (!pair.value.isValid())
|
|
|
|
|
return false;
|
|
|
|
|
m_extra << pair;
|
|
|
|
|
}
|
|
|
|
|
|
2013-02-07 10:42:24 +01:00
|
|
|
if (m_id.isEmpty())
|
|
|
|
|
std::cerr << "No id given for kit." << std::endl << std::endl;
|
|
|
|
|
if (m_displayName.isEmpty())
|
|
|
|
|
std::cerr << "No name given for kit." << std::endl << std::endl;
|
|
|
|
|
if (m_deviceType.isEmpty())
|
|
|
|
|
std::cerr << "No devicetype given for kit." << std::endl << std::endl;
|
2013-10-29 16:40:57 +01:00
|
|
|
if (!m_debuggerId.isEmpty() && (!m_debugger.isEmpty() || m_debuggerEngine != 0)) {
|
|
|
|
|
std::cerr << "Can not set both debugger id and debugger/debuggerengine." << std::endl << std::endl;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2013-02-07 10:42:24 +01:00
|
|
|
|
2012-09-18 15:58:07 +02:00
|
|
|
return !m_id.isEmpty() && !m_displayName.isEmpty() && !m_deviceType.isEmpty();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int AddKitOperation::execute() const
|
|
|
|
|
{
|
2016-07-15 12:42:00 +02:00
|
|
|
QVariantMap map = load("Profiles");
|
2012-09-18 15:58:07 +02:00
|
|
|
if (map.isEmpty())
|
|
|
|
|
map = initializeKits();
|
|
|
|
|
|
2014-03-04 14:11:12 +01:00
|
|
|
QVariantMap result = addKit(map, m_id, m_displayName, m_icon, m_debuggerId, m_debuggerEngine,
|
2016-07-15 11:52:13 +02:00
|
|
|
m_debugger, m_deviceType, m_device, m_sysRoot, m_tcs, m_qt,
|
2016-11-17 14:07:03 +01:00
|
|
|
m_mkspec, m_cmakeId, m_cmakeGenerator, m_cmakeExtraGenerator,
|
|
|
|
|
m_cmakeGeneratorToolset, m_cmakeGeneratorPlatform, m_cmakeConfiguration,
|
|
|
|
|
m_env, m_extra);
|
2012-09-18 15:58:07 +02:00
|
|
|
|
2013-05-16 15:47:47 +02:00
|
|
|
if (result.isEmpty() || map == result)
|
2013-07-08 08:35:18 +02:00
|
|
|
return 2;
|
2012-09-18 15:58:07 +02:00
|
|
|
|
2016-07-15 12:42:00 +02:00
|
|
|
return save(result, "Profiles") ? 0 : 3;
|
2012-09-18 15:58:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef WITH_TESTS
|
|
|
|
|
bool AddKitOperation::test() const
|
|
|
|
|
{
|
|
|
|
|
QVariantMap map = initializeKits();
|
|
|
|
|
|
2014-03-04 11:06:51 +01:00
|
|
|
QVariantMap tcMap = AddToolChainOperation::initializeToolChains();
|
2016-07-15 11:52:13 +02:00
|
|
|
tcMap = AddToolChainOperation::addToolChain(tcMap, "{tc-id}", "langId", "TC", "/usr/bin/gcc",
|
2016-07-15 12:42:00 +02:00
|
|
|
"x86-linux-generic-elf-32bit",
|
|
|
|
|
"x86-linux-generic-elf-32bit",
|
2014-03-04 11:06:51 +01:00
|
|
|
KeyValuePairList());
|
|
|
|
|
|
|
|
|
|
QVariantMap qtMap = AddQtOperation::initializeQtVersions();
|
2016-07-15 12:42:00 +02:00
|
|
|
qtMap = AddQtOperation::addQt(qtMap, "{qt-id}", "Qt", "desktop-qt", "/usr/bin/qmake",
|
2018-06-21 14:40:12 +02:00
|
|
|
KeyValuePairList(), {});
|
2014-03-04 11:06:51 +01:00
|
|
|
|
|
|
|
|
QVariantMap devMap = AddDeviceOperation::initializeDevices();
|
2016-07-15 12:42:00 +02:00
|
|
|
devMap = AddDeviceOperation::addDevice(devMap, "{dev-id}", "Dev", 0, 0,
|
|
|
|
|
"HWplatform", "SWplatform",
|
|
|
|
|
"localhost", "10000-11000",
|
|
|
|
|
"localhost", "", 42,
|
|
|
|
|
"desktop", "", 22, 10000,
|
|
|
|
|
"uname", 1,
|
2014-03-04 11:06:51 +01:00
|
|
|
KeyValuePairList());
|
|
|
|
|
|
2017-02-22 15:09:35 +01:00
|
|
|
const QStringList env = {"TEST=1", "PATH"};
|
2015-04-30 12:55:26 +02:00
|
|
|
|
2012-09-28 09:50:06 +02:00
|
|
|
if (map.count() != 3
|
2016-07-15 12:42:00 +02:00
|
|
|
|| !map.contains(VERSION) || map.value(VERSION).toInt() != 1
|
|
|
|
|
|| !map.contains(COUNT) || map.value(COUNT).toInt() != 0
|
|
|
|
|
|| !map.contains(DEFAULT) || !map.value(DEFAULT).toString().isEmpty())
|
2012-09-18 15:58:07 +02:00
|
|
|
return false;
|
|
|
|
|
|
2016-07-15 11:52:13 +02:00
|
|
|
QHash<QString, QString> tcs;
|
|
|
|
|
tcs.insert("Cxx", "{tcXX-id}");
|
|
|
|
|
|
2014-03-04 11:06:51 +01:00
|
|
|
// Fail if TC is not there:
|
2016-11-17 14:07:03 +01:00
|
|
|
QVariantMap empty = addKit(map, tcMap, qtMap, devMap, QVariantMap(),
|
2016-07-15 12:42:00 +02:00
|
|
|
"testId", "Test Kit", "/tmp/icon.png", QString(), 1,
|
|
|
|
|
"/usr/bin/gdb-test", "Desktop", "{dev-id}", QString(),
|
2016-11-17 14:07:03 +01:00
|
|
|
tcs, "{qt-id}", "unsupported/mkspec",
|
|
|
|
|
QString(), QString(), QString(), QString(), QString(), QStringList(),
|
|
|
|
|
QStringList(),
|
2017-02-22 15:09:35 +01:00
|
|
|
KeyValuePairList({KeyValuePair("PE.Profile.Data/extraData", QVariant("extraValue"))}));
|
2014-03-04 11:06:51 +01:00
|
|
|
if (!empty.isEmpty())
|
|
|
|
|
return false;
|
2014-04-03 16:43:01 +02:00
|
|
|
// Do not fail if TC is an ABI:
|
2016-07-15 11:52:13 +02:00
|
|
|
tcs.clear();
|
|
|
|
|
tcs.insert("C", "x86-linux-generic-elf-64bit");
|
2016-11-17 14:07:03 +01:00
|
|
|
empty = addKit(map, tcMap, qtMap, devMap, QVariantMap(),
|
|
|
|
|
"testId", "Test Kit", "/tmp/icon.png", QString(), 1,
|
2016-07-15 12:42:00 +02:00
|
|
|
"/usr/bin/gdb-test", "Desktop", "{dev-id}", QString(),
|
2016-11-17 14:07:03 +01:00
|
|
|
tcs, "{qt-id}", "unsupported/mkspec",
|
|
|
|
|
QString(), QString(), QString(), QString(), QString(), QStringList(), env,
|
2017-02-22 15:09:35 +01:00
|
|
|
KeyValuePairList({KeyValuePair("PE.Profile.Data/extraData", QVariant("extraValue"))}));
|
2014-04-03 16:43:01 +02:00
|
|
|
if (empty.isEmpty())
|
|
|
|
|
return false;
|
2014-04-07 11:11:17 +02:00
|
|
|
// QTCREATORBUG-11983, mach_o was not covered by the first attempt to fix this.
|
2016-07-15 11:52:13 +02:00
|
|
|
tcs.insert("D", "x86-macos-generic-mach_o-64bit");
|
2016-11-17 14:07:03 +01:00
|
|
|
empty = addKit(map, tcMap, qtMap, devMap, QVariantMap(),
|
|
|
|
|
"testId", "Test Kit", "/tmp/icon.png", QString(), 1,
|
2016-07-15 12:42:00 +02:00
|
|
|
"/usr/bin/gdb-test", "Desktop", "{dev-id}", QString(),
|
2016-11-17 14:07:03 +01:00
|
|
|
tcs, "{qt-id}", "unsupported/mkspec",
|
|
|
|
|
QString(), QString(), QString(), QString(), QString(), QStringList(), env,
|
2017-02-22 15:09:35 +01:00
|
|
|
KeyValuePairList({KeyValuePair("PE.Profile.Data/extraData", QVariant("extraValue"))}));
|
2014-04-07 11:11:17 +02:00
|
|
|
if (empty.isEmpty())
|
|
|
|
|
return false;
|
|
|
|
|
|
2016-07-15 11:52:13 +02:00
|
|
|
tcs.clear();
|
|
|
|
|
tcs.insert("Cxx", "{tc-id}");
|
|
|
|
|
|
2014-03-04 11:06:51 +01:00
|
|
|
// Fail if Qt is not there:
|
2016-11-17 14:07:03 +01:00
|
|
|
empty = addKit(map, tcMap, qtMap, devMap, QVariantMap(),
|
|
|
|
|
"testId", "Test Kit", "/tmp/icon.png", QString(), 1,
|
2016-07-15 11:52:13 +02:00
|
|
|
"/usr/bin/gdb-test", "Desktop", "{dev-id}", QString(), tcs, "{qtXX-id}",
|
2016-11-17 14:07:03 +01:00
|
|
|
"unsupported/mkspec",
|
|
|
|
|
QString(), QString(), QString(), QString(), QString(), QStringList(), env,
|
2017-02-22 15:09:35 +01:00
|
|
|
KeyValuePairList({KeyValuePair("PE.Profile.Data/extraData", QVariant("extraValue"))}));
|
2014-03-04 11:06:51 +01:00
|
|
|
if (!empty.isEmpty())
|
|
|
|
|
return false;
|
|
|
|
|
// Fail if dev is not there:
|
2016-11-17 14:07:03 +01:00
|
|
|
empty = addKit(map, tcMap, qtMap, devMap, QVariantMap(),
|
|
|
|
|
"testId", "Test Kit", "/tmp/icon.png", QString(), 1,
|
2016-07-15 11:52:13 +02:00
|
|
|
"/usr/bin/gdb-test", "Desktop", "{devXX-id}", QString(), tcs, "{qt-id}",
|
2016-11-17 14:07:03 +01:00
|
|
|
"unsupported/mkspec",
|
|
|
|
|
QString(), QString(), QString(), QString(), QString(), QStringList(), env,
|
2017-02-22 15:09:35 +01:00
|
|
|
KeyValuePairList({KeyValuePair("PE.Profile.Data/extraData", QVariant("extraValue"))}));
|
2014-03-04 11:06:51 +01:00
|
|
|
if (!empty.isEmpty())
|
|
|
|
|
return false;
|
|
|
|
|
|
2015-04-30 12:55:26 +02:00
|
|
|
// Profile 0:
|
2016-11-17 14:07:03 +01:00
|
|
|
map = addKit(map, tcMap, qtMap, devMap, QVariantMap(),
|
|
|
|
|
"testId", "Test Kit", "/tmp/icon.png", QString(), 1,
|
2016-07-15 11:52:13 +02:00
|
|
|
"/usr/bin/gdb-test", "Desktop", QString(), QString(), tcs, "{qt-id}",
|
2016-11-17 14:07:03 +01:00
|
|
|
"unsupported/mkspec",
|
|
|
|
|
QString(), QString(), QString(), QString(), QString(), QStringList(), env,
|
2017-02-22 15:09:35 +01:00
|
|
|
KeyValuePairList({KeyValuePair("PE.Profile.Data/extraData", QVariant("extraValue"))}));
|
2012-09-18 15:58:07 +02:00
|
|
|
|
2012-09-28 09:50:06 +02:00
|
|
|
if (map.count() != 4
|
2016-07-15 12:42:00 +02:00
|
|
|
|| !map.contains(VERSION) || map.value(VERSION).toInt() != 1
|
|
|
|
|
|| !map.contains(COUNT) || map.value(COUNT).toInt() != 1
|
|
|
|
|
|| !map.contains(DEFAULT) || map.value(DEFAULT).toString() != "testId"
|
|
|
|
|
|| !map.contains("Profile.0"))
|
2012-09-18 15:58:07 +02:00
|
|
|
return false;
|
|
|
|
|
|
2016-07-15 12:42:00 +02:00
|
|
|
QVariantMap profile0 = map.value("Profile.0").toMap();
|
2013-10-29 16:40:57 +01:00
|
|
|
if (profile0.count() != 6
|
2016-07-15 12:42:00 +02:00
|
|
|
|| !profile0.contains(ID) || profile0.value(ID).toString() != "testId"
|
|
|
|
|
|| !profile0.contains(DISPLAYNAME) || profile0.value(DISPLAYNAME).toString() != "Test Kit"
|
|
|
|
|
|| !profile0.contains(ICON) || profile0.value(ICON).toString() != "/tmp/icon.png"
|
|
|
|
|
|| !profile0.contains(DATA) || profile0.value(DATA).type() != QVariant::Map
|
|
|
|
|
|| !profile0.contains(AUTODETECTED) || profile0.value(AUTODETECTED).toBool() != true
|
|
|
|
|
|| !profile0.contains(SDK) || profile0.value(SDK).toBool() != true)
|
2013-10-29 16:40:57 +01:00
|
|
|
return false;
|
|
|
|
|
|
2016-07-15 12:42:00 +02:00
|
|
|
QVariantMap data = profile0.value(DATA).toMap();
|
2015-04-30 12:55:26 +02:00
|
|
|
if (data.count() != 7
|
2016-07-15 12:42:00 +02:00
|
|
|
|| !data.contains(DEBUGGER) || data.value(DEBUGGER).type() != QVariant::Map
|
|
|
|
|
|| !data.contains(DEVICE_TYPE) || data.value(DEVICE_TYPE).toString() != "Desktop"
|
2016-07-15 11:52:13 +02:00
|
|
|
|| !data.contains(TOOLCHAIN)
|
2016-07-15 12:42:00 +02:00
|
|
|
|| !data.contains(QT) || data.value(QT).toString() != "SDK.{qt-id}"
|
|
|
|
|
|| !data.contains(MKSPEC) || data.value(MKSPEC).toString() != "unsupported/mkspec"
|
|
|
|
|
|| !data.contains("extraData") || data.value("extraData").toString() != "extraValue")
|
2012-09-18 15:58:07 +02:00
|
|
|
return false;
|
2016-07-15 11:52:13 +02:00
|
|
|
QVariantMap tcOutput = data.value(TOOLCHAIN).toMap();
|
|
|
|
|
if (tcOutput.count() != 1
|
|
|
|
|
|| !tcOutput.contains("Cxx") || tcOutput.value("Cxx") != "{tc-id}")
|
|
|
|
|
return false;
|
2012-09-18 15:58:07 +02:00
|
|
|
|
|
|
|
|
// Ignore existing ids:
|
2016-11-17 14:07:03 +01:00
|
|
|
QVariantMap result = addKit(map, tcMap, qtMap, devMap, QVariantMap(),
|
|
|
|
|
"testId", "Test Qt Version X",
|
2016-07-15 12:42:00 +02:00
|
|
|
"/tmp/icon3.png", QString(), 1, "/usr/bin/gdb-test3", "Desktop",
|
2016-11-17 14:07:03 +01:00
|
|
|
QString(), QString(), tcs, "{qt-id}", "unsupported/mkspec",
|
|
|
|
|
QString(), QString(), QString(), QString(), QString(), QStringList(), env,
|
2017-02-22 15:09:35 +01:00
|
|
|
KeyValuePairList({KeyValuePair("PE.Profile.Data/extraData", QVariant("extraValue"))}));
|
2012-09-18 15:58:07 +02:00
|
|
|
if (!result.isEmpty())
|
|
|
|
|
return false;
|
|
|
|
|
|
2015-04-30 12:55:26 +02:00
|
|
|
// Profile 1: Make sure name is unique:
|
2016-11-17 14:07:03 +01:00
|
|
|
map = addKit(map, tcMap, qtMap, devMap, QVariantMap(),
|
|
|
|
|
"testId2", "Test Kit2", "/tmp/icon2.png", QString(), 1,
|
2016-07-15 11:52:13 +02:00
|
|
|
"/usr/bin/gdb-test2", "Desktop", "{dev-id}", "/sys/root\\\\", tcs,
|
2016-11-17 14:07:03 +01:00
|
|
|
"{qt-id}", "unsupported/mkspec",
|
|
|
|
|
QString(), QString(), QString(), QString(), QString(), QStringList(), env,
|
2017-02-22 15:09:35 +01:00
|
|
|
KeyValuePairList({KeyValuePair("PE.Profile.Data/extraData", QVariant("extraValue"))}));
|
2012-09-28 09:50:06 +02:00
|
|
|
if (map.count() != 5
|
2016-07-15 12:42:00 +02:00
|
|
|
|| !map.contains(VERSION) || map.value(VERSION).toInt() != 1
|
|
|
|
|
|| !map.contains(COUNT) || map.value(COUNT).toInt() != 2
|
|
|
|
|
|| !map.contains(DEFAULT) || map.value(DEFAULT).toInt() != 0
|
|
|
|
|
|| !map.contains("Profile.0")
|
|
|
|
|
|| !map.contains("Profile.1"))
|
|
|
|
|
|
|
|
|
|
if (map.value("Profile.0") != profile0)
|
2012-09-18 15:58:07 +02:00
|
|
|
return false;
|
|
|
|
|
|
2016-07-15 12:42:00 +02:00
|
|
|
QVariantMap profile1 = map.value("Profile.1").toMap();
|
2013-10-29 16:40:57 +01:00
|
|
|
if (profile1.count() != 6
|
2016-07-15 12:42:00 +02:00
|
|
|
|| !profile1.contains(ID) || profile1.value(ID).toString() != "testId2"
|
|
|
|
|
|| !profile1.contains(DISPLAYNAME) || profile1.value(DISPLAYNAME).toString() != "Test Kit2"
|
|
|
|
|
|| !profile1.contains(ICON) || profile1.value(ICON).toString() != "/tmp/icon2.png"
|
|
|
|
|
|| !profile1.contains(DATA) || profile1.value(DATA).type() != QVariant::Map
|
|
|
|
|
|| !profile1.contains(AUTODETECTED) || profile1.value(AUTODETECTED).toBool() != true
|
|
|
|
|
|| !profile1.contains(SDK) || profile1.value(SDK).toBool() != true)
|
2013-10-29 16:40:57 +01:00
|
|
|
return false;
|
|
|
|
|
|
2016-07-15 12:42:00 +02:00
|
|
|
data = profile1.value(DATA).toMap();
|
2015-04-30 12:55:26 +02:00
|
|
|
if (data.count() != 9
|
2016-07-15 12:42:00 +02:00
|
|
|
|| !data.contains(DEBUGGER) || data.value(DEBUGGER).type() != QVariant::Map
|
|
|
|
|
|| !data.contains(DEVICE_TYPE) || data.value(DEVICE_TYPE).toString() != "Desktop"
|
|
|
|
|
|| !data.contains(DEVICE_ID) || data.value(DEVICE_ID).toString() != "{dev-id}"
|
|
|
|
|
|| !data.contains(SYSROOT) || data.value(SYSROOT).toString() != "/sys/root\\\\"
|
2016-07-15 11:52:13 +02:00
|
|
|
|| !data.contains(TOOLCHAIN)
|
2016-07-15 12:42:00 +02:00
|
|
|
|| !data.contains(QT) || data.value(QT).toString() != "SDK.{qt-id}"
|
|
|
|
|
|| !data.contains(MKSPEC) || data.value(MKSPEC).toString() != "unsupported/mkspec"
|
|
|
|
|
|| !data.contains(ENV) || data.value(ENV).toStringList() != env
|
|
|
|
|
|| !data.contains("extraData") || data.value("extraData").toString() != "extraValue")
|
2013-10-29 16:40:57 +01:00
|
|
|
return false;
|
2016-07-15 11:52:13 +02:00
|
|
|
tcOutput = data.value(TOOLCHAIN).toMap();
|
|
|
|
|
if (tcOutput.count() != 1
|
|
|
|
|
|| !tcOutput.contains("Cxx") || tcOutput.value("Cxx") != "{tc-id}")
|
|
|
|
|
return false;
|
2013-10-29 16:40:57 +01:00
|
|
|
|
2015-04-30 12:55:26 +02:00
|
|
|
// Profile 2: Test debugger id:
|
2016-11-17 14:07:03 +01:00
|
|
|
map = addKit(map, tcMap, qtMap, devMap, QVariantMap(),
|
|
|
|
|
"test with debugger Id", "Test debugger Id",
|
2016-07-15 12:42:00 +02:00
|
|
|
"/tmp/icon2.png", "debugger Id", 0, QString(), "Desktop", QString(), QString(),
|
2016-11-17 14:07:03 +01:00
|
|
|
tcs, "{qt-id}", "unsupported/mkspec",
|
|
|
|
|
QString(), QString(), QString(), QString(), QString(), QStringList(), env,
|
2017-02-22 15:09:35 +01:00
|
|
|
KeyValuePairList({KeyValuePair("PE.Profile.Data/extraData", QVariant("extraValue"))}));
|
2013-10-29 16:40:57 +01:00
|
|
|
if (map.count() != 6
|
2016-07-15 12:42:00 +02:00
|
|
|
|| !map.contains(VERSION) || map.value(VERSION).toInt() != 1
|
|
|
|
|
|| !map.contains(COUNT) || map.value(COUNT).toInt() != 3
|
|
|
|
|
|| !map.contains(DEFAULT) || map.value(DEFAULT).toInt() != 0
|
|
|
|
|
|| !map.contains("Profile.0")
|
|
|
|
|
|| !map.contains("Profile.1")
|
|
|
|
|
|| !map.contains("Profile.2"))
|
|
|
|
|
|
|
|
|
|
if (map.value("Profile.0") != profile0)
|
2013-10-29 16:40:57 +01:00
|
|
|
return false;
|
2016-07-15 12:42:00 +02:00
|
|
|
if (map.value("Profile.1") != profile1)
|
2013-10-29 16:40:57 +01:00
|
|
|
return false;
|
|
|
|
|
|
2016-07-15 12:42:00 +02:00
|
|
|
QVariantMap profile2 = map.value("Profile.2").toMap();
|
2013-10-29 16:40:57 +01:00
|
|
|
if (profile2.count() != 6
|
2016-07-15 12:42:00 +02:00
|
|
|
|| !profile2.contains(ID) || profile2.value(ID).toString() != "test with debugger Id"
|
|
|
|
|
|| !profile2.contains(DISPLAYNAME) || profile2.value(DISPLAYNAME).toString() != "Test debugger Id"
|
|
|
|
|
|| !profile2.contains(ICON) || profile2.value(ICON).toString() != "/tmp/icon2.png"
|
|
|
|
|
|| !profile2.contains(DATA) || profile2.value(DATA).type() != QVariant::Map
|
|
|
|
|
|| !profile2.contains(AUTODETECTED) || profile2.value(AUTODETECTED).toBool() != true
|
|
|
|
|
|| !profile2.contains(SDK) || profile2.value(SDK).toBool() != true)
|
2013-10-29 16:40:57 +01:00
|
|
|
return false;
|
|
|
|
|
|
2016-07-15 12:42:00 +02:00
|
|
|
data = profile2.value(DATA).toMap();
|
2015-04-30 12:55:26 +02:00
|
|
|
if (data.count() != 7
|
2016-07-15 12:42:00 +02:00
|
|
|
|| !data.contains(DEBUGGER) || data.value(DEBUGGER).toString() != "debugger Id")
|
2012-09-18 15:58:07 +02:00
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2014-03-04 11:06:51 +01:00
|
|
|
QVariantMap AddKitOperation::addKit(const QVariantMap &map,
|
|
|
|
|
const QString &id, const QString &displayName,
|
|
|
|
|
const QString &icon, const QString &debuggerId,
|
|
|
|
|
const quint32 &debuggerType, const QString &debugger,
|
2014-08-04 09:37:51 +03:00
|
|
|
const QString &deviceType, const QString &device,
|
2016-07-15 11:52:13 +02:00
|
|
|
const QString &sysRoot, const QHash<QString, QString> &tcs, const QString &qt,
|
2016-11-17 14:07:03 +01:00
|
|
|
const QString &mkspec, const QString &cmakeId,
|
|
|
|
|
const QString &cmakeGenerator, const QString &cmakeExtraGenerator,
|
|
|
|
|
const QString &cmakeGeneratorToolset,
|
|
|
|
|
const QString &cmakeGeneratorPlatform,
|
|
|
|
|
const QStringList &cmakeConfiguration, const QStringList &env,
|
2015-04-30 12:55:26 +02:00
|
|
|
const KeyValuePairList &extra)
|
2014-03-04 11:06:51 +01:00
|
|
|
{
|
2016-07-15 12:42:00 +02:00
|
|
|
QVariantMap tcMap = load("ToolChains");
|
|
|
|
|
QVariantMap qtMap = load("QtVersions");
|
|
|
|
|
QVariantMap devMap = load("Devices");
|
2016-11-17 14:07:03 +01:00
|
|
|
QVariantMap cmakeMap = load("cmaketools");
|
2014-03-04 11:06:51 +01:00
|
|
|
|
2016-11-17 14:07:03 +01:00
|
|
|
return addKit(map, tcMap, qtMap, devMap, cmakeMap, id, displayName, icon, debuggerId, debuggerType,
|
|
|
|
|
debugger, deviceType, device, sysRoot, tcs, qt, mkspec,
|
|
|
|
|
cmakeId, cmakeGenerator, cmakeExtraGenerator, cmakeGeneratorToolset,
|
|
|
|
|
cmakeGeneratorPlatform, cmakeConfiguration,
|
|
|
|
|
env, extra);
|
2014-03-04 11:06:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QVariantMap AddKitOperation::addKit(const QVariantMap &map, const QVariantMap &tcMap,
|
|
|
|
|
const QVariantMap &qtMap, const QVariantMap &devMap,
|
2016-11-17 14:07:03 +01:00
|
|
|
const QVariantMap &cmakeMap,
|
2014-03-04 11:06:51 +01:00
|
|
|
const QString &id, const QString &displayName,
|
|
|
|
|
const QString &icon, const QString &debuggerId,
|
|
|
|
|
const quint32 &debuggerType, const QString &debugger,
|
2014-08-04 09:37:51 +03:00
|
|
|
const QString &deviceType, const QString &device,
|
2016-07-15 11:52:13 +02:00
|
|
|
const QString &sysRoot, const QHash<QString, QString> &tcs, const QString &qt,
|
2016-11-17 14:07:03 +01:00
|
|
|
const QString &mkspec, const QString &cmakeId,
|
|
|
|
|
const QString &cmakeGenerator, const QString &cmakeExtraGenerator,
|
|
|
|
|
const QString &cmakeGeneratorToolset,
|
|
|
|
|
const QString &cmakeGeneratorPlatform,
|
|
|
|
|
const QStringList &cmakeConfiguration, const QStringList &env,
|
2015-04-30 12:55:26 +02:00
|
|
|
const KeyValuePairList &extra)
|
2012-09-18 15:58:07 +02:00
|
|
|
{
|
|
|
|
|
// Sanity check: Make sure autodetection source is not in use already:
|
2014-02-20 11:37:56 +01:00
|
|
|
QStringList valueKeys = FindValueOperation::findValue(map, QVariant(id));
|
2012-09-18 15:58:07 +02:00
|
|
|
bool hasId = false;
|
|
|
|
|
foreach (const QString &k, valueKeys) {
|
2016-07-15 12:42:00 +02:00
|
|
|
if (k.endsWith(QString('/') + ID)) {
|
2012-09-18 15:58:07 +02:00
|
|
|
hasId = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (hasId) {
|
|
|
|
|
std::cerr << "Error: Id " << qPrintable(id) << " already defined as kit." << std::endl;
|
|
|
|
|
return QVariantMap();
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-15 11:52:13 +02:00
|
|
|
for (auto i = tcs.constBegin(); i != tcs.constEnd(); ++i) {
|
|
|
|
|
if (!i.value().isEmpty() && !AddToolChainOperation::exists(tcMap, i.value())) {
|
|
|
|
|
QRegExp abiRegExp = QRegExp("[a-z0-9_]+-[a-z0-9_]+-[a-z0-9_]+-[a-z0-9_]+-(8|16|32|64|128)bit");
|
|
|
|
|
if (!abiRegExp.exactMatch(i.value())) {
|
|
|
|
|
std::cerr << "Error: Toolchain " << qPrintable(i.value())
|
|
|
|
|
<< " for language " << qPrintable(i.key()) << " does not exist." << std::endl;
|
|
|
|
|
return QVariantMap();
|
|
|
|
|
}
|
2014-04-03 16:43:01 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-04 11:06:51 +01:00
|
|
|
QString qtId = qt;
|
2016-07-15 12:42:00 +02:00
|
|
|
if (!qtId.isEmpty() && !qtId.startsWith("SDK."))
|
2014-03-04 11:06:51 +01:00
|
|
|
qtId = QString::fromLatin1("SDK.") + qt;
|
|
|
|
|
if (!qtId.isEmpty() && !AddQtOperation::exists(qtMap, qtId)) {
|
|
|
|
|
std::cerr << "Error: Qt " << qPrintable(qtId) << " does not exist." << std::endl;
|
|
|
|
|
return QVariantMap();
|
|
|
|
|
}
|
|
|
|
|
if (!device.isEmpty() && !AddDeviceOperation::exists(devMap, device)) {
|
|
|
|
|
std::cerr << "Error: Device " << qPrintable(device) << " does not exist." << std::endl;
|
|
|
|
|
return QVariantMap();
|
|
|
|
|
}
|
2016-11-17 14:07:03 +01:00
|
|
|
if (!cmakeId.isEmpty() && !AddCMakeOperation::exists(cmakeMap, cmakeId)) {
|
|
|
|
|
std::cerr << "Error: CMake tool " << qPrintable(cmakeId) << " does not exist." << std::endl;
|
|
|
|
|
return QVariantMap();
|
|
|
|
|
}
|
2014-03-04 11:06:51 +01:00
|
|
|
|
2012-09-18 15:58:07 +02:00
|
|
|
// Find position to insert:
|
|
|
|
|
bool ok;
|
2016-07-15 12:42:00 +02:00
|
|
|
int count = GetOperation::get(map, COUNT).toInt(&ok);
|
2012-09-18 15:58:07 +02:00
|
|
|
if (!ok || count < 0) {
|
|
|
|
|
std::cerr << "Error: Count found in kits file seems wrong." << std::endl;
|
|
|
|
|
return QVariantMap();
|
|
|
|
|
}
|
|
|
|
|
const QString kit = QString::fromLatin1(PREFIX) + QString::number(count);
|
|
|
|
|
|
2016-07-15 12:42:00 +02:00
|
|
|
QString defaultKit = GetOperation::get(map, DEFAULT).toString();
|
2015-04-30 12:54:48 +02:00
|
|
|
if (defaultKit.isEmpty())
|
|
|
|
|
defaultKit = id;
|
2012-09-18 15:58:07 +02:00
|
|
|
|
|
|
|
|
// remove data:
|
2017-02-22 15:09:35 +01:00
|
|
|
QVariantMap cleaned = RmKeysOperation::rmKeys(map, {COUNT, DEFAULT});
|
2012-09-18 15:58:07 +02:00
|
|
|
|
|
|
|
|
// Sanity check: Make sure displayName is unique.
|
2016-07-15 12:42:00 +02:00
|
|
|
QStringList nameKeys = FindKeyOperation::findKey(map, DISPLAYNAME);
|
2012-09-18 15:58:07 +02:00
|
|
|
QStringList nameList;
|
2013-03-11 17:23:55 +01:00
|
|
|
foreach (const QString &nameKey, nameKeys)
|
2012-09-18 15:58:07 +02:00
|
|
|
nameList << GetOperation::get(map, nameKey).toString();
|
|
|
|
|
const QString uniqueName = makeUnique(displayName, nameList);
|
|
|
|
|
|
|
|
|
|
// insert data:
|
2017-02-22 15:09:35 +01:00
|
|
|
KeyValuePairList data = { KeyValuePair({kit, ID}, QVariant(id)),
|
|
|
|
|
KeyValuePair({kit, DISPLAYNAME}, QVariant(uniqueName)),
|
|
|
|
|
KeyValuePair({kit, ICON}, QVariant(icon)),
|
|
|
|
|
KeyValuePair({kit, AUTODETECTED}, QVariant(true)),
|
|
|
|
|
KeyValuePair({kit, SDK}, QVariant(true))};
|
2012-09-18 15:58:07 +02:00
|
|
|
|
2015-07-13 17:01:50 +03:00
|
|
|
if (!debuggerId.isEmpty() || !debugger.isEmpty()) {
|
2014-04-09 15:15:02 +02:00
|
|
|
if (debuggerId.isEmpty()) {
|
2017-02-22 15:09:35 +01:00
|
|
|
data << KeyValuePair({kit, DATA, DEBUGGER, DEBUGGER_ENGINE}, QVariant(debuggerType));
|
|
|
|
|
data << KeyValuePair({kit, DATA, DEBUGGER, DEBUGGER_BINARY}, QVariant(debugger));
|
2014-04-09 15:15:02 +02:00
|
|
|
} else {
|
2017-02-22 15:09:35 +01:00
|
|
|
data << KeyValuePair({kit, DATA, DEBUGGER }, QVariant(debuggerId));
|
2014-04-09 15:15:02 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!deviceType.isNull())
|
2017-02-22 15:09:35 +01:00
|
|
|
data << KeyValuePair({kit, DATA, DEVICE_TYPE}, QVariant(deviceType));
|
2014-04-09 15:15:02 +02:00
|
|
|
if (!device.isNull())
|
2017-02-22 15:09:35 +01:00
|
|
|
data << KeyValuePair({kit, DATA, DEVICE_ID}, QVariant(device));
|
2014-04-09 15:15:02 +02:00
|
|
|
if (!sysRoot.isNull())
|
2017-02-22 15:09:35 +01:00
|
|
|
data << KeyValuePair({kit, DATA, SYSROOT}, QVariant(sysRoot));
|
2016-07-15 11:52:13 +02:00
|
|
|
for (auto i = tcs.constBegin(); i != tcs.constEnd(); ++i)
|
2017-02-22 15:09:35 +01:00
|
|
|
data << KeyValuePair({kit, DATA, TOOLCHAIN, i.key()}, QVariant(i.value()));
|
2014-04-09 15:15:02 +02:00
|
|
|
if (!qtId.isNull())
|
2017-02-22 15:09:35 +01:00
|
|
|
data << KeyValuePair({kit, DATA, QT}, QVariant(qtId));
|
2014-04-09 15:15:02 +02:00
|
|
|
if (!mkspec.isNull())
|
2017-02-22 15:09:35 +01:00
|
|
|
data << KeyValuePair({kit, DATA, MKSPEC}, QVariant(mkspec));
|
2016-11-17 14:07:03 +01:00
|
|
|
if (!cmakeId.isNull())
|
2016-12-21 10:49:49 +01:00
|
|
|
data << KeyValuePair({kit, DATA, CMAKE_ID}, QVariant(cmakeId));
|
2016-11-17 14:07:03 +01:00
|
|
|
if (!cmakeGenerator.isNull()) {
|
|
|
|
|
QVariantMap generatorMap;
|
|
|
|
|
generatorMap.insert("Generator", cmakeGenerator);
|
|
|
|
|
if (!cmakeExtraGenerator.isNull())
|
|
|
|
|
generatorMap.insert("ExtraGenerator", cmakeExtraGenerator);
|
|
|
|
|
if (!cmakeGeneratorToolset.isNull())
|
|
|
|
|
generatorMap.insert("Toolset", cmakeGeneratorToolset);
|
|
|
|
|
if (!cmakeGeneratorPlatform.isNull())
|
|
|
|
|
generatorMap.insert("Platform", cmakeGeneratorPlatform);
|
2017-02-22 15:09:35 +01:00
|
|
|
data << KeyValuePair({kit, DATA, CMAKE_GENERATOR}, generatorMap);
|
2016-11-17 14:07:03 +01:00
|
|
|
}
|
2016-12-21 10:49:49 +01:00
|
|
|
if (!cmakeConfiguration.isEmpty())
|
|
|
|
|
data << KeyValuePair({kit, DATA, CMAKE_CONFIGURATION}, QVariant(cmakeConfiguration));
|
2015-04-30 12:55:26 +02:00
|
|
|
if (!env.isEmpty())
|
2017-02-22 15:09:35 +01:00
|
|
|
data << KeyValuePair({kit, DATA, ENV}, QVariant(env));
|
2012-09-18 15:58:07 +02:00
|
|
|
|
2016-07-15 12:42:00 +02:00
|
|
|
data << KeyValuePair(DEFAULT, QVariant(defaultKit));
|
|
|
|
|
data << KeyValuePair(COUNT, QVariant(count + 1));
|
2012-09-18 15:58:07 +02:00
|
|
|
|
|
|
|
|
KeyValuePairList qtExtraList;
|
|
|
|
|
foreach (const KeyValuePair &pair, extra)
|
|
|
|
|
qtExtraList << KeyValuePair(QStringList() << kit << pair.key, pair.value);
|
|
|
|
|
data.append(qtExtraList);
|
|
|
|
|
|
|
|
|
|
return AddKeysOperation::addKeys(cleaned, data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QVariantMap AddKitOperation::initializeKits()
|
|
|
|
|
{
|
|
|
|
|
QVariantMap map;
|
2016-07-15 12:42:00 +02:00
|
|
|
map.insert(VERSION, 1);
|
|
|
|
|
map.insert(DEFAULT, QString());
|
|
|
|
|
map.insert(COUNT, 0);
|
2012-09-18 15:58:07 +02:00
|
|
|
return map;
|
|
|
|
|
}
|