diff options
Diffstat (limited to 'src/tools')
24 files changed, 770 insertions, 80 deletions
diff --git a/src/tools/3rdparty/iossim/iossim.pro b/src/tools/3rdparty/iossim/iossim.pro index 63d21886b5..cd153ea73c 100644 --- a/src/tools/3rdparty/iossim/iossim.pro +++ b/src/tools/3rdparty/iossim/iossim.pro @@ -1,5 +1,8 @@ CONFIG += console +QT += core +QT += gui + CONFIG -= app_bundle include(../../../../qtcreator.pri) diff --git a/src/tools/3rdparty/iossim/iphonesimulator.mm b/src/tools/3rdparty/iossim/iphonesimulator.mm index c746775314..78955216a4 100644 --- a/src/tools/3rdparty/iossim/iphonesimulator.mm +++ b/src/tools/3rdparty/iossim/iphonesimulator.mm @@ -14,8 +14,8 @@ NSString *simulatorPrefrencesName = @"com.apple.iphonesimulator"; NSString *deviceProperty = @"SimulateDevice"; -NSString *deviceIphoneRetina3_5Inch = @"iPhone (Retina 3.5-inch)"; -NSString *deviceIphoneRetina4_0Inch = @"iPhone (Retina 4-inch)"; +NSString *deviceIphoneRetina3_5Inch = @"iPhone Retina (3.5-inch)"; +NSString *deviceIphoneRetina4_0Inch = @"iPhone Retina (4-inch)"; NSString *deviceIphone = @"iPhone"; NSString *deviceIpad = @"iPad"; NSString *deviceIpadRetina = @"iPad (Retina)"; @@ -156,6 +156,7 @@ NSString *deviceIpadRetina = @"iPad (Retina)"; return; } nsprintf(@"<inferior_pid>%@</inferior_pid>", [session simulatedApplicationPID]); + fflush(stdout); pidCheckingTimer = [[NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(checkPid:) userInfo:nil repeats: TRUE] retain]; } else { @@ -266,6 +267,16 @@ NSString *deviceIpadRetina = @"iPad (Retina)"; } } + + NSString *sdkVersion = [sdkRoot sdkVersion]; + NSString *appSupportDir = [NSString stringWithFormat:@"%@/Library/Application Support/iPhone Simulator/%@", + NSHomeDirectory(), sdkVersion]; + [environment addEntriesFromDictionary:@{ + @"CFFIXED_USER_HOME" : appSupportDir, + @"IPHONE_SIMULATOR_ROOT" : [sdkRoot sdkRootPath], + @"NSUnbufferedIO" : @"YES", + }]; + /* Set up the session configuration */ tClass = objc_getClass("DTiPhoneSimulatorSessionConfig"); if (tClass == nil) { @@ -275,7 +286,7 @@ NSString *deviceIpadRetina = @"iPad (Retina)"; config = [[[tClass alloc] init] autorelease]; [config setApplicationToSimulateOnStart:appSpec]; [config setSimulatedSystemRoot:sdkRoot]; - [config setSimulatedApplicationShouldWaitForDebugger:shouldStartDebugger]; + [config setSimulatedApplicationShouldWaitForDebugger:shouldWaitDebugger]; [config setSimulatedApplicationLaunchArgs:args]; [config setSimulatedApplicationLaunchEnvironment:environment]; diff --git a/src/tools/buildoutputparser/buildoutputparser.pro b/src/tools/buildoutputparser/buildoutputparser.pro index f02c37cc63..5b9aa4ea24 100644 --- a/src/tools/buildoutputparser/buildoutputparser.pro +++ b/src/tools/buildoutputparser/buildoutputparser.pro @@ -1,7 +1,7 @@ TEMPLATE = app TARGET = buildoutputparser QTC_LIB_DEPENDS = utils -QTC_PLUGIN_DEPENDS = projectexplorer qtsupport qt4projectmanager +QTC_PLUGIN_DEPENDS = projectexplorer qtsupport qmakeprojectmanager QT = core gui CONFIG += console diff --git a/src/tools/buildoutputparser/buildoutputparser.qbs b/src/tools/buildoutputparser/buildoutputparser.qbs index 74651d8f66..f1fbd8f795 100644 --- a/src/tools/buildoutputparser/buildoutputparser.qbs +++ b/src/tools/buildoutputparser/buildoutputparser.qbs @@ -6,7 +6,7 @@ QtcTool { Depends { name: "Qt"; submodules: ["core", "widgets"]; } Depends { name: "ProjectExplorer" } Depends { name: "QtSupport" } - Depends { name: "Qt4ProjectManager" } + Depends { name: "QmakeProjectManager" } Depends { name: "Utils" } files: [ "main.cpp", diff --git a/src/tools/buildoutputparser/outputprocessor.cpp b/src/tools/buildoutputparser/outputprocessor.cpp index 047638838c..4bb9166ff5 100644 --- a/src/tools/buildoutputparser/outputprocessor.cpp +++ b/src/tools/buildoutputparser/outputprocessor.cpp @@ -33,7 +33,7 @@ #include <projectexplorer/gccparser.h> #include <projectexplorer/gnumakeparser.h> #include <projectexplorer/osparser.h> -#include <qt4projectmanager/qmakeparser.h> +#include <qmakeprojectmanager/qmakeparser.h> #include <qtsupport/qtparser.h> #include <utils/fileutils.h> diff --git a/src/tools/iostool/main.cpp b/src/tools/iostool/main.cpp index 9030e103f0..9acc5a71a2 100644 --- a/src/tools/iostool/main.cpp +++ b/src/tools/iostool/main.cpp @@ -45,6 +45,7 @@ #include <sys/un.h> #include <unistd.h> #include <string.h> +#include <errno.h> class IosTool: public QObject { @@ -274,7 +275,20 @@ int send_fd(int socket, int fd_to_send) control_message->cmsg_len = CMSG_LEN(sizeof(int)); *((int *) CMSG_DATA(control_message)) = fd_to_send; - return sendmsg(socket, &socket_message, 0); + qptrdiff res = sendmsg(socket, &socket_message, 0); + while (true) { + qptrdiff nRead = recv(socket, &message_buffer[0], 1, MSG_WAITALL); + if (nRead == -1) { + if (errno == EINTR) + continue; + qDebug() << "wait in send_fd failed " << qt_error_string(errno); + sleep(4); + return res; + } + if (nRead == 1) + break; + } + return res; } void IosTool::didTransferApp(const QString &bundlePath, const QString &deviceId, @@ -329,7 +343,7 @@ void IosTool::didStartApp(const QString &bundlePath, const QString &deviceId, if (debug) { stopXml(0); // these are 67 characters, this is used as read size on the other side... - const char *msg = "now sending the gdbserver socket, will need a unix socket to succeed"; + const char *msg = "Now sending the gdbserver socket, will need a unix socket to succeed"; outFile.write(msg, strlen(msg)); outFile.flush(); int sent = send_fd(1, gdbFd); diff --git a/src/tools/sdktool/adddebuggeroperation.cpp b/src/tools/sdktool/adddebuggeroperation.cpp new file mode 100644 index 0000000000..d01b39a1f1 --- /dev/null +++ b/src/tools/sdktool/adddebuggeroperation.cpp @@ -0,0 +1,237 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "adddebuggeroperation.h" + +#include "addkeysoperation.h" +#include "findkeyoperation.h" +#include "findvalueoperation.h" +#include "getoperation.h" +#include "rmkeysoperation.h" + +#include "settings.h" + +#include <iostream> + +const char VERSION[] = "Version"; +const char COUNT[] = "DebuggerItem.Count"; +const char PREFIX[] = "DebuggerItem."; + +// Debuggers: +const char ID[] = "Id"; +const char DISPLAYNAME[] = "DisplayName"; +const char AUTODETECTED[] = "AutoDetected"; +const char ABIS[] = "Abis"; +const char BINARY[] = "Binary"; +const char ENGINE_TYPE[] = "EngineType"; + +AddDebuggerOperation::AddDebuggerOperation() + : m_engine(0) +{ } + +QString AddDebuggerOperation::name() const +{ + return QLatin1String("addDebugger"); +} + +QString AddDebuggerOperation::helpText() const +{ + return QLatin1String("add a debugger to Qt Creator"); +} + +QString AddDebuggerOperation::argumentsHelpText() const +{ + return QLatin1String(" --id <ID> id of the new kit (required).\n" + " --name <NAME> display name of the new kit (required).\n" + " --engine <ENGINE> debuggerengine of the new kit.\n" + " --binary <PATH> debugger of the new kit.\n" + " --abis <ABI,ABI> list of ABI strings (comma separated).\n" + " <KEY> <TYPE:VALUE> extra key value pairs\n"); +} + +bool AddDebuggerOperation::setArguments(const QStringList &args) +{ + m_engine = 0; + + 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(); + + if (current == QLatin1String("--id")) { + if (next.isNull()) + return false; + ++i; // skip next; + m_id = next; + continue; + } + + if (current == QLatin1String("--name")) { + if (next.isNull()) + return false; + ++i; // skip next; + m_displayName = next; + continue; + } + + if (current == QLatin1String("--engine")) { + if (next.isNull()) + return false; + ++i; // skip next; + bool ok; + m_engine = next.toInt(&ok); + if (!ok) { + std::cerr << "Debugger type is not an integer!" << std::endl; + return false; + } + continue; + } + + if (current == QLatin1String("--binary")) { + if (next.isNull()) + return false; + ++i; // skip next; + m_binary = next; + continue; + } + + if (current == QLatin1String("--abis")) { + if (next.isNull()) + return false; + ++i; // skip next + m_abis = next.split(QLatin1String(",")); + continue; + } + } + + 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; + + return !m_id.isEmpty() && !m_displayName.isEmpty(); +} + +int AddDebuggerOperation::execute() const +{ + QVariantMap map = load(QLatin1String("debuggers")); + if (map.isEmpty()) + map = initializeDebuggers(); + + QVariantMap result = addDebugger(map, m_id, m_displayName, m_engine, m_binary, m_abis, + m_extra); + + if (result.isEmpty() || map == result) + return 2; + + return save(result, QLatin1String("debuggers")) ? 0 : 3; +} + +#ifdef WITH_TESTS +bool AddDebuggerOperation::test() const +{ + QVariantMap map = initializeDebuggers(); + + if (map.count() != 2 + || !map.contains(QLatin1String(VERSION)) + || map.value(QLatin1String(VERSION)).toInt() != 1 + || !map.contains(QLatin1String(COUNT)) + || map.value(QLatin1String(COUNT)).toInt() != 0) + return false; + + return true; +} +#endif + +QVariantMap AddDebuggerOperation::addDebugger(const QVariantMap &map, + const QString &id, const QString &displayName, + const quint32 &engine, const QString &binary, + const QStringList &abis, const KeyValuePairList &extra) +{ + // Sanity check: Make sure autodetection source is not in use already: + QStringList valueKeys = FindValueOperation::findValues(map, QVariant(id)); + bool hasId = false; + foreach (const QString &k, valueKeys) { + if (k.endsWith(QString(QLatin1Char('/')) + QLatin1String(ID))) { + hasId = true; + break; + } + } + if (hasId) { + std::cerr << "Error: Id " << qPrintable(id) << " already defined as debugger." << std::endl; + return QVariantMap(); + } + + // Find position to insert: + bool ok; + int count = GetOperation::get(map, QLatin1String(COUNT)).toInt(&ok); + if (!ok || count < 0) { + std::cerr << "Error: Count found in debuggers file seems wrong." << std::endl; + return QVariantMap(); + } + const QString debugger = QString::fromLatin1(PREFIX) + QString::number(count); + + // remove data: + QStringList toRemove; + toRemove << QLatin1String(COUNT); + QVariantMap cleaned = RmKeysOperation::rmKeys(map, toRemove); + + // Sanity check: Make sure displayName is unique. + QStringList nameKeys = FindKeyOperation::findKey(map, QLatin1String(DISPLAYNAME)); + QStringList nameList; + foreach (const QString &nameKey, nameKeys) + nameList << GetOperation::get(map, nameKey).toString(); + const QString uniqueName = makeUnique(displayName, nameList); + + // insert data: + KeyValuePairList data; + data << KeyValuePair(QStringList() << debugger << QLatin1String(ID), QVariant(id)); + data << KeyValuePair(QStringList() << debugger << QLatin1String(DISPLAYNAME), QVariant(uniqueName)); + data << KeyValuePair(QStringList() << debugger << QLatin1String(AUTODETECTED), QVariant(true)); + + data << KeyValuePair(QStringList() << debugger << QLatin1String(ABIS), QVariant(abis)); + data << KeyValuePair(QStringList() << debugger << QLatin1String(ENGINE_TYPE), QVariant(engine)); + data << KeyValuePair(QStringList() << debugger << QLatin1String(BINARY), QVariant(binary)); + + data << KeyValuePair(QStringList() << QLatin1String(COUNT), QVariant(count + 1)); + + KeyValuePairList qtExtraList; + foreach (const KeyValuePair &pair, extra) + qtExtraList << KeyValuePair(QStringList() << debugger << pair.key, pair.value); + data.append(qtExtraList); + + return AddKeysOperation::addKeys(cleaned, data); +} + +QVariantMap AddDebuggerOperation::initializeDebuggers() +{ + QVariantMap map; + map.insert(QLatin1String(VERSION), 1); + map.insert(QLatin1String(COUNT), 0); + return map; +} diff --git a/src/tools/sdktool/adddebuggeroperation.h b/src/tools/sdktool/adddebuggeroperation.h new file mode 100644 index 0000000000..622155a4f4 --- /dev/null +++ b/src/tools/sdktool/adddebuggeroperation.h @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef ADDDEBUGGEROPERATION_H +#define ADDDEBUGGEROPERATION_H + +#include "operation.h" + +#include <QString> + +class AddDebuggerOperation : public Operation +{ +public: + AddDebuggerOperation(); + + QString name() const; + QString helpText() const; + QString argumentsHelpText() const; + + bool setArguments(const QStringList &args); + + int execute() const; + +#ifdef WITH_TESTS + bool test() const; +#endif + + static QVariantMap addDebugger(const QVariantMap &map, + const QString &id, const QString &displayName, + const quint32 &engine, const QString &binary, + const QStringList &abis, const KeyValuePairList &extra); + + static QVariantMap initializeDebuggers(); + +private: + QString m_id; + QString m_displayName; + quint32 m_engine; + QString m_binary; + QStringList m_abis; + KeyValuePairList m_extra; +}; + +#endif // ADDDEBUGGEROPERATION_H diff --git a/src/tools/sdktool/addkitoperation.cpp b/src/tools/sdktool/addkitoperation.cpp index 05b68cb124..b86e343631 100644 --- a/src/tools/sdktool/addkitoperation.cpp +++ b/src/tools/sdktool/addkitoperation.cpp @@ -40,28 +40,28 @@ #include <iostream> // Qt version file stuff: -static char PREFIX[] = "Profile."; -static char VERSION[] = "Version"; -static char COUNT[] = "Profile.Count"; -static char DEFAULT[] = "Profile.Default"; +const char PREFIX[] = "Profile."; +const char VERSION[] = "Version"; +const char COUNT[] = "Profile.Count"; +const char DEFAULT[] = "Profile.Default"; // Kit: -static char ID[] = "PE.Profile.Id"; -static char DISPLAYNAME[] = "PE.Profile.Name"; -static char ICON[] = "PE.Profile.Icon"; -static char AUTODETECTED[] = "PE.Profile.Autodetected"; -static char SDK[] = "PE.Profile.SDK"; -static char DATA[] = "PE.Profile.Data"; +const char ID[] = "PE.Profile.Id"; +const char DISPLAYNAME[] = "PE.Profile.Name"; +const char ICON[] = "PE.Profile.Icon"; +const char AUTODETECTED[] = "PE.Profile.Autodetected"; +const char SDK[] = "PE.Profile.SDK"; +const char DATA[] = "PE.Profile.Data"; // Standard KitInformation: -static char DEBUGGER[] = "Debugger.Information"; -static char DEBUGGER_ENGINE[] = "EngineType"; -static char DEBUGGER_BINARY[] = "Binary"; -static char DEVICE_TYPE[] = "PE.Profile.DeviceType"; -static char SYSROOT[] = "PE.Profile.SysRoot"; -static char TOOLCHAIN[] = "PE.Profile.ToolChain"; -static char MKSPEC[] = "QtPM4.mkSpecInformation"; -static char QT[] = "QtSupport.QtInformation"; +const char DEBUGGER[] = "Debugger.Information"; +const char DEBUGGER_ENGINE[] = "EngineType"; +const char DEBUGGER_BINARY[] = "Binary"; +const char DEVICE_TYPE[] = "PE.Profile.DeviceType"; +const char SYSROOT[] = "PE.Profile.SysRoot"; +const char TOOLCHAIN[] = "PE.Profile.ToolChain"; +const char MKSPEC[] = "QtPM4.mkSpecInformation"; +const char QT[] = "QtSupport.QtInformation"; AddKitOperation::AddKitOperation() : m_debuggerEngine(0) @@ -84,6 +84,8 @@ QString AddKitOperation::argumentsHelpText() const return QLatin1String(" --id <ID> id of the new kit (required).\n" " --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" @@ -139,6 +141,14 @@ bool AddKitOperation::setArguments(const QStringList &args) continue; } + if (current == QLatin1String("--debuggerid")) { + if (next.isNull()) + return false; + ++i; // skip next; + m_debuggerId = next; + continue; + } + if (current == QLatin1String("--debugger")) { if (next.isNull()) return false; @@ -205,6 +215,10 @@ bool AddKitOperation::setArguments(const QStringList &args) 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; + 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; + } return !m_id.isEmpty() && !m_displayName.isEmpty() && !m_deviceType.isEmpty(); } @@ -215,7 +229,7 @@ int AddKitOperation::execute() const if (map.isEmpty()) map = initializeKits(); - QVariantMap result = addKit(map, m_id, m_displayName, m_icon, m_debuggerEngine, m_debugger, + QVariantMap result = addKit(map, m_id, m_displayName, m_icon, m_debuggerId, m_debuggerEngine, m_debugger, m_deviceType.toUtf8(), m_sysRoot, m_tc, m_qt, m_mkspec, m_extra); if (result.isEmpty() || map == result) @@ -239,7 +253,7 @@ bool AddKitOperation::test() const return false; map = addKit(map, QLatin1String("testId"), QLatin1String("Test Kit"), QLatin1String("/tmp/icon.png"), - 1, QLatin1String("/usr/bin/gdb-test"), + QString(), 1, QLatin1String("/usr/bin/gdb-test"), QByteArray("Desktop"), QString(), QLatin1String("{some-tc-id}"), QLatin1String("{some-qt-id}"), QLatin1String("unsupported/mkspec"), KeyValuePairList() << KeyValuePair(QLatin1String("PE.Profile.Data/extraData"), QVariant(QLatin1String("extraValue")))); @@ -255,19 +269,30 @@ bool AddKitOperation::test() const return false; QVariantMap profile0 = map.value(QLatin1String("Profile.0")).toMap(); - if (profile0.count() != 5 + if (profile0.count() != 6 || !profile0.contains(QLatin1String(ID)) || profile0.value(QLatin1String(ID)).toString() != QLatin1String("testId") || !profile0.contains(QLatin1String(DISPLAYNAME)) || profile0.value(QLatin1String(DISPLAYNAME)).toString() != QLatin1String("Test Kit") + || !profile0.contains(QLatin1String(ICON)) + || profile0.value(QLatin1String(ICON)).toString() != QLatin1String("/tmp/icon.png") + || !profile0.contains(QLatin1String(DATA)) + || profile0.value(QLatin1String(DATA)).type() != QVariant::Map || !profile0.contains(QLatin1String(AUTODETECTED)) + || profile0.value(QLatin1String(AUTODETECTED)).toBool() != true || !profile0.contains(QLatin1String(SDK)) - || profile0.value(QLatin1String(AUTODETECTED)).toBool() != true) + || profile0.value(QLatin1String(SDK)).toBool() != true) + return false; + + QVariantMap data = profile0.value(QLatin1String(DATA)).toMap(); + if (data.count() != 7 + || !data.contains(QLatin1String(DEBUGGER)) + || data.value(QLatin1String(DEBUGGER)).type()!= QVariant::Map) return false; // Ignore existing ids: QVariantMap result = addKit(map, QLatin1String("testId"), QLatin1String("Test Qt Version X"), QLatin1String("/tmp/icon3.png"), - 1, QLatin1String("/usr/bin/gdb-test3"), + QString(), 1, QLatin1String("/usr/bin/gdb-test3"), QByteArray("Desktop"), QString(), QLatin1String("{some-tc-id3}"), QLatin1String("{some-qt-id3}"), QLatin1String("unsupported/mkspec3"), KeyValuePairList() << KeyValuePair(QLatin1String("PE.Profile.Data/extraData"), QVariant(QLatin1String("extraValue3")))); @@ -276,7 +301,7 @@ bool AddKitOperation::test() const // Make sure name is unique: map = addKit(map, QLatin1String("testId2"), QLatin1String("Test Kit2"), QLatin1String("/tmp/icon2.png"), - 1, QLatin1String("/usr/bin/gdb-test2"), + QString(), 1, QLatin1String("/usr/bin/gdb-test2"), QByteArray("Desktop"), QString(), QLatin1String("{some-tc-id2}"), QLatin1String("{some-qt-id2}"), QLatin1String("unsupported/mkspec2"), KeyValuePairList() << KeyValuePair(QLatin1String("PE.Profile.Data/extraData"), QVariant(QLatin1String("extraValue2")))); @@ -294,14 +319,69 @@ bool AddKitOperation::test() const return false; QVariantMap profile1 = map.value(QLatin1String("Profile.1")).toMap(); - if (profile1.count() != 5 + if (profile1.count() != 6 || !profile1.contains(QLatin1String(ID)) || profile1.value(QLatin1String(ID)).toString() != QLatin1String("testId2") || !profile1.contains(QLatin1String(DISPLAYNAME)) || profile1.value(QLatin1String(DISPLAYNAME)).toString() != QLatin1String("Test Kit2") + || !profile1.contains(QLatin1String(ICON)) + || profile1.value(QLatin1String(ICON)).toString() != QLatin1String("/tmp/icon2.png") + || !profile1.contains(QLatin1String(DATA)) + || profile1.value(QLatin1String(DATA)).type() != QVariant::Map || !profile1.contains(QLatin1String(AUTODETECTED)) + || profile1.value(QLatin1String(AUTODETECTED)).toBool() != true || !profile1.contains(QLatin1String(SDK)) - || profile1.value(QLatin1String(AUTODETECTED)).toBool() != true) + || profile1.value(QLatin1String(SDK)).toBool() != true) + return false; + + data = profile1.value(QLatin1String(DATA)).toMap(); + if (data.count() != 7 + || !data.contains(QLatin1String(DEBUGGER)) + || data.value(QLatin1String(DEBUGGER)).type() != QVariant::Map) + return false; + + // Test debugger id: + map = addKit(map, QLatin1String("test with debugger Id"), QLatin1String("Test debugger Id"), QLatin1String("/tmp/icon2.png"), + QString::fromLatin1("debugger Id"), 0, QString(), + QByteArray("Desktop"), QString(), + QLatin1String("{some-tc-id2}"), QLatin1String("{some-qt-id2}"), QLatin1String("unsupported/mkspec2"), + KeyValuePairList() << KeyValuePair(QLatin1String("PE.Profile.Data/extraData"), QVariant(QLatin1String("extraValue2")))); + if (map.count() != 6 + || !map.contains(QLatin1String(VERSION)) + || map.value(QLatin1String(VERSION)).toInt() != 1 + || !map.contains(QLatin1String(COUNT)) + || map.value(QLatin1String(COUNT)).toInt() != 3 + || !map.contains(QLatin1String(DEFAULT)) + || map.value(QLatin1String(DEFAULT)).toInt() != 0 + || !map.contains(QLatin1String("Profile.0")) + || !map.contains(QLatin1String("Profile.1")) + || !map.contains(QLatin1String("Profile.2"))) + + if (map.value(QLatin1String("Profile.0")) != profile0) + return false; + if (map.value(QLatin1String("Profile.1")) != profile1) + return false; + + QVariantMap profile2 = map.value(QLatin1String("Profile.2")).toMap(); + if (profile2.count() != 6 + || !profile2.contains(QLatin1String(ID)) + || profile2.value(QLatin1String(ID)).toString() != QLatin1String("test with debugger Id") + || !profile2.contains(QLatin1String(DISPLAYNAME)) + || profile2.value(QLatin1String(DISPLAYNAME)).toString() != QLatin1String("Test debugger Id") + || !profile2.contains(QLatin1String(ICON)) + || profile2.value(QLatin1String(ICON)).toString() != QLatin1String("/tmp/icon2.png") + || !profile2.contains(QLatin1String(DATA)) + || profile2.value(QLatin1String(DATA)).type() != QVariant::Map + || !profile2.contains(QLatin1String(AUTODETECTED)) + || profile2.value(QLatin1String(AUTODETECTED)).toBool() != true + || !profile2.contains(QLatin1String(SDK)) + || profile2.value(QLatin1String(SDK)).toBool() != true) + return false; + + data = profile2.value(QLatin1String(DATA)).toMap(); + if (data.count() != 7 + || !data.contains(QLatin1String(DEBUGGER)) + || data.value(QLatin1String(DEBUGGER)).toString() != QLatin1String("debugger Id")) return false; return true; @@ -310,7 +390,7 @@ bool AddKitOperation::test() const QVariantMap AddKitOperation::addKit(const QVariantMap &map, const QString &id, const QString &displayName, const QString &icon, - const quint32 &debuggerType, const QString &debugger, + const QString &debuggerId, const quint32 &debuggerType, const QString &debugger, const QByteArray &deviceType, const QString &sysRoot, const QString &tc, const QString &qt, const QString &mkspec, const KeyValuePairList &extra) @@ -371,10 +451,15 @@ QVariantMap AddKitOperation::addKit(const QVariantMap &map, data << KeyValuePair(QStringList() << kit << QLatin1String(AUTODETECTED), QVariant(true)); data << KeyValuePair(QStringList() << kit << QLatin1String(SDK), QVariant(true)); - data << KeyValuePair(QStringList() << kit << QLatin1String(DATA) - << QLatin1String(DEBUGGER) << QLatin1String(DEBUGGER_ENGINE), QVariant(debuggerType)); - data << KeyValuePair(QStringList() << kit << QLatin1String(DATA) - << QLatin1String(DEBUGGER) << QLatin1String(DEBUGGER_BINARY), QVariant(debugger)); + if (debuggerId.isEmpty()) { + data << KeyValuePair(QStringList() << kit << QLatin1String(DATA) + << QLatin1String(DEBUGGER) << QLatin1String(DEBUGGER_ENGINE), QVariant(debuggerType)); + data << KeyValuePair(QStringList() << kit << QLatin1String(DATA) + << QLatin1String(DEBUGGER) << QLatin1String(DEBUGGER_BINARY), QVariant(debugger)); + } else { + data << KeyValuePair(QStringList() << kit << QLatin1String(DATA) << QLatin1String(DEBUGGER), + QVariant(debuggerId)); + } data << KeyValuePair(QStringList() << kit << QLatin1String(DATA) << QLatin1String(DEVICE_TYPE), QVariant(deviceType)); data << KeyValuePair(QStringList() << kit << QLatin1String(DATA) diff --git a/src/tools/sdktool/addkitoperation.h b/src/tools/sdktool/addkitoperation.h index dbc4cfce3e..f7db866735 100644 --- a/src/tools/sdktool/addkitoperation.h +++ b/src/tools/sdktool/addkitoperation.h @@ -52,7 +52,7 @@ public: #endif static QVariantMap addKit(const QVariantMap &map, - const QString &id, const QString &displayName, const QString &icon, + const QString &id, const QString &displayName, const QString &icon, const QString &debuggerId, const quint32 &debuggerType, const QString &debugger, const QByteArray &deviceType, const QString &sysRoot, const QString &tc, const QString &qt, const QString &mkspec, @@ -64,6 +64,7 @@ private: QString m_id; QString m_displayName; QString m_icon; + QString m_debuggerId; quint32 m_debuggerEngine; QString m_debugger; QString m_deviceType; diff --git a/src/tools/sdktool/addqtoperation.cpp b/src/tools/sdktool/addqtoperation.cpp index 43dfd534f0..692c46e68c 100644 --- a/src/tools/sdktool/addqtoperation.cpp +++ b/src/tools/sdktool/addqtoperation.cpp @@ -42,16 +42,16 @@ #include <iostream> // Qt version file stuff: -static char PREFIX[] = "QtVersion."; -static char VERSION[] = "Version"; +const char PREFIX[] = "QtVersion."; +const char VERSION[] = "Version"; // BaseQtVersion: -static char ID[] = "Id"; -static char DISPLAYNAME[] = "Name"; -static char AUTODETECTED[] = "isAutodetected"; -static char AUTODETECTION_SOURCE[] = "autodetectionSource"; -static char QMAKE[] = "QMakePath"; -static char TYPE[] = "QtVersion.Type"; +const char ID[] = "Id"; +const char DISPLAYNAME[] = "Name"; +const char AUTODETECTED[] = "isAutodetected"; +const char AUTODETECTION_SOURCE[] = "autodetectionSource"; +const char QMAKE[] = "QMakePath"; +const char TYPE[] = "QtVersion.Type"; QString AddQtOperation::name() const { diff --git a/src/tools/sdktool/addtoolchainoperation.cpp b/src/tools/sdktool/addtoolchainoperation.cpp index 7279169660..bfafd54b57 100644 --- a/src/tools/sdktool/addtoolchainoperation.cpp +++ b/src/tools/sdktool/addtoolchainoperation.cpp @@ -40,19 +40,19 @@ #include <iostream> // ToolChain file stuff: -static char COUNT[] = "ToolChain.Count"; -static char PREFIX[] = "ToolChain."; -static char VERSION[] = "Version"; +const char COUNT[] = "ToolChain.Count"; +const char PREFIX[] = "ToolChain."; +const char VERSION[] = "Version"; // ToolChain: -static char ID[] = "ProjectExplorer.ToolChain.Id"; -static char DISPLAYNAME[] = "ProjectExplorer.ToolChain.DisplayName"; -static char AUTODETECTED[] = "ProjectExplorer.ToolChain.Autodetect"; +const char ID[] = "ProjectExplorer.ToolChain.Id"; +const char DISPLAYNAME[] = "ProjectExplorer.ToolChain.DisplayName"; +const char AUTODETECTED[] = "ProjectExplorer.ToolChain.Autodetect"; // GCC ToolChain: -static char PATH[] = "ProjectExplorer.GccToolChain.Path"; -static char TARGET_ABI[] = "ProjectExplorer.GccToolChain.TargetAbi"; -static char SUPPORTED_ABIS[] = "ProjectExplorer.GccToolChain.SupportedAbis"; +const char PATH[] = "ProjectExplorer.GccToolChain.Path"; +const char TARGET_ABI[] = "ProjectExplorer.GccToolChain.TargetAbi"; +const char SUPPORTED_ABIS[] = "ProjectExplorer.GccToolChain.SupportedAbis"; QString AddToolChainOperation::name() const { @@ -255,7 +255,6 @@ QVariantMap AddToolChainOperation::addToolChain(const QVariantMap &map, QVariantMap result = RmKeysOperation::rmKeys(map, QStringList() << QLatin1String(COUNT)); - std::cout << "Registering ToolChain " << count << std::endl; const QString tc = QString::fromLatin1(PREFIX) + QString::number(count); KeyValuePairList data; diff --git a/src/tools/sdktool/main.cpp b/src/tools/sdktool/main.cpp index 18d1e12fbe..6ad6b60947 100644 --- a/src/tools/sdktool/main.cpp +++ b/src/tools/sdktool/main.cpp @@ -31,6 +31,7 @@ #include "operation.h" +#include "adddebuggeroperation.h" #include "addkeysoperation.h" #include "addkitoperation.h" #include "addqtoperation.h" @@ -38,6 +39,7 @@ #include "findkeyoperation.h" #include "findvalueoperation.h" #include "getoperation.h" +#include "rmdebuggeroperation.h" #include "rmkeysoperation.h" #include "rmkitoperation.h" #include "rmqtoperation.h" @@ -160,13 +162,15 @@ int main(int argc, char *argv[]) Settings settings; QList<Operation *> operations; - operations << new AddKeysOperation + operations << new AddDebuggerOperation + << new AddKeysOperation << new AddKitOperation << new AddQtOperation << new AddToolChainOperation << new FindKeyOperation << new FindValueOperation << new GetOperation + << new RmDebuggerOperation << new RmKeysOperation << new RmKitOperation << new RmQtOperation diff --git a/src/tools/sdktool/rmdebuggeroperation.cpp b/src/tools/sdktool/rmdebuggeroperation.cpp new file mode 100644 index 0000000000..c87943ddf8 --- /dev/null +++ b/src/tools/sdktool/rmdebuggeroperation.cpp @@ -0,0 +1,190 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "rmdebuggeroperation.h" + +#include "adddebuggeroperation.h" +#include "addkeysoperation.h" +#include "findkeyoperation.h" +#include "findvalueoperation.h" +#include "getoperation.h" +#include "rmkeysoperation.h" + +#include "settings.h" + +#include <iostream> + +// Qt version file stuff: +const char PREFIX[] = "DebuggerItem."; +const char COUNT[] = "DebuggerItem.Count"; +#ifdef WITH_TESTS +const char VERSION[] = "Version"; +#endif + +// Kit: +const char ID[] = "Id"; + +QString RmDebuggerOperation::name() const +{ + return QLatin1String("rmDebugger"); +} + +QString RmDebuggerOperation::helpText() const +{ + return QLatin1String("remove a debugger from Qt Creator"); +} + +QString RmDebuggerOperation::argumentsHelpText() const +{ + return QLatin1String(" --id <ID> id of the debugger to remove.\n"); +} + +bool RmDebuggerOperation::setArguments(const QStringList &args) +{ + if (args.count() != 2) + return false; + if (args.at(0) != QLatin1String("--id")) + return false; + + m_id = args.at(1); + + if (m_id.isEmpty()) + std::cerr << "No id given." << std::endl << std::endl; + + return !m_id.isEmpty(); +} + +int RmDebuggerOperation::execute() const +{ + QVariantMap map = load(QLatin1String("debuggers")); + if (map.isEmpty()) + map = AddDebuggerOperation::initializeDebuggers(); + + QVariantMap result = rmDebugger(map, m_id); + + if (result == map) + return 2; + + return save(result, QLatin1String("debuggers")) ? 0 : 3; +} + +#ifdef WITH_TESTS +bool RmDebuggerOperation::test() const +{ + + QVariantMap map = + AddDebuggerOperation::addDebugger(AddDebuggerOperation::initializeDebuggers(), + QLatin1String("id1"), QLatin1String("Name1"), + 2, QLatin1String("/tmp/debugger1"), + QStringList() << QLatin1String("test11") << QLatin1String("test12"), + KeyValuePairList()); + map = + AddDebuggerOperation::addDebugger(map, QLatin1String("id2"), QLatin1String("Name2"), + 2, QLatin1String("/tmp/debugger2"), + QStringList() << QLatin1String("test21") << QLatin1String("test22"), + KeyValuePairList()); + + QVariantMap result = rmDebugger(map, QLatin1String("id2")); + if (result.count() != 3 + || !result.contains(QLatin1String("DebuggerItem.0")) + || !result.contains(QLatin1String(COUNT)) + || result.value(QLatin1String(COUNT)).toInt() != 1 + || !result.contains(QLatin1String(VERSION)) + || result.value(QLatin1String(VERSION)).toInt() != 1) + return false; + + result = rmDebugger(map, QLatin1String("unknown")); + if (result != map) + return false; + + result = rmDebugger(map, QLatin1String("id2")); + if (result.count() != 3 + || !result.contains(QLatin1String("DebuggerItem.0")) + || !result.contains(QLatin1String(COUNT)) + || result.value(QLatin1String(COUNT)).toInt() != 1 + || !result.contains(QLatin1String(VERSION)) + || result.value(QLatin1String(VERSION)).toInt() != 1) + return false; + + result = rmDebugger(result, QLatin1String("id1")); + if (result.count() != 2 + || !result.contains(QLatin1String(COUNT)) + || result.value(QLatin1String(COUNT)).toInt() != 0 + || !result.contains(QLatin1String(VERSION)) + || result.value(QLatin1String(VERSION)).toInt() != 1) + return false; + + return true; +} +#endif + +QVariantMap RmDebuggerOperation::rmDebugger(const QVariantMap &map, const QString &id) +{ + QVariantMap result = AddDebuggerOperation::initializeDebuggers(); + + QVariantList debuggerList; + bool ok; + int count = GetOperation::get(map, QLatin1String(COUNT)).toInt(&ok); + if (!ok) { + std::cerr << "Error: The count found in map is not an integer." << std::endl; + return map; + } + + int debuggerPos = -1; + for (int i = 0; i < count; ++i) { + const QString key = QString::fromLatin1(PREFIX) + QString::number(i); + QVariantMap debugger = map.value(key).toMap(); + if (debugger.value(QLatin1String(ID)).toString() == id) { + debuggerPos = i; + continue; + } + debuggerList << debugger; + } + if (debuggerList.count() == map.count() - 2) { + std::cerr << "Error: Id was not found." << std::endl; + return map; + } + + // remove data: + QStringList toRemove; + toRemove << QLatin1String(COUNT); + result = RmKeysOperation::rmKeys(result, toRemove); + + // insert data: + KeyValuePairList data; + data << KeyValuePair(QLatin1String(COUNT), count - 1); + + for (int i = 0; i < debuggerList.count(); ++i) { + data << KeyValuePair(QStringList() << QString::fromLatin1(PREFIX) + QString::number(i), + debuggerList.at(i)); + } + + return AddKeysOperation::addKeys(result, data); +} + diff --git a/src/tools/sdktool/rmdebuggeroperation.h b/src/tools/sdktool/rmdebuggeroperation.h new file mode 100644 index 0000000000..a4bc61e545 --- /dev/null +++ b/src/tools/sdktool/rmdebuggeroperation.h @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef RMDEBUGGEROPERATION_H +#define RMDEBUGGEROPERATION_H + +#include "operation.h" + +#include <QString> + +class RmDebuggerOperation : public Operation +{ +public: + QString name() const; + QString helpText() const; + QString argumentsHelpText() const; + + bool setArguments(const QStringList &args); + + int execute() const; + +#ifdef WITH_TESTS + bool test() const; +#endif + + static QVariantMap rmDebugger(const QVariantMap &map, const QString &id); + +private: + QString m_id; +}; + +#endif // RMDEBUGGEROPERATION_H diff --git a/src/tools/sdktool/rmkitoperation.cpp b/src/tools/sdktool/rmkitoperation.cpp index c5e6c79334..92bdf5cee6 100644 --- a/src/tools/sdktool/rmkitoperation.cpp +++ b/src/tools/sdktool/rmkitoperation.cpp @@ -41,15 +41,15 @@ #include <iostream> // Qt version file stuff: -static char PREFIX[] = "Profile."; -static char COUNT[] = "Profile.Count"; -static char DEFAULT[] = "Profile.Default"; +const char PREFIX[] = "Profile."; +const char COUNT[] = "Profile.Count"; +const char DEFAULT[] = "Profile.Default"; #ifdef WITH_TESTS -static char VERSION[] = "Version"; +const char VERSION[] = "Version"; #endif // Kit: -static char ID[] = "PE.Profile.Id"; +const char ID[] = "PE.Profile.Id"; QString RmKitOperation::name() const { @@ -63,7 +63,7 @@ QString RmKitOperation::helpText() const QString RmKitOperation::argumentsHelpText() const { - return QLatin1String(" --id <ID> id of the new kit.\n"); + return QLatin1String(" --id <ID> id of the kit to remove.\n"); } bool RmKitOperation::setArguments(const QStringList &args) @@ -102,7 +102,7 @@ bool RmKitOperation::test() const AddKitOperation::addKit(AddKitOperation::initializeKits(), QLatin1String("testId"), QLatin1String("Test Qt Version"), QLatin1String("/tmp/icon.png"), - 1, QLatin1String("/usr/bin/gdb-test"), + QString(), 1, QLatin1String("/usr/bin/gdb-test"), QByteArray("Desktop"), QString(), QLatin1String("{some-tc-id}"), QLatin1String("{some-qt-id}"), QLatin1String("unsupported/mkspec"), @@ -110,7 +110,7 @@ bool RmKitOperation::test() const map = AddKitOperation::addKit(map, QLatin1String("testId2"), QLatin1String("Test Qt Version"), QLatin1String("/tmp/icon2.png"), - 1, QLatin1String("/usr/bin/gdb-test2"), + QString(), 1, QLatin1String("/usr/bin/gdb-test2"), QByteArray("Desktop"), QString(), QLatin1String("{some-tc-id2}"), QLatin1String("{some-qt-id2}"), QLatin1String("unsupported/mkspec2"), diff --git a/src/tools/sdktool/rmqtoperation.cpp b/src/tools/sdktool/rmqtoperation.cpp index d129300341..f3ffcb324b 100644 --- a/src/tools/sdktool/rmqtoperation.cpp +++ b/src/tools/sdktool/rmqtoperation.cpp @@ -39,10 +39,10 @@ #include <iostream> // ToolChain file stuff: -static char PREFIX[] = "QtVersion."; +const char PREFIX[] = "QtVersion."; // ToolChain: -static char AUTODETECTION_SOURCE[] = "autodetectionSource"; +const char AUTODETECTION_SOURCE[] = "autodetectionSource"; QString RmQtOperation::name() const { diff --git a/src/tools/sdktool/rmtoolchainoperation.cpp b/src/tools/sdktool/rmtoolchainoperation.cpp index 72481990ca..2f7d532480 100644 --- a/src/tools/sdktool/rmtoolchainoperation.cpp +++ b/src/tools/sdktool/rmtoolchainoperation.cpp @@ -39,11 +39,11 @@ #include <iostream> // ToolChain file stuff: -static char COUNT[] = "ToolChain.Count"; -static char PREFIX[] = "ToolChain."; +const char COUNT[] = "ToolChain.Count"; +const char PREFIX[] = "ToolChain."; // ToolChain: -static char ID[] = "ProjectExplorer.ToolChain.Id"; +const char ID[] = "ProjectExplorer.ToolChain.Id"; QString RmToolChainOperation::name() const { diff --git a/src/tools/sdktool/sdktool.pro b/src/tools/sdktool/sdktool.pro index a49012be06..6bace4f254 100644 --- a/src/tools/sdktool/sdktool.pro +++ b/src/tools/sdktool/sdktool.pro @@ -13,6 +13,7 @@ isEmpty(PRECOMPILED_HEADER):PRECOMPILED_HEADER = $$PWD/../../shared/qtcreator_pc SOURCES += \ main.cpp \ + adddebuggeroperation.cpp \ addkeysoperation.cpp \ addkitoperation.cpp \ addqtoperation.cpp \ @@ -21,6 +22,7 @@ SOURCES += \ findvalueoperation.cpp \ getoperation.cpp \ operation.cpp \ + rmdebuggeroperation.cpp \ rmkeysoperation.cpp \ rmkitoperation.cpp \ rmqtoperation.cpp \ @@ -28,6 +30,7 @@ SOURCES += \ settings.cpp \ HEADERS += \ + adddebuggeroperation.h \ addkeysoperation.h \ addkitoperation.h \ addqtoperation.h \ @@ -36,6 +39,7 @@ HEADERS += \ findvalueoperation.h \ getoperation.h \ operation.h \ + rmdebuggeroperation.h \ rmkeysoperation.h \ rmkitoperation.h \ rmqtoperation.h \ diff --git a/src/tools/sdktool/sdktool.qbs b/src/tools/sdktool/sdktool.qbs index 019df95b87..dc659377e6 100644 --- a/src/tools/sdktool/sdktool.qbs +++ b/src/tools/sdktool/sdktool.qbs @@ -12,6 +12,7 @@ QtcTool { ? 'DATA_PATH="."' : 'DATA_PATH="../share/qtcreator"']) files: [ + "adddebuggeroperation.cpp", "adddebuggeroperation.h", "addkeysoperation.cpp", "addkeysoperation.h", "addkitoperation.cpp", @@ -29,6 +30,7 @@ QtcTool { "main.cpp", "operation.cpp", "operation.h", + "rmdebuggeroperation.cpp", "rmdebuggeroperation.h", "rmkeysoperation.cpp", "rmkeysoperation.h", "rmkitoperation.cpp", diff --git a/src/tools/sdktool/settings.cpp b/src/tools/sdktool/settings.cpp index 4cd29dd3b7..f04e309179 100644 --- a/src/tools/sdktool/settings.cpp +++ b/src/tools/sdktool/settings.cpp @@ -73,6 +73,8 @@ Utils::FileName Settings::getPath(const QString &file) result.appendPath(QLatin1String("devices")); else if (file == QLatin1String("android")) result.appendPath(QLatin1String("android")); + else if (file == QLatin1String("debuggers")) + result.appendPath(QLatin1String("debuggers")); else return Utils::FileName(); result.append(QLatin1String(".xml")); diff --git a/src/tools/valgrindfake/outputgenerator.cpp b/src/tools/valgrindfake/outputgenerator.cpp index 5d797e601f..dd7f836e44 100644 --- a/src/tools/valgrindfake/outputgenerator.cpp +++ b/src/tools/valgrindfake/outputgenerator.cpp @@ -30,8 +30,6 @@ #include "outputgenerator.h" -#include <utils/sleep.h> - #include <QAbstractSocket> #include <QIODevice> #include <QTextStream> @@ -39,6 +37,22 @@ #include <QStringList> #include <QDebug> + +// Yes, this is ugly. But please don't introduce a libUtils dependency +// just to get rid of a single function. +#ifdef Q_OS_WIN +#include <windows.h> +void doSleep(int msec) { ::Sleep(msec); } +#else +#include <time.h> +#include <unistd.h> +void doSleep(int msec) +{ + struct timespec ts = { msec / 1000, (msec % 1000) * 1000000 }; + ::nanosleep(&ts, NULL); +} +#endif + using namespace Valgrind::Fake; OutputGenerator::OutputGenerator(QAbstractSocket *output, QIODevice *input) : @@ -104,7 +118,7 @@ void OutputGenerator::produceRuntimeError() m_output->flush(); } else if (m_wait) { qDebug() << "waiting in fake valgrind for " << m_wait << " seconds..." << endl; - Utils::sleep(1000 * m_wait); + doSleep(1000 * m_wait); } } diff --git a/src/tools/valgrindfake/valgrindfake.pro b/src/tools/valgrindfake/valgrindfake.pro index bd7eae2cda..10f3e203b7 100644 --- a/src/tools/valgrindfake/valgrindfake.pro +++ b/src/tools/valgrindfake/valgrindfake.pro @@ -2,15 +2,12 @@ TEMPLATE = app TARGET = valgrind-fake QT += network xml +QT -= gui widgets macx:CONFIG -= app_bundle -isEmpty(PRECOMPILED_HEADER):PRECOMPILED_HEADER = $$PWD/../../shared/qtcreator_pch.h - HEADERS += outputgenerator.h SOURCES += main.cpp \ outputgenerator.cpp -QTC_LIB_DEPENDS += \ - utils include(../../../qtcreator.pri) diff --git a/src/tools/valgrindfake/valgrindfake.qbs b/src/tools/valgrindfake/valgrindfake.qbs index ddedef4e80..e17aa76b48 100644 --- a/src/tools/valgrindfake/valgrindfake.qbs +++ b/src/tools/valgrindfake/valgrindfake.qbs @@ -4,7 +4,6 @@ CppApplication { name: "valgrind-fake" type: "application" destinationDirectory: project.ide_bin_path - Depends { name: "Utils" } Depends { name: "Qt"; submodules: ["network", "xml"]; } files: [ "main.cpp", |